repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/wikipedia/Descriptor.java | Descriptor.setIncomingLinks | public void setIncomingLinks(int i, Title v) {
if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_incomingLinks == null)
jcasType.jcas.throwFeatMissing("incomingLinks", "de.julielab.jules.types.wikipedia.Descriptor");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_incomingLinks), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_incomingLinks), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setIncomingLinks(int i, Title v) {
if (Descriptor_Type.featOkTst && ((Descriptor_Type)jcasType).casFeat_incomingLinks == null)
jcasType.jcas.throwFeatMissing("incomingLinks", "de.julielab.jules.types.wikipedia.Descriptor");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_incomingLinks), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Descriptor_Type)jcasType).casFeatCode_incomingLinks), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setIncomingLinks",
"(",
"int",
"i",
",",
"Title",
"v",
")",
"{",
"if",
"(",
"Descriptor_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Descriptor_Type",
")",
"jcasType",
")",
".",
"casFeat_incomingLinks",
"==",
"null",
")",
"jcasType",
".",
"... | indexed setter for incomingLinks - sets an indexed value - List of incoming links (from other Wikipedia pages) associated with a Wikipedia page.
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"incomingLinks",
"-",
"sets",
"an",
"indexed",
"value",
"-",
"List",
"of",
"incoming",
"links",
"(",
"from",
"other",
"Wikipedia",
"pages",
")",
"associated",
"with",
"a",
"Wikipedia",
"page",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/wikipedia/Descriptor.java#L161-L165 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProject.java | FrameworkProject.mergeProjectProperties | @Override
public void mergeProjectProperties(final Properties properties, final Set<String> removePrefixes) {
projectConfigModifier.mergeProjectProperties(properties, removePrefixes);
} | java | @Override
public void mergeProjectProperties(final Properties properties, final Set<String> removePrefixes) {
projectConfigModifier.mergeProjectProperties(properties, removePrefixes);
} | [
"@",
"Override",
"public",
"void",
"mergeProjectProperties",
"(",
"final",
"Properties",
"properties",
",",
"final",
"Set",
"<",
"String",
">",
"removePrefixes",
")",
"{",
"projectConfigModifier",
".",
"mergeProjectProperties",
"(",
"properties",
",",
"removePrefixes"... | Update the project properties file by setting updating the given properties, and removing
any properties that have a prefix in the removePrefixes set
@param properties new properties to put in the file
@param removePrefixes prefixes of properties to remove from the file | [
"Update",
"the",
"project",
"properties",
"file",
"by",
"setting",
"updating",
"the",
"given",
"properties",
"and",
"removing",
"any",
"properties",
"that",
"have",
"a",
"prefix",
"in",
"the",
"removePrefixes",
"set"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProject.java#L396-L399 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/MariaDbConnection.java | MariaDbConnection.setCatalog | public void setCatalog(final String catalog) throws SQLException {
if (catalog == null) {
throw new SQLException("The catalog name may not be null", "XAE05");
}
try {
stateFlag |= ConnectionState.STATE_DATABASE;
protocol.setCatalog(catalog);
} catch (SQLException e) {
throw ExceptionMapper.getException(e, this, null, false);
}
} | java | public void setCatalog(final String catalog) throws SQLException {
if (catalog == null) {
throw new SQLException("The catalog name may not be null", "XAE05");
}
try {
stateFlag |= ConnectionState.STATE_DATABASE;
protocol.setCatalog(catalog);
} catch (SQLException e) {
throw ExceptionMapper.getException(e, this, null, false);
}
} | [
"public",
"void",
"setCatalog",
"(",
"final",
"String",
"catalog",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"catalog",
"==",
"null",
")",
"{",
"throw",
"new",
"SQLException",
"(",
"\"The catalog name may not be null\"",
",",
"\"XAE05\"",
")",
";",
"}",
"... | <p>Sets the given catalog name in order to select a subspace of this <code>Connection</code>
object's database in which to work.</p>
<p>If the driver does not support catalogs, it will silently ignore this request.</p>
MariaDB treats catalogs and databases as equivalent
@param catalog the name of a catalog (subspace in this <code>Connection</code> object's
database) in which to work
@throws SQLException if a database access error occurs or this method is called on a closed
connection
@see #getCatalog | [
"<p",
">",
"Sets",
"the",
"given",
"catalog",
"name",
"in",
"order",
"to",
"select",
"a",
"subspace",
"of",
"this",
"<code",
">",
"Connection<",
"/",
"code",
">",
"object",
"s",
"database",
"in",
"which",
"to",
"work",
".",
"<",
"/",
"p",
">",
"<p",
... | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/MariaDbConnection.java#L888-L898 |
arxanchain/java-common | src/main/java/com/arxanfintech/common/crypto/core/ECKey.java | ECKey.decryptAES | public byte[] decryptAES(byte[] cipher) {
if (privKey == null) {
throw new MissingPrivateKeyException();
}
if (!(privKey instanceof BCECPrivateKey)) {
throw new UnsupportedOperationException("Cannot use the private key as an AES key");
}
AESFastEngine engine = new AESFastEngine();
SICBlockCipher ctrEngine = new SICBlockCipher(engine);
KeyParameter key = new KeyParameter(BigIntegers.asUnsignedByteArray(((BCECPrivateKey) privKey).getD()));
ParametersWithIV params = new ParametersWithIV(key, new byte[16]);
ctrEngine.init(false, params);
int i = 0;
byte[] out = new byte[cipher.length];
while (i < cipher.length) {
ctrEngine.processBlock(cipher, i, out, i);
i += engine.getBlockSize();
if (cipher.length - i < engine.getBlockSize())
break;
}
// process left bytes
if (cipher.length - i > 0) {
byte[] tmpBlock = new byte[16];
System.arraycopy(cipher, i, tmpBlock, 0, cipher.length - i);
ctrEngine.processBlock(tmpBlock, 0, tmpBlock, 0);
System.arraycopy(tmpBlock, 0, out, i, cipher.length - i);
}
return out;
} | java | public byte[] decryptAES(byte[] cipher) {
if (privKey == null) {
throw new MissingPrivateKeyException();
}
if (!(privKey instanceof BCECPrivateKey)) {
throw new UnsupportedOperationException("Cannot use the private key as an AES key");
}
AESFastEngine engine = new AESFastEngine();
SICBlockCipher ctrEngine = new SICBlockCipher(engine);
KeyParameter key = new KeyParameter(BigIntegers.asUnsignedByteArray(((BCECPrivateKey) privKey).getD()));
ParametersWithIV params = new ParametersWithIV(key, new byte[16]);
ctrEngine.init(false, params);
int i = 0;
byte[] out = new byte[cipher.length];
while (i < cipher.length) {
ctrEngine.processBlock(cipher, i, out, i);
i += engine.getBlockSize();
if (cipher.length - i < engine.getBlockSize())
break;
}
// process left bytes
if (cipher.length - i > 0) {
byte[] tmpBlock = new byte[16];
System.arraycopy(cipher, i, tmpBlock, 0, cipher.length - i);
ctrEngine.processBlock(tmpBlock, 0, tmpBlock, 0);
System.arraycopy(tmpBlock, 0, out, i, cipher.length - i);
}
return out;
} | [
"public",
"byte",
"[",
"]",
"decryptAES",
"(",
"byte",
"[",
"]",
"cipher",
")",
"{",
"if",
"(",
"privKey",
"==",
"null",
")",
"{",
"throw",
"new",
"MissingPrivateKeyException",
"(",
")",
";",
"}",
"if",
"(",
"!",
"(",
"privKey",
"instanceof",
"BCECPriv... | Decrypt cipher by AES in SIC(also know as CTR) mode
@param cipher
-proper cipher
@return decrypted cipher, equal length to the cipher.
@deprecated should not use EC private scalar value as an AES key | [
"Decrypt",
"cipher",
"by",
"AES",
"in",
"SIC",
"(",
"also",
"know",
"as",
"CTR",
")",
"mode"
] | train | https://github.com/arxanchain/java-common/blob/3ddfedfd948f5bab3fee0b74b85cdce4702ed84e/src/main/java/com/arxanfintech/common/crypto/core/ECKey.java#L951-L986 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java | ComputeNodeOperations.updateComputeNodeUser | public void updateComputeNodeUser(String poolId, String nodeId, String userName, String sshPublicKey) throws BatchErrorException, IOException {
updateComputeNodeUser(poolId, nodeId, userName, sshPublicKey, (Iterable<BatchClientBehavior>) null);
} | java | public void updateComputeNodeUser(String poolId, String nodeId, String userName, String sshPublicKey) throws BatchErrorException, IOException {
updateComputeNodeUser(poolId, nodeId, userName, sshPublicKey, (Iterable<BatchClientBehavior>) null);
} | [
"public",
"void",
"updateComputeNodeUser",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"String",
"userName",
",",
"String",
"sshPublicKey",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"updateComputeNodeUser",
"(",
"poolId",
",",
"nodeId... | Updates the specified user account on the specified compute node.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node where the user account will be updated.
@param userName The name of the user account to update.
@param sshPublicKey The SSH public key that can be used for remote login to the compute node. If null, the SSH public key is removed.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Updates",
"the",
"specified",
"user",
"account",
"on",
"the",
"specified",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L180-L182 |
dropbox/dropbox-sdk-java | src/main/java/com/dropbox/core/v1/DbxClientV1.java | DbxClientV1.chunkedUploadFirst | public String chunkedUploadFirst(byte[] data, int dataOffset, int dataLength)
throws DbxException
{
return chunkedUploadFirst(dataLength, new DbxStreamWriter.ByteArrayCopier(data, dataOffset, dataLength));
} | java | public String chunkedUploadFirst(byte[] data, int dataOffset, int dataLength)
throws DbxException
{
return chunkedUploadFirst(dataLength, new DbxStreamWriter.ByteArrayCopier(data, dataOffset, dataLength));
} | [
"public",
"String",
"chunkedUploadFirst",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"dataOffset",
",",
"int",
"dataLength",
")",
"throws",
"DbxException",
"{",
"return",
"chunkedUploadFirst",
"(",
"dataLength",
",",
"new",
"DbxStreamWriter",
".",
"ByteArrayCopier... | Upload the first chunk of a multi-chunk upload.
@param data
The data to append.
@param dataOffset
The start offset in {@code data} to read from.
@param dataLength
The number of bytes to read from {@code data}, starting from {@code dataOffset}.
@return
The ID designated by the Dropbox server to identify the chunked upload. | [
"Upload",
"the",
"first",
"chunk",
"of",
"a",
"multi",
"-",
"chunk",
"upload",
"."
] | train | https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L1017-L1021 |
jamesagnew/hapi-fhir | hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java | AbstractJaxRsResourceProvider.customOperation | protected Response customOperation(final String resource, final RequestTypeEnum requestType, final String id,
final String operationName, final RestOperationTypeEnum operationType)
throws IOException {
final Builder request = getResourceRequest(requestType, operationType).resource(resource).id(id);
return execute(request, operationName);
} | java | protected Response customOperation(final String resource, final RequestTypeEnum requestType, final String id,
final String operationName, final RestOperationTypeEnum operationType)
throws IOException {
final Builder request = getResourceRequest(requestType, operationType).resource(resource).id(id);
return execute(request, operationName);
} | [
"protected",
"Response",
"customOperation",
"(",
"final",
"String",
"resource",
",",
"final",
"RequestTypeEnum",
"requestType",
",",
"final",
"String",
"id",
",",
"final",
"String",
"operationName",
",",
"final",
"RestOperationTypeEnum",
"operationType",
")",
"throws"... | Execute a custom operation
@param resource the resource to create
@param requestType the type of request
@param id the id of the resource on which to perform the operation
@param operationName the name of the operation to execute
@param operationType the rest operation type
@return the response
@see <a href="https://www.hl7.org/fhir/operations.html">https://www.hl7.org/fhir/operations.html</a> | [
"Execute",
"a",
"custom",
"operation"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsResourceProvider.java#L240-L245 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java | TrackerMeanShiftComaniciu2003.updateLocation | protected void updateLocation( T image , RectangleRotate_F32 region ) {
double bestHistScore = Double.MAX_VALUE;
float bestX = -1, bestY = -1;
for( int i = 0; i < maxIterations; i++ ) {
calcHistogram.computeHistogram(image,region);
float histogram[] = calcHistogram.getHistogram();
updateWeights(histogram);
// the histogram fit doesn't always improve with each mean-shift iteration
// save the best one and use it later on
double histScore = distanceHistogram(keyHistogram, histogram);
if( histScore < bestHistScore ) {
bestHistScore = histScore;
bestX = region.cx;
bestY = region.cy;
}
List<Point2D_F32> samples = calcHistogram.getSamplePts();
int sampleHistIndex[] = calcHistogram.getSampleHistIndex();
// Compute equation 13
float meanX = 0;
float meanY = 0;
float totalWeight = 0;
for( int j = 0; j < samples.size(); j++ ) {
Point2D_F32 samplePt = samples.get(j);
int histIndex = sampleHistIndex[j];
if( histIndex < 0 )
continue;
// compute the weight derived from the Bhattacharyya coefficient. Equation 10.
float w = weightHistogram[histIndex];
meanX += w*samplePt.x;
meanY += w*samplePt.y;
totalWeight += w;
}
meanX /= totalWeight;
meanY /= totalWeight;
// convert to image pixels
calcHistogram.squareToImageSample(meanX, meanY, region);
meanX = calcHistogram.imageX;
meanY = calcHistogram.imageY;
// see if the change is below the threshold
boolean done = Math.abs(meanX-region.cx ) <= minimumChange && Math.abs(meanY-region.cy ) <= minimumChange;
region.cx = meanX;
region.cy = meanY;
if( done ) {
break;
}
}
// use the best location found
region.cx = bestX;
region.cy = bestY;
} | java | protected void updateLocation( T image , RectangleRotate_F32 region ) {
double bestHistScore = Double.MAX_VALUE;
float bestX = -1, bestY = -1;
for( int i = 0; i < maxIterations; i++ ) {
calcHistogram.computeHistogram(image,region);
float histogram[] = calcHistogram.getHistogram();
updateWeights(histogram);
// the histogram fit doesn't always improve with each mean-shift iteration
// save the best one and use it later on
double histScore = distanceHistogram(keyHistogram, histogram);
if( histScore < bestHistScore ) {
bestHistScore = histScore;
bestX = region.cx;
bestY = region.cy;
}
List<Point2D_F32> samples = calcHistogram.getSamplePts();
int sampleHistIndex[] = calcHistogram.getSampleHistIndex();
// Compute equation 13
float meanX = 0;
float meanY = 0;
float totalWeight = 0;
for( int j = 0; j < samples.size(); j++ ) {
Point2D_F32 samplePt = samples.get(j);
int histIndex = sampleHistIndex[j];
if( histIndex < 0 )
continue;
// compute the weight derived from the Bhattacharyya coefficient. Equation 10.
float w = weightHistogram[histIndex];
meanX += w*samplePt.x;
meanY += w*samplePt.y;
totalWeight += w;
}
meanX /= totalWeight;
meanY /= totalWeight;
// convert to image pixels
calcHistogram.squareToImageSample(meanX, meanY, region);
meanX = calcHistogram.imageX;
meanY = calcHistogram.imageY;
// see if the change is below the threshold
boolean done = Math.abs(meanX-region.cx ) <= minimumChange && Math.abs(meanY-region.cy ) <= minimumChange;
region.cx = meanX;
region.cy = meanY;
if( done ) {
break;
}
}
// use the best location found
region.cx = bestX;
region.cy = bestY;
} | [
"protected",
"void",
"updateLocation",
"(",
"T",
"image",
",",
"RectangleRotate_F32",
"region",
")",
"{",
"double",
"bestHistScore",
"=",
"Double",
".",
"MAX_VALUE",
";",
"float",
"bestX",
"=",
"-",
"1",
",",
"bestY",
"=",
"-",
"1",
";",
"for",
"(",
"int... | Updates the region's location using the standard mean-shift algorithm | [
"Updates",
"the",
"region",
"s",
"location",
"using",
"the",
"standard",
"mean",
"-",
"shift",
"algorithm"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java#L240-L303 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/db/store/JCRStoreResource.java | JCRStoreResource.setIdentifer | protected void setIdentifer(final String _identifier)
throws EFapsException
{
if (!_identifier.equals(this.identifier)) {
ConnectionResource res = null;
try {
res = Context.getThreadContext().getConnectionResource();
final StringBuffer cmd = new StringBuffer().append("update ")
.append(JCRStoreResource.TABLENAME_STORE).append(" set ")
.append(JCRStoreResource.COLNAME_IDENTIFIER).append("=? ")
.append("where ID =").append(getGeneralID());
final PreparedStatement stmt = res.prepareStatement(cmd.toString());
try {
stmt.setString(1, _identifier);
stmt.execute();
} finally {
stmt.close();
}
this.identifier = _identifier;
} catch (final EFapsException e) {
throw e;
} catch (final SQLException e) {
throw new EFapsException(JDBCStoreResource.class, "write.SQLException", e);
}
}
} | java | protected void setIdentifer(final String _identifier)
throws EFapsException
{
if (!_identifier.equals(this.identifier)) {
ConnectionResource res = null;
try {
res = Context.getThreadContext().getConnectionResource();
final StringBuffer cmd = new StringBuffer().append("update ")
.append(JCRStoreResource.TABLENAME_STORE).append(" set ")
.append(JCRStoreResource.COLNAME_IDENTIFIER).append("=? ")
.append("where ID =").append(getGeneralID());
final PreparedStatement stmt = res.prepareStatement(cmd.toString());
try {
stmt.setString(1, _identifier);
stmt.execute();
} finally {
stmt.close();
}
this.identifier = _identifier;
} catch (final EFapsException e) {
throw e;
} catch (final SQLException e) {
throw new EFapsException(JDBCStoreResource.class, "write.SQLException", e);
}
}
} | [
"protected",
"void",
"setIdentifer",
"(",
"final",
"String",
"_identifier",
")",
"throws",
"EFapsException",
"{",
"if",
"(",
"!",
"_identifier",
".",
"equals",
"(",
"this",
".",
"identifier",
")",
")",
"{",
"ConnectionResource",
"res",
"=",
"null",
";",
"try... | Set the identifier in the eFaps DataBase.
@param _identifier identifer to set
@throws EFapsException on error | [
"Set",
"the",
"identifier",
"in",
"the",
"eFaps",
"DataBase",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/store/JCRStoreResource.java#L326-L354 |
baratine/baratine | framework/src/main/java/com/caucho/v5/http/pod/PodLoader.java | PodLoader.buildClassLoader | public ClassLoader buildClassLoader(ClassLoader serviceLoader)
{
synchronized (_loaderMap) {
SoftReference<ClassLoader> extLoaderRef = _loaderMap.get(serviceLoader);
if (extLoaderRef != null) {
ClassLoader extLoader = extLoaderRef.get();
if (extLoader != null) {
return extLoader;
}
}
}
String parentId = EnvLoader.getEnvironmentName(serviceLoader);
String id = _id + "!" + parentId;
//DynamicClassLoader extLoader = new PodExtClassLoader(serviceLoader, id);
DynamicClassLoader extLoader = null;
/*
LibraryLoader libLoader
= new LibraryLoader(extLoader, getRootDirectory().lookup("lib"));
libLoader.init();
CompilingLoader compLoader
= new CompilingLoader(extLoader, getRootDirectory().lookup("classes"));
compLoader.init();
synchronized (_loaderMap) {
SoftReference<ClassLoader> extLoaderRef = _loaderMap.get(serviceLoader);
if (extLoaderRef != null) {
ClassLoader extLoaderOld = extLoaderRef.get();
if (extLoaderOld != null) {
return extLoaderOld;
}
}
_loaderMap.put(serviceLoader, new SoftReference<>(extLoader));
}
*/
return extLoader;
} | java | public ClassLoader buildClassLoader(ClassLoader serviceLoader)
{
synchronized (_loaderMap) {
SoftReference<ClassLoader> extLoaderRef = _loaderMap.get(serviceLoader);
if (extLoaderRef != null) {
ClassLoader extLoader = extLoaderRef.get();
if (extLoader != null) {
return extLoader;
}
}
}
String parentId = EnvLoader.getEnvironmentName(serviceLoader);
String id = _id + "!" + parentId;
//DynamicClassLoader extLoader = new PodExtClassLoader(serviceLoader, id);
DynamicClassLoader extLoader = null;
/*
LibraryLoader libLoader
= new LibraryLoader(extLoader, getRootDirectory().lookup("lib"));
libLoader.init();
CompilingLoader compLoader
= new CompilingLoader(extLoader, getRootDirectory().lookup("classes"));
compLoader.init();
synchronized (_loaderMap) {
SoftReference<ClassLoader> extLoaderRef = _loaderMap.get(serviceLoader);
if (extLoaderRef != null) {
ClassLoader extLoaderOld = extLoaderRef.get();
if (extLoaderOld != null) {
return extLoaderOld;
}
}
_loaderMap.put(serviceLoader, new SoftReference<>(extLoader));
}
*/
return extLoader;
} | [
"public",
"ClassLoader",
"buildClassLoader",
"(",
"ClassLoader",
"serviceLoader",
")",
"{",
"synchronized",
"(",
"_loaderMap",
")",
"{",
"SoftReference",
"<",
"ClassLoader",
">",
"extLoaderRef",
"=",
"_loaderMap",
".",
"get",
"(",
"serviceLoader",
")",
";",
"if",
... | Builds a combined class-loader with the target service loader as a
parent, and this calling pod loader as a child. | [
"Builds",
"a",
"combined",
"class",
"-",
"loader",
"with",
"the",
"target",
"service",
"loader",
"as",
"a",
"parent",
"and",
"this",
"calling",
"pod",
"loader",
"as",
"a",
"child",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/http/pod/PodLoader.java#L191-L237 |
GwtMaterialDesign/gwt-material | gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java | MaterialListValueBox.setItemText | public void setItemText(int index, String text, Direction dir) {
index += getIndexOffset();
listBox.setItemText(index, text, dir);
reload();
} | java | public void setItemText(int index, String text, Direction dir) {
index += getIndexOffset();
listBox.setItemText(index, text, dir);
reload();
} | [
"public",
"void",
"setItemText",
"(",
"int",
"index",
",",
"String",
"text",
",",
"Direction",
"dir",
")",
"{",
"index",
"+=",
"getIndexOffset",
"(",
")",
";",
"listBox",
".",
"setItemText",
"(",
"index",
",",
"text",
",",
"dir",
")",
";",
"reload",
"(... | Sets the text associated with the item at a given index.
@param index the index of the item to be set
@param text the item's new text
@param dir the item's direction.
@throws IndexOutOfBoundsException if the index is out of range | [
"Sets",
"the",
"text",
"associated",
"with",
"the",
"item",
"at",
"a",
"given",
"index",
"."
] | train | https://github.com/GwtMaterialDesign/gwt-material/blob/86feefb282b007c0a44784c09e651a50f257138e/gwt-material/src/main/java/gwt/material/design/client/ui/MaterialListValueBox.java#L732-L736 |
Red5/red5-server-common | src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java | RTMPHandshake.getDigestOffset1 | protected int getDigestOffset1(byte[] handshake, int bufferOffset) {
bufferOffset += 8;
int offset = handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
int res = (offset % 728) + 12;
if (res + DIGEST_LENGTH > 771) {
log.error("Invalid digest offset calc: {}", res);
}
return res;
} | java | protected int getDigestOffset1(byte[] handshake, int bufferOffset) {
bufferOffset += 8;
int offset = handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
bufferOffset++;
offset += handshake[bufferOffset] & 0xff;
int res = (offset % 728) + 12;
if (res + DIGEST_LENGTH > 771) {
log.error("Invalid digest offset calc: {}", res);
}
return res;
} | [
"protected",
"int",
"getDigestOffset1",
"(",
"byte",
"[",
"]",
"handshake",
",",
"int",
"bufferOffset",
")",
"{",
"bufferOffset",
"+=",
"8",
";",
"int",
"offset",
"=",
"handshake",
"[",
"bufferOffset",
"]",
"&",
"0xff",
";",
"bufferOffset",
"++",
";",
"off... | Returns a digest byte offset.
@param handshake handshake sequence
@param bufferOffset buffer offset
@return digest offset | [
"Returns",
"a",
"digest",
"byte",
"offset",
"."
] | train | https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L508-L522 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEEJBInvocationInfoBase.java | TEEJBInvocationInfoBase.turnNullClass2EmptyString | protected static String turnNullClass2EmptyString(Class<?> cls, String NullDefaultStr)
{
return (cls == null) ? NullDefaultStr : cls.toString();
} | java | protected static String turnNullClass2EmptyString(Class<?> cls, String NullDefaultStr)
{
return (cls == null) ? NullDefaultStr : cls.toString();
} | [
"protected",
"static",
"String",
"turnNullClass2EmptyString",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"String",
"NullDefaultStr",
")",
"{",
"return",
"(",
"cls",
"==",
"null",
")",
"?",
"NullDefaultStr",
":",
"cls",
".",
"toString",
"(",
")",
";",
"}"
] | Helper method to convert a Class object to its textual representation.
If class is null, the <i>NullDefaultStr</i> is returned. | [
"Helper",
"method",
"to",
"convert",
"a",
"Class",
"object",
"to",
"its",
"textual",
"representation",
".",
"If",
"class",
"is",
"null",
"the",
"<i",
">",
"NullDefaultStr<",
"/",
"i",
">",
"is",
"returned",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/traceinfo/ejbcontainer/TEEJBInvocationInfoBase.java#L34-L37 |
michael-rapp/AndroidMaterialPreferences | library/src/main/java/de/mrapp/android/preference/SwitchPreference.java | SwitchPreference.createCheckedChangeListener | private OnCheckedChangeListener createCheckedChangeListener() {
return new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
if (getOnPreferenceChangeListener() == null || getOnPreferenceChangeListener()
.onPreferenceChange(SwitchPreference.this, isChecked)) {
setChecked(isChecked);
} else {
setChecked(!isChecked);
}
}
};
} | java | private OnCheckedChangeListener createCheckedChangeListener() {
return new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
if (getOnPreferenceChangeListener() == null || getOnPreferenceChangeListener()
.onPreferenceChange(SwitchPreference.this, isChecked)) {
setChecked(isChecked);
} else {
setChecked(!isChecked);
}
}
};
} | [
"private",
"OnCheckedChangeListener",
"createCheckedChangeListener",
"(",
")",
"{",
"return",
"new",
"OnCheckedChangeListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onCheckedChanged",
"(",
"final",
"CompoundButton",
"buttonView",
",",
"final",
"boolean",
... | Creates and returns a listener, which allows to change the preference's value, depending on
the preference's switch's state.
@return The listener, which has been created, as an instance of the type {@link
OnCheckedChangeListener} | [
"Creates",
"and",
"returns",
"a",
"listener",
"which",
"allows",
"to",
"change",
"the",
"preference",
"s",
"value",
"depending",
"on",
"the",
"preference",
"s",
"switch",
"s",
"state",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialPreferences/blob/73a7e449458313bd041fc8d6038e290506b68eb1/library/src/main/java/de/mrapp/android/preference/SwitchPreference.java#L154-L168 |
ysc/word | src/main/java/org/apdplat/word/corpus/Evaluation.java | Evaluation.evaluation | public static EvaluationResult evaluation(String resultText, String standardText, String perfectResult, String wrongResult) {
long start = System.currentTimeMillis();
int perfectLineCount=0;
int wrongLineCount=0;
int perfectCharCount=0;
int wrongCharCount=0;
try(BufferedReader resultReader = new BufferedReader(new InputStreamReader(new FileInputStream(resultText),"utf-8"));
BufferedReader standardReader = new BufferedReader(new InputStreamReader(new FileInputStream(standardText),"utf-8"));
BufferedWriter perfectResultWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(perfectResult),"utf-8"));
BufferedWriter wrongResultWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(wrongResult),"utf-8"))){
String result;
while( (result = resultReader.readLine()) != null ){
result = result.trim();
String standard = standardReader.readLine().trim();
if(result.equals("")){
continue;
}
if(result.equals(standard)){
//分词结果和标准一模一样
perfectResultWriter.write(standard+"\n");
perfectLineCount++;
perfectCharCount+=standard.replaceAll("\\s+", "").length();
}else{
//分词结果和标准不一样
wrongResultWriter.write("实际分词结果:"+result+"\n");
wrongResultWriter.write("标准分词结果:"+standard+"\n");
wrongLineCount++;
wrongCharCount+=standard.replaceAll("\\s+", "").length();
}
}
} catch (IOException ex) {
LOGGER.error("分词效果评估失败:", ex);
}
long cost = System.currentTimeMillis() - start;
int totalLineCount = perfectLineCount+wrongLineCount;
int totalCharCount = perfectCharCount+wrongCharCount;
LOGGER.info("评估耗时:"+cost+" 毫秒");
EvaluationResult er = new EvaluationResult();
er.setPerfectCharCount(perfectCharCount);
er.setPerfectLineCount(perfectLineCount);
er.setTotalCharCount(totalCharCount);
er.setTotalLineCount(totalLineCount);
er.setWrongCharCount(wrongCharCount);
er.setWrongLineCount(wrongLineCount);
return er;
} | java | public static EvaluationResult evaluation(String resultText, String standardText, String perfectResult, String wrongResult) {
long start = System.currentTimeMillis();
int perfectLineCount=0;
int wrongLineCount=0;
int perfectCharCount=0;
int wrongCharCount=0;
try(BufferedReader resultReader = new BufferedReader(new InputStreamReader(new FileInputStream(resultText),"utf-8"));
BufferedReader standardReader = new BufferedReader(new InputStreamReader(new FileInputStream(standardText),"utf-8"));
BufferedWriter perfectResultWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(perfectResult),"utf-8"));
BufferedWriter wrongResultWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(wrongResult),"utf-8"))){
String result;
while( (result = resultReader.readLine()) != null ){
result = result.trim();
String standard = standardReader.readLine().trim();
if(result.equals("")){
continue;
}
if(result.equals(standard)){
//分词结果和标准一模一样
perfectResultWriter.write(standard+"\n");
perfectLineCount++;
perfectCharCount+=standard.replaceAll("\\s+", "").length();
}else{
//分词结果和标准不一样
wrongResultWriter.write("实际分词结果:"+result+"\n");
wrongResultWriter.write("标准分词结果:"+standard+"\n");
wrongLineCount++;
wrongCharCount+=standard.replaceAll("\\s+", "").length();
}
}
} catch (IOException ex) {
LOGGER.error("分词效果评估失败:", ex);
}
long cost = System.currentTimeMillis() - start;
int totalLineCount = perfectLineCount+wrongLineCount;
int totalCharCount = perfectCharCount+wrongCharCount;
LOGGER.info("评估耗时:"+cost+" 毫秒");
EvaluationResult er = new EvaluationResult();
er.setPerfectCharCount(perfectCharCount);
er.setPerfectLineCount(perfectLineCount);
er.setTotalCharCount(totalCharCount);
er.setTotalLineCount(totalLineCount);
er.setWrongCharCount(wrongCharCount);
er.setWrongLineCount(wrongLineCount);
return er;
} | [
"public",
"static",
"EvaluationResult",
"evaluation",
"(",
"String",
"resultText",
",",
"String",
"standardText",
",",
"String",
"perfectResult",
",",
"String",
"wrongResult",
")",
"{",
"long",
"start",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"in... | 分词效果评估
@param resultText 实际分词结果文件路径
@param standardText 标准分词结果文件路径
@param perfectResult 分词完美内容保存文件路径
@param wrongResult 分词错误内容保存文件路径
@return 评估结果 | [
"分词效果评估"
] | train | https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/corpus/Evaluation.java#L157-L202 |
UrielCh/ovh-java-sdk | ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java | ApiOvhHorizonView.serviceName_accessPoint_accessPointId_customerNetwork_customerNetworkId_GET | public OvhCustomerNetworkPool serviceName_accessPoint_accessPointId_customerNetwork_customerNetworkId_GET(String serviceName, Long accessPointId, Long customerNetworkId) throws IOException {
String qPath = "/horizonView/{serviceName}/accessPoint/{accessPointId}/customerNetwork/{customerNetworkId}";
StringBuilder sb = path(qPath, serviceName, accessPointId, customerNetworkId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCustomerNetworkPool.class);
} | java | public OvhCustomerNetworkPool serviceName_accessPoint_accessPointId_customerNetwork_customerNetworkId_GET(String serviceName, Long accessPointId, Long customerNetworkId) throws IOException {
String qPath = "/horizonView/{serviceName}/accessPoint/{accessPointId}/customerNetwork/{customerNetworkId}";
StringBuilder sb = path(qPath, serviceName, accessPointId, customerNetworkId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhCustomerNetworkPool.class);
} | [
"public",
"OvhCustomerNetworkPool",
"serviceName_accessPoint_accessPointId_customerNetwork_customerNetworkId_GET",
"(",
"String",
"serviceName",
",",
"Long",
"accessPointId",
",",
"Long",
"customerNetworkId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/horizo... | Get this object properties
REST: GET /horizonView/{serviceName}/accessPoint/{accessPointId}/customerNetwork/{customerNetworkId}
@param serviceName [required] Domain of the service
@param accessPointId [required] Pool id
@param customerNetworkId [required] Customer Network id | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java#L122-L127 |
Erudika/para | para-server/src/main/java/com/erudika/para/persistence/AWSDynamoUtils.java | AWSDynamoUtils.updateTable | public static boolean updateTable(String appid, long readCapacity, long writeCapacity) {
if (StringUtils.isBlank(appid) || StringUtils.containsWhitespace(appid)) {
return false;
}
String table = getTableNameForAppid(appid);
try {
// AWS throws an exception if the new read/write capacity values are the same as the current ones
getClient().updateTable(new UpdateTableRequest().withTableName(table).
withProvisionedThroughput(new ProvisionedThroughput(readCapacity, writeCapacity)));
return true;
} catch (Exception e) {
logger.error("Could not update table '{}' - table is not active or no change to capacity: {}",
table, e.getMessage());
}
return false;
} | java | public static boolean updateTable(String appid, long readCapacity, long writeCapacity) {
if (StringUtils.isBlank(appid) || StringUtils.containsWhitespace(appid)) {
return false;
}
String table = getTableNameForAppid(appid);
try {
// AWS throws an exception if the new read/write capacity values are the same as the current ones
getClient().updateTable(new UpdateTableRequest().withTableName(table).
withProvisionedThroughput(new ProvisionedThroughput(readCapacity, writeCapacity)));
return true;
} catch (Exception e) {
logger.error("Could not update table '{}' - table is not active or no change to capacity: {}",
table, e.getMessage());
}
return false;
} | [
"public",
"static",
"boolean",
"updateTable",
"(",
"String",
"appid",
",",
"long",
"readCapacity",
",",
"long",
"writeCapacity",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"appid",
")",
"||",
"StringUtils",
".",
"containsWhitespace",
"(",
"appid"... | Updates the table settings (read and write capacities).
@param appid name of the {@link com.erudika.para.core.App}
@param readCapacity read capacity
@param writeCapacity write capacity
@return true if updated | [
"Updates",
"the",
"table",
"settings",
"(",
"read",
"and",
"write",
"capacities",
")",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/persistence/AWSDynamoUtils.java#L211-L226 |
adamfisk/littleshoot-util | src/main/java/org/littleshoot/util/xml/XPathUtils.java | XPathUtils.newXPath | public static XPathUtils newXPath(final String str) throws SAXException,
IOException {
final XPathFactory xpfactory = XPathFactory.newInstance();
final XPath xPath = xpfactory.newXPath();
final Document doc = XmlUtils.toDoc(str);
return new XPathUtils(xPath, doc);
} | java | public static XPathUtils newXPath(final String str) throws SAXException,
IOException {
final XPathFactory xpfactory = XPathFactory.newInstance();
final XPath xPath = xpfactory.newXPath();
final Document doc = XmlUtils.toDoc(str);
return new XPathUtils(xPath, doc);
} | [
"public",
"static",
"XPathUtils",
"newXPath",
"(",
"final",
"String",
"str",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"final",
"XPathFactory",
"xpfactory",
"=",
"XPathFactory",
".",
"newInstance",
"(",
")",
";",
"final",
"XPath",
"xPath",
"=",
"... | Creates a new {@link XPathUtils} instance.
@param str The string with XML data.
@return A new {@link XPathUtils} instance.
@throws SAXException If there's a SAX error in the XML.
@throws IOException If there's an IO error reading the stream. | [
"Creates",
"a",
"new",
"{",
"@link",
"XPathUtils",
"}",
"instance",
"."
] | train | https://github.com/adamfisk/littleshoot-util/blob/3c0dc4955116b3382d6b0575d2f164b7508a4f73/src/main/java/org/littleshoot/util/xml/XPathUtils.java#L86-L92 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ProjectsInner.java | ProjectsInner.createOrUpdate | public ProjectInner createOrUpdate(String groupName, String serviceName, String projectName, ProjectInner parameters) {
return createOrUpdateWithServiceResponseAsync(groupName, serviceName, projectName, parameters).toBlocking().single().body();
} | java | public ProjectInner createOrUpdate(String groupName, String serviceName, String projectName, ProjectInner parameters) {
return createOrUpdateWithServiceResponseAsync(groupName, serviceName, projectName, parameters).toBlocking().single().body();
} | [
"public",
"ProjectInner",
"createOrUpdate",
"(",
"String",
"groupName",
",",
"String",
"serviceName",
",",
"String",
"projectName",
",",
"ProjectInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"groupName",
",",
"serviceName",
","... | Create or update project.
The project resource is a nested resource representing a stored migration project. The PUT method creates a new project or updates an existing one.
@param groupName Name of the resource group
@param serviceName Name of the service
@param projectName Name of the project
@param parameters Information about the project
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ProjectInner object if successful. | [
"Create",
"or",
"update",
"project",
".",
"The",
"project",
"resource",
"is",
"a",
"nested",
"resource",
"representing",
"a",
"stored",
"migration",
"project",
".",
"The",
"PUT",
"method",
"creates",
"a",
"new",
"project",
"or",
"updates",
"an",
"existing",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ProjectsInner.java#L232-L234 |
ManfredTremmel/gwt-bean-validators | gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/engine/path/NodeImpl.java | NodeImpl.makeIterableAndSetIndex | public static NodeImpl makeIterableAndSetIndex(final NodeImpl node, final Integer index) {
return new NodeImpl( //
node.name, //
node.parent, //
true, //
index, //
null, //
node.kind, //
node.parameterTypes, //
node.parameterIndex, //
node.value, //
node.containerClass, //
node.typeArgumentIndex //
);
} | java | public static NodeImpl makeIterableAndSetIndex(final NodeImpl node, final Integer index) {
return new NodeImpl( //
node.name, //
node.parent, //
true, //
index, //
null, //
node.kind, //
node.parameterTypes, //
node.parameterIndex, //
node.value, //
node.containerClass, //
node.typeArgumentIndex //
);
} | [
"public",
"static",
"NodeImpl",
"makeIterableAndSetIndex",
"(",
"final",
"NodeImpl",
"node",
",",
"final",
"Integer",
"index",
")",
"{",
"return",
"new",
"NodeImpl",
"(",
"//",
"node",
".",
"name",
",",
"//",
"node",
".",
"parent",
",",
"//",
"true",
",",
... | make it iterable and set index.
@param node node to build
@param index index to set
@return iterable node implementation | [
"make",
"it",
"iterable",
"and",
"set",
"index",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/engine/path/NodeImpl.java#L311-L325 |
operasoftware/operaprestodriver | src/com/opera/core/systems/OperaDriver.java | OperaDriver.findElement | protected WebElement findElement(String by, String using, OperaWebElement el) {
checkNotNull(using, "Cannot find elements when the selector is null");
assertConnected();
using = OperaStrings.escapeJsString(using);
boolean isAvailable;
Integer id;
String script;
if (el == null) {
// Search the document
script =
"return " + OperaAtom.FIND_ELEMENT + "({\"" + by + "\": \"" + using + "\"})";
} else {
// Search within an element
script =
"return " + OperaAtom.FIND_ELEMENT + "({\"" + by + "\": \"" + using
+ "\"}, locator)";
}
if (el == null) {
id = debugger.getObject(script);
} else {
id = debugger.executeScriptOnObject(script, el.getObjectId());
}
isAvailable = (id != null);
if (isAvailable) {
String error =
debugger.callFunctionOnObject("return (locator instanceof Error) ? locator.message : ''",
id);
if (!error.isEmpty()) {
throw new InvalidSelectorException(error);
}
Boolean isStale =
Boolean.valueOf(debugger.callFunctionOnObject("locator.parentNode == undefined", id));
if (isStale) {
throw new StaleElementReferenceException("This element is no longer part of DOM");
}
return new OperaWebElement(this, id);
} else {
throw new NoSuchElementException("Cannot find element(s) with " + by);
}
} | java | protected WebElement findElement(String by, String using, OperaWebElement el) {
checkNotNull(using, "Cannot find elements when the selector is null");
assertConnected();
using = OperaStrings.escapeJsString(using);
boolean isAvailable;
Integer id;
String script;
if (el == null) {
// Search the document
script =
"return " + OperaAtom.FIND_ELEMENT + "({\"" + by + "\": \"" + using + "\"})";
} else {
// Search within an element
script =
"return " + OperaAtom.FIND_ELEMENT + "({\"" + by + "\": \"" + using
+ "\"}, locator)";
}
if (el == null) {
id = debugger.getObject(script);
} else {
id = debugger.executeScriptOnObject(script, el.getObjectId());
}
isAvailable = (id != null);
if (isAvailable) {
String error =
debugger.callFunctionOnObject("return (locator instanceof Error) ? locator.message : ''",
id);
if (!error.isEmpty()) {
throw new InvalidSelectorException(error);
}
Boolean isStale =
Boolean.valueOf(debugger.callFunctionOnObject("locator.parentNode == undefined", id));
if (isStale) {
throw new StaleElementReferenceException("This element is no longer part of DOM");
}
return new OperaWebElement(this, id);
} else {
throw new NoSuchElementException("Cannot find element(s) with " + by);
}
} | [
"protected",
"WebElement",
"findElement",
"(",
"String",
"by",
",",
"String",
"using",
",",
"OperaWebElement",
"el",
")",
"{",
"checkNotNull",
"(",
"using",
",",
"\"Cannot find elements when the selector is null\"",
")",
";",
"assertConnected",
"(",
")",
";",
"using... | Find a single element using the selenium atoms.
@param by how to find the element, strings defined in RemoteWebDriver
@param using the value to use to find the element
@param el the element to search within
@return an element | [
"Find",
"a",
"single",
"element",
"using",
"the",
"selenium",
"atoms",
"."
] | train | https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaDriver.java#L452-L499 |
samskivert/pythagoras | src/main/java/pythagoras/f/Matrix3.java | Matrix3.setToRotation | public Matrix3 setToRotation (IVector3 from, IVector3 to) {
float angle = from.angle(to);
return (angle < 0.0001f) ?
setToIdentity() : setToRotation(angle, from.cross(to).normalizeLocal());
} | java | public Matrix3 setToRotation (IVector3 from, IVector3 to) {
float angle = from.angle(to);
return (angle < 0.0001f) ?
setToIdentity() : setToRotation(angle, from.cross(to).normalizeLocal());
} | [
"public",
"Matrix3",
"setToRotation",
"(",
"IVector3",
"from",
",",
"IVector3",
"to",
")",
"{",
"float",
"angle",
"=",
"from",
".",
"angle",
"(",
"to",
")",
";",
"return",
"(",
"angle",
"<",
"0.0001f",
")",
"?",
"setToIdentity",
"(",
")",
":",
"setToRo... | Sets this to a rotation matrix that rotates one vector onto another.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"rotation",
"matrix",
"that",
"rotates",
"one",
"vector",
"onto",
"another",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Matrix3.java#L155-L159 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/AbstractRenderer.java | AbstractRenderer.buildContextURL | protected String buildContextURL(ODataRequestContext requestContext, Object data) throws ODataRenderException {
ODataUri oDataUri = requestContext.getUri();
if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) {
return buildContextUrlFromOperationCall(oDataUri, requestContext.getEntityDataModel(),
isListOrStream(data));
}
Option<String> contextURL;
if (isWriteOperation(requestContext)) {
contextURL = getContextUrlWriteOperation(oDataUri);
} else {
contextURL = getContextUrl(oDataUri);
}
checkContextURL(requestContext, contextURL);
return contextURL.get();
} | java | protected String buildContextURL(ODataRequestContext requestContext, Object data) throws ODataRenderException {
ODataUri oDataUri = requestContext.getUri();
if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) {
return buildContextUrlFromOperationCall(oDataUri, requestContext.getEntityDataModel(),
isListOrStream(data));
}
Option<String> contextURL;
if (isWriteOperation(requestContext)) {
contextURL = getContextUrlWriteOperation(oDataUri);
} else {
contextURL = getContextUrl(oDataUri);
}
checkContextURL(requestContext, contextURL);
return contextURL.get();
} | [
"protected",
"String",
"buildContextURL",
"(",
"ODataRequestContext",
"requestContext",
",",
"Object",
"data",
")",
"throws",
"ODataRenderException",
"{",
"ODataUri",
"oDataUri",
"=",
"requestContext",
".",
"getUri",
"(",
")",
";",
"if",
"(",
"ODataUriUtil",
".",
... | Build the 'Context URL' from a given OData request context.
@param requestContext The given OData request context
@param data Result data
@return The built 'Context URL'
@throws ODataRenderException If unable to build context url | [
"Build",
"the",
"Context",
"URL",
"from",
"a",
"given",
"OData",
"request",
"context",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/AbstractRenderer.java#L205-L220 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PRStream.java | PRStream.setData | public void setData(byte[] data, boolean compress, int compressionLevel) {
remove(PdfName.FILTER);
this.offset = -1;
if (Document.compress && compress) {
try {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Deflater deflater = new Deflater(compressionLevel);
DeflaterOutputStream zip = new DeflaterOutputStream(stream, deflater);
zip.write(data);
zip.close();
deflater.end();
bytes = stream.toByteArray();
this.compressionLevel = compressionLevel;
}
catch (IOException ioe) {
throw new ExceptionConverter(ioe);
}
put(PdfName.FILTER, PdfName.FLATEDECODE);
}
else
bytes = data;
setLength(bytes.length);
} | java | public void setData(byte[] data, boolean compress, int compressionLevel) {
remove(PdfName.FILTER);
this.offset = -1;
if (Document.compress && compress) {
try {
ByteArrayOutputStream stream = new ByteArrayOutputStream();
Deflater deflater = new Deflater(compressionLevel);
DeflaterOutputStream zip = new DeflaterOutputStream(stream, deflater);
zip.write(data);
zip.close();
deflater.end();
bytes = stream.toByteArray();
this.compressionLevel = compressionLevel;
}
catch (IOException ioe) {
throw new ExceptionConverter(ioe);
}
put(PdfName.FILTER, PdfName.FLATEDECODE);
}
else
bytes = data;
setLength(bytes.length);
} | [
"public",
"void",
"setData",
"(",
"byte",
"[",
"]",
"data",
",",
"boolean",
"compress",
",",
"int",
"compressionLevel",
")",
"{",
"remove",
"(",
"PdfName",
".",
"FILTER",
")",
";",
"this",
".",
"offset",
"=",
"-",
"1",
";",
"if",
"(",
"Document",
"."... | Sets the data associated with the stream, either compressed or
uncompressed. Note that the data will never be compressed if
Document.compress is set to false.
@param data raw data, decrypted and uncompressed.
@param compress true if you want the stream to be compressed.
@param compressionLevel a value between -1 and 9 (ignored if compress == false)
@since iText 2.1.3 | [
"Sets",
"the",
"data",
"associated",
"with",
"the",
"stream",
"either",
"compressed",
"or",
"uncompressed",
".",
"Note",
"that",
"the",
"data",
"will",
"never",
"be",
"compressed",
"if",
"Document",
".",
"compress",
"is",
"set",
"to",
"false",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PRStream.java#L155-L177 |
structurizr/java | structurizr-core/src/com/structurizr/documentation/StructurizrDocumentationTemplate.java | StructurizrDocumentationTemplate.addCodeSection | @Nonnull
public Section addCodeSection(@Nullable Component component, @Nonnull Format format, @Nonnull String content) {
return addSection(component, "Code", format, content);
} | java | @Nonnull
public Section addCodeSection(@Nullable Component component, @Nonnull Format format, @Nonnull String content) {
return addSection(component, "Code", format, content);
} | [
"@",
"Nonnull",
"public",
"Section",
"addCodeSection",
"(",
"@",
"Nullable",
"Component",
"component",
",",
"@",
"Nonnull",
"Format",
"format",
",",
"@",
"Nonnull",
"String",
"content",
")",
"{",
"return",
"addSection",
"(",
"component",
",",
"\"Code\"",
",",
... | Adds a "Code" section relating to a {@link Component}.
@param component the {@link Component} the documentation content relates to
@param format the {@link Format} of the documentation content
@param content a String containing the documentation content
@return a documentation {@link Section} | [
"Adds",
"a",
"Code",
"section",
"relating",
"to",
"a",
"{",
"@link",
"Component",
"}",
"."
] | train | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/StructurizrDocumentationTemplate.java#L278-L281 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java | Infer.reportInstError | void reportInstError(UndetVar uv, InferenceBound ib) {
reportInferenceError(
String.format("inferred.do.not.conform.to.%s.bounds", StringUtils.toLowerCase(ib.name())),
uv.getInst(),
uv.getBounds(ib));
} | java | void reportInstError(UndetVar uv, InferenceBound ib) {
reportInferenceError(
String.format("inferred.do.not.conform.to.%s.bounds", StringUtils.toLowerCase(ib.name())),
uv.getInst(),
uv.getBounds(ib));
} | [
"void",
"reportInstError",
"(",
"UndetVar",
"uv",
",",
"InferenceBound",
"ib",
")",
"{",
"reportInferenceError",
"(",
"String",
".",
"format",
"(",
"\"inferred.do.not.conform.to.%s.bounds\"",
",",
"StringUtils",
".",
"toLowerCase",
"(",
"ib",
".",
"name",
"(",
")"... | Incorporation error: mismatch between inferred type and given bound. | [
"Incorporation",
"error",
":",
"mismatch",
"between",
"inferred",
"type",
"and",
"given",
"bound",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java#L1270-L1275 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java | DateFunctions.dateAddStr | public static Expression dateAddStr(Expression expression, int n, DatePart part) {
return x("DATE_ADD_STR(" + expression.toString() + ", " + n + ", \"" + part + "\")");
} | java | public static Expression dateAddStr(Expression expression, int n, DatePart part) {
return x("DATE_ADD_STR(" + expression.toString() + ", " + n + ", \"" + part + "\")");
} | [
"public",
"static",
"Expression",
"dateAddStr",
"(",
"Expression",
"expression",
",",
"int",
"n",
",",
"DatePart",
"part",
")",
"{",
"return",
"x",
"(",
"\"DATE_ADD_STR(\"",
"+",
"expression",
".",
"toString",
"(",
")",
"+",
"\", \"",
"+",
"n",
"+",
"\", \... | Returned expression results in Performs Date arithmetic. n and part are used to define an interval or duration,
which is then added (or subtracted) to the date string in a supported format, returning the result. | [
"Returned",
"expression",
"results",
"in",
"Performs",
"Date",
"arithmetic",
".",
"n",
"and",
"part",
"are",
"used",
"to",
"define",
"an",
"interval",
"or",
"duration",
"which",
"is",
"then",
"added",
"(",
"or",
"subtracted",
")",
"to",
"the",
"date",
"str... | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L90-L92 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/utilities/ServerUtility.java | ServerUtility.getServerResponseAsStream | private static InputStream getServerResponseAsStream(String protocol,
String user,
String pass,
String path) throws IOException {
String url = getBaseURL(protocol) + path;
logger.info("Getting URL: {}", url);
UsernamePasswordCredentials creds =
new UsernamePasswordCredentials(user, pass);
return s_webClient.get(url, true, creds);
} | java | private static InputStream getServerResponseAsStream(String protocol,
String user,
String pass,
String path) throws IOException {
String url = getBaseURL(protocol) + path;
logger.info("Getting URL: {}", url);
UsernamePasswordCredentials creds =
new UsernamePasswordCredentials(user, pass);
return s_webClient.get(url, true, creds);
} | [
"private",
"static",
"InputStream",
"getServerResponseAsStream",
"(",
"String",
"protocol",
",",
"String",
"user",
",",
"String",
"pass",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"String",
"url",
"=",
"getBaseURL",
"(",
"protocol",
")",
"+",
"... | Hits the given Fedora Server URL and returns the response as a String.
Throws an IOException if the response code is not 200(OK). | [
"Hits",
"the",
"given",
"Fedora",
"Server",
"URL",
"and",
"returns",
"the",
"response",
"as",
"a",
"String",
".",
"Throws",
"an",
"IOException",
"if",
"the",
"response",
"code",
"is",
"not",
"200",
"(",
"OK",
")",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/utilities/ServerUtility.java#L144-L153 |
netty/netty | transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java | AbstractCoalescingBufferQueue.copyAndCompose | protected final ByteBuf copyAndCompose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) {
ByteBuf newCumulation = alloc.ioBuffer(cumulation.readableBytes() + next.readableBytes());
try {
newCumulation.writeBytes(cumulation).writeBytes(next);
} catch (Throwable cause) {
newCumulation.release();
safeRelease(next);
throwException(cause);
}
cumulation.release();
next.release();
return newCumulation;
} | java | protected final ByteBuf copyAndCompose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) {
ByteBuf newCumulation = alloc.ioBuffer(cumulation.readableBytes() + next.readableBytes());
try {
newCumulation.writeBytes(cumulation).writeBytes(next);
} catch (Throwable cause) {
newCumulation.release();
safeRelease(next);
throwException(cause);
}
cumulation.release();
next.release();
return newCumulation;
} | [
"protected",
"final",
"ByteBuf",
"copyAndCompose",
"(",
"ByteBufAllocator",
"alloc",
",",
"ByteBuf",
"cumulation",
",",
"ByteBuf",
"next",
")",
"{",
"ByteBuf",
"newCumulation",
"=",
"alloc",
".",
"ioBuffer",
"(",
"cumulation",
".",
"readableBytes",
"(",
")",
"+"... | Compose {@code cumulation} and {@code next} into a new {@link ByteBufAllocator#ioBuffer()}.
@param alloc The allocator to use to allocate the new buffer.
@param cumulation The current cumulation.
@param next The next buffer.
@return The result of {@code cumulation + next}. | [
"Compose",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java#L292-L304 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_line_serviceName_PUT | public void billingAccount_line_serviceName_PUT(String billingAccount, String serviceName, OvhLine body) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}";
StringBuilder sb = path(qPath, billingAccount, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void billingAccount_line_serviceName_PUT(String billingAccount, String serviceName, OvhLine body) throws IOException {
String qPath = "/telephony/{billingAccount}/line/{serviceName}";
StringBuilder sb = path(qPath, billingAccount, serviceName);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"billingAccount_line_serviceName_PUT",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"OvhLine",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/line/{serviceName}\"",
";",
"StringBuild... | Alter this object properties
REST: PUT /telephony/{billingAccount}/line/{serviceName}
@param body [required] New object properties
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1485-L1489 |
j256/simplecsv | src/main/java/com/j256/simplecsv/processor/CsvProcessor.java | CsvProcessor.writeHeader | public void writeHeader(BufferedWriter bufferedWriter, boolean appendLineTermination) throws IOException {
checkEntityConfig();
bufferedWriter.write(buildHeaderLine(appendLineTermination));
} | java | public void writeHeader(BufferedWriter bufferedWriter, boolean appendLineTermination) throws IOException {
checkEntityConfig();
bufferedWriter.write(buildHeaderLine(appendLineTermination));
} | [
"public",
"void",
"writeHeader",
"(",
"BufferedWriter",
"bufferedWriter",
",",
"boolean",
"appendLineTermination",
")",
"throws",
"IOException",
"{",
"checkEntityConfig",
"(",
")",
";",
"bufferedWriter",
".",
"write",
"(",
"buildHeaderLine",
"(",
"appendLineTermination"... | Write the header line to the writer.
@param bufferedWriter
Where to write our header information.
@param appendLineTermination
Set to true to add the newline to the end of the line.
@throws IOException
If there are any IO exceptions thrown when writing. | [
"Write",
"the",
"header",
"line",
"to",
"the",
"writer",
"."
] | train | https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L451-L454 |
teatrove/teatrove | trove/src/main/java/org/teatrove/trove/classfile/Modifiers.java | Modifiers.setFinal | public static int setFinal(int modifier, boolean b) {
if (b) {
return (modifier | FINAL) & (~INTERFACE & ~ABSTRACT);
}
else {
return modifier & ~FINAL;
}
} | java | public static int setFinal(int modifier, boolean b) {
if (b) {
return (modifier | FINAL) & (~INTERFACE & ~ABSTRACT);
}
else {
return modifier & ~FINAL;
}
} | [
"public",
"static",
"int",
"setFinal",
"(",
"int",
"modifier",
",",
"boolean",
"b",
")",
"{",
"if",
"(",
"b",
")",
"{",
"return",
"(",
"modifier",
"|",
"FINAL",
")",
"&",
"(",
"~",
"INTERFACE",
"&",
"~",
"ABSTRACT",
")",
";",
"}",
"else",
"{",
"r... | When set final, the modifier is cleared from being an interface or
abstract. | [
"When",
"set",
"final",
"the",
"modifier",
"is",
"cleared",
"from",
"being",
"an",
"interface",
"or",
"abstract",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/classfile/Modifiers.java#L82-L89 |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java | PersistenceController.deleteConversations | public Observable<Boolean> deleteConversations(List<ChatConversationBase> conversationsToDelete) {
return asObservable(new Executor<Boolean>() {
@Override
void execute(ChatStore store, Emitter<Boolean> emitter) {
store.beginTransaction();
boolean isSuccess = true;
for (int i = 0; i < conversationsToDelete.size(); i++) {
isSuccess = isSuccess && store.deleteConversation(conversationsToDelete.get(i).getConversationId());
}
store.endTransaction();
emitter.onNext(isSuccess);
emitter.onCompleted();
}
});
} | java | public Observable<Boolean> deleteConversations(List<ChatConversationBase> conversationsToDelete) {
return asObservable(new Executor<Boolean>() {
@Override
void execute(ChatStore store, Emitter<Boolean> emitter) {
store.beginTransaction();
boolean isSuccess = true;
for (int i = 0; i < conversationsToDelete.size(); i++) {
isSuccess = isSuccess && store.deleteConversation(conversationsToDelete.get(i).getConversationId());
}
store.endTransaction();
emitter.onNext(isSuccess);
emitter.onCompleted();
}
});
} | [
"public",
"Observable",
"<",
"Boolean",
">",
"deleteConversations",
"(",
"List",
"<",
"ChatConversationBase",
">",
"conversationsToDelete",
")",
"{",
"return",
"asObservable",
"(",
"new",
"Executor",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"void",
... | Delete conversations from the store.
@param conversationsToDelete List of conversations to delete.
@return Observable emitting result. | [
"Delete",
"conversations",
"from",
"the",
"store",
"."
] | train | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java#L575-L589 |
apache/spark | launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java | CommandBuilderUtils.findJarsDir | static String findJarsDir(String sparkHome, String scalaVersion, boolean failIfNotFound) {
// TODO: change to the correct directory once the assembly build is changed.
File libdir = new File(sparkHome, "jars");
if (!libdir.isDirectory()) {
libdir = new File(sparkHome, String.format("assembly/target/scala-%s/jars", scalaVersion));
if (!libdir.isDirectory()) {
checkState(!failIfNotFound,
"Library directory '%s' does not exist; make sure Spark is built.",
libdir.getAbsolutePath());
return null;
}
}
return libdir.getAbsolutePath();
} | java | static String findJarsDir(String sparkHome, String scalaVersion, boolean failIfNotFound) {
// TODO: change to the correct directory once the assembly build is changed.
File libdir = new File(sparkHome, "jars");
if (!libdir.isDirectory()) {
libdir = new File(sparkHome, String.format("assembly/target/scala-%s/jars", scalaVersion));
if (!libdir.isDirectory()) {
checkState(!failIfNotFound,
"Library directory '%s' does not exist; make sure Spark is built.",
libdir.getAbsolutePath());
return null;
}
}
return libdir.getAbsolutePath();
} | [
"static",
"String",
"findJarsDir",
"(",
"String",
"sparkHome",
",",
"String",
"scalaVersion",
",",
"boolean",
"failIfNotFound",
")",
"{",
"// TODO: change to the correct directory once the assembly build is changed.",
"File",
"libdir",
"=",
"new",
"File",
"(",
"sparkHome",
... | Find the location of the Spark jars dir, depending on whether we're looking at a build
or a distribution directory. | [
"Find",
"the",
"location",
"of",
"the",
"Spark",
"jars",
"dir",
"depending",
"on",
"whether",
"we",
"re",
"looking",
"at",
"a",
"build",
"or",
"a",
"distribution",
"directory",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java#L316-L329 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.addIntentWithServiceResponseAsync | public Observable<ServiceResponse<UUID>> addIntentWithServiceResponseAsync(UUID appId, String versionId, AddIntentOptionalParameter addIntentOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final String name = addIntentOptionalParameter != null ? addIntentOptionalParameter.name() : null;
return addIntentWithServiceResponseAsync(appId, versionId, name);
} | java | public Observable<ServiceResponse<UUID>> addIntentWithServiceResponseAsync(UUID appId, String versionId, AddIntentOptionalParameter addIntentOptionalParameter) {
if (this.client.endpoint() == null) {
throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null.");
}
if (appId == null) {
throw new IllegalArgumentException("Parameter appId is required and cannot be null.");
}
if (versionId == null) {
throw new IllegalArgumentException("Parameter versionId is required and cannot be null.");
}
final String name = addIntentOptionalParameter != null ? addIntentOptionalParameter.name() : null;
return addIntentWithServiceResponseAsync(appId, versionId, name);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"UUID",
">",
">",
"addIntentWithServiceResponseAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"AddIntentOptionalParameter",
"addIntentOptionalParameter",
")",
"{",
"if",
"(",
"this",
".",
"client",
... | Adds an intent classifier to the application.
@param appId The application ID.
@param versionId The version ID.
@param addIntentOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object | [
"Adds",
"an",
"intent",
"classifier",
"to",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L628-L641 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrRequestHandler.java | JawrRequestHandler.initResourceBundleHandler | protected ResourceBundleHandler initResourceBundleHandler() {
ResourceBundleHandler rsHandler = null;
if (jawrConfig.getUseBundleMapping() && StringUtils.isNotEmpty(jawrConfig.getJawrWorkingDirectory())) {
rsHandler = new ServletContextResourceBundleHandler(servletContext, jawrConfig.getJawrWorkingDirectory(),
jawrConfig.getResourceCharset(), jawrConfig.getGeneratorRegistry(), resourceType);
} else {
rsHandler = new ServletContextResourceBundleHandler(servletContext, jawrConfig.getResourceCharset(),
jawrConfig.getGeneratorRegistry(), resourceType);
}
return rsHandler;
} | java | protected ResourceBundleHandler initResourceBundleHandler() {
ResourceBundleHandler rsHandler = null;
if (jawrConfig.getUseBundleMapping() && StringUtils.isNotEmpty(jawrConfig.getJawrWorkingDirectory())) {
rsHandler = new ServletContextResourceBundleHandler(servletContext, jawrConfig.getJawrWorkingDirectory(),
jawrConfig.getResourceCharset(), jawrConfig.getGeneratorRegistry(), resourceType);
} else {
rsHandler = new ServletContextResourceBundleHandler(servletContext, jawrConfig.getResourceCharset(),
jawrConfig.getGeneratorRegistry(), resourceType);
}
return rsHandler;
} | [
"protected",
"ResourceBundleHandler",
"initResourceBundleHandler",
"(",
")",
"{",
"ResourceBundleHandler",
"rsHandler",
"=",
"null",
";",
"if",
"(",
"jawrConfig",
".",
"getUseBundleMapping",
"(",
")",
"&&",
"StringUtils",
".",
"isNotEmpty",
"(",
"jawrConfig",
".",
"... | Initialize the resource bundle handler
@return the resource bundle handler | [
"Initialize",
"the",
"resource",
"bundle",
"handler"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/servlet/JawrRequestHandler.java#L600-L610 |
Whiley/WhileyCompiler | src/main/java/wyil/interpreter/Interpreter.java | Interpreter.executeFail | private Status executeFail(Stmt.Fail stmt, CallStack frame, EnclosingScope scope) {
throw new AssertionError("Runtime fault occurred");
} | java | private Status executeFail(Stmt.Fail stmt, CallStack frame, EnclosingScope scope) {
throw new AssertionError("Runtime fault occurred");
} | [
"private",
"Status",
"executeFail",
"(",
"Stmt",
".",
"Fail",
"stmt",
",",
"CallStack",
"frame",
",",
"EnclosingScope",
"scope",
")",
"{",
"throw",
"new",
"AssertionError",
"(",
"\"Runtime fault occurred\"",
")",
";",
"}"
] | Execute a fail statement at a given point in the function or method body.
This will generate a runtime fault.
@param stmt
--- The fail statement to execute
@param frame
--- The current stack frame
@return | [
"Execute",
"a",
"fail",
"statement",
"at",
"a",
"given",
"point",
"in",
"the",
"function",
"or",
"method",
"body",
".",
"This",
"will",
"generate",
"a",
"runtime",
"fault",
"."
] | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L366-L368 |
JodaOrg/joda-time-jsptags | src/main/java/org/joda/time/contrib/jsptag/Util.java | Util.findMatch | private static ResourceBundle findMatch(String basename, Locale pref) {
ResourceBundle match = null;
try {
ResourceBundle bundle = ResourceBundle.getBundle(basename, pref,
Thread.currentThread().getContextClassLoader());
Locale avail = bundle.getLocale();
if (pref.equals(avail)) {
// Exact match
match = bundle;
} else {
/*
* We have to make sure that the match we got is for the
* specified locale. The way ResourceBundle.getBundle() works,
* if a match is not found with (1) the specified locale, it
* tries to match with (2) the current default locale as
* returned by Locale.getDefault() or (3) the root resource
* bundle (basename). We must ignore any match that could have
* worked with (2) or (3). So if an exact match is not found, we
* make the following extra tests: - avail locale must be equal
* to preferred locale - avail country must be empty or equal to
* preferred country (the equality match might have failed on
* the variant)
*/
if (pref.getLanguage().equals(avail.getLanguage())
&& ("".equals(avail.getCountry()) || pref.getCountry()
.equals(avail.getCountry()))) {
/*
* Language match. By making sure the available locale does
* not have a country and matches the preferred locale's
* language, we rule out "matches" based on the container's
* default locale. For example, if the preferred locale is
* "en-US", the container's default locale is "en-UK", and
* there is a resource bundle (with the requested base name)
* available for "en-UK", ResourceBundle.getBundle() will
* return it, but even though its language matches that of
* the preferred locale, we must ignore it, because matches
* based on the container's default locale are not portable
* across different containers with different default
* locales.
*/
match = bundle;
}
}
} catch (MissingResourceException mre) {
}
return match;
} | java | private static ResourceBundle findMatch(String basename, Locale pref) {
ResourceBundle match = null;
try {
ResourceBundle bundle = ResourceBundle.getBundle(basename, pref,
Thread.currentThread().getContextClassLoader());
Locale avail = bundle.getLocale();
if (pref.equals(avail)) {
// Exact match
match = bundle;
} else {
/*
* We have to make sure that the match we got is for the
* specified locale. The way ResourceBundle.getBundle() works,
* if a match is not found with (1) the specified locale, it
* tries to match with (2) the current default locale as
* returned by Locale.getDefault() or (3) the root resource
* bundle (basename). We must ignore any match that could have
* worked with (2) or (3). So if an exact match is not found, we
* make the following extra tests: - avail locale must be equal
* to preferred locale - avail country must be empty or equal to
* preferred country (the equality match might have failed on
* the variant)
*/
if (pref.getLanguage().equals(avail.getLanguage())
&& ("".equals(avail.getCountry()) || pref.getCountry()
.equals(avail.getCountry()))) {
/*
* Language match. By making sure the available locale does
* not have a country and matches the preferred locale's
* language, we rule out "matches" based on the container's
* default locale. For example, if the preferred locale is
* "en-US", the container's default locale is "en-UK", and
* there is a resource bundle (with the requested base name)
* available for "en-UK", ResourceBundle.getBundle() will
* return it, but even though its language matches that of
* the preferred locale, we must ignore it, because matches
* based on the container's default locale are not portable
* across different containers with different default
* locales.
*/
match = bundle;
}
}
} catch (MissingResourceException mre) {
}
return match;
} | [
"private",
"static",
"ResourceBundle",
"findMatch",
"(",
"String",
"basename",
",",
"Locale",
"pref",
")",
"{",
"ResourceBundle",
"match",
"=",
"null",
";",
"try",
"{",
"ResourceBundle",
"bundle",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"basename",
",",
... | Gets the resource bundle with the given base name and preferred locale.
This method calls java.util.ResourceBundle.getBundle(), but ignores its
return value unless its locale represents an exact or language match with
the given preferred locale.
@param basename the resource bundle base name @param pref the preferred
locale
@return the requested resource bundle, or <tt>null</tt> if no resource
bundle with the given base name exists or if there is no exact- or
language-match between the preferred locale and the locale of the bundle
returned by java.util.ResourceBundle.getBundle(). | [
"Gets",
"the",
"resource",
"bundle",
"with",
"the",
"given",
"base",
"name",
"and",
"preferred",
"locale",
"."
] | train | https://github.com/JodaOrg/joda-time-jsptags/blob/69008a813568cb6f3e37ea7a80f8b1f2070edf14/src/main/java/org/joda/time/contrib/jsptag/Util.java#L586-L634 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java | JComponentFactory.newHelpSet | public static HelpSet newHelpSet(final String directoryPath, final String filename)
throws HelpSetException
{
String absolutePath = directoryPath + filename;
URL hsURL = ClassExtensions.getResource(absolutePath);
HelpSet hs = new HelpSet(ClassExtensions.getClassLoader(), hsURL);
return hs;
} | java | public static HelpSet newHelpSet(final String directoryPath, final String filename)
throws HelpSetException
{
String absolutePath = directoryPath + filename;
URL hsURL = ClassExtensions.getResource(absolutePath);
HelpSet hs = new HelpSet(ClassExtensions.getClassLoader(), hsURL);
return hs;
} | [
"public",
"static",
"HelpSet",
"newHelpSet",
"(",
"final",
"String",
"directoryPath",
",",
"final",
"String",
"filename",
")",
"throws",
"HelpSetException",
"{",
"String",
"absolutePath",
"=",
"directoryPath",
"+",
"filename",
";",
"URL",
"hsURL",
"=",
"ClassExten... | Factory method for create new {@link HelpSet} object.
@param directoryPath
the directory path
@param filename
the filename
@return the new {@link HelpSet} object
@throws HelpSetException
is thrown if there are problems parsing the {@link HelpSet} object. | [
"Factory",
"method",
"for",
"create",
"new",
"{",
"@link",
"HelpSet",
"}",
"object",
"."
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/components/factories/JComponentFactory.java#L141-L148 |
gresrun/jesque | src/main/java/net/greghaines/jesque/client/AbstractClient.java | AbstractClient.doPriorityEnqueue | public static void doPriorityEnqueue(final Jedis jedis, final String namespace, final String queue, final String jobJson) {
jedis.sadd(JesqueUtils.createKey(namespace, QUEUES), queue);
jedis.lpush(JesqueUtils.createKey(namespace, QUEUE, queue), jobJson);
} | java | public static void doPriorityEnqueue(final Jedis jedis, final String namespace, final String queue, final String jobJson) {
jedis.sadd(JesqueUtils.createKey(namespace, QUEUES), queue);
jedis.lpush(JesqueUtils.createKey(namespace, QUEUE, queue), jobJson);
} | [
"public",
"static",
"void",
"doPriorityEnqueue",
"(",
"final",
"Jedis",
"jedis",
",",
"final",
"String",
"namespace",
",",
"final",
"String",
"queue",
",",
"final",
"String",
"jobJson",
")",
"{",
"jedis",
".",
"sadd",
"(",
"JesqueUtils",
".",
"createKey",
"(... | Helper method that encapsulates the minimum logic for adding a high
priority job to a queue.
@param jedis
the connection to Redis
@param namespace
the Resque namespace
@param queue
the Resque queue name
@param jobJson
the job serialized as JSON | [
"Helper",
"method",
"that",
"encapsulates",
"the",
"minimum",
"logic",
"for",
"adding",
"a",
"high",
"priority",
"job",
"to",
"a",
"queue",
"."
] | train | https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/client/AbstractClient.java#L256-L259 |
apache/incubator-heron | heron/spi/src/java/org/apache/heron/spi/common/TokenSub.java | TokenSub.combinePaths | private static String combinePaths(List<String> paths) {
File file = new File(paths.get(0));
for (int i = 1; i < paths.size(); i++) {
file = new File(file, paths.get(i));
}
return file.getPath();
} | java | private static String combinePaths(List<String> paths) {
File file = new File(paths.get(0));
for (int i = 1; i < paths.size(); i++) {
file = new File(file, paths.get(i));
}
return file.getPath();
} | [
"private",
"static",
"String",
"combinePaths",
"(",
"List",
"<",
"String",
">",
"paths",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"paths",
".",
"get",
"(",
"0",
")",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"paths",
... | Given a list of strings, concatenate them to form a file system
path
@param paths a list of strings to be included in the path
@return String string that gives the file system path | [
"Given",
"a",
"list",
"of",
"strings",
"concatenate",
"them",
"to",
"form",
"a",
"file",
"system",
"path"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/common/TokenSub.java#L149-L157 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/script/TemplateBasedScriptBuilder.java | TemplateBasedScriptBuilder.fromTemplateResource | public static TemplateBasedScriptBuilder fromTemplateResource(Resource scriptTemplateResource) {
try {
return new TemplateBasedScriptBuilder(FileUtils.readToString(scriptTemplateResource.getInputStream()));
} catch (IOException e) {
throw new CitrusRuntimeException("Error loading script template from file resource", e);
}
} | java | public static TemplateBasedScriptBuilder fromTemplateResource(Resource scriptTemplateResource) {
try {
return new TemplateBasedScriptBuilder(FileUtils.readToString(scriptTemplateResource.getInputStream()));
} catch (IOException e) {
throw new CitrusRuntimeException("Error loading script template from file resource", e);
}
} | [
"public",
"static",
"TemplateBasedScriptBuilder",
"fromTemplateResource",
"(",
"Resource",
"scriptTemplateResource",
")",
"{",
"try",
"{",
"return",
"new",
"TemplateBasedScriptBuilder",
"(",
"FileUtils",
".",
"readToString",
"(",
"scriptTemplateResource",
".",
"getInputStre... | Static construction method returning a fully qualified instance of this builder.
@param scriptTemplateResource external file resource holding script template code.
@return instance of this builder. | [
"Static",
"construction",
"method",
"returning",
"a",
"fully",
"qualified",
"instance",
"of",
"this",
"builder",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/script/TemplateBasedScriptBuilder.java#L117-L123 |
pravega/pravega | controller/src/main/java/io/pravega/controller/store/stream/StoreException.java | StoreException.create | public static StoreException create(final Type type, final String errorMessage) {
Exceptions.checkNotNullOrEmpty(errorMessage, "errorMessage");
return create(type, null, errorMessage);
} | java | public static StoreException create(final Type type, final String errorMessage) {
Exceptions.checkNotNullOrEmpty(errorMessage, "errorMessage");
return create(type, null, errorMessage);
} | [
"public",
"static",
"StoreException",
"create",
"(",
"final",
"Type",
"type",
",",
"final",
"String",
"errorMessage",
")",
"{",
"Exceptions",
".",
"checkNotNullOrEmpty",
"(",
"errorMessage",
",",
"\"errorMessage\"",
")",
";",
"return",
"create",
"(",
"type",
","... | Factory method to construct Store exceptions.
@param type Type of Exception.
@param errorMessage The detailed error message.
@return Instance of StoreException. | [
"Factory",
"method",
"to",
"construct",
"Store",
"exceptions",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/store/stream/StoreException.java#L68-L71 |
jayantk/jklol | src/com/jayantkrish/jklol/ccg/lexicon/StringContext.java | StringContext.getContextsFromExamples | public static List<StringContext> getContextsFromExamples(List<CcgExample> examples) {
List<StringContext> contexts = Lists.newArrayList();
for (CcgExample example : examples) {
AnnotatedSentence sentence = example.getSentence();
int numTerminals = sentence.size();
for (int i = 0; i < numTerminals; i++) {
for (int j = i; j < numTerminals; j++) {
contexts.add(new StringContext(i, j, sentence));
}
}
}
return contexts;
} | java | public static List<StringContext> getContextsFromExamples(List<CcgExample> examples) {
List<StringContext> contexts = Lists.newArrayList();
for (CcgExample example : examples) {
AnnotatedSentence sentence = example.getSentence();
int numTerminals = sentence.size();
for (int i = 0; i < numTerminals; i++) {
for (int j = i; j < numTerminals; j++) {
contexts.add(new StringContext(i, j, sentence));
}
}
}
return contexts;
} | [
"public",
"static",
"List",
"<",
"StringContext",
">",
"getContextsFromExamples",
"(",
"List",
"<",
"CcgExample",
">",
"examples",
")",
"{",
"List",
"<",
"StringContext",
">",
"contexts",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"for",
"(",
"CcgExam... | Generates and returns a list of every StringContext for every
sentence in {@code examples}.
@param examples
@return | [
"Generates",
"and",
"returns",
"a",
"list",
"of",
"every",
"StringContext",
"for",
"every",
"sentence",
"in",
"{",
"@code",
"examples",
"}",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/lexicon/StringContext.java#L37-L49 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/BaasDocument.java | BaasDocument.getStructure | public JsonStructure getStructure(String name, JsonStructure otherwise) {
return data.getStructure(name, otherwise);
} | java | public JsonStructure getStructure(String name, JsonStructure otherwise) {
return data.getStructure(name, otherwise);
} | [
"public",
"JsonStructure",
"getStructure",
"(",
"String",
"name",
",",
"JsonStructure",
"otherwise",
")",
"{",
"return",
"data",
".",
"getStructure",
"(",
"name",
",",
"otherwise",
")",
";",
"}"
] | Returns the value mapped to <code>name</code> as a {@link com.baasbox.android.json.JsonStructure}
or <code>otherwise</code> if the mapping is absent.
@param name a non <code>null</code> key
@param otherwise a default value
@return the value mapped to <code>name</code> or <code>otherwise</code> | [
"Returns",
"the",
"value",
"mapped",
"to",
"<code",
">",
"name<",
"/",
"code",
">",
"as",
"a",
"{",
"@link",
"com",
".",
"baasbox",
".",
"android",
".",
"json",
".",
"JsonStructure",
"}",
"or",
"<code",
">",
"otherwise<",
"/",
"code",
">",
"if",
"the... | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasDocument.java#L994-L996 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/imports/graphmapper/tf/TFGraphMapper.java | TFGraphMapper.initFunctionFromProperties | public void initFunctionFromProperties(DifferentialFunction on, Map<String, AttrValue> attributesForNode, NodeDef node, GraphDef graph) {
initFunctionFromProperties(on.tensorflowName(),on,attributesForNode,node,graph);
} | java | public void initFunctionFromProperties(DifferentialFunction on, Map<String, AttrValue> attributesForNode, NodeDef node, GraphDef graph) {
initFunctionFromProperties(on.tensorflowName(),on,attributesForNode,node,graph);
} | [
"public",
"void",
"initFunctionFromProperties",
"(",
"DifferentialFunction",
"on",
",",
"Map",
"<",
"String",
",",
"AttrValue",
">",
"attributesForNode",
",",
"NodeDef",
"node",
",",
"GraphDef",
"graph",
")",
"{",
"initFunctionFromProperties",
"(",
"on",
".",
"ten... | Calls {@link #initFunctionFromProperties(DifferentialFunction, Map, NodeDef, GraphDef)}
using {@link DifferentialFunction#tensorflowName()}
@param on the function to use init on
@param attributesForNode the attributes for the node
@param node
@param graph | [
"Calls",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/imports/graphmapper/tf/TFGraphMapper.java#L676-L678 |
voldemort/voldemort | src/java/voldemort/tools/admin/AdminParserUtils.java | AdminParserUtils.checkRequired | public static void checkRequired(OptionSet options, String opt) throws VoldemortException {
List<String> opts = Lists.newArrayList();
opts.add(opt);
checkRequired(options, opts);
} | java | public static void checkRequired(OptionSet options, String opt) throws VoldemortException {
List<String> opts = Lists.newArrayList();
opts.add(opt);
checkRequired(options, opts);
} | [
"public",
"static",
"void",
"checkRequired",
"(",
"OptionSet",
"options",
",",
"String",
"opt",
")",
"throws",
"VoldemortException",
"{",
"List",
"<",
"String",
">",
"opts",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"opts",
".",
"add",
"(",
"opt",
... | Checks if the required option exists.
@param options OptionSet to checked
@param opt Required option to check
@throws VoldemortException | [
"Checks",
"if",
"the",
"required",
"option",
"exists",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/tools/admin/AdminParserUtils.java#L312-L316 |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java | ConvertBufferedImage.convertTo_U8 | public static BufferedImage convertTo_U8(Planar<GrayU8> src, BufferedImage dst, boolean orderRgb ) {
dst = checkInputs(src, dst);
if( orderRgb ) {
src = orderBandsIntoBuffered(src, dst);
}
DataBuffer buffer = dst.getRaster().getDataBuffer();
try {
if (buffer.getDataType() == DataBuffer.TYPE_BYTE && isKnownByteFormat(dst) ) {
ConvertRaster.planarToBuffered_U8(src, (DataBufferByte)buffer, dst.getRaster());
} else if (buffer.getDataType() == DataBuffer.TYPE_INT) {
ConvertRaster.planarToBuffered_U8(src, (DataBufferInt)buffer, dst.getRaster());
} else {
ConvertRaster.planarToBuffered_U8(src, dst);
}
// hack so that it knows the buffer has been modified
dst.setRGB(0,0,dst.getRGB(0,0));
} catch( java.security.AccessControlException e) {
ConvertRaster.planarToBuffered_U8(src, dst);
}
return dst;
} | java | public static BufferedImage convertTo_U8(Planar<GrayU8> src, BufferedImage dst, boolean orderRgb ) {
dst = checkInputs(src, dst);
if( orderRgb ) {
src = orderBandsIntoBuffered(src, dst);
}
DataBuffer buffer = dst.getRaster().getDataBuffer();
try {
if (buffer.getDataType() == DataBuffer.TYPE_BYTE && isKnownByteFormat(dst) ) {
ConvertRaster.planarToBuffered_U8(src, (DataBufferByte)buffer, dst.getRaster());
} else if (buffer.getDataType() == DataBuffer.TYPE_INT) {
ConvertRaster.planarToBuffered_U8(src, (DataBufferInt)buffer, dst.getRaster());
} else {
ConvertRaster.planarToBuffered_U8(src, dst);
}
// hack so that it knows the buffer has been modified
dst.setRGB(0,0,dst.getRGB(0,0));
} catch( java.security.AccessControlException e) {
ConvertRaster.planarToBuffered_U8(src, dst);
}
return dst;
} | [
"public",
"static",
"BufferedImage",
"convertTo_U8",
"(",
"Planar",
"<",
"GrayU8",
">",
"src",
",",
"BufferedImage",
"dst",
",",
"boolean",
"orderRgb",
")",
"{",
"dst",
"=",
"checkInputs",
"(",
"src",
",",
"dst",
")",
";",
"if",
"(",
"orderRgb",
")",
"{"... | Converts a {@link Planar} {@link GrayU8} into a BufferedImage.
@param src Input image.
@param dst Where the converted image is written to. If null a new image is created.
@param orderRgb If applicable, should it change the order of the color bands (assumed RGB or ARGB) into the
order based on BufferedImage.TYPE. Most of the time you want this to be true.
@return Converted image. | [
"Converts",
"a",
"{",
"@link",
"Planar",
"}",
"{",
"@link",
"GrayU8",
"}",
"into",
"a",
"BufferedImage",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java#L784-L807 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaApi.java | MediaApi.attachments | public String attachments(String mediatype, String id, String documentId) throws ApiException {
ApiResponse<String> resp = attachmentsWithHttpInfo(mediatype, id, documentId);
return resp.getData();
} | java | public String attachments(String mediatype, String id, String documentId) throws ApiException {
ApiResponse<String> resp = attachmentsWithHttpInfo(mediatype, id, documentId);
return resp.getData();
} | [
"public",
"String",
"attachments",
"(",
"String",
"mediatype",
",",
"String",
"id",
",",
"String",
"documentId",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"String",
">",
"resp",
"=",
"attachmentsWithHttpInfo",
"(",
"mediatype",
",",
"id",
",",
"d... | Get the attachment of the interaction
Get the attachment of the interaction specified in the documentId path parameter
@param mediatype media-type of interaction (required)
@param id id of interaction (required)
@param documentId id of document to get (required)
@return String
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"the",
"attachment",
"of",
"the",
"interaction",
"Get",
"the",
"attachment",
"of",
"the",
"interaction",
"specified",
"in",
"the",
"documentId",
"path",
"parameter"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L1158-L1161 |
petergeneric/stdlib | guice/common/src/main/java/com/peterphi/std/guice/common/ClassScanner.java | ClassScanner.getImplementations | public <T> List<Class<? extends T>> getImplementations(final Class<T> clazz)
{
return getImplementations(clazz, null);
} | java | public <T> List<Class<? extends T>> getImplementations(final Class<T> clazz)
{
return getImplementations(clazz, null);
} | [
"public",
"<",
"T",
">",
"List",
"<",
"Class",
"<",
"?",
"extends",
"T",
">",
">",
"getImplementations",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"getImplementations",
"(",
"clazz",
",",
"null",
")",
";",
"}"
] | Find all implementations of an interface (if an interface is provided) or extensions (if a class is provided)
@param clazz
@param <T>
@return | [
"Find",
"all",
"implementations",
"of",
"an",
"interface",
"(",
"if",
"an",
"interface",
"is",
"provided",
")",
"or",
"extensions",
"(",
"if",
"a",
"class",
"is",
"provided",
")"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/common/src/main/java/com/peterphi/std/guice/common/ClassScanner.java#L185-L188 |
stephanenicolas/toothpick | toothpick-compiler/src/main/java/toothpick/compiler/common/ToothpickProcessor.java | ToothpickProcessor.isOverride | protected boolean isOverride(TypeElement typeElement, ExecutableElement methodElement) {
TypeElement currentTypeElement = typeElement;
do {
if (currentTypeElement != typeElement) {
List<? extends Element> enclosedElements = currentTypeElement.getEnclosedElements();
for (Element enclosedElement : enclosedElements) {
if (enclosedElement.getSimpleName().equals(methodElement.getSimpleName())
&& enclosedElement.getAnnotation(Inject.class) != null
&& enclosedElement.getKind() == ElementKind.METHOD) {
return true;
}
}
}
TypeMirror superclass = currentTypeElement.getSuperclass();
if (superclass.getKind() == TypeKind.DECLARED) {
DeclaredType superType = (DeclaredType) superclass;
currentTypeElement = (TypeElement) superType.asElement();
} else {
currentTypeElement = null;
}
} while (currentTypeElement != null);
return false;
} | java | protected boolean isOverride(TypeElement typeElement, ExecutableElement methodElement) {
TypeElement currentTypeElement = typeElement;
do {
if (currentTypeElement != typeElement) {
List<? extends Element> enclosedElements = currentTypeElement.getEnclosedElements();
for (Element enclosedElement : enclosedElements) {
if (enclosedElement.getSimpleName().equals(methodElement.getSimpleName())
&& enclosedElement.getAnnotation(Inject.class) != null
&& enclosedElement.getKind() == ElementKind.METHOD) {
return true;
}
}
}
TypeMirror superclass = currentTypeElement.getSuperclass();
if (superclass.getKind() == TypeKind.DECLARED) {
DeclaredType superType = (DeclaredType) superclass;
currentTypeElement = (TypeElement) superType.asElement();
} else {
currentTypeElement = null;
}
} while (currentTypeElement != null);
return false;
} | [
"protected",
"boolean",
"isOverride",
"(",
"TypeElement",
"typeElement",
",",
"ExecutableElement",
"methodElement",
")",
"{",
"TypeElement",
"currentTypeElement",
"=",
"typeElement",
";",
"do",
"{",
"if",
"(",
"currentTypeElement",
"!=",
"typeElement",
")",
"{",
"Li... | the {@code methodElement} would be an override of this method. | [
"the",
"{"
] | train | https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-compiler/src/main/java/toothpick/compiler/common/ToothpickProcessor.java#L378-L400 |
qiujuer/Genius-Android | caprice/ui/src/main/java/net/qiujuer/genius/ui/drawable/TouchEffectDrawable.java | TouchEffectDrawable.onDraw | protected void onDraw(Effect shape, Canvas canvas, Paint paint) {
shape.draw(canvas, paint);
} | java | protected void onDraw(Effect shape, Canvas canvas, Paint paint) {
shape.draw(canvas, paint);
} | [
"protected",
"void",
"onDraw",
"(",
"Effect",
"shape",
",",
"Canvas",
"canvas",
",",
"Paint",
"paint",
")",
"{",
"shape",
".",
"draw",
"(",
"canvas",
",",
"paint",
")",
";",
"}"
] | Called from the drawable's draw() method after the canvas has been set to
draw the shape at (0,0). Subclasses can override for special effects such
as multiple layers, stroking, etc. | [
"Called",
"from",
"the",
"drawable",
"s",
"draw",
"()",
"method",
"after",
"the",
"canvas",
"has",
"been",
"set",
"to",
"draw",
"the",
"shape",
"at",
"(",
"0",
"0",
")",
".",
"Subclasses",
"can",
"override",
"for",
"special",
"effects",
"such",
"as",
"... | train | https://github.com/qiujuer/Genius-Android/blob/babefaf1321f5883a21cada582b6fa5104adc648/caprice/ui/src/main/java/net/qiujuer/genius/ui/drawable/TouchEffectDrawable.java#L240-L242 |
windup/windup | reporting/api/src/main/java/org/jboss/windup/reporting/category/IssueCategoryRegistry.java | IssueCategoryRegistry.loadFromGraph | public static IssueCategoryModel loadFromGraph(GraphContext graphContext, IssueCategory issueCategory)
{
return loadFromGraph(graphContext.getFramed(), issueCategory.getCategoryID());
} | java | public static IssueCategoryModel loadFromGraph(GraphContext graphContext, IssueCategory issueCategory)
{
return loadFromGraph(graphContext.getFramed(), issueCategory.getCategoryID());
} | [
"public",
"static",
"IssueCategoryModel",
"loadFromGraph",
"(",
"GraphContext",
"graphContext",
",",
"IssueCategory",
"issueCategory",
")",
"{",
"return",
"loadFromGraph",
"(",
"graphContext",
".",
"getFramed",
"(",
")",
",",
"issueCategory",
".",
"getCategoryID",
"("... | Loads the related graph vertex for the given {@link IssueCategory}. | [
"Loads",
"the",
"related",
"graph",
"vertex",
"for",
"the",
"given",
"{"
] | train | https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/reporting/api/src/main/java/org/jboss/windup/reporting/category/IssueCategoryRegistry.java#L109-L112 |
amaembo/streamex | src/main/java/one/util/streamex/LongStreamEx.java | LongStreamEx.joining | public String joining(CharSequence delimiter, CharSequence prefix, CharSequence suffix) {
return collect(LongCollector.joining(delimiter, prefix, suffix));
} | java | public String joining(CharSequence delimiter, CharSequence prefix, CharSequence suffix) {
return collect(LongCollector.joining(delimiter, prefix, suffix));
} | [
"public",
"String",
"joining",
"(",
"CharSequence",
"delimiter",
",",
"CharSequence",
"prefix",
",",
"CharSequence",
"suffix",
")",
"{",
"return",
"collect",
"(",
"LongCollector",
".",
"joining",
"(",
"delimiter",
",",
"prefix",
",",
"suffix",
")",
")",
";",
... | Returns a {@link String} which is the concatenation of the results of
calling {@link String#valueOf(long)} on each element of this stream,
separated by the specified delimiter, with the specified prefix and
suffix in encounter order.
<p>
This is a terminal operation.
@param delimiter the delimiter to be used between each element
@param prefix the sequence of characters to be used at the beginning of
the joined result
@param suffix the sequence of characters to be used at the end of the
joined result
@return the result of concatenation. For empty input stream
{@code prefix + suffix} is returned.
@since 0.3.1 | [
"Returns",
"a",
"{",
"@link",
"String",
"}",
"which",
"is",
"the",
"concatenation",
"of",
"the",
"results",
"of",
"calling",
"{",
"@link",
"String#valueOf",
"(",
"long",
")",
"}",
"on",
"each",
"element",
"of",
"this",
"stream",
"separated",
"by",
"the",
... | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L1422-L1424 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/ClassUtils.java | ClassUtils.getPublicMethod | @GwtIncompatible("incompatible method")
public static Method getPublicMethod(final Class<?> cls, final String methodName, final Class<?>... parameterTypes)
throws SecurityException, NoSuchMethodException {
final Method declaredMethod = cls.getMethod(methodName, parameterTypes);
if (Modifier.isPublic(declaredMethod.getDeclaringClass().getModifiers())) {
return declaredMethod;
}
final List<Class<?>> candidateClasses = new ArrayList<>();
candidateClasses.addAll(getAllInterfaces(cls));
candidateClasses.addAll(getAllSuperclasses(cls));
for (final Class<?> candidateClass : candidateClasses) {
if (!Modifier.isPublic(candidateClass.getModifiers())) {
continue;
}
Method candidateMethod;
try {
candidateMethod = candidateClass.getMethod(methodName, parameterTypes);
} catch (final NoSuchMethodException ex) {
continue;
}
if (Modifier.isPublic(candidateMethod.getDeclaringClass().getModifiers())) {
return candidateMethod;
}
}
throw new NoSuchMethodException("Can't find a public method for " +
methodName + " " + ArrayUtils.toString(parameterTypes));
} | java | @GwtIncompatible("incompatible method")
public static Method getPublicMethod(final Class<?> cls, final String methodName, final Class<?>... parameterTypes)
throws SecurityException, NoSuchMethodException {
final Method declaredMethod = cls.getMethod(methodName, parameterTypes);
if (Modifier.isPublic(declaredMethod.getDeclaringClass().getModifiers())) {
return declaredMethod;
}
final List<Class<?>> candidateClasses = new ArrayList<>();
candidateClasses.addAll(getAllInterfaces(cls));
candidateClasses.addAll(getAllSuperclasses(cls));
for (final Class<?> candidateClass : candidateClasses) {
if (!Modifier.isPublic(candidateClass.getModifiers())) {
continue;
}
Method candidateMethod;
try {
candidateMethod = candidateClass.getMethod(methodName, parameterTypes);
} catch (final NoSuchMethodException ex) {
continue;
}
if (Modifier.isPublic(candidateMethod.getDeclaringClass().getModifiers())) {
return candidateMethod;
}
}
throw new NoSuchMethodException("Can't find a public method for " +
methodName + " " + ArrayUtils.toString(parameterTypes));
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"Method",
"getPublicMethod",
"(",
"final",
"Class",
"<",
"?",
">",
"cls",
",",
"final",
"String",
"methodName",
",",
"final",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",... | <p>Returns the desired Method much like {@code Class.getMethod}, however
it ensures that the returned Method is from a public class or interface and not
from an anonymous inner class. This means that the Method is invokable and
doesn't fall foul of Java bug
<a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957">4071957</a>).</p>
<pre>
<code>Set set = Collections.unmodifiableSet(...);
Method method = ClassUtils.getPublicMethod(set.getClass(), "isEmpty", new Class[0]);
Object result = method.invoke(set, new Object[]);</code>
</pre>
@param cls the class to check, not null
@param methodName the name of the method
@param parameterTypes the list of parameters
@return the method
@throws NullPointerException if the class is null
@throws SecurityException if a security violation occurred
@throws NoSuchMethodException if the method is not found in the given class
or if the method doesn't conform with the requirements | [
"<p",
">",
"Returns",
"the",
"desired",
"Method",
"much",
"like",
"{",
"@code",
"Class",
".",
"getMethod",
"}",
"however",
"it",
"ensures",
"that",
"the",
"returned",
"Method",
"is",
"from",
"a",
"public",
"class",
"or",
"interface",
"and",
"not",
"from",
... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L1100-L1130 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.getFlowLogStatusAsync | public Observable<FlowLogInformationInner> getFlowLogStatusAsync(String resourceGroupName, String networkWatcherName, String targetResourceId) {
return getFlowLogStatusWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).map(new Func1<ServiceResponse<FlowLogInformationInner>, FlowLogInformationInner>() {
@Override
public FlowLogInformationInner call(ServiceResponse<FlowLogInformationInner> response) {
return response.body();
}
});
} | java | public Observable<FlowLogInformationInner> getFlowLogStatusAsync(String resourceGroupName, String networkWatcherName, String targetResourceId) {
return getFlowLogStatusWithServiceResponseAsync(resourceGroupName, networkWatcherName, targetResourceId).map(new Func1<ServiceResponse<FlowLogInformationInner>, FlowLogInformationInner>() {
@Override
public FlowLogInformationInner call(ServiceResponse<FlowLogInformationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"FlowLogInformationInner",
">",
"getFlowLogStatusAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"String",
"targetResourceId",
")",
"{",
"return",
"getFlowLogStatusWithServiceResponseAsync",
"(",
"resourceGrou... | Queries status of flow log on a specified resource.
@param resourceGroupName The name of the network watcher resource group.
@param networkWatcherName The name of the network watcher resource.
@param targetResourceId The target resource where getting the flow logging status.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Queries",
"status",
"of",
"flow",
"log",
"on",
"a",
"specified",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L1997-L2004 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.setDefaultSipDomain_POST | public void setDefaultSipDomain_POST(OvhNumberCountryEnum country, String domain, OvhSipDomainProductTypeEnum type) throws IOException {
String qPath = "/telephony/setDefaultSipDomain";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "country", country);
addBody(o, "domain", domain);
addBody(o, "type", type);
exec(qPath, "POST", sb.toString(), o);
} | java | public void setDefaultSipDomain_POST(OvhNumberCountryEnum country, String domain, OvhSipDomainProductTypeEnum type) throws IOException {
String qPath = "/telephony/setDefaultSipDomain";
StringBuilder sb = path(qPath);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "country", country);
addBody(o, "domain", domain);
addBody(o, "type", type);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"setDefaultSipDomain_POST",
"(",
"OvhNumberCountryEnum",
"country",
",",
"String",
"domain",
",",
"OvhSipDomainProductTypeEnum",
"type",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/setDefaultSipDomain\"",
";",
"StringBuilder",
... | Get all available SIP domains by country
REST: POST /telephony/setDefaultSipDomain
@param domain [required] SIP domain to set
@param type [required] Product type
@param country [required] Country | [
"Get",
"all",
"available",
"SIP",
"domains",
"by",
"country"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8968-L8976 |
OpenLiberty/open-liberty | dev/com.ibm.ws.classloading.bells/src/com/ibm/ws/classloading/bells/internal/Bell.java | Bell.update | void update() {
final BundleContext context = componentContext.getBundleContext();
// determine the service filter to use for discovering the Library service this bell is for
String libraryRef = library.id();
// it is unclear if only looking at the id would work here.
// other examples in classloading use both id and service.pid to look up so doing the same here.
String libraryStatusFilter = String.format("(&(objectClass=%s)(|(id=%s)(service.pid=%s)))", Library.class.getName(), libraryRef, libraryRef);
Filter filter;
try {
filter = context.createFilter(libraryStatusFilter);
} catch (InvalidSyntaxException e) {
// should not happen, but blow up if it does
throw new RuntimeException(e);
}
final Set<String> serviceNames = getServiceNames((String[]) config.get(SERVICE_ATT));
// create a tracker that will register the services once the library becomes available
ServiceTracker<Library, List<ServiceRegistration<?>>> newTracker = null;
newTracker = new ServiceTracker<Library, List<ServiceRegistration<?>>>(context, filter, new ServiceTrackerCustomizer<Library, List<ServiceRegistration<?>>>() {
@Override
public List<ServiceRegistration<?>> addingService(ServiceReference<Library> libraryRef) {
Library library = context.getService(libraryRef);
// Got the library now register the services.
// The list of registrations is returned so we don't have to store them ourselves.
return registerLibraryServices(library, serviceNames);
}
@Override
public void modifiedService(ServiceReference<Library> libraryRef, List<ServiceRegistration<?>> metaInfServices) {
// don't care
}
@Override
@FFDCIgnore(IllegalStateException.class)
public void removedService(ServiceReference<Library> libraryRef, List<ServiceRegistration<?>> metaInfServices) {
// THe library is going away; need to unregister the services
for (ServiceRegistration<?> registration : metaInfServices) {
try {
registration.unregister();
} catch (IllegalStateException e) {
// ignore; already unregistered
}
}
context.ungetService(libraryRef);
}
});
trackerLock.lock();
try {
if (tracker != null) {
// close the existing tracker so we unregister existing services
tracker.close();
}
// store and open the new tracker so we can register the configured services.
tracker = newTracker;
tracker.open();
} finally {
trackerLock.unlock();
}
} | java | void update() {
final BundleContext context = componentContext.getBundleContext();
// determine the service filter to use for discovering the Library service this bell is for
String libraryRef = library.id();
// it is unclear if only looking at the id would work here.
// other examples in classloading use both id and service.pid to look up so doing the same here.
String libraryStatusFilter = String.format("(&(objectClass=%s)(|(id=%s)(service.pid=%s)))", Library.class.getName(), libraryRef, libraryRef);
Filter filter;
try {
filter = context.createFilter(libraryStatusFilter);
} catch (InvalidSyntaxException e) {
// should not happen, but blow up if it does
throw new RuntimeException(e);
}
final Set<String> serviceNames = getServiceNames((String[]) config.get(SERVICE_ATT));
// create a tracker that will register the services once the library becomes available
ServiceTracker<Library, List<ServiceRegistration<?>>> newTracker = null;
newTracker = new ServiceTracker<Library, List<ServiceRegistration<?>>>(context, filter, new ServiceTrackerCustomizer<Library, List<ServiceRegistration<?>>>() {
@Override
public List<ServiceRegistration<?>> addingService(ServiceReference<Library> libraryRef) {
Library library = context.getService(libraryRef);
// Got the library now register the services.
// The list of registrations is returned so we don't have to store them ourselves.
return registerLibraryServices(library, serviceNames);
}
@Override
public void modifiedService(ServiceReference<Library> libraryRef, List<ServiceRegistration<?>> metaInfServices) {
// don't care
}
@Override
@FFDCIgnore(IllegalStateException.class)
public void removedService(ServiceReference<Library> libraryRef, List<ServiceRegistration<?>> metaInfServices) {
// THe library is going away; need to unregister the services
for (ServiceRegistration<?> registration : metaInfServices) {
try {
registration.unregister();
} catch (IllegalStateException e) {
// ignore; already unregistered
}
}
context.ungetService(libraryRef);
}
});
trackerLock.lock();
try {
if (tracker != null) {
// close the existing tracker so we unregister existing services
tracker.close();
}
// store and open the new tracker so we can register the configured services.
tracker = newTracker;
tracker.open();
} finally {
trackerLock.unlock();
}
} | [
"void",
"update",
"(",
")",
"{",
"final",
"BundleContext",
"context",
"=",
"componentContext",
".",
"getBundleContext",
"(",
")",
";",
"// determine the service filter to use for discovering the Library service this bell is for",
"String",
"libraryRef",
"=",
"library",
".",
... | Configures this bell with a specific library and a possible set of service names
@param context the bundle context
@param executor the executor service
@param config the configuration settings | [
"Configures",
"this",
"bell",
"with",
"a",
"specific",
"library",
"and",
"a",
"possible",
"set",
"of",
"service",
"names"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading.bells/src/com/ibm/ws/classloading/bells/internal/Bell.java#L137-L195 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/ringsearch/FiguerasSSSRFinder.java | FiguerasSSSRFinder.breakBond | private void breakBond(IAtom atom, IAtomContainer molecule) {
Iterator<IBond> bonds = molecule.bonds().iterator();
while (bonds.hasNext()) {
IBond bond = (IBond) bonds.next();
if (bond.contains(atom)) {
molecule.removeElectronContainer(bond);
break;
}
}
} | java | private void breakBond(IAtom atom, IAtomContainer molecule) {
Iterator<IBond> bonds = molecule.bonds().iterator();
while (bonds.hasNext()) {
IBond bond = (IBond) bonds.next();
if (bond.contains(atom)) {
molecule.removeElectronContainer(bond);
break;
}
}
} | [
"private",
"void",
"breakBond",
"(",
"IAtom",
"atom",
",",
"IAtomContainer",
"molecule",
")",
"{",
"Iterator",
"<",
"IBond",
">",
"bonds",
"=",
"molecule",
".",
"bonds",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"bonds",
".",
"hasNext",
"... | Eliminates one bond of this atom from the molecule
@param atom The atom one bond is eliminated of
@param molecule The molecule that contains the atom | [
"Eliminates",
"one",
"bond",
"of",
"this",
"atom",
"from",
"the",
"molecule"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/ringsearch/FiguerasSSSRFinder.java#L354-L363 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java | Long.divideUnsigned | public static long divideUnsigned(long dividend, long divisor) {
if (divisor < 0L) { // signed comparison
// Answer must be 0 or 1 depending on relative magnitude
// of dividend and divisor.
return (compareUnsigned(dividend, divisor)) < 0 ? 0L :1L;
}
if (dividend > 0) // Both inputs non-negative
return dividend/divisor;
else {
/*
* For simple code, leveraging BigInteger. Longer and faster
* code written directly in terms of operations on longs is
* possible; see "Hacker's Delight" for divide and remainder
* algorithms.
*/
return toUnsignedBigInteger(dividend).
divide(toUnsignedBigInteger(divisor)).longValue();
}
} | java | public static long divideUnsigned(long dividend, long divisor) {
if (divisor < 0L) { // signed comparison
// Answer must be 0 or 1 depending on relative magnitude
// of dividend and divisor.
return (compareUnsigned(dividend, divisor)) < 0 ? 0L :1L;
}
if (dividend > 0) // Both inputs non-negative
return dividend/divisor;
else {
/*
* For simple code, leveraging BigInteger. Longer and faster
* code written directly in terms of operations on longs is
* possible; see "Hacker's Delight" for divide and remainder
* algorithms.
*/
return toUnsignedBigInteger(dividend).
divide(toUnsignedBigInteger(divisor)).longValue();
}
} | [
"public",
"static",
"long",
"divideUnsigned",
"(",
"long",
"dividend",
",",
"long",
"divisor",
")",
"{",
"if",
"(",
"divisor",
"<",
"0L",
")",
"{",
"// signed comparison",
"// Answer must be 0 or 1 depending on relative magnitude",
"// of dividend and divisor.",
"return",... | Returns the unsigned quotient of dividing the first argument by
the second where each argument and the result is interpreted as
an unsigned value.
<p>Note that in two's complement arithmetic, the three other
basic arithmetic operations of add, subtract, and multiply are
bit-wise identical if the two operands are regarded as both
being signed or both being unsigned. Therefore separate {@code
addUnsigned}, etc. methods are not provided.
@param dividend the value to be divided
@param divisor the value doing the dividing
@return the unsigned quotient of the first argument divided by
the second argument
@see #remainderUnsigned
@since 1.8 | [
"Returns",
"the",
"unsigned",
"quotient",
"of",
"dividing",
"the",
"first",
"argument",
"by",
"the",
"second",
"where",
"each",
"argument",
"and",
"the",
"result",
"is",
"interpreted",
"as",
"an",
"unsigned",
"value",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Long.java#L1138-L1157 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.listWebWorkerUsagesAsync | public Observable<Page<UsageInner>> listWebWorkerUsagesAsync(final String resourceGroupName, final String name, final String workerPoolName) {
return listWebWorkerUsagesWithServiceResponseAsync(resourceGroupName, name, workerPoolName)
.map(new Func1<ServiceResponse<Page<UsageInner>>, Page<UsageInner>>() {
@Override
public Page<UsageInner> call(ServiceResponse<Page<UsageInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<UsageInner>> listWebWorkerUsagesAsync(final String resourceGroupName, final String name, final String workerPoolName) {
return listWebWorkerUsagesWithServiceResponseAsync(resourceGroupName, name, workerPoolName)
.map(new Func1<ServiceResponse<Page<UsageInner>>, Page<UsageInner>>() {
@Override
public Page<UsageInner> call(ServiceResponse<Page<UsageInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"UsageInner",
">",
">",
"listWebWorkerUsagesAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"String",
"workerPoolName",
")",
"{",
"return",
"listWebWorkerUsagesWithServiceResp... | Get usage metrics for a worker pool of an App Service Environment.
Get usage metrics for a worker pool of an App Service Environment.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@param workerPoolName Name of the worker pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<UsageInner> object | [
"Get",
"usage",
"metrics",
"for",
"a",
"worker",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
".",
"Get",
"usage",
"metrics",
"for",
"a",
"worker",
"pool",
"of",
"an",
"App",
"Service",
"Environment",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L6524-L6532 |
google/closure-compiler | src/com/google/javascript/jscomp/NodeUtil.java | NodeUtil.isControlStructureCodeBlock | static boolean isControlStructureCodeBlock(Node parent, Node n) {
switch (parent.getToken()) {
case DO:
return parent.getFirstChild() == n;
case TRY:
return parent.getFirstChild() == n || parent.getLastChild() == n;
case FOR:
case FOR_IN:
case FOR_OF:
case FOR_AWAIT_OF:
case WHILE:
case LABEL:
case WITH:
case CATCH:
return parent.getLastChild() == n;
case IF:
case SWITCH:
case CASE:
return parent.getFirstChild() != n;
case DEFAULT_CASE:
return true;
default:
checkState(isControlStructure(parent), parent);
return false;
}
} | java | static boolean isControlStructureCodeBlock(Node parent, Node n) {
switch (parent.getToken()) {
case DO:
return parent.getFirstChild() == n;
case TRY:
return parent.getFirstChild() == n || parent.getLastChild() == n;
case FOR:
case FOR_IN:
case FOR_OF:
case FOR_AWAIT_OF:
case WHILE:
case LABEL:
case WITH:
case CATCH:
return parent.getLastChild() == n;
case IF:
case SWITCH:
case CASE:
return parent.getFirstChild() != n;
case DEFAULT_CASE:
return true;
default:
checkState(isControlStructure(parent), parent);
return false;
}
} | [
"static",
"boolean",
"isControlStructureCodeBlock",
"(",
"Node",
"parent",
",",
"Node",
"n",
")",
"{",
"switch",
"(",
"parent",
".",
"getToken",
"(",
")",
")",
"{",
"case",
"DO",
":",
"return",
"parent",
".",
"getFirstChild",
"(",
")",
"==",
"n",
";",
... | Determines whether the given node is code node for FOR, DO,
WHILE, WITH, or IF node. | [
"Determines",
"whether",
"the",
"given",
"node",
"is",
"code",
"node",
"for",
"FOR",
"DO",
"WHILE",
"WITH",
"or",
"IF",
"node",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L2563-L2588 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/fieldprocessor/impl/CellProcessor.java | CellProcessor.getCellPosition | private CellPosition getCellPosition(final FieldAccessor accessor, final XlsCell anno) throws AnnotationInvalidException {
if(Utils.isNotEmpty(anno.address())) {
try {
return CellPosition.of(anno.address());
} catch(IllegalArgumentException e) {
throw new AnnotationInvalidException(anno, MessageBuilder.create("anno.attr.invalidAddress")
.var("property", accessor.getNameWithClass())
.varWithAnno("anno", XlsCell.class)
.var("attrName", "address")
.var("attrValue", anno.address())
.format());
}
} else {
if(anno.row() < 0) {
throw new AnnotationInvalidException(anno, MessageBuilder.create("anno.attr.min")
.var("property", accessor.getNameWithClass())
.varWithAnno("anno", XlsCell.class)
.var("attrName", "row")
.var("attrValue", anno.row())
.var("min", 0)
.format());
}
if(anno.column() < 0) {
throw new AnnotationInvalidException(anno, MessageBuilder.create("anno.attr.min")
.var("property", accessor.getNameWithClass())
.varWithAnno("anno", XlsCell.class)
.var("attrName", "column")
.var("attrValue", anno.column())
.var("min", 0)
.format());
}
return CellPosition.of(anno.row(), anno.column());
}
} | java | private CellPosition getCellPosition(final FieldAccessor accessor, final XlsCell anno) throws AnnotationInvalidException {
if(Utils.isNotEmpty(anno.address())) {
try {
return CellPosition.of(anno.address());
} catch(IllegalArgumentException e) {
throw new AnnotationInvalidException(anno, MessageBuilder.create("anno.attr.invalidAddress")
.var("property", accessor.getNameWithClass())
.varWithAnno("anno", XlsCell.class)
.var("attrName", "address")
.var("attrValue", anno.address())
.format());
}
} else {
if(anno.row() < 0) {
throw new AnnotationInvalidException(anno, MessageBuilder.create("anno.attr.min")
.var("property", accessor.getNameWithClass())
.varWithAnno("anno", XlsCell.class)
.var("attrName", "row")
.var("attrValue", anno.row())
.var("min", 0)
.format());
}
if(anno.column() < 0) {
throw new AnnotationInvalidException(anno, MessageBuilder.create("anno.attr.min")
.var("property", accessor.getNameWithClass())
.varWithAnno("anno", XlsCell.class)
.var("attrName", "column")
.var("attrValue", anno.column())
.var("min", 0)
.format());
}
return CellPosition.of(anno.row(), anno.column());
}
} | [
"private",
"CellPosition",
"getCellPosition",
"(",
"final",
"FieldAccessor",
"accessor",
",",
"final",
"XlsCell",
"anno",
")",
"throws",
"AnnotationInvalidException",
"{",
"if",
"(",
"Utils",
".",
"isNotEmpty",
"(",
"anno",
".",
"address",
"(",
")",
")",
")",
... | アノテーションから、セルのアドレスを取得する。
@param accessor フィールド情報
@param anno アノテーション
@return 値が設定されているセルのアドレス
@throws AnnotationInvalidException アドレスの設定値が不正な場合 | [
"アノテーションから、セルのアドレスを取得する。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/fieldprocessor/impl/CellProcessor.java#L69-L108 |
elki-project/elki | elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java | GeneratorXMLDatabaseConnection.processElementNormal | private void processElementNormal(GeneratorSingleCluster cluster, Node cur) {
double mean = 0.0;
double stddev = 1.0;
String meanstr = ((Element) cur).getAttribute(ATTR_MEAN);
if(meanstr != null && meanstr.length() > 0) {
mean = ParseUtil.parseDouble(meanstr);
}
String stddevstr = ((Element) cur).getAttribute(ATTR_STDDEV);
if(stddevstr != null && stddevstr.length() > 0) {
stddev = ParseUtil.parseDouble(stddevstr);
}
// *** New normal distribution generator
Random random = cluster.getNewRandomGenerator();
Distribution generator = new NormalDistribution(mean, stddev, random);
cluster.addGenerator(generator);
// TODO: check for unknown attributes.
XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
while(iter.hasNext()) {
Node child = iter.next();
if(child.getNodeType() == Node.ELEMENT_NODE) {
LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
}
}
} | java | private void processElementNormal(GeneratorSingleCluster cluster, Node cur) {
double mean = 0.0;
double stddev = 1.0;
String meanstr = ((Element) cur).getAttribute(ATTR_MEAN);
if(meanstr != null && meanstr.length() > 0) {
mean = ParseUtil.parseDouble(meanstr);
}
String stddevstr = ((Element) cur).getAttribute(ATTR_STDDEV);
if(stddevstr != null && stddevstr.length() > 0) {
stddev = ParseUtil.parseDouble(stddevstr);
}
// *** New normal distribution generator
Random random = cluster.getNewRandomGenerator();
Distribution generator = new NormalDistribution(mean, stddev, random);
cluster.addGenerator(generator);
// TODO: check for unknown attributes.
XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
while(iter.hasNext()) {
Node child = iter.next();
if(child.getNodeType() == Node.ELEMENT_NODE) {
LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
}
}
} | [
"private",
"void",
"processElementNormal",
"(",
"GeneratorSingleCluster",
"cluster",
",",
"Node",
"cur",
")",
"{",
"double",
"mean",
"=",
"0.0",
";",
"double",
"stddev",
"=",
"1.0",
";",
"String",
"meanstr",
"=",
"(",
"(",
"Element",
")",
"cur",
")",
".",
... | Process a 'normal' Element in the XML stream.
@param cluster
@param cur Current document nod | [
"Process",
"a",
"normal",
"Element",
"in",
"the",
"XML",
"stream",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/datasource/GeneratorXMLDatabaseConnection.java#L426-L451 |
nmorel/gwt-jackson | gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java | AbstractCreator.constructorCallCode | private CodeBlock constructorCallCode( ClassName className, ImmutableList<? extends JParameterizedMapper> parameters ) {
CodeBlock.Builder builder = CodeBlock.builder();
builder.add( "new $T", className );
return methodCallCodeWithJParameterizedMapperParameters( builder, parameters );
} | java | private CodeBlock constructorCallCode( ClassName className, ImmutableList<? extends JParameterizedMapper> parameters ) {
CodeBlock.Builder builder = CodeBlock.builder();
builder.add( "new $T", className );
return methodCallCodeWithJParameterizedMapperParameters( builder, parameters );
} | [
"private",
"CodeBlock",
"constructorCallCode",
"(",
"ClassName",
"className",
",",
"ImmutableList",
"<",
"?",
"extends",
"JParameterizedMapper",
">",
"parameters",
")",
"{",
"CodeBlock",
".",
"Builder",
"builder",
"=",
"CodeBlock",
".",
"builder",
"(",
")",
";",
... | Build the code to call the constructor of a class
@param className the class to call
@param parameters the parameters of the constructor
@return the code calling the constructor | [
"Build",
"the",
"code",
"to",
"call",
"the",
"constructor",
"of",
"a",
"class"
] | train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/AbstractCreator.java#L855-L859 |
baasbox/Android-SDK | library/src/main/java/com/baasbox/android/BaasAsset.java | BaasAsset.streamAsset | public static <R> RequestToken streamAsset(String id, int flags, DataStreamHandler<R> contentHandler, BaasHandler<R> handler) {
return BaasAsset.doStreamAsset(id, null, -1, flags, contentHandler, handler);
} | java | public static <R> RequestToken streamAsset(String id, int flags, DataStreamHandler<R> contentHandler, BaasHandler<R> handler) {
return BaasAsset.doStreamAsset(id, null, -1, flags, contentHandler, handler);
} | [
"public",
"static",
"<",
"R",
">",
"RequestToken",
"streamAsset",
"(",
"String",
"id",
",",
"int",
"flags",
",",
"DataStreamHandler",
"<",
"R",
">",
"contentHandler",
",",
"BaasHandler",
"<",
"R",
">",
"handler",
")",
"{",
"return",
"BaasAsset",
".",
"doSt... | Streams the file using the provided data stream handler.
@param id the name of the asset to download
@param flags
@param handler the completion handler
@param <R> the type to transform the bytes to.
@return a request token to handle the request | [
"Streams",
"the",
"file",
"using",
"the",
"provided",
"data",
"stream",
"handler",
"."
] | train | https://github.com/baasbox/Android-SDK/blob/6bb2203246b885b2ad63a7bfaf37c83caf15e0d8/library/src/main/java/com/baasbox/android/BaasAsset.java#L126-L128 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/model/loader/ObjFileImporter.java | ObjFileImporter.addUV | private void addUV(String data)
{
String coords[] = data.split("\\s+");
float u = 0;
float v = 0;
if (coords.length != 2)
{
MalisisCore.log.error( "[ObjFileImporter] Wrong UV coordinates number {} at line {} : {}",
coords.length,
lineNumber,
currentLine);
}
else
{
u = Float.parseFloat(coords[0]);
v = 1 - Float.parseFloat(coords[1]);
}
uvs.add(new UV(u, v));
} | java | private void addUV(String data)
{
String coords[] = data.split("\\s+");
float u = 0;
float v = 0;
if (coords.length != 2)
{
MalisisCore.log.error( "[ObjFileImporter] Wrong UV coordinates number {} at line {} : {}",
coords.length,
lineNumber,
currentLine);
}
else
{
u = Float.parseFloat(coords[0]);
v = 1 - Float.parseFloat(coords[1]);
}
uvs.add(new UV(u, v));
} | [
"private",
"void",
"addUV",
"(",
"String",
"data",
")",
"{",
"String",
"coords",
"[",
"]",
"=",
"data",
".",
"split",
"(",
"\"\\\\s+\"",
")",
";",
"float",
"u",
"=",
"0",
";",
"float",
"v",
"=",
"0",
";",
"if",
"(",
"coords",
".",
"length",
"!=",... | Creates a new {@link UV} from data and adds it to {@link #uvs}.
@param data the data | [
"Creates",
"a",
"new",
"{",
"@link",
"UV",
"}",
"from",
"data",
"and",
"adds",
"it",
"to",
"{",
"@link",
"#uvs",
"}",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/model/loader/ObjFileImporter.java#L231-L250 |
m-m-m/util | version/src/main/java/net/sf/mmm/util/version/base/AbstractVersionIdentifier.java | AbstractVersionIdentifier.compareToLabel | private int compareToLabel(int currentResult, VersionIdentifier otherVersion) {
if (currentResult == COMPARE_TO_INCOMPARABLE) {
return COMPARE_TO_INCOMPARABLE;
}
int result = currentResult;
if (result == 0) {
String label = getLabel();
if (label != null) {
String otherLabel = otherVersion.getLabel();
if (otherLabel != null) {
if (!label.equalsIgnoreCase(otherLabel)) {
// 2 versions identical except for label
return COMPARE_TO_INCOMPARABLE;
}
}
}
}
return result;
} | java | private int compareToLabel(int currentResult, VersionIdentifier otherVersion) {
if (currentResult == COMPARE_TO_INCOMPARABLE) {
return COMPARE_TO_INCOMPARABLE;
}
int result = currentResult;
if (result == 0) {
String label = getLabel();
if (label != null) {
String otherLabel = otherVersion.getLabel();
if (otherLabel != null) {
if (!label.equalsIgnoreCase(otherLabel)) {
// 2 versions identical except for label
return COMPARE_TO_INCOMPARABLE;
}
}
}
}
return result;
} | [
"private",
"int",
"compareToLabel",
"(",
"int",
"currentResult",
",",
"VersionIdentifier",
"otherVersion",
")",
"{",
"if",
"(",
"currentResult",
"==",
"COMPARE_TO_INCOMPARABLE",
")",
"{",
"return",
"COMPARE_TO_INCOMPARABLE",
";",
"}",
"int",
"result",
"=",
"currentR... | This method performs the part of {@link #compareTo(VersionIdentifier)} for the {@link #getLabel() label}.
@param currentResult is the current result so far.
@param otherVersion is the {@link VersionIdentifier} to compare to.
@return the result of comparison. | [
"This",
"method",
"performs",
"the",
"part",
"of",
"{",
"@link",
"#compareTo",
"(",
"VersionIdentifier",
")",
"}",
"for",
"the",
"{",
"@link",
"#getLabel",
"()",
"label",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/version/src/main/java/net/sf/mmm/util/version/base/AbstractVersionIdentifier.java#L277-L296 |
chalup/microorm | library/src/main/java/org/chalup/microorm/MicroOrm.java | MicroOrm.fromCursor | @SuppressWarnings("unchecked")
public <T> T fromCursor(Cursor c, T object) {
return ((DaoAdapter<T>) getAdapter(object.getClass())).fromCursor(c, object);
} | java | @SuppressWarnings("unchecked")
public <T> T fromCursor(Cursor c, T object) {
return ((DaoAdapter<T>) getAdapter(object.getClass())).fromCursor(c, object);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"fromCursor",
"(",
"Cursor",
"c",
",",
"T",
"object",
")",
"{",
"return",
"(",
"(",
"DaoAdapter",
"<",
"T",
">",
")",
"getAdapter",
"(",
"object",
".",
"getClass",
"(",
... | Fills the field in the provided object with data from the current row in
{@link Cursor}.
@param <T> the type of the provided object
@param c an open {@link Cursor} with position set to valid row
@param object the instance to be filled with data
@return the same object for easy chaining | [
"Fills",
"the",
"field",
"in",
"the",
"provided",
"object",
"with",
"data",
"from",
"the",
"current",
"row",
"in",
"{",
"@link",
"Cursor",
"}",
"."
] | train | https://github.com/chalup/microorm/blob/54c437608c4563daa207950d6a7af663f820da89/library/src/main/java/org/chalup/microorm/MicroOrm.java#L71-L74 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java | ResourcesInner.listAsync | public Observable<Page<GenericResourceInner>> listAsync(final String filter, final String expand, final Integer top) {
return listWithServiceResponseAsync(filter, expand, top)
.map(new Func1<ServiceResponse<Page<GenericResourceInner>>, Page<GenericResourceInner>>() {
@Override
public Page<GenericResourceInner> call(ServiceResponse<Page<GenericResourceInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<GenericResourceInner>> listAsync(final String filter, final String expand, final Integer top) {
return listWithServiceResponseAsync(filter, expand, top)
.map(new Func1<ServiceResponse<Page<GenericResourceInner>>, Page<GenericResourceInner>>() {
@Override
public Page<GenericResourceInner> call(ServiceResponse<Page<GenericResourceInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"GenericResourceInner",
">",
">",
"listAsync",
"(",
"final",
"String",
"filter",
",",
"final",
"String",
"expand",
",",
"final",
"Integer",
"top",
")",
"{",
"return",
"listWithServiceResponseAsync",
"(",
"filter",
",",
... | Get all the resources in a subscription.
@param filter The filter to apply on the operation.
@param expand The $expand query parameter.
@param top The number of results to return. If null is passed, returns all resource groups.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<GenericResourceInner> object | [
"Get",
"all",
"the",
"resources",
"in",
"a",
"subscription",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourcesInner.java#L892-L900 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java | SecureUtil.signParams | public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params) {
return signParams(digestAlgorithm, params, StrUtil.EMPTY, StrUtil.EMPTY, true);
} | java | public static String signParams(DigestAlgorithm digestAlgorithm, Map<?, ?> params) {
return signParams(digestAlgorithm, params, StrUtil.EMPTY, StrUtil.EMPTY, true);
} | [
"public",
"static",
"String",
"signParams",
"(",
"DigestAlgorithm",
"digestAlgorithm",
",",
"Map",
"<",
"?",
",",
"?",
">",
"params",
")",
"{",
"return",
"signParams",
"(",
"digestAlgorithm",
",",
"params",
",",
"StrUtil",
".",
"EMPTY",
",",
"StrUtil",
".",
... | 对参数做签名<br>
参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串<br>
拼接后的字符串键值对之间无符号,键值对之间无符号,忽略null值
@param digestAlgorithm 摘要算法
@param params 参数
@return 签名
@since 4.0.1 | [
"对参数做签名<br",
">",
"参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串<br",
">",
"拼接后的字符串键值对之间无符号,键值对之间无符号,忽略null值"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L904-L906 |
jenkinsci/ssh-slaves-plugin | src/main/java/hudson/plugins/sshslaves/JavaProvider.java | JavaProvider.getJavas | public List<String> getJavas(SlaveComputer computer, TaskListener listener, Connection connection) {
return getJavas(listener,connection);
} | java | public List<String> getJavas(SlaveComputer computer, TaskListener listener, Connection connection) {
return getJavas(listener,connection);
} | [
"public",
"List",
"<",
"String",
">",
"getJavas",
"(",
"SlaveComputer",
"computer",
",",
"TaskListener",
"listener",
",",
"Connection",
"connection",
")",
"{",
"return",
"getJavas",
"(",
"listener",
",",
"connection",
")",
";",
"}"
] | Returns the list of possible places where java executable might exist.
@return
Can be empty but never null. Absolute path to the possible locations of Java. | [
"Returns",
"the",
"list",
"of",
"possible",
"places",
"where",
"java",
"executable",
"might",
"exist",
"."
] | train | https://github.com/jenkinsci/ssh-slaves-plugin/blob/95f528730fc1e01b25983459927b7516ead3ee00/src/main/java/hudson/plugins/sshslaves/JavaProvider.java#L58-L60 |
ZuInnoTe/hadoopoffice | fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/HadoopKeyStoreManager.java | HadoopKeyStoreManager.getPrivateKey | public Key getPrivateKey(String alias, String password) throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException {
return this.keystore.getKey(alias, password.toCharArray());
} | java | public Key getPrivateKey(String alias, String password) throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException {
return this.keystore.getKey(alias, password.toCharArray());
} | [
"public",
"Key",
"getPrivateKey",
"(",
"String",
"alias",
",",
"String",
"password",
")",
"throws",
"UnrecoverableKeyException",
",",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"this",
".",
"keystore",
".",
"getKey",
"(",
"alias",
",",
"p... | Reads a private key from keystore
@param alias
@param password
@return
@throws UnrecoverableKeyException
@throws KeyStoreException
@throws NoSuchAlgorithmException | [
"Reads",
"a",
"private",
"key",
"from",
"keystore"
] | train | https://github.com/ZuInnoTe/hadoopoffice/blob/58fc9223ee290bcb14847aaaff3fadf39c465e46/fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/HadoopKeyStoreManager.java#L103-L105 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/UTF8ByteArrayUtils.java | UTF8ByteArrayUtils.findByte | public static int findByte(byte [] utf, int start, int end, byte b) {
for(int i=start; i<end; i++) {
if (utf[i]==b) {
return i;
}
}
return -1;
} | java | public static int findByte(byte [] utf, int start, int end, byte b) {
for(int i=start; i<end; i++) {
if (utf[i]==b) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"findByte",
"(",
"byte",
"[",
"]",
"utf",
",",
"int",
"start",
",",
"int",
"end",
",",
"byte",
"b",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"start",
";",
"i",
"<",
"end",
";",
"i",
"++",
")",
"{",
"if",
"(",
"utf",
... | Find the first occurrence of the given byte b in a UTF-8 encoded string
@param utf a byte array containing a UTF-8 encoded string
@param start starting offset
@param end ending position
@param b the byte to find
@return position that first byte occures otherwise -1 | [
"Find",
"the",
"first",
"occurrence",
"of",
"the",
"given",
"byte",
"b",
"in",
"a",
"UTF",
"-",
"8",
"encoded",
"string"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/UTF8ByteArrayUtils.java#L30-L37 |
KostyaSha/yet-another-docker-plugin | yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/utils/HostAndPortChecker.java | HostAndPortChecker.sleepFor | private static void sleepFor(int time, TimeUnit units) {
try {
LOG.trace("Sleeping for {} {}", time, units.toString());
Thread.sleep(units.toMillis(time));
} catch (InterruptedException e) {
// no-op
}
} | java | private static void sleepFor(int time, TimeUnit units) {
try {
LOG.trace("Sleeping for {} {}", time, units.toString());
Thread.sleep(units.toMillis(time));
} catch (InterruptedException e) {
// no-op
}
} | [
"private",
"static",
"void",
"sleepFor",
"(",
"int",
"time",
",",
"TimeUnit",
"units",
")",
"{",
"try",
"{",
"LOG",
".",
"trace",
"(",
"\"Sleeping for {} {}\"",
",",
"time",
",",
"units",
".",
"toString",
"(",
")",
")",
";",
"Thread",
".",
"sleep",
"("... | Blocks current thread for {@code time} of {@code units}
@param time number of units
@param units to convert to millis | [
"Blocks",
"current",
"thread",
"for",
"{",
"@code",
"time",
"}",
"of",
"{",
"@code",
"units",
"}"
] | train | https://github.com/KostyaSha/yet-another-docker-plugin/blob/40b12e39ff94c3834cff7e028c3dd01c88e87d77/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/utils/HostAndPortChecker.java#L111-L118 |
arquillian/arquillian-cube | core/src/main/java/org/arquillian/cube/impl/util/ConfigUtil.java | ConfigUtil.getStringProperty | public static String getStringProperty(String name, Map<String, String> map, String defaultValue) {
if (map.containsKey(name) && Strings.isNotNullOrEmpty(map.get(name))) {
defaultValue = map.get(name);
}
return getPropertyOrEnvironmentVariable(name, defaultValue);
} | java | public static String getStringProperty(String name, Map<String, String> map, String defaultValue) {
if (map.containsKey(name) && Strings.isNotNullOrEmpty(map.get(name))) {
defaultValue = map.get(name);
}
return getPropertyOrEnvironmentVariable(name, defaultValue);
} | [
"public",
"static",
"String",
"getStringProperty",
"(",
"String",
"name",
",",
"Map",
"<",
"String",
",",
"String",
">",
"map",
",",
"String",
"defaultValue",
")",
"{",
"if",
"(",
"map",
".",
"containsKey",
"(",
"name",
")",
"&&",
"Strings",
".",
"isNotN... | Gets a property from system, environment or an external map.
The lookup order is system > env > map > defaultValue.
@param name
The name of the property.
@param map
The external map.
@param defaultValue
The value that should be used if property is not found. | [
"Gets",
"a",
"property",
"from",
"system",
"environment",
"or",
"an",
"external",
"map",
".",
"The",
"lookup",
"order",
"is",
"system",
">",
"env",
">",
"map",
">",
"defaultValue",
"."
] | train | https://github.com/arquillian/arquillian-cube/blob/ce6b08062cc6ba2a68ecc29606bbae9acda5be13/core/src/main/java/org/arquillian/cube/impl/util/ConfigUtil.java#L25-L30 |
alipay/sofa-rpc | core/common/src/main/java/com/alipay/sofa/rpc/common/utils/FileUtils.java | FileUtils.file2String | public static String file2String(Class clazz, String relativePath, String encoding) throws IOException {
InputStream is = null;
InputStreamReader reader = null;
BufferedReader bufferedReader = null;
try {
is = clazz.getResourceAsStream(relativePath);
reader = new InputStreamReader(is, encoding);
bufferedReader = new BufferedReader(reader);
StringBuilder context = new StringBuilder();
String lineText;
while ((lineText = bufferedReader.readLine()) != null) {
context.append(lineText).append(LINE_SEPARATOR);
}
return context.toString();
} finally {
if (bufferedReader != null) {
bufferedReader.close();
}
if (reader != null) {
reader.close();
}
if (is != null) {
is.close();
}
}
} | java | public static String file2String(Class clazz, String relativePath, String encoding) throws IOException {
InputStream is = null;
InputStreamReader reader = null;
BufferedReader bufferedReader = null;
try {
is = clazz.getResourceAsStream(relativePath);
reader = new InputStreamReader(is, encoding);
bufferedReader = new BufferedReader(reader);
StringBuilder context = new StringBuilder();
String lineText;
while ((lineText = bufferedReader.readLine()) != null) {
context.append(lineText).append(LINE_SEPARATOR);
}
return context.toString();
} finally {
if (bufferedReader != null) {
bufferedReader.close();
}
if (reader != null) {
reader.close();
}
if (is != null) {
is.close();
}
}
} | [
"public",
"static",
"String",
"file2String",
"(",
"Class",
"clazz",
",",
"String",
"relativePath",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"InputStream",
"is",
"=",
"null",
";",
"InputStreamReader",
"reader",
"=",
"null",
";",
"BufferedRead... | 读取类相对路径内容
@param clazz 文件
@param relativePath 相对路径
@param encoding 编码
@return 文件内容
@throws IOException 发送IO异常 | [
"读取类相对路径内容"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/FileUtils.java#L141-L166 |
alexa/alexa-skills-kit-sdk-for-java | ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java | ResponseBuilder.addElicitSlotDirective | public ResponseBuilder addElicitSlotDirective(String slotName, Intent updatedIntent) {
ElicitSlotDirective elicitSlotDirective = ElicitSlotDirective.builder()
.withUpdatedIntent(updatedIntent)
.withSlotToElicit(slotName)
.build();
return addDirective(elicitSlotDirective);
} | java | public ResponseBuilder addElicitSlotDirective(String slotName, Intent updatedIntent) {
ElicitSlotDirective elicitSlotDirective = ElicitSlotDirective.builder()
.withUpdatedIntent(updatedIntent)
.withSlotToElicit(slotName)
.build();
return addDirective(elicitSlotDirective);
} | [
"public",
"ResponseBuilder",
"addElicitSlotDirective",
"(",
"String",
"slotName",
",",
"Intent",
"updatedIntent",
")",
"{",
"ElicitSlotDirective",
"elicitSlotDirective",
"=",
"ElicitSlotDirective",
".",
"builder",
"(",
")",
".",
"withUpdatedIntent",
"(",
"updatedIntent",
... | Adds a Dialog {@link ElicitSlotDirective} to the response.
@param slotName name of slot to elicit
@param updatedIntent updated intent
@return response builder | [
"Adds",
"a",
"Dialog",
"{",
"@link",
"ElicitSlotDirective",
"}",
"to",
"the",
"response",
"."
] | train | https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java#L287-L293 |
tvesalainen/util | util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java | SimpleWorkflow.switchTo | public M switchTo(K to, M msg)
{
doFork(to, msg);
return doJoin();
} | java | public M switchTo(K to, M msg)
{
doFork(to, msg);
return doJoin();
} | [
"public",
"M",
"switchTo",
"(",
"K",
"to",
",",
"M",
"msg",
")",
"{",
"doFork",
"(",
"to",
",",
"msg",
")",
";",
"return",
"doJoin",
"(",
")",
";",
"}"
] | Switch executing thread.
@param to Next executing
@param msg
@return | [
"Switch",
"executing",
"thread",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/SimpleWorkflow.java#L254-L258 |
sawano/java-commons | src/main/java/se/sawano/java/commons/lang/validate/Validate.java | Validate.validState | public static void validState(final boolean expression, final String message, final Object... values) {
INSTANCE.validState(expression, message, values);
} | java | public static void validState(final boolean expression, final String message, final Object... values) {
INSTANCE.validState(expression, message, values);
} | [
"public",
"static",
"void",
"validState",
"(",
"final",
"boolean",
"expression",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"INSTANCE",
".",
"validState",
"(",
"expression",
",",
"message",
",",
"values",
")",
";",
... | <p>Validate that the stateful condition is {@code true}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean
expression, such as validating a primitive number or using your own custom validation expression.</p>
<pre>Validate.validState(this.isOk(), "The state is not OK: %s", myObject);</pre>
@param expression
the boolean expression to check
@param message
the {@link String#format(String, Object...)} exception message if invalid, not null
@param values
the optional values for the formatted exception message, null array not recommended
@throws IllegalStateValidationException
if expression is {@code false}
@see #validState(boolean) | [
"<p",
">",
"Validate",
"that",
"the",
"stateful",
"condition",
"is",
"{",
"@code",
"true",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"This",
"method",
"is",
"useful",
"when",
"validating",
"according",
... | train | https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L1355-L1357 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/CouchbaseAsyncBucket.java | CouchbaseAsyncBucket.addDetails | private static <X extends CouchbaseException, R extends CouchbaseResponse> X addDetails(X ex, R r) {
return Utils.addDetails(ex, r);
} | java | private static <X extends CouchbaseException, R extends CouchbaseResponse> X addDetails(X ex, R r) {
return Utils.addDetails(ex, r);
} | [
"private",
"static",
"<",
"X",
"extends",
"CouchbaseException",
",",
"R",
"extends",
"CouchbaseResponse",
">",
"X",
"addDetails",
"(",
"X",
"ex",
",",
"R",
"r",
")",
"{",
"return",
"Utils",
".",
"addDetails",
"(",
"ex",
",",
"r",
")",
";",
"}"
] | Helper method to encapsulate the logic of enriching the exception with detailed status info. | [
"Helper",
"method",
"to",
"encapsulate",
"the",
"logic",
"of",
"enriching",
"the",
"exception",
"with",
"detailed",
"status",
"info",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/CouchbaseAsyncBucket.java#L2102-L2104 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/io/Files.java | Files.readLines | @CanIgnoreReturnValue // some processors won't return a useful result
public static <T> T readLines(File file, Charset charset, LineProcessor<T> callback)
throws IOException {
return asCharSource(file, charset).readLines(callback);
} | java | @CanIgnoreReturnValue // some processors won't return a useful result
public static <T> T readLines(File file, Charset charset, LineProcessor<T> callback)
throws IOException {
return asCharSource(file, charset).readLines(callback);
} | [
"@",
"CanIgnoreReturnValue",
"// some processors won't return a useful result",
"public",
"static",
"<",
"T",
">",
"T",
"readLines",
"(",
"File",
"file",
",",
"Charset",
"charset",
",",
"LineProcessor",
"<",
"T",
">",
"callback",
")",
"throws",
"IOException",
"{",
... | Streams lines from a {@link File}, stopping when our callback returns false, or we have read
all of the lines.
@param file the file to read from
@param charset the charset used to decode the input stream; see {@link StandardCharsets} for
helpful predefined constants
@param callback the {@link LineProcessor} to use to handle the lines
@return the output of processing the lines
@throws IOException if an I/O error occurs | [
"Streams",
"lines",
"from",
"a",
"{",
"@link",
"File",
"}",
"stopping",
"when",
"our",
"callback",
"returns",
"false",
"or",
"we",
"have",
"read",
"all",
"of",
"the",
"lines",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/io/Files.java#L550-L554 |
centic9/commons-test | src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java | SafeCloseSmtpServer.sendResponse | private static void sendResponse(PrintWriter out, SmtpResponse smtpResponse) {
if (smtpResponse.getCode() > 0) {
int code = smtpResponse.getCode();
String message = smtpResponse.getMessage();
out.print(code + " " + message + "\r\n");
out.flush();
}
} | java | private static void sendResponse(PrintWriter out, SmtpResponse smtpResponse) {
if (smtpResponse.getCode() > 0) {
int code = smtpResponse.getCode();
String message = smtpResponse.getMessage();
out.print(code + " " + message + "\r\n");
out.flush();
}
} | [
"private",
"static",
"void",
"sendResponse",
"(",
"PrintWriter",
"out",
",",
"SmtpResponse",
"smtpResponse",
")",
"{",
"if",
"(",
"smtpResponse",
".",
"getCode",
"(",
")",
">",
"0",
")",
"{",
"int",
"code",
"=",
"smtpResponse",
".",
"getCode",
"(",
")",
... | Send response to client.
@param out socket output stream
@param smtpResponse response object | [
"Send",
"response",
"to",
"client",
"."
] | train | https://github.com/centic9/commons-test/blob/562047c198133ecb116f2472e9aeb15e866579f5/src/main/java/org/dstadler/commons/email/SafeCloseSmtpServer.java#L251-L258 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/util/HexHelper.java | HexHelper.generateHex | public static final String generateHex(final Random random, final int characters)
{
if (characters < 1)
throw new IllegalArgumentException("characters must be >= 1");
final char[] str = new char[characters];
for (int i = 0; i < characters; i++)
{
str[i] = hex[random.nextInt(16)];
}
return new String(str);
} | java | public static final String generateHex(final Random random, final int characters)
{
if (characters < 1)
throw new IllegalArgumentException("characters must be >= 1");
final char[] str = new char[characters];
for (int i = 0; i < characters; i++)
{
str[i] = hex[random.nextInt(16)];
}
return new String(str);
} | [
"public",
"static",
"final",
"String",
"generateHex",
"(",
"final",
"Random",
"random",
",",
"final",
"int",
"characters",
")",
"{",
"if",
"(",
"characters",
"<",
"1",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"characters must be >= 1\"",
")",
";",... | Generates a hexidecimal String of length <code>characters</code>
@param random
the random number generator to use
@param characters
the number of characters in the resulting String
@return | [
"Generates",
"a",
"hexidecimal",
"String",
"of",
"length",
"<code",
">",
"characters<",
"/",
"code",
">"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/util/HexHelper.java#L142-L155 |
Gant/Gant | src/main/groovy/org/codehaus/gant/GantMetaClass.java | GantMetaClass.invokeMethod | @SuppressWarnings("rawtypes")
@Override public Object invokeMethod(final Class sender, final Object receiver, final String methodName, final Object[] arguments, final boolean isCallToSuper, final boolean fromInsideClass) {
return invokeMethod(receiver, methodName, arguments);
} | java | @SuppressWarnings("rawtypes")
@Override public Object invokeMethod(final Class sender, final Object receiver, final String methodName, final Object[] arguments, final boolean isCallToSuper, final boolean fromInsideClass) {
return invokeMethod(receiver, methodName, arguments);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"@",
"Override",
"public",
"Object",
"invokeMethod",
"(",
"final",
"Class",
"sender",
",",
"final",
"Object",
"receiver",
",",
"final",
"String",
"methodName",
",",
"final",
"Object",
"[",
"]",
"arguments",
",... | Invoke a method on the given receiver for the specified arguments. The sender is the class that
invoked the method on the object. Attempt to establish the method to invoke based on the name and
arguments provided.
<p>The {@code isCallToSuper} and {@code fromInsideClass} help the Groovy runtime perform
optimizations on the call to go directly to the superclass if necessary.</p>
@param sender The {@code java.lang.Class} instance that invoked the method.
@param receiver The object which the method was invoked on.
@param methodName The name of the method.
@param arguments The arguments to the method.
@param isCallToSuper Whether the method is a call to a superclass method.
@param fromInsideClass Whether the call was invoked from the inside or the outside of the class.
@return The return value of the method | [
"Invoke",
"a",
"method",
"on",
"the",
"given",
"receiver",
"for",
"the",
"specified",
"arguments",
".",
"The",
"sender",
"is",
"the",
"class",
"that",
"invoked",
"the",
"method",
"on",
"the",
"object",
".",
"Attempt",
"to",
"establish",
"the",
"method",
"t... | train | https://github.com/Gant/Gant/blob/8f82b3cd8968d5595dc44e2beae9f7948172868b/src/main/groovy/org/codehaus/gant/GantMetaClass.java#L205-L208 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java | DatabasesInner.beginExportAsync | public Observable<ImportExportOperationResultInner> beginExportAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters) {
return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<ImportExportOperationResultInner>, ImportExportOperationResultInner>() {
@Override
public ImportExportOperationResultInner call(ServiceResponse<ImportExportOperationResultInner> response) {
return response.body();
}
});
} | java | public Observable<ImportExportOperationResultInner> beginExportAsync(String resourceGroupName, String serverName, String databaseName, ImportExportDatabaseDefinition parameters) {
return beginExportWithServiceResponseAsync(resourceGroupName, serverName, databaseName, parameters).map(new Func1<ServiceResponse<ImportExportOperationResultInner>, ImportExportOperationResultInner>() {
@Override
public ImportExportOperationResultInner call(ServiceResponse<ImportExportOperationResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImportExportOperationResultInner",
">",
"beginExportAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"ImportExportDatabaseDefinition",
"parameters",
")",
"{",
"return",
"beginExportWit... | Exports a database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@param parameters The database export request parameters.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImportExportOperationResultInner object | [
"Exports",
"a",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java#L1026-L1033 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/value/binary/FileSystemBinaryStore.java | FileSystemBinaryStore.pruneEmptyDirectories | protected void pruneEmptyDirectories( File directory,
File removeable ) {
assert directory != null;
assert removeable != null;
if (directory.equals(removeable)) {
return;
}
assert isAncestor(directory, removeable);
while (!removeable.equals(directory)) {
if (removeable.exists()) {
// It exists, so try to delete it...
if (!removeable.delete()) {
// Couldn't delete it, so stop
return;
}
}
removeable = removeable.getParentFile();
}
} | java | protected void pruneEmptyDirectories( File directory,
File removeable ) {
assert directory != null;
assert removeable != null;
if (directory.equals(removeable)) {
return;
}
assert isAncestor(directory, removeable);
while (!removeable.equals(directory)) {
if (removeable.exists()) {
// It exists, so try to delete it...
if (!removeable.delete()) {
// Couldn't delete it, so stop
return;
}
}
removeable = removeable.getParentFile();
}
} | [
"protected",
"void",
"pruneEmptyDirectories",
"(",
"File",
"directory",
",",
"File",
"removeable",
")",
"{",
"assert",
"directory",
"!=",
"null",
";",
"assert",
"removeable",
"!=",
"null",
";",
"if",
"(",
"directory",
".",
"equals",
"(",
"removeable",
")",
"... | Remove any empty directories above <code>removeable</code> but below <code>directory</code>
@param directory the top-level directory to keep; may not be null and must be an ancestor of <code>removeable</code>
@param removeable the file or directory above which any empty directories can be removed; may not be null | [
"Remove",
"any",
"empty",
"directories",
"above",
"<code",
">",
"removeable<",
"/",
"code",
">",
"but",
"below",
"<code",
">",
"directory<",
"/",
"code",
">"
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/value/binary/FileSystemBinaryStore.java#L443-L462 |
super-csv/super-csv | super-csv/src/main/java/org/supercsv/cellprocessor/ParseDateTimeAbstract.java | ParseDateTimeAbstract.checkPreconditions | private static void checkPreconditions(final String dateFormat, final Locale locale) {
if( dateFormat == null ) {
throw new NullPointerException("dateFormat should not be null");
} else if( locale == null ) {
throw new NullPointerException("locale should not be null");
}
} | java | private static void checkPreconditions(final String dateFormat, final Locale locale) {
if( dateFormat == null ) {
throw new NullPointerException("dateFormat should not be null");
} else if( locale == null ) {
throw new NullPointerException("locale should not be null");
}
} | [
"private",
"static",
"void",
"checkPreconditions",
"(",
"final",
"String",
"dateFormat",
",",
"final",
"Locale",
"locale",
")",
"{",
"if",
"(",
"dateFormat",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"dateFormat should not be null\"",
... | Checks the preconditions for creating a new ParseDateTimeAbstract processor with date format and locale.
@param dateFormat
the date format to use
@param locale
the Locale used to parse the date
@throws NullPointerException
if dateFormat or locale is null | [
"Checks",
"the",
"preconditions",
"for",
"creating",
"a",
"new",
"ParseDateTimeAbstract",
"processor",
"with",
"date",
"format",
"and",
"locale",
"."
] | train | https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/ParseDateTimeAbstract.java#L196-L202 |
google/closure-templates | java/src/com/google/template/soy/pysrc/internal/GenPyCallExprVisitor.java | GenPyCallExprVisitor.visitCallDelegateNode | @Override
protected PyExpr visitCallDelegateNode(CallDelegateNode node) {
ExprRootNode variantSoyExpr = node.getDelCalleeVariantExpr();
PyExpr variantPyExpr;
if (variantSoyExpr == null) {
// Case 1: Delegate call with empty variant.
variantPyExpr = new PyStringExpr("''");
} else {
// Case 2: Delegate call with variant expression.
TranslateToPyExprVisitor translator =
new TranslateToPyExprVisitor(localVarStack, pluginValueFactory, errorReporter);
variantPyExpr = translator.exec(variantSoyExpr);
}
String calleeExprText =
new PyFunctionExprBuilder("runtime.get_delegate_fn")
.addArg(node.getDelCalleeName())
.addArg(variantPyExpr)
.addArg(node.allowEmptyDefault())
.build();
String callExprText = calleeExprText + "(" + genObjToPass(node) + ", ijData)";
return escapeCall(callExprText, node.getEscapingDirectives());
} | java | @Override
protected PyExpr visitCallDelegateNode(CallDelegateNode node) {
ExprRootNode variantSoyExpr = node.getDelCalleeVariantExpr();
PyExpr variantPyExpr;
if (variantSoyExpr == null) {
// Case 1: Delegate call with empty variant.
variantPyExpr = new PyStringExpr("''");
} else {
// Case 2: Delegate call with variant expression.
TranslateToPyExprVisitor translator =
new TranslateToPyExprVisitor(localVarStack, pluginValueFactory, errorReporter);
variantPyExpr = translator.exec(variantSoyExpr);
}
String calleeExprText =
new PyFunctionExprBuilder("runtime.get_delegate_fn")
.addArg(node.getDelCalleeName())
.addArg(variantPyExpr)
.addArg(node.allowEmptyDefault())
.build();
String callExprText = calleeExprText + "(" + genObjToPass(node) + ", ijData)";
return escapeCall(callExprText, node.getEscapingDirectives());
} | [
"@",
"Override",
"protected",
"PyExpr",
"visitCallDelegateNode",
"(",
"CallDelegateNode",
"node",
")",
"{",
"ExprRootNode",
"variantSoyExpr",
"=",
"node",
".",
"getDelCalleeVariantExpr",
"(",
")",
";",
"PyExpr",
"variantPyExpr",
";",
"if",
"(",
"variantSoyExpr",
"==... | Visits a delegate call node and builds the call expression to retrieve the function and execute
it. The get_delegate_fn returns the function directly, so its output can be called directly.
@param node The delegate call node.
@return The call Python expression. | [
"Visits",
"a",
"delegate",
"call",
"node",
"and",
"builds",
"the",
"call",
"expression",
"to",
"retrieve",
"the",
"function",
"and",
"execute",
"it",
".",
"The",
"get_delegate_fn",
"returns",
"the",
"function",
"directly",
"so",
"its",
"output",
"can",
"be",
... | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/GenPyCallExprVisitor.java#L157-L179 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/util/ElementIdMap.java | ElementIdMap.addReferenced | public ElementId addReferenced(char[] buffer, int start, int len, int hash,
Location loc, PrefixedName elemName, PrefixedName attrName)
{
int index = (hash & mIndexMask);
ElementId id = mTable[index];
while (id != null) {
if (id.idMatches(buffer, start, len)) { // found existing one
return id;
}
id = id.nextColliding();
}
// Not found, need to create a placeholder...
// But first, do we need more room?
if (mSize >= mSizeThreshold) {
rehash();
// Index changes, for the new entr:
index = (hash & mIndexMask);
}
++mSize;
// Ok, then, let's create the entry
String idStr = new String(buffer, start, len);
id = new ElementId(idStr, loc, false, elemName, attrName);
// First, let's link it to Map; all ids have to be connected
id.setNextColliding(mTable[index]);
mTable[index] = id;
// And then add the undefined entry at the end of list
if (mHead == null) {
mHead = mTail = id;
} else {
mTail.linkUndefined(id);
mTail = id;
}
return id;
} | java | public ElementId addReferenced(char[] buffer, int start, int len, int hash,
Location loc, PrefixedName elemName, PrefixedName attrName)
{
int index = (hash & mIndexMask);
ElementId id = mTable[index];
while (id != null) {
if (id.idMatches(buffer, start, len)) { // found existing one
return id;
}
id = id.nextColliding();
}
// Not found, need to create a placeholder...
// But first, do we need more room?
if (mSize >= mSizeThreshold) {
rehash();
// Index changes, for the new entr:
index = (hash & mIndexMask);
}
++mSize;
// Ok, then, let's create the entry
String idStr = new String(buffer, start, len);
id = new ElementId(idStr, loc, false, elemName, attrName);
// First, let's link it to Map; all ids have to be connected
id.setNextColliding(mTable[index]);
mTable[index] = id;
// And then add the undefined entry at the end of list
if (mHead == null) {
mHead = mTail = id;
} else {
mTail.linkUndefined(id);
mTail = id;
}
return id;
} | [
"public",
"ElementId",
"addReferenced",
"(",
"char",
"[",
"]",
"buffer",
",",
"int",
"start",
",",
"int",
"len",
",",
"int",
"hash",
",",
"Location",
"loc",
",",
"PrefixedName",
"elemName",
",",
"PrefixedName",
"attrName",
")",
"{",
"int",
"index",
"=",
... | Method called when a reference to id is encountered. If so, need
to check if specified id entry (ref or definiton) exists; and if not,
to add a reference marker. | [
"Method",
"called",
"when",
"a",
"reference",
"to",
"id",
"is",
"encountered",
".",
"If",
"so",
"need",
"to",
"check",
"if",
"specified",
"id",
"entry",
"(",
"ref",
"or",
"definiton",
")",
"exists",
";",
"and",
"if",
"not",
"to",
"add",
"a",
"reference... | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/util/ElementIdMap.java#L143-L182 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/super_src/org/opencms/util/CmsUUID.java | CmsUUID.checkId | public static void checkId(CmsUUID id, boolean canBeNull) {
if (canBeNull && (id == null)) {
return;
}
if ((!canBeNull && (id == null)) || id.isNullUUID()) {
throw new IllegalArgumentException(Messages.get().key(Messages.ERR_INVALID_UUID_1, id));
}
} | java | public static void checkId(CmsUUID id, boolean canBeNull) {
if (canBeNull && (id == null)) {
return;
}
if ((!canBeNull && (id == null)) || id.isNullUUID()) {
throw new IllegalArgumentException(Messages.get().key(Messages.ERR_INVALID_UUID_1, id));
}
} | [
"public",
"static",
"void",
"checkId",
"(",
"CmsUUID",
"id",
",",
"boolean",
"canBeNull",
")",
"{",
"if",
"(",
"canBeNull",
"&&",
"(",
"id",
"==",
"null",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"(",
"!",
"canBeNull",
"&&",
"(",
"id",
"==",
... | Check that the given id is not the null id.<p>
@param id the id to check
@param canBeNull only if flag is set, <code>null</code> is accepted
@see #isNullUUID() | [
"Check",
"that",
"the",
"given",
"id",
"is",
"not",
"the",
"null",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/org/opencms/util/CmsUUID.java#L78-L86 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Validate.java | Validate.notEmpty | public static <T> T[] notEmpty(final T[] array, final String message, final Object... values) {
if (array == null) {
throw new NullPointerException(StringUtils.simpleFormat(message, values));
}
if (array.length == 0) {
throw new IllegalArgumentException(StringUtils.simpleFormat(message, values));
}
return array;
} | java | public static <T> T[] notEmpty(final T[] array, final String message, final Object... values) {
if (array == null) {
throw new NullPointerException(StringUtils.simpleFormat(message, values));
}
if (array.length == 0) {
throw new IllegalArgumentException(StringUtils.simpleFormat(message, values));
}
return array;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"notEmpty",
"(",
"final",
"T",
"[",
"]",
"array",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"array",
"==",
"null",
")",
"{",
"throw",
"new",
... | <p>Validate that the specified argument array is neither {@code null}
nor a length of zero (no elements); otherwise throwing an exception
with the specified message.
<pre>Validate.notEmpty(myArray, "The array must not be empty");</pre>
@param <T> the array type
@param array the array to check, validated not null by this method
@param message the {@link String#format(String, Object...)} exception message if invalid, not null
@param values the optional values for the formatted exception message, null array not recommended
@return the validated array (never {@code null} method for chaining)
@throws NullPointerException if the array is {@code null}
@throws IllegalArgumentException if the array is empty
@see #notEmpty(Object[]) | [
"<p",
">",
"Validate",
"that",
"the",
"specified",
"argument",
"array",
"is",
"neither",
"{",
"@code",
"null",
"}",
"nor",
"a",
"length",
"of",
"zero",
"(",
"no",
"elements",
")",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L251-L259 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.listPreparationAndReleaseTaskStatusNextAsync | public Observable<Page<JobPreparationAndReleaseTaskExecutionInformation>> listPreparationAndReleaseTaskStatusNextAsync(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions) {
return listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions)
.map(new Func1<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>, Page<JobPreparationAndReleaseTaskExecutionInformation>>() {
@Override
public Page<JobPreparationAndReleaseTaskExecutionInformation> call(ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders> response) {
return response.body();
}
});
} | java | public Observable<Page<JobPreparationAndReleaseTaskExecutionInformation>> listPreparationAndReleaseTaskStatusNextAsync(final String nextPageLink, final JobListPreparationAndReleaseTaskStatusNextOptions jobListPreparationAndReleaseTaskStatusNextOptions) {
return listPreparationAndReleaseTaskStatusNextWithServiceResponseAsync(nextPageLink, jobListPreparationAndReleaseTaskStatusNextOptions)
.map(new Func1<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>, Page<JobPreparationAndReleaseTaskExecutionInformation>>() {
@Override
public Page<JobPreparationAndReleaseTaskExecutionInformation> call(ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"JobPreparationAndReleaseTaskExecutionInformation",
">",
">",
"listPreparationAndReleaseTaskStatusNextAsync",
"(",
"final",
"String",
"nextPageLink",
",",
"final",
"JobListPreparationAndReleaseTaskStatusNextOptions",
"jobListPreparationAndRel... | Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run.
This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param jobListPreparationAndReleaseTaskStatusNextOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<JobPreparationAndReleaseTaskExecutionInformation> object | [
"Lists",
"the",
"execution",
"status",
"of",
"the",
"Job",
"Preparation",
"and",
"Job",
"Release",
"task",
"for",
"the",
"specified",
"job",
"across",
"the",
"compute",
"nodes",
"where",
"the",
"job",
"has",
"run",
".",
"This",
"API",
"returns",
"the",
"Jo... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L3965-L3973 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/map/MapView.java | MapView.getPanToViewTranslation | public Matrix getPanToViewTranslation() {
if (viewState.getScale() > 0) {
double dX = -((viewState.getX() - viewState.getPanX()) * viewState.getScale()) + width / 2;
double dY = (viewState.getY() - viewState.getPanY()) * viewState.getScale() + height / 2;
return new Matrix(1, 0, 0, 1, dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
} | java | public Matrix getPanToViewTranslation() {
if (viewState.getScale() > 0) {
double dX = -((viewState.getX() - viewState.getPanX()) * viewState.getScale()) + width / 2;
double dY = (viewState.getY() - viewState.getPanY()) * viewState.getScale() + height / 2;
return new Matrix(1, 0, 0, 1, dX, dY);
}
return new Matrix(1, 0, 0, 1, 0, 0);
} | [
"public",
"Matrix",
"getPanToViewTranslation",
"(",
")",
"{",
"if",
"(",
"viewState",
".",
"getScale",
"(",
")",
">",
"0",
")",
"{",
"double",
"dX",
"=",
"-",
"(",
"(",
"viewState",
".",
"getX",
"(",
")",
"-",
"viewState",
".",
"getPanX",
"(",
")",
... | Return the translation of coordinates relative to the pan origin to view coordinates.
@return transformation matrix | [
"Return",
"the",
"translation",
"of",
"coordinates",
"relative",
"to",
"the",
"pan",
"origin",
"to",
"view",
"coordinates",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/MapView.java#L183-L190 |
LearnLib/learnlib | algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/AbstractTTTHypothesis.java | AbstractTTTHypothesis.getInternalTransition | public TTTTransition<I, D> getInternalTransition(TTTState<I, D> state, I input) {
int inputIdx = alphabet.getSymbolIndex(input);
return getInternalTransition(state, inputIdx);
} | java | public TTTTransition<I, D> getInternalTransition(TTTState<I, D> state, I input) {
int inputIdx = alphabet.getSymbolIndex(input);
return getInternalTransition(state, inputIdx);
} | [
"public",
"TTTTransition",
"<",
"I",
",",
"D",
">",
"getInternalTransition",
"(",
"TTTState",
"<",
"I",
",",
"D",
">",
"state",
",",
"I",
"input",
")",
"{",
"int",
"inputIdx",
"=",
"alphabet",
".",
"getSymbolIndex",
"(",
"input",
")",
";",
"return",
"g... | Retrieves the <i>internal</i> transition (i.e., the {@link TTTTransition} object) for a given state and input.
This method is required since the {@link DFA} interface requires the return value of {@link
#getTransition(TTTState, Object)} to refer to the successor state directly.
@param state
the source state
@param input
the input symbol triggering the transition
@return the transition object | [
"Retrieves",
"the",
"<i",
">",
"internal<",
"/",
"i",
">",
"transition",
"(",
"i",
".",
"e",
".",
"the",
"{",
"@link",
"TTTTransition",
"}",
"object",
")",
"for",
"a",
"given",
"state",
"and",
"input",
".",
"This",
"method",
"is",
"required",
"since",
... | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/AbstractTTTHypothesis.java#L98-L101 |
pac4j/pac4j | pac4j-core/src/main/java/org/pac4j/core/profile/ProfileHelper.java | ProfileHelper.sanitizeIdentifier | public static String sanitizeIdentifier(final BasicUserProfile profile, final Object id) {
if (id != null) {
String sId = id.toString();
if (profile != null) {
final String type = profile.getClass().getName() + BasicUserProfile.SEPARATOR;
if (sId.startsWith(type)) {
sId = sId.substring(type.length());
}
}
return sId;
}
return null;
} | java | public static String sanitizeIdentifier(final BasicUserProfile profile, final Object id) {
if (id != null) {
String sId = id.toString();
if (profile != null) {
final String type = profile.getClass().getName() + BasicUserProfile.SEPARATOR;
if (sId.startsWith(type)) {
sId = sId.substring(type.length());
}
}
return sId;
}
return null;
} | [
"public",
"static",
"String",
"sanitizeIdentifier",
"(",
"final",
"BasicUserProfile",
"profile",
",",
"final",
"Object",
"id",
")",
"{",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"String",
"sId",
"=",
"id",
".",
"toString",
"(",
")",
";",
"if",
"(",
"pr... | Sanitize into a string identifier.
@param profile the user profile
@param id the identifier object
@return the sanitized identifier | [
"Sanitize",
"into",
"a",
"string",
"identifier",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/profile/ProfileHelper.java#L128-L140 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/AttributeValue.java | AttributeValue.withM | public AttributeValue withM(java.util.Map<String, AttributeValue> m) {
setM(m);
return this;
} | java | public AttributeValue withM(java.util.Map<String, AttributeValue> m) {
setM(m);
return this;
} | [
"public",
"AttributeValue",
"withM",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"AttributeValue",
">",
"m",
")",
"{",
"setM",
"(",
"m",
")",
";",
"return",
"this",
";",
"}"
] | <p>
An attribute of type Map. For example:
</p>
<p>
<code>"M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}</code>
</p>
@param m
An attribute of type Map. For example:</p>
<p>
<code>"M": {"Name": {"S": "Joe"}, "Age": {"N": "35"}}</code>
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"An",
"attribute",
"of",
"type",
"Map",
".",
"For",
"example",
":",
"<",
"/",
"p",
">",
"<p",
">",
"<code",
">",
"M",
":",
"{",
"Name",
":",
"{",
"S",
":",
"Joe",
"}",
"Age",
":",
"{",
"N",
":",
"35",
"}}",
"<",
"/",
"code",
">... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/AttributeValue.java#L739-L742 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/spi/PathsDocumentExtension.java | PathsDocumentExtension.levelOffset | protected int levelOffset(Context context) {
//TODO: Unused method, make sure this is never used and then remove it.
int levelOffset;
switch (context.position) {
case DOCUMENT_BEFORE:
case DOCUMENT_AFTER:
levelOffset = 0;
break;
case DOCUMENT_BEGIN:
case DOCUMENT_END:
case OPERATION_BEFORE:
case OPERATION_AFTER:
levelOffset = 1;
break;
case OPERATION_BEGIN:
case OPERATION_END:
levelOffset = increaseLevelOffset(2);
break;
case OPERATION_DESCRIPTION_BEFORE:
case OPERATION_DESCRIPTION_AFTER:
case OPERATION_PARAMETERS_BEFORE:
case OPERATION_PARAMETERS_AFTER:
case OPERATION_RESPONSES_BEFORE:
case OPERATION_RESPONSES_AFTER:
case OPERATION_SECURITY_BEFORE:
case OPERATION_SECURITY_AFTER:
levelOffset = increaseLevelOffset(2);
break;
case OPERATION_DESCRIPTION_BEGIN:
case OPERATION_DESCRIPTION_END:
case OPERATION_PARAMETERS_BEGIN:
case OPERATION_PARAMETERS_END:
case OPERATION_RESPONSES_BEGIN:
case OPERATION_RESPONSES_END:
case OPERATION_SECURITY_BEGIN:
case OPERATION_SECURITY_END:
levelOffset = 3;
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", context.position));
}
return levelOffset;
} | java | protected int levelOffset(Context context) {
//TODO: Unused method, make sure this is never used and then remove it.
int levelOffset;
switch (context.position) {
case DOCUMENT_BEFORE:
case DOCUMENT_AFTER:
levelOffset = 0;
break;
case DOCUMENT_BEGIN:
case DOCUMENT_END:
case OPERATION_BEFORE:
case OPERATION_AFTER:
levelOffset = 1;
break;
case OPERATION_BEGIN:
case OPERATION_END:
levelOffset = increaseLevelOffset(2);
break;
case OPERATION_DESCRIPTION_BEFORE:
case OPERATION_DESCRIPTION_AFTER:
case OPERATION_PARAMETERS_BEFORE:
case OPERATION_PARAMETERS_AFTER:
case OPERATION_RESPONSES_BEFORE:
case OPERATION_RESPONSES_AFTER:
case OPERATION_SECURITY_BEFORE:
case OPERATION_SECURITY_AFTER:
levelOffset = increaseLevelOffset(2);
break;
case OPERATION_DESCRIPTION_BEGIN:
case OPERATION_DESCRIPTION_END:
case OPERATION_PARAMETERS_BEGIN:
case OPERATION_PARAMETERS_END:
case OPERATION_RESPONSES_BEGIN:
case OPERATION_RESPONSES_END:
case OPERATION_SECURITY_BEGIN:
case OPERATION_SECURITY_END:
levelOffset = 3;
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", context.position));
}
return levelOffset;
} | [
"protected",
"int",
"levelOffset",
"(",
"Context",
"context",
")",
"{",
"//TODO: Unused method, make sure this is never used and then remove it.",
"int",
"levelOffset",
";",
"switch",
"(",
"context",
".",
"position",
")",
"{",
"case",
"DOCUMENT_BEFORE",
":",
"case",
"DO... | Returns title level offset from 1 to apply to content
@param context context
@return title level offset | [
"Returns",
"title",
"level",
"offset",
"from",
"1",
"to",
"apply",
"to",
"content"
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/spi/PathsDocumentExtension.java#L39-L81 |
Wikidata/Wikidata-Toolkit | wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/SnakRdfConverter.java | SnakRdfConverter.setSnakContext | public void setSnakContext(Resource subject, PropertyContext propertyContext) {
this.currentSubject = subject;
this.currentPropertyContext = propertyContext;
this.simple = (this.currentPropertyContext == PropertyContext.DIRECT)
|| (this.currentPropertyContext == PropertyContext.VALUE_SIMPLE)
|| (this.currentPropertyContext == PropertyContext.QUALIFIER_SIMPLE)
|| (this.currentPropertyContext == PropertyContext.REFERENCE_SIMPLE);
} | java | public void setSnakContext(Resource subject, PropertyContext propertyContext) {
this.currentSubject = subject;
this.currentPropertyContext = propertyContext;
this.simple = (this.currentPropertyContext == PropertyContext.DIRECT)
|| (this.currentPropertyContext == PropertyContext.VALUE_SIMPLE)
|| (this.currentPropertyContext == PropertyContext.QUALIFIER_SIMPLE)
|| (this.currentPropertyContext == PropertyContext.REFERENCE_SIMPLE);
} | [
"public",
"void",
"setSnakContext",
"(",
"Resource",
"subject",
",",
"PropertyContext",
"propertyContext",
")",
"{",
"this",
".",
"currentSubject",
"=",
"subject",
";",
"this",
".",
"currentPropertyContext",
"=",
"propertyContext",
";",
"this",
".",
"simple",
"=",... | Sets the context in which snaks should be used. This is useful when
converting many snaks that have the same context. In this case, one can
set the context manually and use the converter as a {@link SnakVisitor}.
@param subject
the resource that should be used as a subject of the serialied
triples
@param propertyContext
the context in which the snaks that are to be converted are
used | [
"Sets",
"the",
"context",
"in",
"which",
"snaks",
"should",
"be",
"used",
".",
"This",
"is",
"useful",
"when",
"converting",
"many",
"snaks",
"that",
"have",
"the",
"same",
"context",
".",
"In",
"this",
"case",
"one",
"can",
"set",
"the",
"context",
"man... | train | https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/SnakRdfConverter.java#L135-L143 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.hasUppercaseVariations | public boolean hasUppercaseVariations(int base, boolean lowerOnly) {
if(base > 10) {
int count = getSegmentCount();
for(int i = 0; i < count; i++) {
IPv6AddressSegment seg = getSegment(i);
if(seg.hasUppercaseVariations(base, lowerOnly)) {
return true;
}
}
}
return false;
} | java | public boolean hasUppercaseVariations(int base, boolean lowerOnly) {
if(base > 10) {
int count = getSegmentCount();
for(int i = 0; i < count; i++) {
IPv6AddressSegment seg = getSegment(i);
if(seg.hasUppercaseVariations(base, lowerOnly)) {
return true;
}
}
}
return false;
} | [
"public",
"boolean",
"hasUppercaseVariations",
"(",
"int",
"base",
",",
"boolean",
"lowerOnly",
")",
"{",
"if",
"(",
"base",
">",
"10",
")",
"{",
"int",
"count",
"=",
"getSegmentCount",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
... | Returns whether this subnet or address has alphabetic digits when printed.
Note that this method does not indicate whether any address contained within this subnet has alphabetic digits,
only whether the subnet itself when printed has alphabetic digits.
@return whether the section has alphabetic digits when printed. | [
"Returns",
"whether",
"this",
"subnet",
"or",
"address",
"has",
"alphabetic",
"digits",
"when",
"printed",
"."
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1410-L1421 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.