method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public Collection<GridFile> list() throws FileResourceException {
List<GridFile> gridFileList = new ArrayList<GridFile>();
try {
ftpClient.setPassive();
ftpClient.setLocalActive();
ftpClient.setType(Session.TYPE_ASCII);
Enumeration<?> list = ftpClient.list().elements();
ftpClient.setType(Session.TYPE_IMAGE);
while (list.hasMoreElements()) {
gridFileList.add(createGridFile(list.nextElement()));
}
return gridFileList;
}
catch (Exception e) {
throw translateException(
"Cannot list the elements of the current directory", e);
}
} | Collection<GridFile> function() throws FileResourceException { List<GridFile> gridFileList = new ArrayList<GridFile>(); try { ftpClient.setPassive(); ftpClient.setLocalActive(); ftpClient.setType(Session.TYPE_ASCII); Enumeration<?> list = ftpClient.list().elements(); ftpClient.setType(Session.TYPE_IMAGE); while (list.hasMoreElements()) { gridFileList.add(createGridFile(list.nextElement())); } return gridFileList; } catch (Exception e) { throw translateException( STR, e); } } | /**
* Equivalent to ls command in the current directory
*
* @throws IOException
* @throws FileResourceException
*/ | Equivalent to ls command in the current directory | list | {
"repo_name": "swift-lang/swift-k",
"path": "cogkit/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/ftp/FileResourceImpl.java",
"license": "apache-2.0",
"size": 20617
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.Enumeration",
"java.util.List",
"org.globus.cog.abstraction.impl.file.FileResourceException",
"org.globus.cog.abstraction.interfaces.GridFile",
"org.globus.ftp.Session"
] | import java.util.ArrayList; import java.util.Collection; import java.util.Enumeration; import java.util.List; import org.globus.cog.abstraction.impl.file.FileResourceException; import org.globus.cog.abstraction.interfaces.GridFile; import org.globus.ftp.Session; | import java.util.*; import org.globus.cog.abstraction.impl.file.*; import org.globus.cog.abstraction.interfaces.*; import org.globus.ftp.*; | [
"java.util",
"org.globus.cog",
"org.globus.ftp"
] | java.util; org.globus.cog; org.globus.ftp; | 1,078,200 |
@ApiModelProperty(value = "")
public Filter getFilter() {
return filter;
} | @ApiModelProperty(value = "") Filter function() { return filter; } | /**
* Get filter.
* @return filter
**/ | Get filter | getFilter | {
"repo_name": "docusign/docusign-java-client",
"path": "src/main/java/com/docusign/esign/model/Folder.java",
"license": "mit",
"size": 11900
} | [
"com.docusign.esign.model.Filter",
"io.swagger.annotations.ApiModelProperty"
] | import com.docusign.esign.model.Filter; import io.swagger.annotations.ApiModelProperty; | import com.docusign.esign.model.*; import io.swagger.annotations.*; | [
"com.docusign.esign",
"io.swagger.annotations"
] | com.docusign.esign; io.swagger.annotations; | 261,239 |
PortEntity updateOutputPort(Revision revision, PortDTO outputPortDTO); | PortEntity updateOutputPort(Revision revision, PortDTO outputPortDTO); | /**
* Updates the specified output port.
*
* @param revision Revision to compare with current base revision
* @param outputPortDTO The output PortDTO
* @return snapshot
*/ | Updates the specified output port | updateOutputPort | {
"repo_name": "zhengsg/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java",
"license": "apache-2.0",
"size": 73433
} | [
"org.apache.nifi.web.api.dto.PortDTO",
"org.apache.nifi.web.api.entity.PortEntity"
] | import org.apache.nifi.web.api.dto.PortDTO; import org.apache.nifi.web.api.entity.PortEntity; | import org.apache.nifi.web.api.dto.*; import org.apache.nifi.web.api.entity.*; | [
"org.apache.nifi"
] | org.apache.nifi; | 1,845,509 |
public Builder iterate(@NonNull SentenceIterator iterator) {
this.sentenceIterator = iterator;
return this;
} | Builder function(@NonNull SentenceIterator iterator) { this.sentenceIterator = iterator; return this; } | /**
* This method used to feed SentenceIterator, that contains training corpus, into ParagraphVectors
*
* @param iterator
* @return
*/ | This method used to feed SentenceIterator, that contains training corpus, into ParagraphVectors | iterate | {
"repo_name": "kinbod/deeplearning4j",
"path": "deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/Word2Vec.java",
"license": "apache-2.0",
"size": 21704
} | [
"org.deeplearning4j.text.sentenceiterator.SentenceIterator"
] | import org.deeplearning4j.text.sentenceiterator.SentenceIterator; | import org.deeplearning4j.text.sentenceiterator.*; | [
"org.deeplearning4j.text"
] | org.deeplearning4j.text; | 1,543,779 |
public String getDepositLocation(Community community)
throws DSpaceSWORDException
{
// FIXME: there is no deposit url for communities yet, so this could
// be misleading
return this.getBaseDepositUrl() + "/" + community.getHandle();
} | String function(Community community) throws DSpaceSWORDException { return this.getBaseDepositUrl() + "/" + community.getHandle(); } | /**
* Obtain the deposit URL for the given community. These URLs
* should not be considered persistent, but will remain consistent
* unless configuration changes are made to DSpace
*
* @param community
* @return The Deposit URL
* @throws DSpaceSWORDException
*/ | Obtain the deposit URL for the given community. These URLs should not be considered persistent, but will remain consistent unless configuration changes are made to DSpace | getDepositLocation | {
"repo_name": "jamie-dryad/dryad-repo",
"path": "dspace-sword/dspace-sword-api/src/main/java/org/dspace/sword/SWORDUrlManager.java",
"license": "bsd-3-clause",
"size": 15050
} | [
"org.dspace.content.Community"
] | import org.dspace.content.Community; | import org.dspace.content.*; | [
"org.dspace.content"
] | org.dspace.content; | 2,197,815 |
public static <T> T get(CompletionStage<T> future, long duration, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
return future.toCompletableFuture().get(duration, unit);
} | static <T> T function(CompletionStage<T> future, long duration, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return future.toCompletableFuture().get(duration, unit); } | /**
* Gets the result of the given future.
*
* <p>This utility is provided so consumers of futures need not even convert to {@link
* CompletableFuture}, an interface that is only suitable for producers of futures.
*/ | Gets the result of the given future. This utility is provided so consumers of futures need not even convert to <code>CompletableFuture</code>, an interface that is only suitable for producers of futures | get | {
"repo_name": "lukecwik/incubator-beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/util/MoreFutures.java",
"license": "apache-2.0",
"size": 9363
} | [
"java.util.concurrent.CompletionStage",
"java.util.concurrent.ExecutionException",
"java.util.concurrent.TimeUnit",
"java.util.concurrent.TimeoutException"
] | import java.util.concurrent.CompletionStage; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,310,223 |
public ProvisioningState provisioningState() {
return this.provisioningState;
} | ProvisioningState function() { return this.provisioningState; } | /**
* Get the provisioningState property: The provisioning state of the private dns zone group resource.
*
* @return the provisioningState value.
*/ | Get the provisioningState property: The provisioning state of the private dns zone group resource | provisioningState | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/models/PrivateDnsZoneGroupInner.java",
"license": "mit",
"size": 3974
} | [
"com.azure.resourcemanager.network.models.ProvisioningState"
] | import com.azure.resourcemanager.network.models.ProvisioningState; | import com.azure.resourcemanager.network.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 971,570 |
default boolean onAttackWithTool(@Nonnull EntityPlayer attacker, @Nonnull EntityLivingBase victim, DamageSource damageSource, @Nonnull ItemStack toolStack, @Nonnull ItemStack thisUpgradeStack) {
return true;
}
/**
* Gets the harvest level for a tool with this upgrade installed. This is called only if {@link #modifiesToolStrength()} | default boolean onAttackWithTool(@Nonnull EntityPlayer attacker, @Nonnull EntityLivingBase victim, DamageSource damageSource, @Nonnull ItemStack toolStack, @Nonnull ItemStack thisUpgradeStack) { return true; } /** * Gets the harvest level for a tool with this upgrade installed. This is called only if {@link #modifiesToolStrength()} | /**
* Called in {@link ItemSteamTool.ToolUpgradeEventDelegator#onAttack(LivingAttackEvent)} for every upgrade in the
* steam tool.
* @param attacker The player attacking.
* @param victim The entity being attacked by the player.
* @param damageSource The DamageSource.
* @param toolStack The ItemStack containing the tool.
* @param thisUpgradeStack The ItemStack containing this upgrade.
* @return Return false to cancel the attack and prevent any other processing from happening.
*/ | Called in <code>ItemSteamTool.ToolUpgradeEventDelegator#onAttack(LivingAttackEvent)</code> for every upgrade in the steam tool | onAttackWithTool | {
"repo_name": "Esteemed-Innovation/Flaxbeards-Steam-Power",
"path": "old/api/java/eiteam/esteemedinnovation/api/tool/SteamToolUpgrade.java",
"license": "lgpl-3.0",
"size": 10340
} | [
"javax.annotation.Nonnull",
"net.minecraft.entity.EntityLivingBase",
"net.minecraft.entity.player.EntityPlayer",
"net.minecraft.item.ItemStack",
"net.minecraft.util.DamageSource"
] | import javax.annotation.Nonnull; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.DamageSource; | import javax.annotation.*; import net.minecraft.entity.*; import net.minecraft.entity.player.*; import net.minecraft.item.*; import net.minecraft.util.*; | [
"javax.annotation",
"net.minecraft.entity",
"net.minecraft.item",
"net.minecraft.util"
] | javax.annotation; net.minecraft.entity; net.minecraft.item; net.minecraft.util; | 455,334 |
public static void generateBigNumber(){
System.out.println("**********INSIDE generateBigNumber************");
// create a friendly random number generator
Random r = new Random();
// create an object to do math with huge numbers
BigInteger bigInt = new BigInteger(150, r);
// display the randomly generated huge number
System.out.println(bigInt);
System.out.println("**********************************************");
} // close method generateBigNumber | static void function(){ System.out.println(STR); Random r = new Random(); BigInteger bigInt = new BigInteger(150, r); System.out.println(bigInt); System.out.println(STR); } | /**
* Uses constructor method on a BigInteger to generate a random large number
* and display it to the console
*/ | Uses constructor method on a BigInteger to generate a random large number and display it to the console | generateBigNumber | {
"repo_name": "edarsow/javaCIT111",
"path": "cit111NetBeans/src/week6_basicMethods/BasicSwitchWithMethodCalls.java",
"license": "gpl-3.0",
"size": 3653
} | [
"java.math.BigInteger",
"java.util.Random"
] | import java.math.BigInteger; import java.util.Random; | import java.math.*; import java.util.*; | [
"java.math",
"java.util"
] | java.math; java.util; | 2,306,402 |
void write(Writer w) throws IOException; | void write(Writer w) throws IOException; | /**
* Write a report of the current state.
*
* @param w
* Where to write.
* @throws IOException
* When it cannot be written.
*/ | Write a report of the current state | write | {
"repo_name": "triceo/drooms",
"path": "drooms-api/src/main/java/org/drooms/api/GameProgressListener.java",
"license": "apache-2.0",
"size": 770
} | [
"java.io.IOException",
"java.io.Writer"
] | import java.io.IOException; import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 2,900,677 |
@Test()
public void testForNameAutomated()
throws Exception
{
for (final RouteToBackendSetRoutingType value :
RouteToBackendSetRoutingType.values())
{
for (final String name : getNames(value.name()))
{
assertNotNull(RouteToBackendSetRoutingType.forName(name));
assertEquals(RouteToBackendSetRoutingType.forName(name), value);
}
}
assertNull(RouteToBackendSetRoutingType.forName("some undefined name"));
} | @Test() void function() throws Exception { for (final RouteToBackendSetRoutingType value : RouteToBackendSetRoutingType.values()) { for (final String name : getNames(value.name())) { assertNotNull(RouteToBackendSetRoutingType.forName(name)); assertEquals(RouteToBackendSetRoutingType.forName(name), value); } } assertNull(RouteToBackendSetRoutingType.forName(STR)); } | /**
* Tests the {@code forName} method with automated tests based on the actual
* name of the enum values.
*
* @throws Exception If an unexpected problem occurs.
*/ | Tests the forName method with automated tests based on the actual name of the enum values | testForNameAutomated | {
"repo_name": "UnboundID/ldapsdk",
"path": "tests/unit/src/com/unboundid/ldap/sdk/unboundidds/controls/RouteToBackendSetRoutingTypeTestCase.java",
"license": "gpl-2.0",
"size": 4872
} | [
"org.testng.annotations.Test"
] | import org.testng.annotations.Test; | import org.testng.annotations.*; | [
"org.testng.annotations"
] | org.testng.annotations; | 741 |
public synchronized void setManualFramingRect(int width, int height) {
if (initialized) {
Point screenResolution = configManager.getScreenResolution();
if (width > screenResolution.x) {
width = screenResolution.x;
}
if (height > screenResolution.y) {
height = screenResolution.y;
}
int leftOffset = (screenResolution.x - width) / 2;
int topOffset = (screenResolution.y - height) / 2;
framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
Log.d(TAG, "Calculated manual framing rect: " + framingRect);
framingRectInPreview = null;
} else {
requestedFramingRectWidth = width;
requestedFramingRectHeight = height;
}
} | synchronized void function(int width, int height) { if (initialized) { Point screenResolution = configManager.getScreenResolution(); if (width > screenResolution.x) { width = screenResolution.x; } if (height > screenResolution.y) { height = screenResolution.y; } int leftOffset = (screenResolution.x - width) / 2; int topOffset = (screenResolution.y - height) / 2; framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height); Log.d(TAG, STR + framingRect); framingRectInPreview = null; } else { requestedFramingRectWidth = width; requestedFramingRectHeight = height; } } | /**
* Allows third party apps to specify the scanning rectangle dimensions, rather than determine them automatically based on screen resolution.
*
* @param width
* The width in pixels to scan.
* @param height
* The height in pixels to scan.
*/ | Allows third party apps to specify the scanning rectangle dimensions, rather than determine them automatically based on screen resolution | setManualFramingRect | {
"repo_name": "forkloop/Trackor",
"path": "src/us/forkloop/trackor/scan/CameraManager.java",
"license": "mit",
"size": 10588
} | [
"android.graphics.Point",
"android.graphics.Rect",
"android.util.Log"
] | import android.graphics.Point; import android.graphics.Rect; import android.util.Log; | import android.graphics.*; import android.util.*; | [
"android.graphics",
"android.util"
] | android.graphics; android.util; | 1,905,659 |
public void setCell(final int columnIndex, final Object value) {
Preconditions.checkArgument(columnIndex > 0 && columnIndex < data.length + 1);
data[columnIndex - 1] = value;
} | void function(final int columnIndex, final Object value) { Preconditions.checkArgument(columnIndex > 0 && columnIndex < data.length + 1); data[columnIndex - 1] = value; } | /**
* Set data for cell.
*
* @param columnIndex column index
* @param value data for cell
*/ | Set data for cell | setCell | {
"repo_name": "leeyazhou/sharding-jdbc",
"path": "shardingsphere-underlying/shardingsphere-merge/src/main/java/org/apache/shardingsphere/underlying/merge/result/impl/memory/MemoryQueryResultRow.java",
"license": "apache-2.0",
"size": 2267
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 757,442 |
private void handshakeFailure(SSLException sslException, boolean flush) throws IOException {
//Release all resources such as internal buffers that SSLEngine is managing
log.debug("SSL Handshake failed", sslException);
sslEngine.closeOutbound();
try {
sslEngine.closeInbound();
} catch (SSLException e) {
log.debug("SSLEngine.closeInBound() raised an exception.", e);
}
state = State.HANDSHAKE_FAILED;
handshakeException = new SslAuthenticationException("SSL handshake failed", sslException);
// Attempt to flush any outgoing bytes. If flush doesn't complete, delay exception handling until outgoing bytes
// are flushed. If write fails because remote end has closed the channel, log the I/O exception and continue to
// handle the handshake failure as an authentication exception.
if (!flush || handshakeWrapAfterFailure(flush))
throw handshakeException;
else
log.debug("Delay propagation of handshake exception till {} bytes remaining are flushed", netWriteBuffer.remaining());
} | void function(SSLException sslException, boolean flush) throws IOException { log.debug(STR, sslException); sslEngine.closeOutbound(); try { sslEngine.closeInbound(); } catch (SSLException e) { log.debug(STR, e); } state = State.HANDSHAKE_FAILED; handshakeException = new SslAuthenticationException(STR, sslException); if (!flush handshakeWrapAfterFailure(flush)) throw handshakeException; else log.debug(STR, netWriteBuffer.remaining()); } | /**
* SSL exceptions are propagated as authentication failures so that clients can avoid
* retries and report the failure. If `flush` is true, exceptions are propagated after
* any pending outgoing bytes are flushed to ensure that the peer is notified of the failure.
*/ | SSL exceptions are propagated as authentication failures so that clients can avoid retries and report the failure. If `flush` is true, exceptions are propagated after any pending outgoing bytes are flushed to ensure that the peer is notified of the failure | handshakeFailure | {
"repo_name": "TiVo/kafka",
"path": "clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java",
"license": "apache-2.0",
"size": 47183
} | [
"java.io.IOException",
"javax.net.ssl.SSLException",
"org.apache.kafka.common.errors.SslAuthenticationException"
] | import java.io.IOException; import javax.net.ssl.SSLException; import org.apache.kafka.common.errors.SslAuthenticationException; | import java.io.*; import javax.net.ssl.*; import org.apache.kafka.common.errors.*; | [
"java.io",
"javax.net",
"org.apache.kafka"
] | java.io; javax.net; org.apache.kafka; | 2,197,313 |
private void executeActions(Rule rule) {
List<Action> actions = ((RuntimeRule) rule).getActions();
if (actions == null || actions.size() == 0) {
return;
}
for (Iterator<Action> it = actions.iterator(); it.hasNext();) {
RuntimeAction a = (RuntimeAction) it.next();
ActionHandler aHandler = a.getModuleHandler();
try {
String rUID = rule.getUID();
Map<String, Object> context = getContext(rUID, a.getConnections());
Map<String, ?> outputs = aHandler.execute(context);
if (outputs != null) {
context = getContext(rUID);
updateContext(rUID, a.getId(), outputs);
}
} catch (Throwable t) {
logger.error("Fail to execute the action: " + a.getId(), t);
}
}
} | void function(Rule rule) { List<Action> actions = ((RuntimeRule) rule).getActions(); if (actions == null actions.size() == 0) { return; } for (Iterator<Action> it = actions.iterator(); it.hasNext();) { RuntimeAction a = (RuntimeAction) it.next(); ActionHandler aHandler = a.getModuleHandler(); try { String rUID = rule.getUID(); Map<String, Object> context = getContext(rUID, a.getConnections()); Map<String, ?> outputs = aHandler.execute(context); if (outputs != null) { context = getContext(rUID); updateContext(rUID, a.getId(), outputs); } } catch (Throwable t) { logger.error(STR + a.getId(), t); } } } | /**
* This method evaluates actions of the {@link Rule} and set their {@link Output}s when they exists.
*
* @param rule executed rule.
*/ | This method evaluates actions of the <code>Rule</code> and set their <code>Output</code>s when they exists | executeActions | {
"repo_name": "digitaldan/smarthome",
"path": "bundles/automation/org.eclipse.smarthome.automation.core/src/main/java/org/eclipse/smarthome/automation/core/internal/RuleEngine.java",
"license": "epl-1.0",
"size": 54749
} | [
"java.util.Iterator",
"java.util.List",
"java.util.Map",
"org.eclipse.smarthome.automation.Action",
"org.eclipse.smarthome.automation.Rule",
"org.eclipse.smarthome.automation.handler.ActionHandler"
] | import java.util.Iterator; import java.util.List; import java.util.Map; import org.eclipse.smarthome.automation.Action; import org.eclipse.smarthome.automation.Rule; import org.eclipse.smarthome.automation.handler.ActionHandler; | import java.util.*; import org.eclipse.smarthome.automation.*; import org.eclipse.smarthome.automation.handler.*; | [
"java.util",
"org.eclipse.smarthome"
] | java.util; org.eclipse.smarthome; | 942,107 |
public byte[] serialize() throws PacketException {
// Acquire or compute the serialized payload
byte[] payloadBytes = null;
if (payload != null) {
payloadBytes = payload.serialize();
} else if (rawPayload != null) {
payloadBytes = rawPayload;
}
int payloadSize = (payloadBytes == null) ? 0 : payloadBytes.length;
// Allocate the buffer to contain the full (header + payload) packet
int headerSize = getHeaderSize() / Byte.SIZE;
byte[] packetBytes = new byte[headerSize + payloadSize];
if (payloadSize != 0) {
System.arraycopy(payloadBytes, 0, packetBytes, headerSize,
payloadSize);
}
// Serialize this packet header, field by field
Map<String, HeaderField> fmtMap = getHeaderFormat();
for (Entry<String, HeaderField> entry: fmtMap.entrySet()) {
String field = entry.getKey();
HeaderField hent = entry.getValue();
byte[] fieldBytes = hdrFieldsMap.get(field);
// Let's skip optional fields when not set
if (fieldBytes != null) {
int off = getFieldOffset(field, hent);
int nbits = getFieldNumBits(field, hent);
try {
ByteUtils.setBits(packetBytes, fieldBytes, off, nbits);
} catch (RuntimeException e) {
String msg = "Failed to serialize field: " + field +
": off=" + off + ", size=" + nbits +
", total=" + fieldBytes.length;
throw new PacketException(msg, e);
}
}
}
// Perform post serialize operations (like checksum computation)
postSerializeCustomOperation(packetBytes);
if (LOG.isTraceEnabled()) {
LOG.trace("Serialized: {}: {}", getClass().getSimpleName(),
ByteUtils.toHexString(packetBytes));
}
return packetBytes;
} | byte[] function() throws PacketException { byte[] payloadBytes = null; if (payload != null) { payloadBytes = payload.serialize(); } else if (rawPayload != null) { payloadBytes = rawPayload; } int payloadSize = (payloadBytes == null) ? 0 : payloadBytes.length; int headerSize = getHeaderSize() / Byte.SIZE; byte[] packetBytes = new byte[headerSize + payloadSize]; if (payloadSize != 0) { System.arraycopy(payloadBytes, 0, packetBytes, headerSize, payloadSize); } Map<String, HeaderField> fmtMap = getHeaderFormat(); for (Entry<String, HeaderField> entry: fmtMap.entrySet()) { String field = entry.getKey(); HeaderField hent = entry.getValue(); byte[] fieldBytes = hdrFieldsMap.get(field); if (fieldBytes != null) { int off = getFieldOffset(field, hent); int nbits = getFieldNumBits(field, hent); try { ByteUtils.setBits(packetBytes, fieldBytes, off, nbits); } catch (RuntimeException e) { String msg = STR + field + STR + off + STR + nbits + STR + fieldBytes.length; throw new PacketException(msg, e); } } } postSerializeCustomOperation(packetBytes); if (LOG.isTraceEnabled()) { LOG.trace(STR, getClass().getSimpleName(), ByteUtils.toHexString(packetBytes)); } return packetBytes; } | /**
* This method serializes the header and payload from the respective
* packet class, into a single stream of bytes to be sent on the wire.
*
* @return The byte array representing the serialized Packet.
* @throws PacketException An error occurred.
*/ | This method serializes the header and payload from the respective packet class, into a single stream of bytes to be sent on the wire | serialize | {
"repo_name": "opendaylight/vtn",
"path": "manager/api/src/main/java/org/opendaylight/vtn/manager/packet/Packet.java",
"license": "epl-1.0",
"size": 26026
} | [
"java.util.Map",
"org.opendaylight.vtn.manager.util.ByteUtils"
] | import java.util.Map; import org.opendaylight.vtn.manager.util.ByteUtils; | import java.util.*; import org.opendaylight.vtn.manager.util.*; | [
"java.util",
"org.opendaylight.vtn"
] | java.util; org.opendaylight.vtn; | 1,465,096 |
public void addTest(int testIndex, TestOperationProcessor processor) {
testProcessorManager.addTest(testIndex, processor);
} | void function(int testIndex, TestOperationProcessor processor) { testProcessorManager.addTest(testIndex, processor); } | /**
* Adds a Simulator Test.
*
* @param testIndex the index of the Simulator Test
* @param processor the {@link TestOperationProcessor} which processes incoming
* {@link com.hazelcast.simulator.protocol.operation.SimulatorOperation} for this test
*/ | Adds a Simulator Test | addTest | {
"repo_name": "Donnerbart/hazelcast-simulator",
"path": "simulator/src/main/java/com/hazelcast/simulator/protocol/connector/WorkerConnector.java",
"license": "apache-2.0",
"size": 7073
} | [
"com.hazelcast.simulator.protocol.processors.TestOperationProcessor"
] | import com.hazelcast.simulator.protocol.processors.TestOperationProcessor; | import com.hazelcast.simulator.protocol.processors.*; | [
"com.hazelcast.simulator"
] | com.hazelcast.simulator; | 798,341 |
public void setParameter(String name, String value) throws IOException {
boundary();
writeName(name);
newline(); newline();
writeln(value);
}
| void function(String name, String value) throws IOException { boundary(); writeName(name); newline(); newline(); writeln(value); } | /**
* adds a string parameter to the request
* @param name parameter name
* @param value parameter value
* @throws IOException
*/ | adds a string parameter to the request | setParameter | {
"repo_name": "marktriggs/nyu-sakai-10.4",
"path": "scormcloud-service/SCORMCloud_JavaLibrary/src/com/rusticisoftware/hostedengine/client/ClientHttpRequest.java",
"license": "apache-2.0",
"size": 18156
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 579,598 |
ImmutableSet<String> sdkDylibs() {
return sdkFrameworkAttributes.sdkDylibs();
} | ImmutableSet<String> sdkDylibs() { return sdkFrameworkAttributes.sdkDylibs(); } | /**
* Returns the value of the sdk_dylibs attribute.
*/ | Returns the value of the sdk_dylibs attribute | sdkDylibs | {
"repo_name": "Krasnyanskiy/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java",
"license": "apache-2.0",
"size": 28029
} | [
"com.google.common.collect.ImmutableSet"
] | import com.google.common.collect.ImmutableSet; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 1,089,674 |
public IMethod findAction(Route route, IScriptProject project) {
ViewPath vPath = new ViewPath(route.getViewPath());
if (!vPath.isValid())
return null;
IType type = null;
IType[] controllers = findBundleControllers(vPath.getBundle(), project);
if (controllers == null) {
String msg = "Unable to find bundle controllers ";
if (vPath != null)
msg += vPath.getBundle();
if (project != null) {
msg += " project: " + project.getElementName();
}
Logger.debugMSG(msg);
return null;
}
String ctrl = vPath.getController() + "Controller";
for (IType t : controllers) {
if (t.getElementName().equals(ctrl)) {
type = t;
break;
}
}
if (type == null) {
return null;
}
IMethod method = type.getMethod(vPath.getTemplate() + "Action");
if (method != null)
return method;
return type.getMethod(vPath.getTemplate());
} | IMethod function(Route route, IScriptProject project) { ViewPath vPath = new ViewPath(route.getViewPath()); if (!vPath.isValid()) return null; IType type = null; IType[] controllers = findBundleControllers(vPath.getBundle(), project); if (controllers == null) { String msg = STR; if (vPath != null) msg += vPath.getBundle(); if (project != null) { msg += STR + project.getElementName(); } Logger.debugMSG(msg); return null; } String ctrl = vPath.getController() + STR; for (IType t : controllers) { if (t.getElementName().equals(ctrl)) { type = t; break; } } if (type == null) { return null; } IMethod method = type.getMethod(vPath.getTemplate() + STR); if (method != null) return method; return type.getMethod(vPath.getTemplate()); } | /**
* Find the corresponding {@link IMethod} to a {@link Route}.
*
* @param route
* @param project
* @return
*/ | Find the corresponding <code>IMethod</code> to a <code>Route</code> | findAction | {
"repo_name": "pulse00/Symfony-2-Eclipse-Plugin",
"path": "com.dubture.symfony.core/src/com/dubture/symfony/core/model/SymfonyModelAccess.java",
"license": "mit",
"size": 41186
} | [
"com.dubture.symfony.core.log.Logger",
"com.dubture.symfony.index.model.Route",
"org.eclipse.dltk.core.IMethod",
"org.eclipse.dltk.core.IScriptProject",
"org.eclipse.dltk.core.IType"
] | import com.dubture.symfony.core.log.Logger; import com.dubture.symfony.index.model.Route; import org.eclipse.dltk.core.IMethod; import org.eclipse.dltk.core.IScriptProject; import org.eclipse.dltk.core.IType; | import com.dubture.symfony.core.log.*; import com.dubture.symfony.index.model.*; import org.eclipse.dltk.core.*; | [
"com.dubture.symfony",
"org.eclipse.dltk"
] | com.dubture.symfony; org.eclipse.dltk; | 1,658,580 |
public void setAuthenticationListener(AuthenticationListener authenticationListener)
{
this.authenticationListener = authenticationListener;
}
| void function(AuthenticationListener authenticationListener) { this.authenticationListener = authenticationListener; } | /**
* Sets the authentication listener.
*
* @param authenticationListener AuthenticationListener
*/ | Sets the authentication listener | setAuthenticationListener | {
"repo_name": "Tybion/community-edition",
"path": "projects/remote-api/source/java/org/alfresco/repo/webdav/auth/BaseAuthenticationFilter.java",
"license": "lgpl-3.0",
"size": 17659
} | [
"org.alfresco.repo.web.auth.AuthenticationListener"
] | import org.alfresco.repo.web.auth.AuthenticationListener; | import org.alfresco.repo.web.auth.*; | [
"org.alfresco.repo"
] | org.alfresco.repo; | 2,269,809 |
public static Number unaryPlus(Number left) {
return NumberMath.unaryPlus(left);
} | static Number function(Number left) { return NumberMath.unaryPlus(left); } | /**
* Returns the number, effectively being a noop for numbers.
* Operator overloaded form of the '+' operator when it preceeds
* a single operand, i.e. <code>+10</code>
*
* @param left a Number
* @return the number
* @since 2.2.0
*/ | Returns the number, effectively being a noop for numbers. Operator overloaded form of the '+' operator when it preceeds a single operand, i.e. <code>+10</code> | unaryPlus | {
"repo_name": "apache/incubator-groovy",
"path": "src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "apache-2.0",
"size": 703151
} | [
"org.codehaus.groovy.runtime.typehandling.NumberMath"
] | import org.codehaus.groovy.runtime.typehandling.NumberMath; | import org.codehaus.groovy.runtime.typehandling.*; | [
"org.codehaus.groovy"
] | org.codehaus.groovy; | 2,620,875 |
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle("");
int initialPage = -1;
if (getArguments() != null) {
if (getArguments().containsKey(TomahawkFragment.CONTAINER_FRAGMENT_PAGE)) {
initialPage = getArguments().getInt(TomahawkFragment.CONTAINER_FRAGMENT_PAGE);
}
if (getArguments().containsKey(TomahawkFragment.TOMAHAWK_USER_ID) && !TextUtils
.isEmpty(getArguments().getString(TomahawkFragment.TOMAHAWK_USER_ID))) {
mUser = User.getUserById(getArguments().getString(TomahawkFragment.TOMAHAWK_USER_ID));
if (mUser == null) {
getActivity().getSupportFragmentManager().popBackStack();
} else {
mCurrentRequestIds.add(InfoSystem.getInstance().resolve(mUser));
}
}
}
showContentHeader(mUser, null, R.dimen.header_clear_space_nonscrollable_static_user);
List<String> fragmentClassNames = new ArrayList<String>();
fragmentClassNames.add(SocialActionsFragment.class.getName());
fragmentClassNames.add(PlaylistEntriesFragment.class.getName());
fragmentClassNames.add(UsersFragment.class.getName());
List<String> fragmentTitles = new ArrayList<String>();
fragmentTitles.add(getString(R.string.activity));
fragmentTitles.add(getString(R.string.music));
fragmentTitles.add(getString(R.string.friends));
List<Bundle> fragmentBundles = new ArrayList<Bundle>();
Bundle bundle = new Bundle();
bundle.putString(TomahawkFragment.TOMAHAWK_USER_ID, mUser.getCacheKey());
bundle.putInt(TomahawkFragment.SHOW_MODE, SocialActionsFragment.SHOW_MODE_SOCIALACTIONS);
fragmentBundles.add(bundle);
bundle = new Bundle();
bundle.putString(TomahawkFragment.TOMAHAWK_PLAYLIST_KEY,
mUser.getPlaybackLog().getCacheKey());
bundle.putString(TomahawkFragment.TOMAHAWK_USER_ID, mUser.getCacheKey());
fragmentBundles.add(bundle);
bundle = new Bundle();
bundle.putString(TomahawkFragment.TOMAHAWK_USER_ID, mUser.getCacheKey());
bundle.putInt(TomahawkFragment.SHOW_MODE, UsersFragment.SHOW_MODE_TYPE_FOLLOWERS);
bundle.putString(TomahawkFragment.TOMAHAWK_USER_ID, mUser.getCacheKey());
fragmentBundles.add(bundle);
setupPager(fragmentClassNames, fragmentTitles, fragmentBundles, initialPage);
} | void function(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); getActivity().setTitle(""); int initialPage = -1; if (getArguments() != null) { if (getArguments().containsKey(TomahawkFragment.CONTAINER_FRAGMENT_PAGE)) { initialPage = getArguments().getInt(TomahawkFragment.CONTAINER_FRAGMENT_PAGE); } if (getArguments().containsKey(TomahawkFragment.TOMAHAWK_USER_ID) && !TextUtils .isEmpty(getArguments().getString(TomahawkFragment.TOMAHAWK_USER_ID))) { mUser = User.getUserById(getArguments().getString(TomahawkFragment.TOMAHAWK_USER_ID)); if (mUser == null) { getActivity().getSupportFragmentManager().popBackStack(); } else { mCurrentRequestIds.add(InfoSystem.getInstance().resolve(mUser)); } } } showContentHeader(mUser, null, R.dimen.header_clear_space_nonscrollable_static_user); List<String> fragmentClassNames = new ArrayList<String>(); fragmentClassNames.add(SocialActionsFragment.class.getName()); fragmentClassNames.add(PlaylistEntriesFragment.class.getName()); fragmentClassNames.add(UsersFragment.class.getName()); List<String> fragmentTitles = new ArrayList<String>(); fragmentTitles.add(getString(R.string.activity)); fragmentTitles.add(getString(R.string.music)); fragmentTitles.add(getString(R.string.friends)); List<Bundle> fragmentBundles = new ArrayList<Bundle>(); Bundle bundle = new Bundle(); bundle.putString(TomahawkFragment.TOMAHAWK_USER_ID, mUser.getCacheKey()); bundle.putInt(TomahawkFragment.SHOW_MODE, SocialActionsFragment.SHOW_MODE_SOCIALACTIONS); fragmentBundles.add(bundle); bundle = new Bundle(); bundle.putString(TomahawkFragment.TOMAHAWK_PLAYLIST_KEY, mUser.getPlaybackLog().getCacheKey()); bundle.putString(TomahawkFragment.TOMAHAWK_USER_ID, mUser.getCacheKey()); fragmentBundles.add(bundle); bundle = new Bundle(); bundle.putString(TomahawkFragment.TOMAHAWK_USER_ID, mUser.getCacheKey()); bundle.putInt(TomahawkFragment.SHOW_MODE, UsersFragment.SHOW_MODE_TYPE_FOLLOWERS); bundle.putString(TomahawkFragment.TOMAHAWK_USER_ID, mUser.getCacheKey()); fragmentBundles.add(bundle); setupPager(fragmentClassNames, fragmentTitles, fragmentBundles, initialPage); } | /**
* Called, when this {@link org.tomahawk.tomahawk_android.fragments.UserPagerFragment}'s
* {@link android.view.View} has been created
*/ | Called, when this <code>org.tomahawk.tomahawk_android.fragments.UserPagerFragment</code>'s <code>android.view.View</code> has been created | onViewCreated | {
"repo_name": "0359xiaodong/tomahawk-android",
"path": "src/org/tomahawk/tomahawk_android/fragments/UserPagerFragment.java",
"license": "gpl-3.0",
"size": 4617
} | [
"android.os.Bundle",
"android.text.TextUtils",
"android.view.View",
"java.util.ArrayList",
"java.util.List",
"org.tomahawk.libtomahawk.infosystem.InfoSystem",
"org.tomahawk.libtomahawk.infosystem.User"
] | import android.os.Bundle; import android.text.TextUtils; import android.view.View; import java.util.ArrayList; import java.util.List; import org.tomahawk.libtomahawk.infosystem.InfoSystem; import org.tomahawk.libtomahawk.infosystem.User; | import android.os.*; import android.text.*; import android.view.*; import java.util.*; import org.tomahawk.libtomahawk.infosystem.*; | [
"android.os",
"android.text",
"android.view",
"java.util",
"org.tomahawk.libtomahawk"
] | android.os; android.text; android.view; java.util; org.tomahawk.libtomahawk; | 2,849,394 |
@Ignore( "with the introduction of cross-realm auth this test is invalid" )
@Test
public void testNotUs() throws Exception
{
KerberosPrincipal clientPrincipal = new KerberosPrincipal( "[email protected]" );
KerberosPrincipal serverPrincipal = new KerberosPrincipal( "krbtgt/[email protected]" );
String serverPassword = "randomKey";
Ticket tgt = getTgt( clientPrincipal, serverPrincipal, serverPassword );
KdcReqBody kdcReqBody = new KdcReqBody();
kdcReqBody.setSName( getPrincipalName( "hnelson" ) );
kdcReqBody.setRealm( "EXAMPLE.COM" );
kdcReqBody.setEType( config.getEncryptionTypes() );
kdcReqBody.setNonce( random.nextInt() );
KdcOptions kdcOptions = new KdcOptions();
kdcReqBody.setKdcOptions( kdcOptions );
long currentTime = System.currentTimeMillis();
KerberosTime requestedEndTime = new KerberosTime( currentTime + KerberosTime.DAY );
kdcReqBody.setTill( requestedEndTime );
KdcReq message = getKdcRequest( tgt, kdcReqBody );
handler.messageReceived( session, message );
Object msg = session.getMessage();
assertEquals( "session.getMessage() instanceOf", KrbError.class, msg.getClass() );
KrbError error = ( KrbError ) msg;
assertEquals( "The ticket isn't for us", ErrorType.KRB_AP_ERR_NOT_US, error.getErrorCode() );
} | @Ignore( STR ) void function() throws Exception { KerberosPrincipal clientPrincipal = new KerberosPrincipal( STR ); KerberosPrincipal serverPrincipal = new KerberosPrincipal( STR ); String serverPassword = STR; Ticket tgt = getTgt( clientPrincipal, serverPrincipal, serverPassword ); KdcReqBody kdcReqBody = new KdcReqBody(); kdcReqBody.setSName( getPrincipalName( STR ) ); kdcReqBody.setRealm( STR ); kdcReqBody.setEType( config.getEncryptionTypes() ); kdcReqBody.setNonce( random.nextInt() ); KdcOptions kdcOptions = new KdcOptions(); kdcReqBody.setKdcOptions( kdcOptions ); long currentTime = System.currentTimeMillis(); KerberosTime requestedEndTime = new KerberosTime( currentTime + KerberosTime.DAY ); kdcReqBody.setTill( requestedEndTime ); KdcReq message = getKdcRequest( tgt, kdcReqBody ); handler.messageReceived( session, message ); Object msg = session.getMessage(); assertEquals( STR, KrbError.class, msg.getClass() ); KrbError error = ( KrbError ) msg; assertEquals( STR, ErrorType.KRB_AP_ERR_NOT_US, error.getErrorCode() ); } | /**
* Tests when the ticket isn't for us that the correct error message is returned.
*
* @throws Exception
*/ | Tests when the ticket isn't for us that the correct error message is returned | testNotUs | {
"repo_name": "drankye/directory-server",
"path": "protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/protocol/TicketGrantingServiceTest.java",
"license": "apache-2.0",
"size": 81600
} | [
"javax.security.auth.kerberos.KerberosPrincipal",
"org.apache.directory.shared.kerberos.KerberosTime",
"org.apache.directory.shared.kerberos.codec.options.KdcOptions",
"org.apache.directory.shared.kerberos.components.KdcReq",
"org.apache.directory.shared.kerberos.components.KdcReqBody",
"org.apache.directory.shared.kerberos.exceptions.ErrorType",
"org.apache.directory.shared.kerberos.messages.KrbError",
"org.apache.directory.shared.kerberos.messages.Ticket",
"org.junit.Assert",
"org.junit.Ignore"
] | import javax.security.auth.kerberos.KerberosPrincipal; import org.apache.directory.shared.kerberos.KerberosTime; import org.apache.directory.shared.kerberos.codec.options.KdcOptions; import org.apache.directory.shared.kerberos.components.KdcReq; import org.apache.directory.shared.kerberos.components.KdcReqBody; import org.apache.directory.shared.kerberos.exceptions.ErrorType; import org.apache.directory.shared.kerberos.messages.KrbError; import org.apache.directory.shared.kerberos.messages.Ticket; import org.junit.Assert; import org.junit.Ignore; | import javax.security.auth.kerberos.*; import org.apache.directory.shared.kerberos.*; import org.apache.directory.shared.kerberos.codec.options.*; import org.apache.directory.shared.kerberos.components.*; import org.apache.directory.shared.kerberos.exceptions.*; import org.apache.directory.shared.kerberos.messages.*; import org.junit.*; | [
"javax.security",
"org.apache.directory",
"org.junit"
] | javax.security; org.apache.directory; org.junit; | 894,492 |
private static ConditionFlag toFloatConditionFlag(Condition cond, boolean unorderedIsTrue) {
switch (cond) {
case LT:
return unorderedIsTrue ? ConditionFlag.LT : ConditionFlag.LO;
case LE:
return unorderedIsTrue ? ConditionFlag.LE : ConditionFlag.LS;
case GE:
return unorderedIsTrue ? ConditionFlag.PL : ConditionFlag.GE;
case GT:
return unorderedIsTrue ? ConditionFlag.HI : ConditionFlag.GT;
case EQ:
return ConditionFlag.EQ;
case NE:
return ConditionFlag.NE;
default:
throw GraalError.shouldNotReachHere();
}
} | static ConditionFlag function(Condition cond, boolean unorderedIsTrue) { switch (cond) { case LT: return unorderedIsTrue ? ConditionFlag.LT : ConditionFlag.LO; case LE: return unorderedIsTrue ? ConditionFlag.LE : ConditionFlag.LS; case GE: return unorderedIsTrue ? ConditionFlag.PL : ConditionFlag.GE; case GT: return unorderedIsTrue ? ConditionFlag.HI : ConditionFlag.GT; case EQ: return ConditionFlag.EQ; case NE: return ConditionFlag.NE; default: throw GraalError.shouldNotReachHere(); } } | /**
* Takes a Condition and unorderedIsTrue flag and returns the correct Aarch64 specific
* ConditionFlag. Note: This is only correct if the emitCompare code for floats has correctly
* handled the case of 'EQ && unorderedIsTrue', respectively 'NE && !unorderedIsTrue'!
*/ | Takes a Condition and unorderedIsTrue flag and returns the correct Aarch64 specific ConditionFlag. Note: This is only correct if the emitCompare code for floats has correctly handled the case of 'EQ && unorderedIsTrue', respectively 'NE && !unorderedIsTrue' | toFloatConditionFlag | {
"repo_name": "YouDiSN/OpenJDK-Research",
"path": "jdk9/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.aarch64/src/org/graalvm/compiler/core/aarch64/AArch64LIRGenerator.java",
"license": "gpl-2.0",
"size": 19958
} | [
"org.graalvm.compiler.asm.aarch64.AArch64Assembler",
"org.graalvm.compiler.core.common.calc.Condition",
"org.graalvm.compiler.debug.GraalError"
] | import org.graalvm.compiler.asm.aarch64.AArch64Assembler; import org.graalvm.compiler.core.common.calc.Condition; import org.graalvm.compiler.debug.GraalError; | import org.graalvm.compiler.asm.aarch64.*; import org.graalvm.compiler.core.common.calc.*; import org.graalvm.compiler.debug.*; | [
"org.graalvm.compiler"
] | org.graalvm.compiler; | 1,380,413 |
private static String makeHTML(final Action action) {
if (action == null) {
throw new IllegalArgumentException("action must not be null!");
}
String name = (String) action.getValue(Action.NAME);
if (name == null || name.trim().isEmpty()) {
return "";
}
// if only part of the text should appear as link, <a href> tag is defined in i18n
if (name.contains("<") || name.contains(">")) {
return name;
}
URL iconUrl = null;
if (action instanceof ResourceAction) {
String iconName = ((ResourceAction) action).getIconName();
if (iconName != null) {
String regularIconPath = "icons/16/" + iconName;
String retinaIconPath = "icons/16/@2x/" + iconName;
boolean isRetina = SwingTools.getGUIScaling() == SwingTools.Scaling.RETINA;
String iconLookup = isRetina ? retinaIconPath : regularIconPath;
try {
iconUrl = Tools.getResource(iconLookup);
if (iconUrl == null && isRetina) {
// fallback if @2x icon is missing on retina displays
iconUrl = Tools.getResource(regularIconPath);
}
} catch (NullPointerException e) {
// this can occur if no @2x icon exists on OS X and the security manager throws an NPE
iconUrl = Tools.getResource(regularIconPath);
}
}
}
if (iconUrl != null) {
return String.format(TEMPLATE_ICON_HTML, iconUrl.toString(), name);
} else {
if (Boolean.parseBoolean(String.valueOf(action.getValue(PROPERTY_BOLD)))) {
return String.format(TEMPLATE_HTML_BOLD, name);
} else {
return String.format(TEMPLATE_HTML, name);
}
}
} | static String function(final Action action) { if (action == null) { throw new IllegalArgumentException(STR); } String name = (String) action.getValue(Action.NAME); if (name == null name.trim().isEmpty()) { return STR<STR>STRicons/16/STRicons/16/@2x/" + iconName; boolean isRetina = SwingTools.getGUIScaling() == SwingTools.Scaling.RETINA; String iconLookup = isRetina ? retinaIconPath : regularIconPath; try { iconUrl = Tools.getResource(iconLookup); if (iconUrl == null && isRetina) { iconUrl = Tools.getResource(regularIconPath); } } catch (NullPointerException e) { iconUrl = Tools.getResource(regularIconPath); } } } if (iconUrl != null) { return String.format(TEMPLATE_ICON_HTML, iconUrl.toString(), name); } else { if (Boolean.parseBoolean(String.valueOf(action.getValue(PROPERTY_BOLD)))) { return String.format(TEMPLATE_HTML_BOLD, name); } else { return String.format(TEMPLATE_HTML, name); } } } | /**
* Creates the HTML text which will represent the link button.
*
* @param action
* @return
*/ | Creates the HTML text which will represent the link button | makeHTML | {
"repo_name": "rapidminer/rapidminer-studio",
"path": "src/main/java/com/rapidminer/gui/tools/components/AbstractLinkButton.java",
"license": "agpl-3.0",
"size": 5934
} | [
"com.rapidminer.gui.tools.SwingTools",
"com.rapidminer.tools.Tools",
"javax.swing.Action"
] | import com.rapidminer.gui.tools.SwingTools; import com.rapidminer.tools.Tools; import javax.swing.Action; | import com.rapidminer.gui.tools.*; import com.rapidminer.tools.*; import javax.swing.*; | [
"com.rapidminer.gui",
"com.rapidminer.tools",
"javax.swing"
] | com.rapidminer.gui; com.rapidminer.tools; javax.swing; | 1,198,239 |
public static byte [] encodedDigest(String digestAlgorithm, byte [] content) throws CertificateEncodingException, NoSuchAlgorithmException {
byte [] digest = digest(digestAlgorithm, content);
return digestEncoder(digestAlgorithm, digest);
} | static byte [] function(String digestAlgorithm, byte [] content) throws CertificateEncodingException, NoSuchAlgorithmException { byte [] digest = digest(digestAlgorithm, content); return digestEncoder(digestAlgorithm, digest); } | /**
* Digests some data and wraps it in an encoded PKCS#1 DigestInfo, which contains a specification
* of the digestAlgorithm (as an Object Identifier, or OID wrapped in an AlgorithmIdentifier,
* which for a digest algorithm typically has null parameters), and the digest itself, all encoded in DER.
* @param digestAlgorithm the algorithm to use to digest (as a Java String algorithm name)
* @param content the content to digest
* @return a DER-encoded DigestInfo containing the digested content and the OID for digestAlgorithm
* @throws CertificateEncodingException if there is an error in encoding
* @throws NoSuchAlgorithmException if none of our providers recognize digestAlgorithm, or know its OID
*/ | Digests some data and wraps it in an encoded PKCS#1 DigestInfo, which contains a specification of the digestAlgorithm (as an Object Identifier, or OID wrapped in an AlgorithmIdentifier, which for a digest algorithm typically has null parameters), and the digest itself, all encoded in DER | encodedDigest | {
"repo_name": "MobileCloudNetworking/icnaas",
"path": "mcn-ccn-router/ccnx-0.8.2/javasrc/src/main/org/ccnx/ccn/impl/security/crypto/CCNDigestHelper.java",
"license": "apache-2.0",
"size": 10637
} | [
"java.security.NoSuchAlgorithmException",
"java.security.cert.CertificateEncodingException"
] | import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateEncodingException; | import java.security.*; import java.security.cert.*; | [
"java.security"
] | java.security; | 1,884,823 |
public void testNormalAttachDetach()
throws Exception
{
try
{
SCOCollectionTests.checkAttachDetach(pmf,
List1.class,
ContainerItem.class,
java.util.List.class);
}
finally
{
clean(List1.class);
clean(ContainerItem.class);
}
}
| void function() throws Exception { try { SCOCollectionTests.checkAttachDetach(pmf, List1.class, ContainerItem.class, java.util.List.class); } finally { clean(List1.class); clean(ContainerItem.class); } } | /**
* Test case to check the attach/detach of the container.
**/ | Test case to check the attach/detach of the container | testNormalAttachDetach | {
"repo_name": "hopecee/texsts",
"path": "jdo/identity/src/test/org/datanucleus/tests/types/ListTest.java",
"license": "apache-2.0",
"size": 12543
} | [
"org.jpox.samples.types.container.ContainerItem",
"org.jpox.samples.types.list.List1"
] | import org.jpox.samples.types.container.ContainerItem; import org.jpox.samples.types.list.List1; | import org.jpox.samples.types.container.*; import org.jpox.samples.types.list.*; | [
"org.jpox.samples"
] | org.jpox.samples; | 2,072,006 |
public static ResourceLoader getConfigTimeResourceLoader() {
return configTimeResourceLoaderHolder.get();
} | static ResourceLoader function() { return configTimeResourceLoaderHolder.get(); } | /**
* Return the ResourceLoader for the currently configured Quartz Scheduler,
* to be used by ResourceLoaderClassLoadHelper.
* <p>This instance will be set before initialization of the corresponding
* Scheduler, and reset immediately afterwards. It is thus only available
* during configuration.
* @see #setApplicationContext
* @see ResourceLoaderClassLoadHelper
*/ | Return the ResourceLoader for the currently configured Quartz Scheduler, to be used by ResourceLoaderClassLoadHelper. This instance will be set before initialization of the corresponding Scheduler, and reset immediately afterwards. It is thus only available during configuration | getConfigTimeResourceLoader | {
"repo_name": "boggad/jdk9-sample",
"path": "sample-catalog/spring-jdk9/src/spring.context.support/org/springframework/scheduling/quartz/SchedulerFactoryBean.java",
"license": "mit",
"size": 28631
} | [
"org.springframework.core.io.ResourceLoader"
] | import org.springframework.core.io.ResourceLoader; | import org.springframework.core.io.*; | [
"org.springframework.core"
] | org.springframework.core; | 1,027,067 |
public int getMultiProcChance(ItemStack stack)
{
if (stack.isEmpty())
{
return 0;
}
else
{
if (this.getGemProc(stack) >= 500)
{
return 4+References.random.nextInt(2);
}
else if (this.getGemProc(stack) >= 401)
{
return 3+References.random.nextInt(2);
}
else if (this.getGemProc(stack) >= 301)
{
return 2+References.random.nextInt(2);
}
else if (this.getGemProc(stack) >= 201)
{
return 1+References.random.nextInt(2);
}
else if (this.getGemProc(stack) >= 101)
{
return 0+References.random.nextInt(2);
}
return 0;
}
} | int function(ItemStack stack) { if (stack.isEmpty()) { return 0; } else { if (this.getGemProc(stack) >= 500) { return 4+References.random.nextInt(2); } else if (this.getGemProc(stack) >= 401) { return 3+References.random.nextInt(2); } else if (this.getGemProc(stack) >= 301) { return 2+References.random.nextInt(2); } else if (this.getGemProc(stack) >= 201) { return 1+References.random.nextInt(2); } else if (this.getGemProc(stack) >= 101) { return 0+References.random.nextInt(2); } return 0; } } | /**
* Gets the Multi Proc to process an ItemStack into a Shard.
* @param stack - ItemStack input (Slot 0)
* @return
*/ | Gets the Multi Proc to process an ItemStack into a Shard | getMultiProcChance | {
"repo_name": "Weisses/Ebonheart-Mods",
"path": "Vies Machines/1.12.2 - 2768/src/main/java/com/vies/viesmachines/common/tileentity/TileEntityKitFabricator.java",
"license": "mit",
"size": 16766
} | [
"com.vies.viesmachines.api.References",
"net.minecraft.item.ItemStack"
] | import com.vies.viesmachines.api.References; import net.minecraft.item.ItemStack; | import com.vies.viesmachines.api.*; import net.minecraft.item.*; | [
"com.vies.viesmachines",
"net.minecraft.item"
] | com.vies.viesmachines; net.minecraft.item; | 2,515,936 |
public CredentialInterfaceType getCredentialInterface()
{
return CredentialInterfaceType.getFromStringValue(childNode.getTextValueForPatternName("credential-interface"));
} | CredentialInterfaceType function() { return CredentialInterfaceType.getFromStringValue(childNode.getTextValueForPatternName(STR)); } | /**
* Returns the <code>credential-interface</code> element
* @return the value found for the element <code>credential-interface</code>
*/ | Returns the <code>credential-interface</code> element | getCredentialInterface | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/connector17/AuthenticationMechanismTypeImpl.java",
"license": "epl-1.0",
"size": 8256
} | [
"org.jboss.shrinkwrap.descriptor.api.connector17.CredentialInterfaceType"
] | import org.jboss.shrinkwrap.descriptor.api.connector17.CredentialInterfaceType; | import org.jboss.shrinkwrap.descriptor.api.connector17.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 916,959 |
private void setEventTypes(List<EventType> value) {
this.eventTypes=value;
}
| void function(List<EventType> value) { this.eventTypes=value; } | /**
* set the EventTypes
*/ | set the EventTypes | setEventTypes | {
"repo_name": "daitangio/exchangews",
"path": "src/main/java/microsoft/exchange/webservices/data/SubscribeRequest.java",
"license": "lgpl-3.0",
"size": 5887
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,446,298 |
public static List<Category> getAllCategories()
{
return getAllCategories(SessionFacade.getUserSession().getUserId());
}
| static List<Category> function() { return getAllCategories(SessionFacade.getUserSession().getUserId()); } | /**
* Get all categories.
* A call to @link #getAllCategories(int) is made, passing
* the return of <code>SessionFacade.getUserSession().getUserId()</code>
* as the value for the "userId" argument.
*
* @return <code>List</code> with the categories. Each entry is a <code>Category</code> object.
* @see #getAllCategories(int)
*/ | Get all categories. A call to @link #getAllCategories(int) is made, passing the return of <code>SessionFacade.getUserSession().getUserId()</code> as the value for the "userId" argument | getAllCategories | {
"repo_name": "javadan/jforum",
"path": "src/main/java/net/jforum/repository/ForumRepository.java",
"license": "bsd-3-clause",
"size": 28127
} | [
"java.util.List",
"net.jforum.SessionFacade",
"net.jforum.entities.Category"
] | import java.util.List; import net.jforum.SessionFacade; import net.jforum.entities.Category; | import java.util.*; import net.jforum.*; import net.jforum.entities.*; | [
"java.util",
"net.jforum",
"net.jforum.entities"
] | java.util; net.jforum; net.jforum.entities; | 1,466,690 |
public static boolean isBinary(@Nullable String label) {
return label != null && !label.endsWith(".json");
} | static boolean function(@Nullable String label) { return label != null && !label.endsWith(".json"); } | /**
* Checks if a peeked message has binary content.
*/ | Checks if a peeked message has binary content | isBinary | {
"repo_name": "google/filament",
"path": "android/filament-utils-android/src/main/java/com/google/android/filament/utils/RemoteServer.java",
"license": "apache-2.0",
"size": 3506
} | [
"androidx.annotation.Nullable"
] | import androidx.annotation.Nullable; | import androidx.annotation.*; | [
"androidx.annotation"
] | androidx.annotation; | 2,078,949 |
public static void setMapOutputValueSchema(Job job, Schema schema) {
job.setMapOutputValueClass(AvroValue.class);
AvroSerialization.setValueWriterSchema(job.getConfiguration(), schema);
AvroSerialization.setValueReaderSchema(job.getConfiguration(), schema);
AvroSerialization.addToConfiguration(job.getConfiguration());
} | static void function(Job job, Schema schema) { job.setMapOutputValueClass(AvroValue.class); AvroSerialization.setValueWriterSchema(job.getConfiguration(), schema); AvroSerialization.setValueReaderSchema(job.getConfiguration(), schema); AvroSerialization.addToConfiguration(job.getConfiguration()); } | /**
* Sets the map output value schema.
*
* @param job The job to configure.
* @param schema The map output value schema.
*/ | Sets the map output value schema | setMapOutputValueSchema | {
"repo_name": "RallySoftware/avro",
"path": "lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroJob.java",
"license": "apache-2.0",
"size": 7172
} | [
"org.apache.avro.Schema",
"org.apache.avro.hadoop.io.AvroSerialization",
"org.apache.avro.mapred.AvroValue",
"org.apache.hadoop.mapreduce.Job"
] | import org.apache.avro.Schema; import org.apache.avro.hadoop.io.AvroSerialization; import org.apache.avro.mapred.AvroValue; import org.apache.hadoop.mapreduce.Job; | import org.apache.avro.*; import org.apache.avro.hadoop.io.*; import org.apache.avro.mapred.*; import org.apache.hadoop.mapreduce.*; | [
"org.apache.avro",
"org.apache.hadoop"
] | org.apache.avro; org.apache.hadoop; | 2,819,209 |
@Deprecated
@Generated
@CVariable()
@MappedReturn(ObjCStringMapper.class)
public static native String UITextAttributeTextShadowColor(); | @CVariable() @MappedReturn(ObjCStringMapper.class) static native String function(); | /**
* Key to the text shadow color in the text attributes dictionary. A UIColor instance is expected.
*/ | Key to the text shadow color in the text attributes dictionary. A UIColor instance is expected | UITextAttributeTextShadowColor | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/c/UIKit.java",
"license": "apache-2.0",
"size": 134869
} | [
"org.moe.natj.c.ann.CVariable",
"org.moe.natj.general.ann.MappedReturn",
"org.moe.natj.objc.map.ObjCStringMapper"
] | import org.moe.natj.c.ann.CVariable; import org.moe.natj.general.ann.MappedReturn; import org.moe.natj.objc.map.ObjCStringMapper; | import org.moe.natj.c.ann.*; import org.moe.natj.general.ann.*; import org.moe.natj.objc.map.*; | [
"org.moe.natj"
] | org.moe.natj; | 1,741,616 |
public FireResult calculateFireNumber(FourierMethod fourierMethod, SamplingMethod samplingMethod,
ThresholdMethod thresholdMethod, double fourierImageScale, int imageSize) {
final FireImages images = createImages(fourierImageScale, imageSize);
return calculateFireNumber(fourierMethod, samplingMethod, thresholdMethod, images);
} | FireResult function(FourierMethod fourierMethod, SamplingMethod samplingMethod, ThresholdMethod thresholdMethod, double fourierImageScale, int imageSize) { final FireImages images = createImages(fourierImageScale, imageSize); return calculateFireNumber(fourierMethod, samplingMethod, thresholdMethod, images); } | /**
* Calculate the Fourier Image REsolution (FIRE) number using the chosen threshold method. Should
* be called after {@link #initialise(MemoryPeakResults, MemoryPeakResults)}.
*
* @param fourierMethod the fourier method
* @param samplingMethod the sampling method
* @param thresholdMethod the threshold method
* @param fourierImageScale The scale to use when reconstructing the super-resolution images (0
* for auto)
* @param imageSize The width of the super resolution images when using auto scale (should be a
* power of two minus 1 for optimum memory usage)
* @return The FIRE number
*/ | Calculate the Fourier Image REsolution (FIRE) number using the chosen threshold method. Should be called after <code>#initialise(MemoryPeakResults, MemoryPeakResults)</code> | calculateFireNumber | {
"repo_name": "aherbert/GDSC-SMLM",
"path": "src/main/java/uk/ac/sussex/gdsc/smlm/ij/plugins/Fire.java",
"license": "gpl-3.0",
"size": 110031
} | [
"uk.ac.sussex.gdsc.smlm.ij.frc.Frc"
] | import uk.ac.sussex.gdsc.smlm.ij.frc.Frc; | import uk.ac.sussex.gdsc.smlm.ij.frc.*; | [
"uk.ac.sussex"
] | uk.ac.sussex; | 423,545 |
@Authorized( { PrivilegeConstants.GET_VISITS })
public Integer getEncountersByVisitsAndPatientCount(Patient patient, boolean includeVoided, String query)
throws APIException;
| @Authorized( { PrivilegeConstants.GET_VISITS }) Integer function(Patient patient, boolean includeVoided, String query) throws APIException; | /**
* Returns result count for
* {@link #getEncountersByVisitsAndPatient(Patient, boolean, String, Integer, Integer)}.
*
* @param patient
* @param includeVoided
* @param query
* @return number of results
* @throws APIException
* @since 1.9
*/ | Returns result count for <code>#getEncountersByVisitsAndPatient(Patient, boolean, String, Integer, Integer)</code> | getEncountersByVisitsAndPatientCount | {
"repo_name": "Bhamni/openmrs-core",
"path": "api/src/main/java/org/openmrs/api/EncounterService.java",
"license": "mpl-2.0",
"size": 36306
} | [
"org.openmrs.Patient",
"org.openmrs.annotation.Authorized",
"org.openmrs.util.PrivilegeConstants"
] | import org.openmrs.Patient; import org.openmrs.annotation.Authorized; import org.openmrs.util.PrivilegeConstants; | import org.openmrs.*; import org.openmrs.annotation.*; import org.openmrs.util.*; | [
"org.openmrs",
"org.openmrs.annotation",
"org.openmrs.util"
] | org.openmrs; org.openmrs.annotation; org.openmrs.util; | 1,668,439 |
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public <T> List<T> dynamicQuery(DynamicQuery dynamicQuery); | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) <T> List<T> function(DynamicQuery dynamicQuery); | /**
* Performs a dynamic query on the database and returns the matching rows.
*
* @param dynamicQuery the dynamic query
* @return the matching rows
*/ | Performs a dynamic query on the database and returns the matching rows | dynamicQuery | {
"repo_name": "gamerson/liferay-blade-samples",
"path": "maven/apps/service-builder/dsp/dsp-api/src/main/java/com/liferay/blade/samples/dspservicebuilder/service/CountryLocalService.java",
"license": "apache-2.0",
"size": 10333
} | [
"com.liferay.portal.kernel.dao.orm.DynamicQuery",
"com.liferay.portal.kernel.transaction.Propagation",
"com.liferay.portal.kernel.transaction.Transactional",
"java.util.List"
] | import com.liferay.portal.kernel.dao.orm.DynamicQuery; import com.liferay.portal.kernel.transaction.Propagation; import com.liferay.portal.kernel.transaction.Transactional; import java.util.List; | import com.liferay.portal.kernel.dao.orm.*; import com.liferay.portal.kernel.transaction.*; import java.util.*; | [
"com.liferay.portal",
"java.util"
] | com.liferay.portal; java.util; | 1,660,265 |
@Metadata(description = "Allows to configure a custom value of the response header size on the Jetty connectors.")
public void setResponseHeaderSize(Integer responseHeaderSize) {
this.responseHeaderSize = responseHeaderSize;
} | @Metadata(description = STR) void function(Integer responseHeaderSize) { this.responseHeaderSize = responseHeaderSize; } | /**
* Allows to configure a custom value of the response header size on the Jetty connectors.
*/ | Allows to configure a custom value of the response header size on the Jetty connectors | setResponseHeaderSize | {
"repo_name": "NetNow/camel",
"path": "components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java",
"license": "apache-2.0",
"size": 56873
} | [
"org.apache.camel.spi.Metadata"
] | import org.apache.camel.spi.Metadata; | import org.apache.camel.spi.*; | [
"org.apache.camel"
] | org.apache.camel; | 335,532 |
@Schema(description = "Folder path")
public String getPath() {
return path;
} | @Schema(description = STR) String function() { return path; } | /**
* Folder path
* @return path
**/ | Folder path | getPath | {
"repo_name": "iterate-ch/cyberduck",
"path": "brick/src/main/java/ch/cyberduck/core/brick/io/swagger/client/model/StyleEntity.java",
"license": "gpl-3.0",
"size": 3733
} | [
"io.swagger.v3.oas.annotations.media.Schema"
] | import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.*; | [
"io.swagger.v3"
] | io.swagger.v3; | 1,273,603 |
@JsonProperty("firmware")
public Integer getFirmware() {
return this.firmware;
} | @JsonProperty(STR) Integer function() { return this.firmware; } | /**
* "firmware": 91
*/ | "firmware": 91 | getFirmware | {
"repo_name": "dbadia/openhab",
"path": "bundles/binding/org.openhab.binding.netatmo/src/main/java/org/openhab/binding/netatmo/internal/weather/GetStationsDataResponse.java",
"license": "epl-1.0",
"size": 23138
} | [
"org.codehaus.jackson.annotate.JsonProperty"
] | import org.codehaus.jackson.annotate.JsonProperty; | import org.codehaus.jackson.annotate.*; | [
"org.codehaus.jackson"
] | org.codehaus.jackson; | 2,237,659 |
WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
wifiManager.setWifiEnabled(false);
CellularDataUtil.setMobileDataEnabled(context, false);
AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audio.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
} | WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); wifiManager.setWifiEnabled(false); CellularDataUtil.setMobileDataEnabled(context, false); AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audio.setRingerMode(AudioManager.RINGER_MODE_VIBRATE); } | /**
* Execute this command (turn on flashlight)
*/ | Execute this command (turn on flashlight) | execute | {
"repo_name": "RSenApps/Commandr-Android",
"path": "phone/src/com/RSen/Commandr/builtincommands/GoodNightCommand.java",
"license": "mit",
"size": 1556
} | [
"android.content.Context",
"android.media.AudioManager",
"android.net.wifi.WifiManager"
] | import android.content.Context; import android.media.AudioManager; import android.net.wifi.WifiManager; | import android.content.*; import android.media.*; import android.net.wifi.*; | [
"android.content",
"android.media",
"android.net"
] | android.content; android.media; android.net; | 1,913,301 |
public void setTransform(Transform trans) {
this.transform = trans;
}
| void function(Transform trans) { this.transform = trans; } | /**
* Set the transform given for this definition
*
* @param trans The transform given for this definition
*/ | Set the transform given for this definition | setTransform | {
"repo_name": "dbank-so/fadableUnicodeFont",
"path": "src/org/newdawn/slick/svg/Gradient.java",
"license": "bsd-3-clause",
"size": 6855
} | [
"org.newdawn.slick.geom.Transform"
] | import org.newdawn.slick.geom.Transform; | import org.newdawn.slick.geom.*; | [
"org.newdawn.slick"
] | org.newdawn.slick; | 2,826,418 |
public void join(boolean destroyThreadpool) {
// Make blocking calls to the last processes that are running
if ( ! threadPool.isShutdown()) {
try {
for (int i = nThreads; i > 0; --i) {
idleProcessors.take();
}
if (destroyThreadpool) {
threadPool.shutdown();
// Sanity check. The threadpool should be done after iterating over
// the processors.
threadPool.awaitTermination(10, TimeUnit.SECONDS);
} else {
// Repopulate the list of processors
for (int i = 0; i < nThreads; ++i) {
idleProcessors.put(i);
}
}
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
} | void function(boolean destroyThreadpool) { if ( ! threadPool.isShutdown()) { try { for (int i = nThreads; i > 0; --i) { idleProcessors.take(); } if (destroyThreadpool) { threadPool.shutdown(); threadPool.awaitTermination(10, TimeUnit.SECONDS); } else { for (int i = 0; i < nThreads; ++i) { idleProcessors.put(i); } } } catch (InterruptedException e) { throw new RuntimeException(e); } } } | /**
* Wait for all threads to finish.
*
* @param destroyThreadpool -- if true, then destroy the worker threads
* so that the main thread can shutdown.
*/ | Wait for all threads to finish | join | {
"repo_name": "kornev/CoreNLP",
"path": "src/edu/stanford/nlp/util/concurrent/MulticoreWrapper.java",
"license": "gpl-2.0",
"size": 9254
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,716,867 |
public static String formatHttpRequestHeaders(HttpWebRequest request)
throws URISyntaxException, EWSHttpException {
final String method = request.getRequestMethod().toUpperCase();
final String path = request.getUrl().toURI().getPath();
final Map<String, String> property = request.getRequestProperty();
final String headers = EwsUtilities.formatHttpHeaders(property);
return String.format("%s %s HTTP/%s\n", method, path, "1.1") + headers + "\n";
} | static String function(HttpWebRequest request) throws URISyntaxException, EWSHttpException { final String method = request.getRequestMethod().toUpperCase(); final String path = request.getUrl().toURI().getPath(); final Map<String, String> property = request.getRequestProperty(); final String headers = EwsUtilities.formatHttpHeaders(property); return String.format(STR, method, path, "1.1") + headers + "\n"; } | /**
* Format request HTTP headers.
*
* @param request The HTTP request.
*/ | Format request HTTP headers | formatHttpRequestHeaders | {
"repo_name": "KatharineYe/ews-java-api",
"path": "src/main/java/microsoft/exchange/webservices/data/core/EwsUtilities.java",
"license": "mit",
"size": 46056
} | [
"java.net.URISyntaxException",
"java.util.Map"
] | import java.net.URISyntaxException; import java.util.Map; | import java.net.*; import java.util.*; | [
"java.net",
"java.util"
] | java.net; java.util; | 2,322,516 |
public static void addHorizontalSmallSpring(Path2D.Float path,
int y0,
int x1,
int x2) {
int springHeight = scale(2);
int springWidth = scale(2);
int distance = Math.abs(x2 - x1);
int numSprings = (distance / (springHeight));
int leftOver = (distance - (numSprings * springHeight)) / 2;
path.lineTo(x1, y0);
path.lineTo(x1 - leftOver, y0 - leftOver);
int count = 0;
if (x1 > x2) {
for (int x = x1 - leftOver; x > x2 + leftOver; x -= springHeight) {
int y = (count % 2 == 0) ? y0 - springWidth : y0 + springWidth;
path.lineTo(x, y);
count++;
}
}
else {
for (int x = x1 + leftOver; x < x2 - leftOver; x += springHeight) {
int y = (count % 2 == 0) ? y0 - springWidth : y0 + springWidth;
path.lineTo(x, y);
count++;
}
}
path.lineTo(x2 + leftOver, y0);
path.lineTo(x2, y0);
} | static void function(Path2D.Float path, int y0, int x1, int x2) { int springHeight = scale(2); int springWidth = scale(2); int distance = Math.abs(x2 - x1); int numSprings = (distance / (springHeight)); int leftOver = (distance - (numSprings * springHeight)) / 2; path.lineTo(x1, y0); path.lineTo(x1 - leftOver, y0 - leftOver); int count = 0; if (x1 > x2) { for (int x = x1 - leftOver; x > x2 + leftOver; x -= springHeight) { int y = (count % 2 == 0) ? y0 - springWidth : y0 + springWidth; path.lineTo(x, y); count++; } } else { for (int x = x1 + leftOver; x < x2 - leftOver; x += springHeight) { int y = (count % 2 == 0) ? y0 - springWidth : y0 + springWidth; path.lineTo(x, y); count++; } } path.lineTo(x2 + leftOver, y0); path.lineTo(x2, y0); } | /**
* Add an horizontal spring between (x1, y0) and (x2, y0) to the given path object
*
* @param path the path object we'll add the spring to
* @param y0 the y coordinate of the spring
* @param x1 the x start coordinate
* @param x2 the x end coordiante
*/ | Add an horizontal spring between (x1, y0) and (x2, y0) to the given path object | addHorizontalSmallSpring | {
"repo_name": "AndroidX/constraintlayout",
"path": "desktop/ConstraintLayoutInspector/app/src/androidx/constraintLayout/desktop/constraintRendering/DrawConnectionUtils.java",
"license": "apache-2.0",
"size": 40239
} | [
"java.awt.geom.Path2D"
] | import java.awt.geom.Path2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 620,583 |
public List<WordResult> search(String term, String text)
{
List<WordResult> retval = null;
// search using a case sensitive regular expression
if (((flags & CASE_SENSITIVE) != 0) && ((flags & REGEX) != 0))
{
Pattern p = Pattern.compile(term, Pattern.MULTILINE);
retval = regexSearch(p, text);
}
// search using a case insensitive regular expression
else if ((flags & REGEX) != 0)
{
Pattern p = Pattern.compile(term, Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
retval = regexSearch(p, text);
}
// search by case sensitive text
else if ((flags & CASE_SENSITIVE) != 0)
{
retval = textSearch(term, text);
}
// search by case insensitive text
else if (flags == 0)
{
retval = textSearch(term.toLowerCase(), text.toLowerCase());
}
// fail due to unknown flags
else
{
throw new IllegalArgumentException("Unknown search strategy requested [flags=" + flags);
}
return retval;
} | List<WordResult> function(String term, String text) { List<WordResult> retval = null; if (((flags & CASE_SENSITIVE) != 0) && ((flags & REGEX) != 0)) { Pattern p = Pattern.compile(term, Pattern.MULTILINE); retval = regexSearch(p, text); } else if ((flags & REGEX) != 0) { Pattern p = Pattern.compile(term, Pattern.CASE_INSENSITIVE Pattern.MULTILINE); retval = regexSearch(p, text); } else if ((flags & CASE_SENSITIVE) != 0) { retval = textSearch(term, text); } else if (flags == 0) { retval = textSearch(term.toLowerCase(), text.toLowerCase()); } else { throw new IllegalArgumentException(STR + flags); } return retval; } | /**
* Search for <code>term</code>. Use the constants of this class for flags.
*
* @author Carl Hall ([email protected])
* @param term
* @return An array of found positions of term
*/ | Search for <code>term</code>. Use the constants of this class for flags | search | {
"repo_name": "bwollman/41_follow",
"path": "src/main/java/ghm/follow/search/SearchEngine.java",
"license": "gpl-2.0",
"size": 2979
} | [
"java.util.List",
"java.util.regex.Pattern"
] | import java.util.List; import java.util.regex.Pattern; | import java.util.*; import java.util.regex.*; | [
"java.util"
] | java.util; | 963,589 |
@Test
public void shouldGenerateIsFalsePredicate()
{
// given
String lhs = uniqueString();
// when
String actual = isFalse(lhs);
// then
String expected = lhs + " IS NOT TRUE";
assertEquals(expected, actual);
} | void function() { String lhs = uniqueString(); String actual = isFalse(lhs); String expected = lhs + STR; assertEquals(expected, actual); } | /**
* Test a column for false.
*/ | Test a column for false | shouldGenerateIsFalsePredicate | {
"repo_name": "zangsir/ANNIS",
"path": "annis-service/src/test/java/annis/sqlgen/TestSqlConstraints.java",
"license": "apache-2.0",
"size": 8569
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,512,741 |
void onError(T input, TextInputLayout inputParent, String validationMessage); | void onError(T input, TextInputLayout inputParent, String validationMessage); | /**
* This method will be called if there is a validation error
* @param input The input being validated
* @param inputParent A TextInputLayout parent, will be null if it doesn't exit
* @param validationMessage The error returned from the validate object
*/ | This method will be called if there is a validation error | onError | {
"repo_name": "jordanterry/InputValidator",
"path": "InputValidator/src/main/java/InputValidator/InputValidator.java",
"license": "mit",
"size": 1927
} | [
"android.support.design.widget.TextInputLayout"
] | import android.support.design.widget.TextInputLayout; | import android.support.design.widget.*; | [
"android.support"
] | android.support; | 2,833,612 |
public Long getCount(InstitutionalCollection collection) {
Query q = hbCrudDAO.getSessionFactory().getCurrentSession().getNamedQuery("getInstitutionalItemVersionBySetCount");
q.setParameter("leftValue", collection.getLeftValue());
q.setParameter("rightValue", collection.getRightValue());
q.setParameter("treeRootId", collection.getTreeRoot().getId());
return (Long) q.uniqueResult();
}
| Long function(InstitutionalCollection collection) { Query q = hbCrudDAO.getSessionFactory().getCurrentSession().getNamedQuery(STR); q.setParameter(STR, collection.getLeftValue()); q.setParameter(STR, collection.getRightValue()); q.setParameter(STR, collection.getTreeRoot().getId()); return (Long) q.uniqueResult(); } | /**
* Get all institutional item versions within the collection. This includes sub collections
*
* @see edu.ur.ir.institution.InstitutionalItemVersionDAO#getCount(edu.ur.ir.institution.InstitutionalCollection)
*/ | Get all institutional item versions within the collection. This includes sub collections | getCount | {
"repo_name": "nate-rcl/irplus",
"path": "ir_hibernate/src/edu/ur/hibernate/ir/institution/db/HbInstitutionalItemVersionDAO.java",
"license": "apache-2.0",
"size": 33635
} | [
"edu.ur.ir.institution.InstitutionalCollection",
"org.hibernate.Query"
] | import edu.ur.ir.institution.InstitutionalCollection; import org.hibernate.Query; | import edu.ur.ir.institution.*; import org.hibernate.*; | [
"edu.ur.ir",
"org.hibernate"
] | edu.ur.ir; org.hibernate; | 1,262,625 |
void setNewerGenerationStamp(long newGS) throws IOException {
long curGS = getGenerationStamp();
if (newGS <= curGS) {
throw new IOException("New generation stamp (" + newGS
+ ") must be greater than current one (" + curGS + ")");
}
setGenerationStamp(newGS);
} | void setNewerGenerationStamp(long newGS) throws IOException { long curGS = getGenerationStamp(); if (newGS <= curGS) { throw new IOException(STR + newGS + STR + curGS + ")"); } setGenerationStamp(newGS); } | /**
* Set this replica's generation stamp to be a newer one
* @param newGS new generation stamp
* @throws IOException is the new generation stamp is not greater than the current one
*/ | Set this replica's generation stamp to be a newer one | setNewerGenerationStamp | {
"repo_name": "steveloughran/hadoop-hdfs",
"path": "src/java/org/apache/hadoop/hdfs/server/datanode/ReplicaInfo.java",
"license": "apache-2.0",
"size": 7832
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,329,036 |
public void test0177() throws JavaScriptModelException {
IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0177", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
ASTNode result = runConversion(sourceUnit, true);
ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 1);
assertNotNull("Expression should not be null", node); //$NON-NLS-1$
assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
ExpressionStatement expressionStatement = (ExpressionStatement) node;
Expression ex = expressionStatement.getExpression();
assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$
PostfixExpression postfixExpression = (PostfixExpression) ex;
Expression expr = postfixExpression.getOperand();
assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$
SimpleName name = (SimpleName) expr;
IBinding binding = name.resolveBinding();
assertNotNull("No binding", binding); //$NON-NLS-1$
ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
List fragments = variableDeclarationStatement.fragments();
assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
IVariableBinding variableBinding = fragment.resolveBinding();
assertEquals("return type is not Number", "Number", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
assertTrue(variableBinding == binding);
}
//
//
// public void test0178() throws JavaScriptModelException {
// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0178", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
// ASTNode result = runConversion(sourceUnit, true);
// ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 0);
// assertTrue("Return statement", node2 instanceof ReturnStatement); //$NON-NLS-1$
// ReturnStatement returnStatement = (ReturnStatement) node2;
// Expression expr = returnStatement.getExpression();
// assertTrue("Not a field access", expr instanceof SuperFieldAccess); //$NON-NLS-1$
// SuperFieldAccess fieldAccess = (SuperFieldAccess) expr;
// ITypeBinding typeBinding = fieldAccess.resolveTypeBinding();
// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
// assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$
// assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
// }
| void function() throws JavaScriptModelException { IJavaScriptUnit sourceUnit = getCompilationUnit(STR , "src", STR, STR); ASTNode result = runConversion(sourceUnit, true); ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 1); assertNotNull(STR, node); assertTrue(STR, node instanceof ExpressionStatement); ExpressionStatement expressionStatement = (ExpressionStatement) node; Expression ex = expressionStatement.getExpression(); assertTrue(STR, ex instanceof PostfixExpression); PostfixExpression postfixExpression = (PostfixExpression) ex; Expression expr = postfixExpression.getOperand(); assertTrue(STR, expr instanceof SimpleName); SimpleName name = (SimpleName) expr; IBinding binding = name.resolveBinding(); assertNotNull(STR, binding); ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0); assertTrue(STR, node2 instanceof VariableDeclarationStatement); VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2; List fragments = variableDeclarationStatement.fragments(); assertTrue(STR, fragments.size() == 1); VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0); IVariableBinding variableBinding = fragment.resolveBinding(); assertEquals(STR, STR, variableBinding.getType().getName()); assertTrue(variableBinding == binding); } | /**
* i++; IVariableBinding
*/ | i++; IVariableBinding | test0177 | {
"repo_name": "echoes-tech/eclipse.jsdt.core",
"path": "org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest.java",
"license": "epl-1.0",
"size": 521652
} | [
"java.util.List",
"org.eclipse.wst.jsdt.core.IJavaScriptUnit",
"org.eclipse.wst.jsdt.core.JavaScriptModelException",
"org.eclipse.wst.jsdt.core.dom.ASTNode",
"org.eclipse.wst.jsdt.core.dom.Expression",
"org.eclipse.wst.jsdt.core.dom.ExpressionStatement",
"org.eclipse.wst.jsdt.core.dom.IBinding",
"org.eclipse.wst.jsdt.core.dom.IVariableBinding",
"org.eclipse.wst.jsdt.core.dom.JavaScriptUnit",
"org.eclipse.wst.jsdt.core.dom.PostfixExpression",
"org.eclipse.wst.jsdt.core.dom.SimpleName",
"org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment",
"org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement"
] | import java.util.List; import org.eclipse.wst.jsdt.core.IJavaScriptUnit; import org.eclipse.wst.jsdt.core.JavaScriptModelException; import org.eclipse.wst.jsdt.core.dom.ASTNode; import org.eclipse.wst.jsdt.core.dom.Expression; import org.eclipse.wst.jsdt.core.dom.ExpressionStatement; import org.eclipse.wst.jsdt.core.dom.IBinding; import org.eclipse.wst.jsdt.core.dom.IVariableBinding; import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit; import org.eclipse.wst.jsdt.core.dom.PostfixExpression; import org.eclipse.wst.jsdt.core.dom.SimpleName; import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment; import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement; | import java.util.*; import org.eclipse.wst.jsdt.core.*; import org.eclipse.wst.jsdt.core.dom.*; | [
"java.util",
"org.eclipse.wst"
] | java.util; org.eclipse.wst; | 2,129,365 |
public BooleanColumnBuilder setMinHeight(Integer height) {
getComponent().setHeight(height);
getComponent().setHeightType(ComponentDimensionType.EXPAND);
return this;
}
| BooleanColumnBuilder function(Integer height) { getComponent().setHeight(height); getComponent().setHeightType(ComponentDimensionType.EXPAND); return this; } | /**
* Sets the minimum height of a column.
* @see net.sf.dynamicreports.report.builder.Units
*
* @param height the column minimum height >= 0
* @exception IllegalArgumentException if <code>height</code> is < 0
* @return a column builder
*/ | Sets the minimum height of a column | setMinHeight | {
"repo_name": "svn2github/dynamicreports-jasper",
"path": "dynamicreports-core/src/main/java/net/sf/dynamicreports/report/builder/column/BooleanColumnBuilder.java",
"license": "lgpl-3.0",
"size": 6903
} | [
"net.sf.dynamicreports.report.constant.ComponentDimensionType"
] | import net.sf.dynamicreports.report.constant.ComponentDimensionType; | import net.sf.dynamicreports.report.constant.*; | [
"net.sf.dynamicreports"
] | net.sf.dynamicreports; | 57,756 |
public void fetchBuddies(String[] ids, final SlimCallback callback) {
RequestParams params = new RequestParams();
params.put("domain", domain);
params.put("ticket", ticket);
params.put("ids", stringJoin(ids, ","));
BuddiesResponseHandler handler = new BuddiesResponseHandler(this,
callback);
httpc.get(apiURL + "/buddies", params, handler);
} | void function(String[] ids, final SlimCallback callback) { RequestParams params = new RequestParams(); params.put(STR, domain); params.put(STR, ticket); params.put("ids", stringJoin(ids, ",")); BuddiesResponseHandler handler = new BuddiesResponseHandler(this, callback); httpc.get(apiURL + STR, params, handler); } | /**
* Fetch buddies
*
* @param ids
* @param callback
*/ | Fetch buddies | fetchBuddies | {
"repo_name": "slimpp/SlimChat.Android",
"path": "src/slimchat/android/client/SlimChatClient.java",
"license": "mit",
"size": 10491
} | [
"com.loopj.android.http.RequestParams"
] | import com.loopj.android.http.RequestParams; | import com.loopj.android.http.*; | [
"com.loopj.android"
] | com.loopj.android; | 227,387 |
public void stopRandomNonMasterNode() throws IOException {
NodeAndClient nodeAndClient = getRandomNodeAndClient(new MasterNodePredicate(getMasterName()).negate());
if (nodeAndClient != null) {
logger.info("Closing random non master node [{}] current master [{}] ", nodeAndClient.name, getMasterName());
removeDisruptionSchemeFromNode(nodeAndClient);
nodes.remove(nodeAndClient.name);
nodeAndClient.close();
}
} | void function() throws IOException { NodeAndClient nodeAndClient = getRandomNodeAndClient(new MasterNodePredicate(getMasterName()).negate()); if (nodeAndClient != null) { logger.info(STR, nodeAndClient.name, getMasterName()); removeDisruptionSchemeFromNode(nodeAndClient); nodes.remove(nodeAndClient.name); nodeAndClient.close(); } } | /**
* Stops the any of the current nodes but not the master node.
*/ | Stops the any of the current nodes but not the master node | stopRandomNonMasterNode | {
"repo_name": "jchampion/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java",
"license": "apache-2.0",
"size": 81674
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 399,771 |
protected void calcModulus() {
if (mXAxis == null || !mXAxis.isEnabled())
return;
if (!mXAxis.isAxisModulusCustom()) {
float[] values = new float[9];
mViewPortHandler.getMatrixTouch().getValues(values);
mXAxis.mAxisLabelModulus = (int) Math
.ceil((mData.getXValCount() * mXAxis.mLabelWidth)
/ (mViewPortHandler.contentWidth() * values[Matrix.MSCALE_X]));
}
if (mLogEnabled)
Log.i(LOG_TAG, "X-Axis modulus: " + mXAxis.mAxisLabelModulus + ", x-axis label width: "
+ mXAxis.mLabelWidth + ", content width: " + mViewPortHandler.contentWidth());
if (mXAxis.mAxisLabelModulus < 1)
mXAxis.mAxisLabelModulus = 1;
} | void function() { if (mXAxis == null !mXAxis.isEnabled()) return; if (!mXAxis.isAxisModulusCustom()) { float[] values = new float[9]; mViewPortHandler.getMatrixTouch().getValues(values); mXAxis.mAxisLabelModulus = (int) Math .ceil((mData.getXValCount() * mXAxis.mLabelWidth) / (mViewPortHandler.contentWidth() * values[Matrix.MSCALE_X])); } if (mLogEnabled) Log.i(LOG_TAG, STR + mXAxis.mAxisLabelModulus + STR + mXAxis.mLabelWidth + STR + mViewPortHandler.contentWidth()); if (mXAxis.mAxisLabelModulus < 1) mXAxis.mAxisLabelModulus = 1; } | /**
* calculates the modulus for x-labels and grid
*/ | calculates the modulus for x-labels and grid | calcModulus | {
"repo_name": "CarpOrange/CarpDoctor",
"path": "MPChartLib/src/com/github/mikephil/charting/charts/BarLineChartBase.java",
"license": "apache-2.0",
"size": 46598
} | [
"android.graphics.Matrix",
"android.util.Log"
] | import android.graphics.Matrix; import android.util.Log; | import android.graphics.*; import android.util.*; | [
"android.graphics",
"android.util"
] | android.graphics; android.util; | 1,880,743 |
public DateTime getDeliveryTime() {
return deliveryTime;
} | DateTime function() { return deliveryTime; } | /**
* Gets the delivery time for this SMS. If specified, will schedule
* the message for future delivery using the MOTECH scheduler.
* @return the delivery time for this SMS
*/ | Gets the delivery time for this SMS. If specified, will schedule the message for future delivery using the MOTECH scheduler | getDeliveryTime | {
"repo_name": "pgesek/modules",
"path": "sms/src/main/java/org/motechproject/sms/service/OutgoingSms.java",
"license": "bsd-3-clause",
"size": 11091
} | [
"org.joda.time.DateTime"
] | import org.joda.time.DateTime; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 342,456 |
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
} | void function(ApplicationContext applicationContext) throws BeansException { this.applicationContext = applicationContext; } | /**
* The Spring ApplicationContext
*/ | The Spring ApplicationContext | setApplicationContext | {
"repo_name": "DariusX/camel",
"path": "components/camel-spring/src/main/java/org/apache/camel/component/event/EventComponent.java",
"license": "apache-2.0",
"size": 3808
} | [
"org.springframework.beans.BeansException",
"org.springframework.context.ApplicationContext"
] | import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; | import org.springframework.beans.*; import org.springframework.context.*; | [
"org.springframework.beans",
"org.springframework.context"
] | org.springframework.beans; org.springframework.context; | 2,515,511 |
public SVGAnimatedLength getWidth() {
return width;
} | SVGAnimatedLength function() { return width; } | /**
* <b>DOM</b>: Implements {@link SVGForeignObjectElement#getWidth()}.
*/ | DOM: Implements <code>SVGForeignObjectElement#getWidth()</code> | getWidth | {
"repo_name": "Squeegee/batik",
"path": "sources/org/apache/batik/dom/svg/SVGOMForeignObjectElement.java",
"license": "apache-2.0",
"size": 5347
} | [
"org.w3c.dom.svg.SVGAnimatedLength"
] | import org.w3c.dom.svg.SVGAnimatedLength; | import org.w3c.dom.svg.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,464,063 |
public void zoom(Rectangle2D selection) {
// get the origin of the zoom selection in the Java2D space used for
// drawing the chart (that is, before any scaling to fit the panel)
Point2D selectOrigin = translateScreenToJava2D(new Point(
(int) Math.ceil(selection.getX()),
(int) Math.ceil(selection.getY())));
PlotRenderingInfo plotInfo = this.info.getPlotInfo();
Rectangle2D scaledDataArea = getScreenDataArea(
(int) selection.getCenterX(), (int) selection.getCenterY());
if ((selection.getHeight() > 0) && (selection.getWidth() > 0)) {
double hLower = (selection.getMinX() - scaledDataArea.getMinX())
/ scaledDataArea.getWidth();
double hUpper = (selection.getMaxX() - scaledDataArea.getMinX())
/ scaledDataArea.getWidth();
double vLower = (scaledDataArea.getMaxY() - selection.getMaxY())
/ scaledDataArea.getHeight();
double vUpper = (scaledDataArea.getMaxY() - selection.getMinY())
/ scaledDataArea.getHeight();
Plot p = this.chart.getPlot();
if (p instanceof Zoomable) {
Zoomable z = (Zoomable) p;
if (z.getOrientation() == PlotOrientation.HORIZONTAL) {
z.zoomDomainAxes(vLower, vUpper, plotInfo, selectOrigin);
z.zoomRangeAxes(hLower, hUpper, plotInfo, selectOrigin);
}
else {
z.zoomDomainAxes(hLower, hUpper, plotInfo, selectOrigin);
z.zoomRangeAxes(vLower, vUpper, plotInfo, selectOrigin);
}
}
}
} | void function(Rectangle2D selection) { Point2D selectOrigin = translateScreenToJava2D(new Point( (int) Math.ceil(selection.getX()), (int) Math.ceil(selection.getY()))); PlotRenderingInfo plotInfo = this.info.getPlotInfo(); Rectangle2D scaledDataArea = getScreenDataArea( (int) selection.getCenterX(), (int) selection.getCenterY()); if ((selection.getHeight() > 0) && (selection.getWidth() > 0)) { double hLower = (selection.getMinX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth(); double hUpper = (selection.getMaxX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth(); double vLower = (scaledDataArea.getMaxY() - selection.getMaxY()) / scaledDataArea.getHeight(); double vUpper = (scaledDataArea.getMaxY() - selection.getMinY()) / scaledDataArea.getHeight(); Plot p = this.chart.getPlot(); if (p instanceof Zoomable) { Zoomable z = (Zoomable) p; if (z.getOrientation() == PlotOrientation.HORIZONTAL) { z.zoomDomainAxes(vLower, vUpper, plotInfo, selectOrigin); z.zoomRangeAxes(hLower, hUpper, plotInfo, selectOrigin); } else { z.zoomDomainAxes(hLower, hUpper, plotInfo, selectOrigin); z.zoomRangeAxes(vLower, vUpper, plotInfo, selectOrigin); } } } } | /**
* Zooms in on a selected region.
*
* @param selection the selected region.
*/ | Zooms in on a selected region | zoom | {
"repo_name": "ibestvina/multithread-centiscape",
"path": "CentiScaPe2.1/src/main/java/org/jfree/chart/ChartPanel.java",
"license": "mit",
"size": 88952
} | [
"java.awt.Point",
"java.awt.geom.Point2D",
"java.awt.geom.Rectangle2D",
"org.jfree.chart.plot.Plot",
"org.jfree.chart.plot.PlotOrientation",
"org.jfree.chart.plot.PlotRenderingInfo",
"org.jfree.chart.plot.Zoomable"
] | import java.awt.Point; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.PlotRenderingInfo; import org.jfree.chart.plot.Zoomable; | import java.awt.*; import java.awt.geom.*; import org.jfree.chart.plot.*; | [
"java.awt",
"org.jfree.chart"
] | java.awt; org.jfree.chart; | 485,946 |
public void setCurrentFrameIndex(int nFrame) throws IncompatibleThreadStateException {
assureSuspended();
if ((nFrame < 0) || (nFrame >= thread.frameCount())) {
throw new ArrayIndexOutOfBoundsException();
}
currentFrameIndex = nFrame;
}
| void function(int nFrame) throws IncompatibleThreadStateException { assureSuspended(); if ((nFrame < 0) (nFrame >= thread.frameCount())) { throw new ArrayIndexOutOfBoundsException(); } currentFrameIndex = nFrame; } | /**
* Set the current stackframe to a specific frame.
*
* @param nFrame the number of the desired stackframe. Frame zero is the
* closest to the current program counter
* @throws IllegalAccessError when the thread isn't
* suspended or waiting at a breakpoint
* @throws ArrayIndexOutOfBoundsException when the
* requested frame is beyond the stack boundary
*/ | Set the current stackframe to a specific frame | setCurrentFrameIndex | {
"repo_name": "jdrider/rhodes",
"path": "platform/shared/xruby/src/com/xruby/debug/ThreadInfo.java",
"license": "mit",
"size": 11071
} | [
"com.sun.jdi.IncompatibleThreadStateException"
] | import com.sun.jdi.IncompatibleThreadStateException; | import com.sun.jdi.*; | [
"com.sun.jdi"
] | com.sun.jdi; | 1,612,983 |
protected void updateTransformationPage(AbstractAlphabet abstractAlphabet) {
TransformData myTransformation;
if (abstractAlphabet == null) {
myTransformation = new TransformData();
} else {
myTransformation = AbstractClassicTransformationPage.getTransformFromName(abstractAlphabet);
}
((AbstractClassicTransformationPage) super.getNextPage()).setTransformData(myTransformation);
}
| void function(AbstractAlphabet abstractAlphabet) { TransformData myTransformation; if (abstractAlphabet == null) { myTransformation = new TransformData(); } else { myTransformation = AbstractClassicTransformationPage.getTransformFromName(abstractAlphabet); } ((AbstractClassicTransformationPage) super.getNextPage()).setTransformData(myTransformation); } | /**
* Updates the Transformation Wizard Page to load the Transformation setting for a specified currentAlphabet
*
* @param abstractAlphabet the name of the currentAlphabet
*/ | Updates the Transformation Wizard Page to load the Transformation setting for a specified currentAlphabet | updateTransformationPage | {
"repo_name": "ChristophSonnberger/crypto",
"path": "org.jcryptool.crypto.classic.model/src/org/jcryptool/crypto/classic/model/ui/wizard/AbstractClassicCryptoPage.java",
"license": "epl-1.0",
"size": 40823
} | [
"org.jcryptool.core.operations.algorithm.classic.textmodify.TransformData",
"org.jcryptool.core.operations.alphabets.AbstractAlphabet"
] | import org.jcryptool.core.operations.algorithm.classic.textmodify.TransformData; import org.jcryptool.core.operations.alphabets.AbstractAlphabet; | import org.jcryptool.core.operations.algorithm.classic.textmodify.*; import org.jcryptool.core.operations.alphabets.*; | [
"org.jcryptool.core"
] | org.jcryptool.core; | 1,796,259 |
public void setTPrivateReportRepositoryKey(ObjectKey key) throws TorqueException
{
setMyDefaultReport(new Integer(((NumberKey) key).intValue()));
}
private TBLOB aTBLOB; | void function(ObjectKey key) throws TorqueException { setMyDefaultReport(new Integer(((NumberKey) key).intValue())); } private TBLOB aTBLOB; | /**
* Provides convenient way to set a relationship based on a
* ObjectKey, for example
* <code>bar.setFooKey(foo.getPrimaryKey())</code>
*
*/ | Provides convenient way to set a relationship based on a ObjectKey, for example <code>bar.setFooKey(foo.getPrimaryKey())</code> | setTPrivateReportRepositoryKey | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/persist/BaseTPerson.java",
"license": "gpl-3.0",
"size": 1013508
} | [
"org.apache.torque.TorqueException",
"org.apache.torque.om.NumberKey",
"org.apache.torque.om.ObjectKey"
] | import org.apache.torque.TorqueException; import org.apache.torque.om.NumberKey; import org.apache.torque.om.ObjectKey; | import org.apache.torque.*; import org.apache.torque.om.*; | [
"org.apache.torque"
] | org.apache.torque; | 1,206,767 |
public void testHandshakeStatus01() {
SSLEngineResult.HandshakeStatus[] enHS = SSLEngineResult.HandshakeStatus
.values();
assertTrue("Incorrect array of HandshakeStatus objects",
enHS.length > 0);
assertTrue("FINISHED object does not define", findEl(enHS,
SSLEngineResult.HandshakeStatus.FINISHED));
assertTrue("NEED_UNWRAP object does not define", findEl(enHS,
SSLEngineResult.HandshakeStatus.NEED_UNWRAP));
assertTrue("NEED_WRAP object does not define", findEl(enHS,
SSLEngineResult.HandshakeStatus.NEED_WRAP));
assertTrue("NEED_TASK object does not define", findEl(enHS,
SSLEngineResult.HandshakeStatus.NEED_TASK));
assertTrue("NOT_HANDSHAKING object does not define", findEl(enHS,
SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING));
} | void function() { SSLEngineResult.HandshakeStatus[] enHS = SSLEngineResult.HandshakeStatus .values(); assertTrue(STR, enHS.length > 0); assertTrue(STR, findEl(enHS, SSLEngineResult.HandshakeStatus.FINISHED)); assertTrue(STR, findEl(enHS, SSLEngineResult.HandshakeStatus.NEED_UNWRAP)); assertTrue(STR, findEl(enHS, SSLEngineResult.HandshakeStatus.NEED_WRAP)); assertTrue(STR, findEl(enHS, SSLEngineResult.HandshakeStatus.NEED_TASK)); assertTrue(STR, findEl(enHS, SSLEngineResult.HandshakeStatus.NOT_HANDSHAKING)); } | /**
* Test for <code>SSLEngineResult.HandshakeStatus.values()</code> method
*/ | Test for <code>SSLEngineResult.HandshakeStatus.values()</code> method | testHandshakeStatus01 | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "external/apache-harmony/x-net/src/test/api/java/org/apache/harmony/xnet/tests/javax/net/ssl/SSLEngineResultTest.java",
"license": "gpl-3.0",
"size": 8946
} | [
"javax.net.ssl.SSLEngineResult"
] | import javax.net.ssl.SSLEngineResult; | import javax.net.ssl.*; | [
"javax.net"
] | javax.net; | 2,189,709 |
public static int[] getSchema(CacheObjectBinaryProcessorImpl cacheObjProc, int typeId, int schemaId) {
assert cacheObjProc != null;
BinarySchemaRegistry schemaReg = cacheObjProc.binaryContext().schemaRegistry(typeId);
BinarySchema schema = schemaReg.schema(schemaId);
if (schema == null) {
BinaryTypeImpl meta = (BinaryTypeImpl)cacheObjProc.metadata(typeId);
if (meta != null) {
for (BinarySchema typeSchema : meta.metadata().schemas()) {
if (schemaId == typeSchema.schemaId()) {
schema = typeSchema;
break;
}
}
}
if (schema != null) {
schemaReg.addSchema(schemaId, schema);
}
}
return schema == null ? null : schema.fieldIds();
} | static int[] function(CacheObjectBinaryProcessorImpl cacheObjProc, int typeId, int schemaId) { assert cacheObjProc != null; BinarySchemaRegistry schemaReg = cacheObjProc.binaryContext().schemaRegistry(typeId); BinarySchema schema = schemaReg.schema(schemaId); if (schema == null) { BinaryTypeImpl meta = (BinaryTypeImpl)cacheObjProc.metadata(typeId); if (meta != null) { for (BinarySchema typeSchema : meta.metadata().schemas()) { if (schemaId == typeSchema.schemaId()) { schema = typeSchema; break; } } } if (schema != null) { schemaReg.addSchema(schemaId, schema); } } return schema == null ? null : schema.fieldIds(); } | /**
* Gets the schema.
*
* @param cacheObjProc Cache object processor.
* @param typeId Type id.
* @param schemaId Schema id.
*/ | Gets the schema | getSchema | {
"repo_name": "irudyak/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformUtils.java",
"license": "apache-2.0",
"size": 38830
} | [
"org.apache.ignite.internal.binary.BinarySchema",
"org.apache.ignite.internal.binary.BinarySchemaRegistry",
"org.apache.ignite.internal.binary.BinaryTypeImpl",
"org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl"
] | import org.apache.ignite.internal.binary.BinarySchema; import org.apache.ignite.internal.binary.BinarySchemaRegistry; import org.apache.ignite.internal.binary.BinaryTypeImpl; import org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl; | import org.apache.ignite.internal.binary.*; import org.apache.ignite.internal.processors.cache.binary.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,408,597 |
public static TLLongVector readTLLongVector(InputStream stream, TLContext context) throws IOException {
return context.deserializeLongVector(stream);
} | static TLLongVector function(InputStream stream, TLContext context) throws IOException { return context.deserializeLongVector(stream); } | /**
* Reading tl-vector of longs from stream
*
* @param stream source stream
* @param context tl-context
* @return tl-vector of longs
* @throws IOException reading exception
*/ | Reading tl-vector of longs from stream | readTLLongVector | {
"repo_name": "rubenlagus/TelegramApi",
"path": "src/main/java/org/telegram/tl/StreamingUtils.java",
"license": "mit",
"size": 18152
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 465,542 |
void enterReadInt(@NotNull jazzikParser.ReadIntContext ctx);
void exitReadInt(@NotNull jazzikParser.ReadIntContext ctx); | void enterReadInt(@NotNull jazzikParser.ReadIntContext ctx); void exitReadInt(@NotNull jazzikParser.ReadIntContext ctx); | /**
* Exit a parse tree produced by {@link jazzikParser#ReadInt}.
* @param ctx the parse tree
*/ | Exit a parse tree produced by <code>jazzikParser#ReadInt</code> | exitReadInt | {
"repo_name": "petersch/jazzik",
"path": "src/parser/jazzikListener.java",
"license": "gpl-3.0",
"size": 16952
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 872,376 |
private Object createAuditEntry( PostUpdateEvent postUpdateEvent )
{
return super.createAuditEntry( postUpdateEvent.getEntity(), postUpdateEvent.getState(),
postUpdateEvent.getSession(), postUpdateEvent.getId(), postUpdateEvent.getPersister() );
} | Object function( PostUpdateEvent postUpdateEvent ) { return super.createAuditEntry( postUpdateEvent.getEntity(), postUpdateEvent.getState(), postUpdateEvent.getSession(), postUpdateEvent.getId(), postUpdateEvent.getPersister() ); } | /**
* Create Audit entry for update event
*/ | Create Audit entry for update event | createAuditEntry | {
"repo_name": "dhis2/dhis2-core",
"path": "dhis-2/dhis-support/dhis-support-artemis/src/main/java/org/hisp/dhis/artemis/audit/listener/PostUpdateAuditListener.java",
"license": "bsd-3-clause",
"size": 4164
} | [
"org.hibernate.event.spi.PostUpdateEvent"
] | import org.hibernate.event.spi.PostUpdateEvent; | import org.hibernate.event.spi.*; | [
"org.hibernate.event"
] | org.hibernate.event; | 1,819,247 |
public static ResponseResult handleShardingSphereUIException(final ShardingSphereUIException exception) {
ResponseResult result = new ResponseResult<>();
result.setSuccess(false);
result.setErrorCode(exception.getErrorCode());
result.setErrorMsg(exception.getMessage());
return result;
} | static ResponseResult function(final ShardingSphereUIException exception) { ResponseResult result = new ResponseResult<>(); result.setSuccess(false); result.setErrorCode(exception.getErrorCode()); result.setErrorMsg(exception.getMessage()); return result; } | /**
* Build the error response of ShardingSphere UI exception.
*
* @param exception ShardingSphere UI exception
* @return response result
*/ | Build the error response of ShardingSphere UI exception | handleShardingSphereUIException | {
"repo_name": "shardingjdbc/sharding-jdbc",
"path": "shardingsphere-ui/shardingsphere-ui-backend/src/main/java/org/apache/shardingsphere/ui/web/response/ResponseResultUtil.java",
"license": "apache-2.0",
"size": 3977
} | [
"org.apache.shardingsphere.ui.common.exception.ShardingSphereUIException"
] | import org.apache.shardingsphere.ui.common.exception.ShardingSphereUIException; | import org.apache.shardingsphere.ui.common.exception.*; | [
"org.apache.shardingsphere"
] | org.apache.shardingsphere; | 2,047,037 |
// Setup logback logging engine.
LogbackUtils.install(getResourcePath("/WEB-INF/logback.xml"));
// Setup embedded web server.
ServiceLocatorUtilities.bind(serviceLocator, new EmbeddedJettyBinder(
getResourcePath("."),
getResourcePath("/WEB-INF/webserver.xml"),
AppConfig.class,
false));
} | LogbackUtils.install(getResourcePath(STR)); ServiceLocatorUtilities.bind(serviceLocator, new EmbeddedJettyBinder( getResourcePath("."), getResourcePath(STR), AppConfig.class, false)); } | /**
* Initializes services.
* @param args Program arguments.
* @throws Exception Start error.
*/ | Initializes services | init | {
"repo_name": "expanset/expanset",
"path": "samples/samples-mvc-mustache/src/main/java/com/expanset/samples/mustache/App.java",
"license": "apache-2.0",
"size": 3413
} | [
"com.expanset.jersey.jetty.EmbeddedJettyBinder",
"com.expanset.logback.LogbackUtils",
"org.glassfish.hk2.utilities.ServiceLocatorUtilities"
] | import com.expanset.jersey.jetty.EmbeddedJettyBinder; import com.expanset.logback.LogbackUtils; import org.glassfish.hk2.utilities.ServiceLocatorUtilities; | import com.expanset.jersey.jetty.*; import com.expanset.logback.*; import org.glassfish.hk2.utilities.*; | [
"com.expanset.jersey",
"com.expanset.logback",
"org.glassfish.hk2"
] | com.expanset.jersey; com.expanset.logback; org.glassfish.hk2; | 1,600,668 |
private void processOverReplicatedBlock(Block block, short replication,
DatanodeDescriptor addedNode, DatanodeDescriptor delNodeHint) {
if(addedNode == delNodeHint) {
delNodeHint = null;
}
Collection<DatanodeDescriptor> nonExcess = new ArrayList<DatanodeDescriptor>();
Collection<DatanodeDescriptor> corruptNodes = corruptReplicas.getNodes(block);
for (Iterator<DatanodeDescriptor> it = blocksMap.nodeIterator(block);
it.hasNext();) {
DatanodeDescriptor cur = it.next();
Collection<Block> excessBlocks = excessReplicateMap.get(cur.getStorageID());
if (excessBlocks == null || !excessBlocks.contains(block)) {
if (!cur.isDecommissionInProgress() && !cur.isDecommissioned()) {
// exclude corrupt replicas
if (corruptNodes == null || !corruptNodes.contains(cur)) {
nonExcess.add(cur);
}
}
}
}
chooseExcessReplicates(nonExcess, block, replication,
addedNode, delNodeHint);
} | void function(Block block, short replication, DatanodeDescriptor addedNode, DatanodeDescriptor delNodeHint) { if(addedNode == delNodeHint) { delNodeHint = null; } Collection<DatanodeDescriptor> nonExcess = new ArrayList<DatanodeDescriptor>(); Collection<DatanodeDescriptor> corruptNodes = corruptReplicas.getNodes(block); for (Iterator<DatanodeDescriptor> it = blocksMap.nodeIterator(block); it.hasNext();) { DatanodeDescriptor cur = it.next(); Collection<Block> excessBlocks = excessReplicateMap.get(cur.getStorageID()); if (excessBlocks == null !excessBlocks.contains(block)) { if (!cur.isDecommissionInProgress() && !cur.isDecommissioned()) { if (corruptNodes == null !corruptNodes.contains(cur)) { nonExcess.add(cur); } } } } chooseExcessReplicates(nonExcess, block, replication, addedNode, delNodeHint); } | /**
* Find how many of the containing nodes are "extra", if any.
* If there are any extras, call chooseExcessReplicates() to
* mark them in the excessReplicateMap.
*/ | Find how many of the containing nodes are "extra", if any. If there are any extras, call chooseExcessReplicates() to mark them in the excessReplicateMap | processOverReplicatedBlock | {
"repo_name": "zhaobj/MyHadoop",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java",
"license": "apache-2.0",
"size": 214078
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.Iterator",
"org.apache.hadoop.hdfs.protocol.Block"
] | import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import org.apache.hadoop.hdfs.protocol.Block; | import java.util.*; import org.apache.hadoop.hdfs.protocol.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 1,347,998 |
public TableModel getData() {
return dataRow.getData();
} | TableModel function() { return dataRow.getData(); } | /**
* Grants access to the tablemodel was granted using report properties, now direct.
*
* @return the current tablemodel used in the report.
*/ | Grants access to the tablemodel was granted using report properties, now direct | getData | {
"repo_name": "EgorZhuk/pentaho-reporting",
"path": "engine/core/src/main/java/org/pentaho/reporting/engine/classic/core/parameters/ComputedParameterValues.java",
"license": "lgpl-2.1",
"size": 7357
} | [
"javax.swing.table.TableModel"
] | import javax.swing.table.TableModel; | import javax.swing.table.*; | [
"javax.swing"
] | javax.swing; | 1,774,190 |
public String getAsText(ReadablePartial partial, int fieldValue, Locale locale) {
throw unsupported();
} | String function(ReadablePartial partial, int fieldValue, Locale locale) { throw unsupported(); } | /**
* Always throws UnsupportedOperationException
*
* @throws UnsupportedOperationException
*/ | Always throws UnsupportedOperationException | getAsText | {
"repo_name": "aparo/scalajs-joda",
"path": "src/main/scala/org/joda/time/field/UnsupportedDateTimeField.java",
"license": "apache-2.0",
"size": 14131
} | [
"java.util.Locale",
"org.joda.time.ReadablePartial"
] | import java.util.Locale; import org.joda.time.ReadablePartial; | import java.util.*; import org.joda.time.*; | [
"java.util",
"org.joda.time"
] | java.util; org.joda.time; | 1,405,984 |
public SourceColumn[] guessCsvSchema(InputStream is, char separator) throws IOException {
CSVReader cr = FileUtil.createUtf8CsvReader(is, separator);
return guessCsvSchema(cr);
} | SourceColumn[] function(InputStream is, char separator) throws IOException { CSVReader cr = FileUtil.createUtf8CsvReader(is, separator); return guessCsvSchema(cr); } | /**
* Guesses the CSV schema
*
* @param is CSV stream
* @param separator field separator
* @return the String[] with the CSV column types
* @throws IOException in case of IO issue
*/ | Guesses the CSV schema | guessCsvSchema | {
"repo_name": "dagi/GoodData-CL",
"path": "connector/src/main/java/com/gooddata/csv/DataTypeGuess.java",
"license": "bsd-3-clause",
"size": 9004
} | [
"com.gooddata.modeling.model.SourceColumn",
"com.gooddata.util.CSVReader",
"com.gooddata.util.FileUtil",
"java.io.IOException",
"java.io.InputStream"
] | import com.gooddata.modeling.model.SourceColumn; import com.gooddata.util.CSVReader; import com.gooddata.util.FileUtil; import java.io.IOException; import java.io.InputStream; | import com.gooddata.modeling.model.*; import com.gooddata.util.*; import java.io.*; | [
"com.gooddata.modeling",
"com.gooddata.util",
"java.io"
] | com.gooddata.modeling; com.gooddata.util; java.io; | 604,791 |
EOperation getStoryboardDiagram__Validate__DiagnosticChain_Map();
| EOperation getStoryboardDiagram__Validate__DiagnosticChain_Map(); | /**
* Returns the meta object for the '{@link eu.scasefp7.eclipse.storyboards.StoryboardDiagram#validate(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Validate</em>}' operation.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the '<em>Validate</em>' operation.
* @see eu.scasefp7.eclipse.storyboards.StoryboardDiagram#validate(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map)
* @generated
*/ | Returns the meta object for the '<code>eu.scasefp7.eclipse.storyboards.StoryboardDiagram#validate(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) Validate</code>' operation. | getStoryboardDiagram__Validate__DiagnosticChain_Map | {
"repo_name": "LeonoraG/storyboard-creator",
"path": "eu.scasefp7.eclipse.storyboards/src/eu/scasefp7/eclipse/storyboards/StoryboardsPackage.java",
"license": "apache-2.0",
"size": 45560
} | [
"org.eclipse.emf.ecore.EOperation"
] | import org.eclipse.emf.ecore.EOperation; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 248,992 |
public CcLibraryHelper addIncludeDirs(Iterable<PathFragment> includeDirs) {
Iterables.addAll(this.includeDirs, includeDirs);
return this;
} | CcLibraryHelper function(Iterable<PathFragment> includeDirs) { Iterables.addAll(this.includeDirs, includeDirs); return this; } | /**
* Adds the given directories to the include directories (they are passed with {@code "-I"} to
* the compiler); these are also passed to dependent rules.
*/ | Adds the given directories to the include directories (they are passed with "-I" to the compiler); these are also passed to dependent rules | addIncludeDirs | {
"repo_name": "hermione521/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java",
"license": "apache-2.0",
"size": 61939
} | [
"com.google.common.collect.Iterables",
"com.google.devtools.build.lib.vfs.PathFragment"
] | import com.google.common.collect.Iterables; import com.google.devtools.build.lib.vfs.PathFragment; | import com.google.common.collect.*; import com.google.devtools.build.lib.vfs.*; | [
"com.google.common",
"com.google.devtools"
] | com.google.common; com.google.devtools; | 2,686,168 |
private static synchronized String initMiniCluster(Configuration conf, ReadOnlyProps overrideProps) throws Exception {
setUpConfigForMiniCluster(conf, overrideProps);
utility = new HBaseTestingUtility(conf);
try {
long startTime = System.currentTimeMillis();
utility.startMiniCluster(NUM_SLAVES_BASE);
long startupTime = System.currentTimeMillis()-startTime;
LOGGER.info("HBase minicluster startup complete in {} ms", startupTime);
return getLocalClusterUrl(utility);
} catch (Throwable t) {
throw new RuntimeException(t);
}
} | static synchronized String function(Configuration conf, ReadOnlyProps overrideProps) throws Exception { setUpConfigForMiniCluster(conf, overrideProps); utility = new HBaseTestingUtility(conf); try { long startTime = System.currentTimeMillis(); utility.startMiniCluster(NUM_SLAVES_BASE); long startupTime = System.currentTimeMillis()-startTime; LOGGER.info(STR, startupTime); return getLocalClusterUrl(utility); } catch (Throwable t) { throw new RuntimeException(t); } } | /**
* Initialize the mini cluster using phoenix-test specific configuration.
* @param overrideProps TODO
* @return url to be used by clients to connect to the mini cluster.
* @throws Exception
*/ | Initialize the mini cluster using phoenix-test specific configuration | initMiniCluster | {
"repo_name": "apache/phoenix",
"path": "phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java",
"license": "apache-2.0",
"size": 94542
} | [
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.HBaseTestingUtility",
"org.apache.phoenix.util.ReadOnlyProps"
] | import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.phoenix.util.ReadOnlyProps; | import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*; import org.apache.phoenix.util.*; | [
"org.apache.hadoop",
"org.apache.phoenix"
] | org.apache.hadoop; org.apache.phoenix; | 2,739,384 |
public void visit(final String s, final Field field) throws IOException; | void function(final String s, final Field field) throws IOException; | /**
* Called to visit a string field
*
* @param s
* The field value
*
* @param field
* The field type metadata
*
* @throws IOException
* FieldVisitor instances are usually serializers (writers), and
* thus write to an underlying data output stream. This
* exception declaration is to pass on any IOExceptions thrown
* when writing to that underlying data output stream.
*/ | Called to visit a string field | visit | {
"repo_name": "culvertsoft/mgen",
"path": "mgen-javalib/src/main/java/se/culvertsoft/mgen/javapack/serialization/FieldVisitor.java",
"license": "mit",
"size": 6784
} | [
"java.io.IOException",
"se.culvertsoft.mgen.api.model.Field"
] | import java.io.IOException; import se.culvertsoft.mgen.api.model.Field; | import java.io.*; import se.culvertsoft.mgen.api.model.*; | [
"java.io",
"se.culvertsoft.mgen"
] | java.io; se.culvertsoft.mgen; | 1,046,533 |
public static String nullSafeNameAndSymName(Bundle bundle) {
if (bundle == null)
return NULL_STRING;
Dictionary dict = bundle.getHeaders();
if (dict == null)
return NULL_STRING;
StringBuilder buf = new StringBuilder();
String name = (String) dict.get(org.osgi.framework.Constants.BUNDLE_NAME);
if (name == null)
buf.append(NULL_STRING);
else
buf.append(name);
buf.append(" (");
String sname = (String) dict.get(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME);
if (sname == null)
buf.append(NULL_STRING);
else
buf.append(sname);
buf.append(")");
return buf.toString();
}
| static String function(Bundle bundle) { if (bundle == null) return NULL_STRING; Dictionary dict = bundle.getHeaders(); if (dict == null) return NULL_STRING; StringBuilder buf = new StringBuilder(); String name = (String) dict.get(org.osgi.framework.Constants.BUNDLE_NAME); if (name == null) buf.append(NULL_STRING); else buf.append(name); buf.append(STR); String sname = (String) dict.get(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME); if (sname == null) buf.append(NULL_STRING); else buf.append(sname); buf.append(")"); return buf.toString(); } | /**
* Returns the bundle name and symbolic name - useful when logging bundle info.
*
* @param bundle OSGi bundle (can be null)
* @return the bundle name and symbolic name
*/ | Returns the bundle name and symbolic name - useful when logging bundle info | nullSafeNameAndSymName | {
"repo_name": "glyn/Gemini-Blueprint",
"path": "core/src/main/java/org/eclipse/gemini/blueprint/util/OsgiStringUtils.java",
"license": "apache-2.0",
"size": 7442
} | [
"java.util.Dictionary",
"org.osgi.framework.Bundle",
"org.springframework.core.Constants"
] | import java.util.Dictionary; import org.osgi.framework.Bundle; import org.springframework.core.Constants; | import java.util.*; import org.osgi.framework.*; import org.springframework.core.*; | [
"java.util",
"org.osgi.framework",
"org.springframework.core"
] | java.util; org.osgi.framework; org.springframework.core; | 1,102,238 |
int getDaysBetween(@NonNull DateTime start, @NonNull DateTime end); | int getDaysBetween(@NonNull DateTime start, @NonNull DateTime end); | /**
* Get the number of days between the two given
* date time objects.
* @param start date to compare.
* @param end date to compare.
* @return number of days between the two.
*/ | Get the number of days between the two given date time objects | getDaysBetween | {
"repo_name": "MarcelBraghetto/AndroidNanoDegreeProjectCapstone",
"path": "Phase2/app/src/main/java/io/github/marcelbraghetto/dailydeviations/framework/foundation/dates/contracts/DateProvider.java",
"license": "apache-2.0",
"size": 1858
} | [
"android.support.annotation.NonNull",
"org.joda.time.DateTime"
] | import android.support.annotation.NonNull; import org.joda.time.DateTime; | import android.support.annotation.*; import org.joda.time.*; | [
"android.support",
"org.joda.time"
] | android.support; org.joda.time; | 262,150 |
public void setNick(String nick) {
this.nick.setValue(nick);
}
/**
* Sets the group of the wrapped player. {@link GroupData} objects can be obtained using the static factory method
* {@link GroupData#getByName(java.lang.String, SafeSql)} | void function(String nick) { this.nick.setValue(nick); } /** * Sets the group of the wrapped player. {@link GroupData} objects can be obtained using the static factory method * {@link GroupData#getByName(java.lang.String, SafeSql)} | /**
* Sets the nickname of this player.
*
* @param nick New nickname for the wrapped player or {@code null} to disable.
* @see PlayerWrapper#getNick()
* @see PlayerWrapper#getDisplayName()
*/ | Sets the nickname of this player | setNick | {
"repo_name": "xxyy/xyc",
"path": "games/src/main/java/li/l1t/common/games/data/PlayerWrapper.java",
"license": "mit",
"size": 19234
} | [
"li.l1t.common.sql.SafeSql"
] | import li.l1t.common.sql.SafeSql; | import li.l1t.common.sql.*; | [
"li.l1t.common"
] | li.l1t.common; | 504,361 |
public void testNoSkipUnpublishedProperty() throws Exception {
Document filter = createFilter("nonExistentProperty", "dummy", false,
createDocumentWithUnpublishedProperty());
assertNotNull(filter.findProperty("nonExistentProperty"));
} | void function() throws Exception { Document filter = createFilter(STR, "dummy", false, createDocumentWithUnpublishedProperty()); assertNotNull(filter.findProperty(STR)); } | /**
* Tests that an unpublished property is not skipped if skipOnMatch is false.
*/ | Tests that an unpublished property is not skipped if skipOnMatch is false | testNoSkipUnpublishedProperty | {
"repo_name": "googlegsa/manager.v3",
"path": "projects/connector-manager/source/javatests/com/google/enterprise/connector/util/filter/SkipDocumentFilterTest.java",
"license": "apache-2.0",
"size": 11175
} | [
"com.google.enterprise.connector.spi.Document"
] | import com.google.enterprise.connector.spi.Document; | import com.google.enterprise.connector.spi.*; | [
"com.google.enterprise"
] | com.google.enterprise; | 184,283 |
public static FancyMessage deserialize(final String json) {
final JsonObject serialized = _stringParser.parse(json).getAsJsonObject();
final JsonArray extra = serialized.getAsJsonArray("extra"); // Get the extra component
final FancyMessage returnVal = new FancyMessage();
returnVal.messageParts.clear();
for (final JsonElement mPrt : extra) {
final MessagePart component = new MessagePart();
final JsonObject messagePart = mPrt.getAsJsonObject();
for (final Map.Entry<String, JsonElement> entry : messagePart.entrySet()) {
// Deserialize text
if (TextualComponent.isTextKey(entry.getKey())) {
// The map mimics the YAML serialization, which has a "key" field and one or more "value" fields
final Map<String, Object> serializedMapForm = new HashMap<>(); // Must be object due to Bukkit serializer API compliance
serializedMapForm.put("key", entry.getKey());
if (entry.getValue().isJsonPrimitive()) {
// Assume string
serializedMapForm.put("value", entry.getValue().getAsString());
} else {
// Composite object, but we assume each element is a string
for (final Map.Entry<String, JsonElement> compositeNestedElement : entry.getValue().getAsJsonObject().entrySet()) {
serializedMapForm.put("value." + compositeNestedElement.getKey(), compositeNestedElement.getValue().getAsString());
}
}
component.text = TextualComponent.deserialize(serializedMapForm);
} else if (MessagePart.stylesToNames.inverse().containsKey(entry.getKey())) {
if (entry.getValue().getAsBoolean()) {
component.styles.add(MessagePart.stylesToNames.inverse().get(entry.getKey()));
}
} else if (entry.getKey().equals("color")) {
component.color = ChatColor.valueOf(entry.getValue().getAsString().toUpperCase());
} else if (entry.getKey().equals("clickEvent")) {
final JsonObject object = entry.getValue().getAsJsonObject();
component.clickActionName = object.get("action").getAsString();
component.clickActionData = object.get("value").getAsString();
} else if (entry.getKey().equals("hoverEvent")) {
final JsonObject object = entry.getValue().getAsJsonObject();
component.hoverActionName = object.get("action").getAsString();
if (object.get("value").isJsonPrimitive()) {
// Assume string
component.hoverActionData = new JsonString(object.get("value").getAsString());
} else {
// Assume composite type
// The only composite type we currently store is another FancyMessage
// Therefore, recursion time!
component.hoverActionData = deserialize(object.get("value").toString() );
}
} else if (entry.getKey().equals("insertion")) {
component.insertionData = entry.getValue().getAsString();
} else if (entry.getKey().equals("with")) {
for (final JsonElement object : entry.getValue().getAsJsonArray()) {
if (object.isJsonPrimitive()) {
component.translationReplacements.add(new JsonString(object.getAsString()));
} else {
// Only composite type stored in this array is - again - FancyMessages
// Recurse within this function to parse this as a translation replacement
component.translationReplacements.add(deserialize(object.toString()));
}
}
}
}
returnVal.messageParts.add(component);
}
return returnVal;
} | static FancyMessage function(final String json) { final JsonObject serialized = _stringParser.parse(json).getAsJsonObject(); final JsonArray extra = serialized.getAsJsonArray("extra"); final FancyMessage returnVal = new FancyMessage(); returnVal.messageParts.clear(); for (final JsonElement mPrt : extra) { final MessagePart component = new MessagePart(); final JsonObject messagePart = mPrt.getAsJsonObject(); for (final Map.Entry<String, JsonElement> entry : messagePart.entrySet()) { if (TextualComponent.isTextKey(entry.getKey())) { final Map<String, Object> serializedMapForm = new HashMap<>(); serializedMapForm.put("key", entry.getKey()); if (entry.getValue().isJsonPrimitive()) { serializedMapForm.put("value", entry.getValue().getAsString()); } else { for (final Map.Entry<String, JsonElement> compositeNestedElement : entry.getValue().getAsJsonObject().entrySet()) { serializedMapForm.put(STR + compositeNestedElement.getKey(), compositeNestedElement.getValue().getAsString()); } } component.text = TextualComponent.deserialize(serializedMapForm); } else if (MessagePart.stylesToNames.inverse().containsKey(entry.getKey())) { if (entry.getValue().getAsBoolean()) { component.styles.add(MessagePart.stylesToNames.inverse().get(entry.getKey())); } } else if (entry.getKey().equals("color")) { component.color = ChatColor.valueOf(entry.getValue().getAsString().toUpperCase()); } else if (entry.getKey().equals(STR)) { final JsonObject object = entry.getValue().getAsJsonObject(); component.clickActionName = object.get(STR).getAsString(); component.clickActionData = object.get("value").getAsString(); } else if (entry.getKey().equals(STR)) { final JsonObject object = entry.getValue().getAsJsonObject(); component.hoverActionName = object.get(STR).getAsString(); if (object.get("value").isJsonPrimitive()) { component.hoverActionData = new JsonString(object.get("value").getAsString()); } else { component.hoverActionData = deserialize(object.get("value").toString() ); } } else if (entry.getKey().equals(STR)) { component.insertionData = entry.getValue().getAsString(); } else if (entry.getKey().equals("with")) { for (final JsonElement object : entry.getValue().getAsJsonArray()) { if (object.isJsonPrimitive()) { component.translationReplacements.add(new JsonString(object.getAsString())); } else { component.translationReplacements.add(deserialize(object.toString())); } } } } returnVal.messageParts.add(component); } return returnVal; } | /**
* Deserialize a fancy message from its JSON representation. This JSON representation is of the format of
* that returned by {@link #toJSONString()}, and is compatible with vanilla inputs.
* @param json The JSON string which represents a fancy message.
* @return A {@code FancyMessage} representing the parametrized JSON message.
*/ | Deserialize a fancy message from its JSON representation. This JSON representation is of the format of that returned by <code>#toJSONString()</code>, and is compatible with vanilla inputs | deserialize | {
"repo_name": "SilverCory/PlotSquared",
"path": "Bukkit/src/main/java/com/plotsquared/bukkit/chat/FancyMessage.java",
"license": "gpl-3.0",
"size": 41847
} | [
"com.google.gson.JsonArray",
"com.google.gson.JsonElement",
"com.google.gson.JsonObject",
"java.util.HashMap",
"java.util.Map",
"org.bukkit.ChatColor"
] | import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import java.util.HashMap; import java.util.Map; import org.bukkit.ChatColor; | import com.google.gson.*; import java.util.*; import org.bukkit.*; | [
"com.google.gson",
"java.util",
"org.bukkit"
] | com.google.gson; java.util; org.bukkit; | 958,129 |
private void circuitBreak(String fieldName, long bytesNeeded) throws CircuitBreakingException {
this.trippedCount.incrementAndGet();
final String message = "[" + getName() + "] Data too large, data for field [" + fieldName + "]" +
" would be [" + bytesNeeded + "/" + new ByteSizeValue(bytesNeeded) + "]" +
", which is larger than the limit of [" +
memoryBytesLimit + "/" + new ByteSizeValue(memoryBytesLimit) + "]";
logger.debug("{}", message);
throw new CircuitBreakingException(message, bytesNeeded, memoryBytesLimit);
} | void function(String fieldName, long bytesNeeded) throws CircuitBreakingException { this.trippedCount.incrementAndGet(); final String message = "[" + getName() + STR + fieldName + "]" + STR + bytesNeeded + "/" + new ByteSizeValue(bytesNeeded) + "]" + STR + memoryBytesLimit + "/" + new ByteSizeValue(memoryBytesLimit) + "]"; logger.debug("{}", message); throw new CircuitBreakingException(message, bytesNeeded, memoryBytesLimit); } | /**
* Method used to trip the breaker
*/ | Method used to trip the breaker | circuitBreak | {
"repo_name": "EvilMcJerkface/crate",
"path": "server/src/test/java/org/elasticsearch/common/breaker/MemoryCircuitBreaker.java",
"license": "apache-2.0",
"size": 7981
} | [
"org.elasticsearch.common.unit.ByteSizeValue"
] | import org.elasticsearch.common.unit.ByteSizeValue; | import org.elasticsearch.common.unit.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 2,476,949 |
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
if (childrenFeatures == null) {
super.getChildrenFeatures(object);
childrenFeatures.add(LunEntityPackage.Literals.LBEAN_REFERENCE__TYPE_JVM);
childrenFeatures.add(LunEntityPackage.Literals.LBEAN_REFERENCE__CONSTRAINTS);
}
return childrenFeatures;
} | Collection<? extends EStructuralFeature> function(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(LunEntityPackage.Literals.LBEAN_REFERENCE__TYPE_JVM); childrenFeatures.add(LunEntityPackage.Literals.LBEAN_REFERENCE__CONSTRAINTS); } return childrenFeatures; } | /**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This specifies how to implement <code>#getChildren</code> and is used to deduce an appropriate feature for an <code>org.eclipse.emf.edit.command.AddCommand</code>, <code>org.eclipse.emf.edit.command.RemoveCommand</code> or <code>org.eclipse.emf.edit.command.MoveCommand</code> in <code>#createCommand</code>. | getChildrenFeatures | {
"repo_name": "lunifera/lunifera-dsl",
"path": "org.lunifera.dsl.semantic.entity.edit/src/org/lunifera/dsl/semantic/entity/provider/LBeanReferenceItemProvider.java",
"license": "epl-1.0",
"size": 9781
} | [
"java.util.Collection",
"org.eclipse.emf.ecore.EStructuralFeature",
"org.lunifera.dsl.semantic.entity.LunEntityPackage"
] | import java.util.Collection; import org.eclipse.emf.ecore.EStructuralFeature; import org.lunifera.dsl.semantic.entity.LunEntityPackage; | import java.util.*; import org.eclipse.emf.ecore.*; import org.lunifera.dsl.semantic.entity.*; | [
"java.util",
"org.eclipse.emf",
"org.lunifera.dsl"
] | java.util; org.eclipse.emf; org.lunifera.dsl; | 2,140,530 |
public void setValue(String value) {
this.value = value;
}
@Column(name = "public", nullable = false)
private boolean publicPair = false; | void function(String value) { this.value = value; } @Column(name = STR, nullable = false) private boolean publicPair = false; | /**
* Configuration value setter.
*
* @param value
*/ | Configuration value setter | setValue | {
"repo_name": "bbijelic/shopfoundry",
"path": "shopfoundry-services/shopfoundry-services-registry/src/main/java/org/shopfoundry/services/registry/db/entity/ServiceGroupConfigurationKeyValuePair.java",
"license": "gpl-2.0",
"size": 2417
} | [
"javax.persistence.Column"
] | import javax.persistence.Column; | import javax.persistence.*; | [
"javax.persistence"
] | javax.persistence; | 2,883,000 |
public interface ByteIterator extends Iterator<Byte> {
byte nextByte();
} | interface ByteIterator extends Iterator<Byte> { byte function(); } | /**
* An alternative to {@link Iterator#next()} that returns an
* unboxed primitive {@code byte}.
*
* @return the next {@code byte} in the iteration
* @throws NoSuchElementException if the iteration has no more elements
*/ | An alternative to <code>Iterator#next()</code> that returns an unboxed primitive byte | nextByte | {
"repo_name": "gustavoanatoly/hbase",
"path": "hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/shaded/com/google/protobuf/ByteString.java",
"license": "apache-2.0",
"size": 54700
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,694,640 |
public void updateItem(@NonNull IDrawerItem drawerItem) {
updateItemAtPosition(drawerItem, getPosition(drawerItem));
} | void function(@NonNull IDrawerItem drawerItem) { updateItemAtPosition(drawerItem, getPosition(drawerItem)); } | /**
* update a specific drawer item :D
* automatically identified by its id
*
* @param drawerItem
*/ | update a specific drawer item :D automatically identified by its id | updateItem | {
"repo_name": "FreedomZZQ/YouJoin-Android",
"path": "material-drawer-library/src/main/java/com/mikepenz/materialdrawer/Drawer.java",
"license": "mit",
"size": 33812
} | [
"android.support.annotation.NonNull",
"com.mikepenz.materialdrawer.model.interfaces.IDrawerItem"
] | import android.support.annotation.NonNull; import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem; | import android.support.annotation.*; import com.mikepenz.materialdrawer.model.interfaces.*; | [
"android.support",
"com.mikepenz.materialdrawer"
] | android.support; com.mikepenz.materialdrawer; | 1,028,820 |
@SuppressWarnings("unchecked")
private AbstractModel prepareModels(List<AbstractModel> models,
CostUnitEditorForm form) {
CostUnit costUnit = (CostUnit) models.get(0);
CostUnit costUnitBeforeEdit = costUnit.clone();
costUnit.setCostUnit(form.getCostUnit());
costUnit.setFunds(form.getFunds());
costUnit.setTokenDB(form.getTokenDB());
return costUnitBeforeEdit;
} | @SuppressWarnings(STR) AbstractModel function(List<AbstractModel> models, CostUnitEditorForm form) { CostUnit costUnit = (CostUnit) models.get(0); CostUnit costUnitBeforeEdit = costUnit.clone(); costUnit.setCostUnit(form.getCostUnit()); costUnit.setFunds(form.getFunds()); costUnit.setTokenDB(form.getTokenDB()); return costUnitBeforeEdit; } | /**
* Prepares the cost unit model by setting the values of the cost unit
* editor form to this model.
*
* @param models
* a list that contains the course model of the editor
* @param form
* the course editor form
* @return the edited model
*/ | Prepares the cost unit model by setting the values of the cost unit editor form to this model | prepareModels | {
"repo_name": "aidGer/aidGer",
"path": "src/de/aidger/controller/actions/EditorSaveAction.java",
"license": "gpl-3.0",
"size": 24715
} | [
"de.aidger.model.AbstractModel",
"de.aidger.model.models.CostUnit",
"de.aidger.view.forms.CostUnitEditorForm",
"java.util.List"
] | import de.aidger.model.AbstractModel; import de.aidger.model.models.CostUnit; import de.aidger.view.forms.CostUnitEditorForm; import java.util.List; | import de.aidger.model.*; import de.aidger.model.models.*; import de.aidger.view.forms.*; import java.util.*; | [
"de.aidger.model",
"de.aidger.view",
"java.util"
] | de.aidger.model; de.aidger.view; java.util; | 2,876,120 |
public static <K,V,U> ForkJoinTask<U> searchEntries
(ConcurrentHashMapV8<K,V> map,
Fun<Map.Entry<K,V>, ? extends U> searchFunction) {
if (searchFunction == null) throw new NullPointerException();
return new SearchEntriesTask<K,V,U>
(map, null, -1, searchFunction,
new AtomicReference<U>());
} | static <K,V,U> ForkJoinTask<U> function (ConcurrentHashMapV8<K,V> map, Fun<Map.Entry<K,V>, ? extends U> searchFunction) { if (searchFunction == null) throw new NullPointerException(); return new SearchEntriesTask<K,V,U> (map, null, -1, searchFunction, new AtomicReference<U>()); } | /**
* Returns a task that when invoked, returns a non-null result
* from applying the given search function on each entry, or
* null if none. Upon success, further element processing is
* suppressed and the results of any other parallel
* invocations of the search function are ignored.
*
* @param map the map
* @param searchFunction a function returning a non-null
* result on success, else null
* @return the task
*/ | Returns a task that when invoked, returns a non-null result from applying the given search function on each entry, or null if none. Upon success, further element processing is suppressed and the results of any other parallel invocations of the search function are ignored | searchEntries | {
"repo_name": "dongaihua/highlight-elasticsearch",
"path": "src/main/java/jsr166e/ConcurrentHashMapV8.java",
"license": "apache-2.0",
"size": 283748
} | [
"java.util.Map",
"java.util.concurrent.atomic.AtomicReference"
] | import java.util.Map; import java.util.concurrent.atomic.AtomicReference; | import java.util.*; import java.util.concurrent.atomic.*; | [
"java.util"
] | java.util; | 2,013,072 |
public static boolean isWorldGuard() {
Plugin plugin = Bukkit.getPluginManager().getPlugin("WorldGuard");
if (plugin != null) {
return true;
}
return false;
} | static boolean function() { Plugin plugin = Bukkit.getPluginManager().getPlugin(STR); if (plugin != null) { return true; } return false; } | /**
* Determines if WorldGuard is installed
*
* @return True if WorldGuard is installed, false otherwise
*/ | Determines if WorldGuard is installed | isWorldGuard | {
"repo_name": "minnymin3/Zephyrus",
"path": "Zephyrus-Core/src/main/java/net/lordsofcode/zephyrus/utils/PluginHook.java",
"license": "gpl-3.0",
"size": 4443
} | [
"org.bukkit.Bukkit",
"org.bukkit.plugin.Plugin"
] | import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; | import org.bukkit.*; import org.bukkit.plugin.*; | [
"org.bukkit",
"org.bukkit.plugin"
] | org.bukkit; org.bukkit.plugin; | 1,663,445 |
public static Map.Entry<String, Map<String, ?>> sendSMSCommand(
String phoneNumber, String message) {
ImmutableMap<String, ?> parameters = ImmutableMap
.<String, Object>builder().put("phoneNumber", phoneNumber)
.put("message", message)
.build();
return new AbstractMap.SimpleEntry<>(SEND_SMS, parameters);
} | static Map.Entry<String, Map<String, ?>> function( String phoneNumber, String message) { ImmutableMap<String, ?> parameters = ImmutableMap .<String, Object>builder().put(STR, phoneNumber) .put(STR, message) .build(); return new AbstractMap.SimpleEntry<>(SEND_SMS, parameters); } | /**
* This method forms a {@link Map} of parameters for the element
* value replacement. It is used against input elements
*
* @param phoneNumber The phone number of message sender
* @param message The message content
*
* @return a key-value pair. The key is the command name. The value is a {@link Map} command arguments.
*/ | This method forms a <code>Map</code> of parameters for the element value replacement. It is used against input elements | sendSMSCommand | {
"repo_name": "SrinivasanTarget/java-client",
"path": "src/main/java/io/appium/java_client/android/AndroidMobileCommandHelper.java",
"license": "apache-2.0",
"size": 19196
} | [
"com.google.common.collect.ImmutableMap",
"java.util.AbstractMap",
"java.util.Map"
] | import com.google.common.collect.ImmutableMap; import java.util.AbstractMap; import java.util.Map; | import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 2,911,003 |
public void errorSaving(final CommandSender sender, final String errorSavingMsg, final Exception ex)
{
if (sender != null)
{
if (errorSavingMsg == null)
sender.sendMessage(MESSAGE_ERROR_SAVING);
else
sender.sendMessage(errorSavingMsg);
final StringBuilder sb = new StringBuilder();
sb.append("Could not save config to ").append(getFile());
if(ex != null)
sb.append(" : ").append(ex.getClass().toString());
plugin.getLogger().log(Level.WARNING, sb.toString());
}
}
}
public final MessageSender messageSender = new MessageSender();
// ===========================
public static class YAMLResult
{
private YAMLResult(){}
public YamlConfiguration yaml = new YamlConfiguration();
public boolean isFileFound = true;
public boolean isValidConfig = true;
}
// ------------
| void function(final CommandSender sender, final String errorSavingMsg, final Exception ex) { if (sender != null) { if (errorSavingMsg == null) sender.sendMessage(MESSAGE_ERROR_SAVING); else sender.sendMessage(errorSavingMsg); final StringBuilder sb = new StringBuilder(); sb.append(STR).append(getFile()); if(ex != null) sb.append(STR).append(ex.getClass().toString()); plugin.getLogger().log(Level.WARNING, sb.toString()); } } } public final MessageSender messageSender = new MessageSender(); public static class YAMLResult { private YAMLResult(){} public YamlConfiguration yaml = new YamlConfiguration(); public boolean isFileFound = true; public boolean isValidConfig = true; } | /**
* Sends an error-saving message. (The message will be sent to the logger as well)
* @param sender a {@link CommandSender} to receive the message - if this is <code>null</code> nothing gets sent!
* @param errorSavingMsg the message to send (if this is <code>null</code> a default message will be used)
* @param ex an optional {@link Exception} associated with this error
*/ | Sends an error-saving message. (The message will be sent to the logger as well) | errorSaving | {
"repo_name": "AnorZaken/aztb",
"path": "src/nu/mine/obsidian/aztb/bukkit/loaders/v1_2/YAMLLoader.java",
"license": "lgpl-3.0",
"size": 10732
} | [
"java.util.logging.Level",
"org.bukkit.command.CommandSender",
"org.bukkit.configuration.file.YamlConfiguration"
] | import java.util.logging.Level; import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.YamlConfiguration; | import java.util.logging.*; import org.bukkit.command.*; import org.bukkit.configuration.file.*; | [
"java.util",
"org.bukkit.command",
"org.bukkit.configuration"
] | java.util; org.bukkit.command; org.bukkit.configuration; | 2,223,547 |
public void treePrint(int depth) {
Map printed = getParserContext().getPrintedObjectsMap();
if (printed.containsKey(this)) {
debugPrint(formatNodeString(nodeHeader(), depth));
debugPrint(formatNodeString("***truncated***\n", depth));
}
else {
printed.put(this, null);
debugPrint(formatNodeString(nodeHeader(), depth));
String thisStr = formatNodeString(this.toString(), depth);
if (containsInfo(thisStr)) {
debugPrint(thisStr);
}
if (thisStr.charAt(thisStr.length()-1) != '\n') {
debugPrint("\n");
}
printSubNodes(depth);
}
}
| void function(int depth) { Map printed = getParserContext().getPrintedObjectsMap(); if (printed.containsKey(this)) { debugPrint(formatNodeString(nodeHeader(), depth)); debugPrint(formatNodeString(STR, depth)); } else { printed.put(this, null); debugPrint(formatNodeString(nodeHeader(), depth)); String thisStr = formatNodeString(this.toString(), depth); if (containsInfo(thisStr)) { debugPrint(thisStr); } if (thisStr.charAt(thisStr.length()-1) != '\n') { debugPrint("\n"); } printSubNodes(depth); } } | /**
* Print this tree for debugging purposes. This recurses through
* all the sub-nodes and prints them indented by their depth in
* the tree, starting with the given indentation.
*
* @param depth The depth of this node in the tree, thus,
* the amount to indent it when printing it.
*/ | Print this tree for debugging purposes. This recurses through all the sub-nodes and prints them indented by their depth in the tree, starting with the given indentation | treePrint | {
"repo_name": "youngor/openclouddb",
"path": "MyCAT/src/main/java/com/akiban/sql/parser/QueryTreeNode.java",
"license": "apache-2.0",
"size": 26881
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 691,888 |
public static long length(final File file)
throws SecurityException {
if (file == null) {
throw new IllegalArgumentException("file cannot be <null>");
} | static long function(final File file) throws SecurityException { if (file == null) { throw new IllegalArgumentException(STR); } | /**
* Get the file length.
*
* @return byte length of the file.
* @throws SecurityException if the required permissions to read the file,
* or the path it is in, are missing
* @see File#length
*/ | Get the file length | length | {
"repo_name": "lpxz/grail-derby104",
"path": "java/testing/org/apache/derbyTesting/functionTests/util/PrivilegedFileOpsForTests.java",
"license": "apache-2.0",
"size": 9467
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 147,190 |
public boolean isValidRecurrenceBeginDate( Date beginDate ) ; | boolean function( Date beginDate ) ; | /**
* This method returns true if the bein date is valid.
*
* @param invoiceNumber
* @return
*/ | This method returns true if the bein date is valid | isValidRecurrenceBeginDate | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/ar/document/service/InvoiceRecurrenceDocumentService.java",
"license": "apache-2.0",
"size": 3066
} | [
"java.sql.Date"
] | import java.sql.Date; | import java.sql.*; | [
"java.sql"
] | java.sql; | 592,807 |
public static void createSOARecordset(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.dnsZones()
.manager()
.serviceClient()
.getRecordSets()
.createOrUpdateWithResponse(
"rg1",
"zone1",
"@",
RecordType.SOA,
new RecordSetInner()
.withMetadata(mapOf("key1", "value1"))
.withTtl(3600L)
.withSoaRecord(
new SoaRecord()
.withHost("ns1.contoso.com")
.withEmail("hostmaster.contoso.com")
.withSerialNumber(1L)
.withRefreshTime(3600L)
.withRetryTime(300L)
.withExpireTime(2419200L)
.withMinimumTtl(300L)),
null,
null,
Context.NONE);
} | static void function(com.azure.resourcemanager.AzureResourceManager azure) { azure .dnsZones() .manager() .serviceClient() .getRecordSets() .createOrUpdateWithResponse( "rg1", "zone1", "@", RecordType.SOA, new RecordSetInner() .withMetadata(mapOf("key1", STR)) .withTtl(3600L) .withSoaRecord( new SoaRecord() .withHost(STR) .withEmail(STR) .withSerialNumber(1L) .withRefreshTime(3600L) .withRetryTime(300L) .withExpireTime(2419200L) .withMinimumTtl(300L)), null, null, Context.NONE); } | /**
* Sample code: Create SOA recordset.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/ | Sample code: Create SOA recordset | createSOARecordset | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager/src/samples/java/com/azure/resourcemanager/dns/generated/RecordSetsCreateOrUpdateSamples.java",
"license": "mit",
"size": 13066
} | [
"com.azure.core.util.Context",
"com.azure.resourcemanager.dns.fluent.models.RecordSetInner",
"com.azure.resourcemanager.dns.models.RecordType",
"com.azure.resourcemanager.dns.models.SoaRecord"
] | import com.azure.core.util.Context; import com.azure.resourcemanager.dns.fluent.models.RecordSetInner; import com.azure.resourcemanager.dns.models.RecordType; import com.azure.resourcemanager.dns.models.SoaRecord; | import com.azure.core.util.*; import com.azure.resourcemanager.dns.fluent.models.*; import com.azure.resourcemanager.dns.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,766,421 |
public Interface findInterface(String name) {
final Iterator<Interface> i = this.getInterfaces().iterator();
while ( i.hasNext() ) {
final Interface current = i.next();
if ( current.getInterfacename().equals(name) ) {
return current;
}
}
return null;
}
| Interface function(String name) { final Iterator<Interface> i = this.getInterfaces().iterator(); while ( i.hasNext() ) { final Interface current = i.next(); if ( current.getInterfacename().equals(name) ) { return current; } } return null; } | /**
* Search for an implemented interface.
* @param name The name of the interface.
* @return The interface if it is implemented by this service or null.
*/ | Search for an implemented interface | findInterface | {
"repo_name": "boneman1231/org.apache.felix",
"path": "trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/om/Service.java",
"license": "apache-2.0",
"size": 3165
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 271,092 |
@Test(expected = IndexOutOfBoundsException.class)
public void testShortLine() throws Exception {
InputStream in = input(TestData.CLEAR_CONTENT);
IndexIterator it = new IndexIterator(in);
it.hasNext();
} | @Test(expected = IndexOutOfBoundsException.class) void function() throws Exception { InputStream in = input(TestData.CLEAR_CONTENT); IndexIterator it = new IndexIterator(in); it.hasNext(); } | /**
* It is an error to have a short line in the index.
*
* @throws Exception
*/ | It is an error to have a short line in the index | testShortLine | {
"repo_name": "sarah-happy/happy-archive",
"path": "archive/src/main/java/org/yi/happy/archive/index/IndexIteratorTest.java",
"license": "apache-2.0",
"size": 2311
} | [
"java.io.InputStream",
"org.junit.Test",
"org.yi.happy.archive.test_data.TestData"
] | import java.io.InputStream; import org.junit.Test; import org.yi.happy.archive.test_data.TestData; | import java.io.*; import org.junit.*; import org.yi.happy.archive.test_data.*; | [
"java.io",
"org.junit",
"org.yi.happy"
] | java.io; org.junit; org.yi.happy; | 39,866 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.