repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
UrielCh/ovh-java-sdk | ovh-java-sdk-hpcspot/src/main/java/net/minidev/ovh/api/ApiOvhHpcspot.java | ApiOvhHpcspot.serviceName_consumption_GET | public ArrayList<Long> serviceName_consumption_GET(String serviceName, Date hpcspotItemEndDate_from, Date hpcspotItemEndDate_to, Long hpcspotItemId, Long orderId, OvhConsumptionTypeEnum type) throws IOException {
String qPath = "/hpcspot/{serviceName}/consumption";
StringBuilder sb = path(qPath, serviceName);
query(sb, "hpcspotItemEndDate.from", hpcspotItemEndDate_from);
query(sb, "hpcspotItemEndDate.to", hpcspotItemEndDate_to);
query(sb, "hpcspotItemId", hpcspotItemId);
query(sb, "orderId", orderId);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<Long> serviceName_consumption_GET(String serviceName, Date hpcspotItemEndDate_from, Date hpcspotItemEndDate_to, Long hpcspotItemId, Long orderId, OvhConsumptionTypeEnum type) throws IOException {
String qPath = "/hpcspot/{serviceName}/consumption";
StringBuilder sb = path(qPath, serviceName);
query(sb, "hpcspotItemEndDate.from", hpcspotItemEndDate_from);
query(sb, "hpcspotItemEndDate.to", hpcspotItemEndDate_to);
query(sb, "hpcspotItemId", hpcspotItemId);
query(sb, "orderId", orderId);
query(sb, "type", type);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_consumption_GET",
"(",
"String",
"serviceName",
",",
"Date",
"hpcspotItemEndDate_from",
",",
"Date",
"hpcspotItemEndDate_to",
",",
"Long",
"hpcspotItemId",
",",
"Long",
"orderId",
",",
"OvhConsumptionTypeEnum",
"type... | Details of the consumption of your account
REST: GET /hpcspot/{serviceName}/consumption
@param hpcspotItemEndDate_from [required] Filter the value of hpcspotItemEndDate property (>=)
@param hpcspotItemId [required] Filter the value of hpcspotItemId property (=)
@param orderId [required] Filter the value of orderId property (=)
@param hpcspotItemEndDate_to [required] Filter the value of hpcspotItemEndDate property (<=)
@param type [required] Filter the value of type property (=)
@param serviceName [required] The internal name of your HPC Spot account | [
"Details",
"of",
"the",
"consumption",
"of",
"your",
"account"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hpcspot/src/main/java/net/minidev/ovh/api/ApiOvhHpcspot.java#L88-L98 |
threerings/nenya | core/src/main/java/com/threerings/media/animation/ScaleAnimation.java | ScaleAnimation.getSize | public static Point getSize (float scale, Mirage image)
{
int width = Math.max(0, Math.round(image.getWidth() * scale));
int height = Math.max(0, Math.round(image.getHeight() * scale));
return new Point(width, height);
} | java | public static Point getSize (float scale, Mirage image)
{
int width = Math.max(0, Math.round(image.getWidth() * scale));
int height = Math.max(0, Math.round(image.getHeight() * scale));
return new Point(width, height);
} | [
"public",
"static",
"Point",
"getSize",
"(",
"float",
"scale",
",",
"Mirage",
"image",
")",
"{",
"int",
"width",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"Math",
".",
"round",
"(",
"image",
".",
"getWidth",
"(",
")",
"*",
"scale",
")",
")",
";",
"... | Computes the width and height to which an image should be scaled. | [
"Computes",
"the",
"width",
"and",
"height",
"to",
"which",
"an",
"image",
"should",
"be",
"scaled",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/animation/ScaleAnimation.java#L94-L99 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/TimeUtil.java | TimeUtil.timeInMsOrTimeIfNullUnit | public static long timeInMsOrTimeIfNullUnit(long time, TimeUnit timeUnit) {
return timeUnit != null ? timeUnit.toMillis(time) : time;
} | java | public static long timeInMsOrTimeIfNullUnit(long time, TimeUnit timeUnit) {
return timeUnit != null ? timeUnit.toMillis(time) : time;
} | [
"public",
"static",
"long",
"timeInMsOrTimeIfNullUnit",
"(",
"long",
"time",
",",
"TimeUnit",
"timeUnit",
")",
"{",
"return",
"timeUnit",
"!=",
"null",
"?",
"timeUnit",
".",
"toMillis",
"(",
"time",
")",
":",
"time",
";",
"}"
] | Convert time to milliseconds based on the given time unit.
If time unit is null, then input time is treated as milliseconds.
@param time The input time
@param timeUnit The time unit to base the conversion on
@return The millisecond representation of the time based on the unit, or the time
itself if the unit is <code>null</code> | [
"Convert",
"time",
"to",
"milliseconds",
"based",
"on",
"the",
"given",
"time",
"unit",
".",
"If",
"time",
"unit",
"is",
"null",
"then",
"input",
"time",
"is",
"treated",
"as",
"milliseconds",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/TimeUtil.java#L59-L61 |
groupon/monsoon | history/src/main/java/com/groupon/lex/metrics/history/xdr/TSDataScanDir.java | TSDataScanDir.metadata_end_cmp_ | private static int metadata_end_cmp_(MetaData x, MetaData y) {
return x.getEnd().compareTo(y.getEnd());
} | java | private static int metadata_end_cmp_(MetaData x, MetaData y) {
return x.getEnd().compareTo(y.getEnd());
} | [
"private",
"static",
"int",
"metadata_end_cmp_",
"(",
"MetaData",
"x",
",",
"MetaData",
"y",
")",
"{",
"return",
"x",
".",
"getEnd",
"(",
")",
".",
"compareTo",
"(",
"y",
".",
"getEnd",
"(",
")",
")",
";",
"}"
] | Comparator, in order to sort MetaData based on the end timestamp.
@param x One of the MetaData to compare.
@param y Another one of the MetaData to compare.
@return Comparator result. | [
"Comparator",
"in",
"order",
"to",
"sort",
"MetaData",
"based",
"on",
"the",
"end",
"timestamp",
"."
] | train | https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/history/src/main/java/com/groupon/lex/metrics/history/xdr/TSDataScanDir.java#L186-L188 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/storage/DefaultDOManager.java | DefaultDOManager.getNumObjectsWithVersion | private int getNumObjectsWithVersion(Connection conn, int n)
throws SQLException {
PreparedStatement st = null;
try {
String query;
// Because we are dealing with only two Strings, one of which is fixed,
// take advantage of String.concat
if (n > 0) {
query = "SELECT COUNT(*) FROM doRegistry WHERE systemVersion = ".concat(Integer.toString(n));
} else {
query = "SELECT COUNT(*) FROM doRegistry";
}
st = conn.prepareStatement(query);
ResultSet results = st.executeQuery();
results.next();
return results.getInt(1);
} finally {
if (st != null) {
st.close();
}
}
} | java | private int getNumObjectsWithVersion(Connection conn, int n)
throws SQLException {
PreparedStatement st = null;
try {
String query;
// Because we are dealing with only two Strings, one of which is fixed,
// take advantage of String.concat
if (n > 0) {
query = "SELECT COUNT(*) FROM doRegistry WHERE systemVersion = ".concat(Integer.toString(n));
} else {
query = "SELECT COUNT(*) FROM doRegistry";
}
st = conn.prepareStatement(query);
ResultSet results = st.executeQuery();
results.next();
return results.getInt(1);
} finally {
if (st != null) {
st.close();
}
}
} | [
"private",
"int",
"getNumObjectsWithVersion",
"(",
"Connection",
"conn",
",",
"int",
"n",
")",
"throws",
"SQLException",
"{",
"PreparedStatement",
"st",
"=",
"null",
";",
"try",
"{",
"String",
"query",
";",
"// Because we are dealing with only two Strings, one of which ... | Get the number of objects in the registry whose system version is equal
to the given value. If n is less than one, return the total number of
objects in the registry. | [
"Get",
"the",
"number",
"of",
"objects",
"in",
"the",
"registry",
"whose",
"system",
"version",
"is",
"equal",
"to",
"the",
"given",
"value",
".",
"If",
"n",
"is",
"less",
"than",
"one",
"return",
"the",
"total",
"number",
"of",
"objects",
"in",
"the",
... | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/storage/DefaultDOManager.java#L2104-L2126 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/DataChecksum.java | DataChecksum.writeValue | public int writeValue( byte[] buf, int offset, boolean reset )
throws IOException {
if ( size <= 0 ) {
return 0;
}
if ( size == 4 ) {
int checksum = (int) summer.getValue();
writeIntToBuf(checksum, buf, offset);
} else {
throw new IOException( "Unknown Checksum " + type );
}
if ( reset ) {
reset();
}
return size;
} | java | public int writeValue( byte[] buf, int offset, boolean reset )
throws IOException {
if ( size <= 0 ) {
return 0;
}
if ( size == 4 ) {
int checksum = (int) summer.getValue();
writeIntToBuf(checksum, buf, offset);
} else {
throw new IOException( "Unknown Checksum " + type );
}
if ( reset ) {
reset();
}
return size;
} | [
"public",
"int",
"writeValue",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"boolean",
"reset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"size",
"<=",
"0",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"size",
"==",
"4",
")",
"{"... | Writes the current checksum to a buffer.
If <i>reset</i> is true, then resets the checksum.
@return number of bytes written. Will be equal to getChecksumSize(); | [
"Writes",
"the",
"current",
"checksum",
"to",
"a",
"buffer",
".",
"If",
"<i",
">",
"reset<",
"/",
"i",
">",
"is",
"true",
"then",
"resets",
"the",
"checksum",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/DataChecksum.java#L201-L219 |
ops4j/org.ops4j.base | ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java | NullArgumentException.validateNotEmptyContent | public static void validateNotEmptyContent( String[] arrayToCheck, boolean trim, String argumentName )
throws NullArgumentException
{
validateNotEmpty( arrayToCheck, argumentName );
for( int i = 0; i < arrayToCheck.length; i++ )
{
validateNotEmpty( arrayToCheck[ i ], arrayToCheck[ i ] + "[" + i + "]" );
if( trim )
{
validateNotEmpty( arrayToCheck[ i ].trim(), arrayToCheck[ i ] + "[" + i + "]" );
}
}
} | java | public static void validateNotEmptyContent( String[] arrayToCheck, boolean trim, String argumentName )
throws NullArgumentException
{
validateNotEmpty( arrayToCheck, argumentName );
for( int i = 0; i < arrayToCheck.length; i++ )
{
validateNotEmpty( arrayToCheck[ i ], arrayToCheck[ i ] + "[" + i + "]" );
if( trim )
{
validateNotEmpty( arrayToCheck[ i ].trim(), arrayToCheck[ i ] + "[" + i + "]" );
}
}
} | [
"public",
"static",
"void",
"validateNotEmptyContent",
"(",
"String",
"[",
"]",
"arrayToCheck",
",",
"boolean",
"trim",
",",
"String",
"argumentName",
")",
"throws",
"NullArgumentException",
"{",
"validateNotEmpty",
"(",
"arrayToCheck",
",",
"argumentName",
")",
";"... | Validates that the string array instance is not null and that it has entries that are not null or empty.
@param arrayToCheck The object to be tested.
@param trim If the elements should be trimmed before checking if empty
@param argumentName The name of the object, which is used to construct the exception message.
@throws NullArgumentException if the array instance is null or does not have any entries.
@since 0.5.0, January 18, 2008 | [
"Validates",
"that",
"the",
"string",
"array",
"instance",
"is",
"not",
"null",
"and",
"that",
"it",
"has",
"entries",
"that",
"are",
"not",
"null",
"or",
"empty",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-lang/src/main/java/org/ops4j/lang/NullArgumentException.java#L176-L188 |
grandstaish/paperparcel | paperparcel-compiler/src/main/java/paperparcel/Utils.java | Utils.replaceTypeVariablesWithUpperBounds | static TypeMirror replaceTypeVariablesWithUpperBounds(Types types, TypeMirror type) {
return type.accept(UpperBoundSubstitutingVisitor.INSTANCE, types);
} | java | static TypeMirror replaceTypeVariablesWithUpperBounds(Types types, TypeMirror type) {
return type.accept(UpperBoundSubstitutingVisitor.INSTANCE, types);
} | [
"static",
"TypeMirror",
"replaceTypeVariablesWithUpperBounds",
"(",
"Types",
"types",
",",
"TypeMirror",
"type",
")",
"{",
"return",
"type",
".",
"accept",
"(",
"UpperBoundSubstitutingVisitor",
".",
"INSTANCE",
",",
"types",
")",
";",
"}"
] | <p>Use this when you want a field's type that can be used from a static context (e.g. where
the type vars are no longer available).</p>
<p>Must never be called on types that have recursive type arguments, e.g.
{@literal T extends Comparable<T>}.</p> | [
"<p",
">",
"Use",
"this",
"when",
"you",
"want",
"a",
"field",
"s",
"type",
"that",
"can",
"be",
"used",
"from",
"a",
"static",
"context",
"(",
"e",
".",
"g",
".",
"where",
"the",
"type",
"vars",
"are",
"no",
"longer",
"available",
")",
".",
"<",
... | train | https://github.com/grandstaish/paperparcel/blob/917686ced81b335b6708d81d6cc0e3e496f7280d/paperparcel-compiler/src/main/java/paperparcel/Utils.java#L494-L496 |
wildfly/wildfly-core | controller-client/src/main/java/org/jboss/as/controller/client/helpers/Operations.java | Operations.createReadResourceOperation | public static ModelNode createReadResourceOperation(final ModelNode address, final boolean recursive) {
final ModelNode op = createOperation(READ_RESOURCE_OPERATION, address);
op.get(RECURSIVE).set(recursive);
return op;
} | java | public static ModelNode createReadResourceOperation(final ModelNode address, final boolean recursive) {
final ModelNode op = createOperation(READ_RESOURCE_OPERATION, address);
op.get(RECURSIVE).set(recursive);
return op;
} | [
"public",
"static",
"ModelNode",
"createReadResourceOperation",
"(",
"final",
"ModelNode",
"address",
",",
"final",
"boolean",
"recursive",
")",
"{",
"final",
"ModelNode",
"op",
"=",
"createOperation",
"(",
"READ_RESOURCE_OPERATION",
",",
"address",
")",
";",
"op",
... | Creates an operation to read a resource.
@param address the address to create the read for
@param recursive whether to search recursively or not
@return the operation | [
"Creates",
"an",
"operation",
"to",
"read",
"a",
"resource",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller-client/src/main/java/org/jboss/as/controller/client/helpers/Operations.java#L245-L249 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncLibrary.java | AsyncLibrary.multiIO3 | @Override
public boolean multiIO3(long iobufferAddress, long position, int count,
boolean isRead, boolean forceQueue,
long bytesRequested, boolean useJITBuffer) throws AsyncException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "multiIO3: pos=" + position + " count=" + count);
}
return aio_multiIO3(iobufferAddress, position, count, isRead, forceQueue, bytesRequested, useJITBuffer);
} | java | @Override
public boolean multiIO3(long iobufferAddress, long position, int count,
boolean isRead, boolean forceQueue,
long bytesRequested, boolean useJITBuffer) throws AsyncException {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "multiIO3: pos=" + position + " count=" + count);
}
return aio_multiIO3(iobufferAddress, position, count, isRead, forceQueue, bytesRequested, useJITBuffer);
} | [
"@",
"Override",
"public",
"boolean",
"multiIO3",
"(",
"long",
"iobufferAddress",
",",
"long",
"position",
",",
"int",
"count",
",",
"boolean",
"isRead",
",",
"boolean",
"forceQueue",
",",
"long",
"bytesRequested",
",",
"boolean",
"useJITBuffer",
")",
"throws",
... | /*
@see com.ibm.io.async.IAsyncProvider#multiIO3(long, long, int, boolean, boolean, long, boolean) | [
"/",
"*"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/io/async/AsyncLibrary.java#L687-L695 |
jenkinsci/jenkins | cli/src/main/java/hudson/cli/FlightRecorderInputStream.java | FlightRecorderInputStream.analyzeCrash | public DiagnosedStreamCorruptionException analyzeCrash(Exception problem, String diagnosisName) {
final ByteArrayOutputStream readAhead = new ByteArrayOutputStream();
final IOException[] error = new IOException[1];
Thread diagnosisThread = new Thread(diagnosisName+" stream corruption diagnosis thread") {
public void run() {
int b;
try {
// not all InputStream will look for the thread interrupt flag, so check that explicitly to be defensive
while (!Thread.interrupted() && (b=source.read())!=-1) {
readAhead.write(b);
}
} catch (IOException e) {
error[0] = e;
}
}
};
// wait up to 1 sec to grab as much data as possible
diagnosisThread.start();
try {
diagnosisThread.join(1000);
} catch (InterruptedException ignored) {
// we are only waiting for a fixed amount of time, so we'll pretend like we were in a busy loop
Thread.currentThread().interrupt();
// fall through
}
IOException diagnosisProblem = error[0]; // capture the error, if any, before we kill the thread
if (diagnosisThread.isAlive())
diagnosisThread.interrupt(); // if it's not dead, kill
return new DiagnosedStreamCorruptionException(problem,diagnosisProblem,getRecord(),readAhead.toByteArray());
} | java | public DiagnosedStreamCorruptionException analyzeCrash(Exception problem, String diagnosisName) {
final ByteArrayOutputStream readAhead = new ByteArrayOutputStream();
final IOException[] error = new IOException[1];
Thread diagnosisThread = new Thread(diagnosisName+" stream corruption diagnosis thread") {
public void run() {
int b;
try {
// not all InputStream will look for the thread interrupt flag, so check that explicitly to be defensive
while (!Thread.interrupted() && (b=source.read())!=-1) {
readAhead.write(b);
}
} catch (IOException e) {
error[0] = e;
}
}
};
// wait up to 1 sec to grab as much data as possible
diagnosisThread.start();
try {
diagnosisThread.join(1000);
} catch (InterruptedException ignored) {
// we are only waiting for a fixed amount of time, so we'll pretend like we were in a busy loop
Thread.currentThread().interrupt();
// fall through
}
IOException diagnosisProblem = error[0]; // capture the error, if any, before we kill the thread
if (diagnosisThread.isAlive())
diagnosisThread.interrupt(); // if it's not dead, kill
return new DiagnosedStreamCorruptionException(problem,diagnosisProblem,getRecord(),readAhead.toByteArray());
} | [
"public",
"DiagnosedStreamCorruptionException",
"analyzeCrash",
"(",
"Exception",
"problem",
",",
"String",
"diagnosisName",
")",
"{",
"final",
"ByteArrayOutputStream",
"readAhead",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"final",
"IOException",
"[",
"]",
... | Creates a {@link DiagnosedStreamCorruptionException} based on the recorded content plus read ahead.
The caller is responsible for throwing the exception. | [
"Creates",
"a",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/cli/src/main/java/hudson/cli/FlightRecorderInputStream.java#L50-L84 |
c2nes/ircbot | brewtab-irc/src/main/java/com/brewtab/irc/User.java | User.fromPrefix | public static User fromPrefix(String prefix) {
Matcher matcher = userPrefixPattern.matcher(prefix);
if (matcher.find()) {
String nick = matcher.group(1);
String user = matcher.group(4);
String host = matcher.group(5);
return new User(nick, user, host);
} else {
return null;
}
} | java | public static User fromPrefix(String prefix) {
Matcher matcher = userPrefixPattern.matcher(prefix);
if (matcher.find()) {
String nick = matcher.group(1);
String user = matcher.group(4);
String host = matcher.group(5);
return new User(nick, user, host);
} else {
return null;
}
} | [
"public",
"static",
"User",
"fromPrefix",
"(",
"String",
"prefix",
")",
"{",
"Matcher",
"matcher",
"=",
"userPrefixPattern",
".",
"matcher",
"(",
"prefix",
")",
";",
"if",
"(",
"matcher",
".",
"find",
"(",
")",
")",
"{",
"String",
"nick",
"=",
"matcher",... | Construct a new IRCUser from the give String. The String should be in the
format {@literal <nick>!<user>@<host>}. This format is the same as is
used in IRC message prefixes
@param prefix The prefix to extract the information from
@return a new IRCUser object or null if the prefix could not be parsed | [
"Construct",
"a",
"new",
"IRCUser",
"from",
"the",
"give",
"String",
".",
"The",
"String",
"should",
"be",
"in",
"the",
"format",
"{",
"@literal",
"<nick",
">",
"!<user",
">",
"@<host",
">",
"}",
".",
"This",
"format",
"is",
"the",
"same",
"as",
"is",
... | train | https://github.com/c2nes/ircbot/blob/29cfc5b921ceee2a35e7d6077c5660e6db63ef35/brewtab-irc/src/main/java/com/brewtab/irc/User.java#L122-L134 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/authorization/providers/PoliciesCache.java | PoliciesCache.fromSources | public static PoliciesCache fromSources(final Iterable<CacheableYamlSource> sources, final Set<Attribute> context) {
return fromSourceProvider(
new SourceProvider() {
@Override
public Iterator<CacheableYamlSource> getSourceIterator() {
return sources.iterator();
}
},
context
);
} | java | public static PoliciesCache fromSources(final Iterable<CacheableYamlSource> sources, final Set<Attribute> context) {
return fromSourceProvider(
new SourceProvider() {
@Override
public Iterator<CacheableYamlSource> getSourceIterator() {
return sources.iterator();
}
},
context
);
} | [
"public",
"static",
"PoliciesCache",
"fromSources",
"(",
"final",
"Iterable",
"<",
"CacheableYamlSource",
">",
"sources",
",",
"final",
"Set",
"<",
"Attribute",
">",
"context",
")",
"{",
"return",
"fromSourceProvider",
"(",
"new",
"SourceProvider",
"(",
")",
"{"... | Create a cache from cacheable sources
@param sources source
@return cache | [
"Create",
"a",
"cache",
"from",
"cacheable",
"sources"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/authorization/providers/PoliciesCache.java#L220-L230 |
meertensinstituut/mtas | src/main/java/mtas/solr/search/MtasSolrCollectionCache.java | MtasSolrCollectionCache.getAutomatonById | public Automaton getAutomatonById(String id) throws IOException {
if (idToVersion.containsKey(id)) {
List<BytesRef> bytesArray = new ArrayList<>();
Set<String> data = get(id);
if (data != null) {
Term term;
for (String item : data) {
term = new Term("dummy", item);
bytesArray.add(term.bytes());
}
Collections.sort(bytesArray);
return Automata.makeStringUnion(bytesArray);
}
}
return null;
} | java | public Automaton getAutomatonById(String id) throws IOException {
if (idToVersion.containsKey(id)) {
List<BytesRef> bytesArray = new ArrayList<>();
Set<String> data = get(id);
if (data != null) {
Term term;
for (String item : data) {
term = new Term("dummy", item);
bytesArray.add(term.bytes());
}
Collections.sort(bytesArray);
return Automata.makeStringUnion(bytesArray);
}
}
return null;
} | [
"public",
"Automaton",
"getAutomatonById",
"(",
"String",
"id",
")",
"throws",
"IOException",
"{",
"if",
"(",
"idToVersion",
".",
"containsKey",
"(",
"id",
")",
")",
"{",
"List",
"<",
"BytesRef",
">",
"bytesArray",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
... | Gets the automaton by id.
@param id the id
@return the automaton by id
@throws IOException Signals that an I/O exception has occurred. | [
"Gets",
"the",
"automaton",
"by",
"id",
"."
] | train | https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/solr/search/MtasSolrCollectionCache.java#L296-L311 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/AbstractRectangularShape1dfx.java | AbstractRectangularShape1dfx.minXProperty | @Pure
public DoubleProperty minXProperty() {
if (this.minX == null) {
this.minX = new SimpleDoubleProperty(this, MathFXAttributeNames.MINIMUM_X) {
@Override
protected void invalidated() {
final double currentMin = get();
final double currentMax = getMaxX();
if (currentMin > currentMax) {
// min-max constrain is broken
maxXProperty().set(currentMin);
}
}
};
}
return this.minX;
} | java | @Pure
public DoubleProperty minXProperty() {
if (this.minX == null) {
this.minX = new SimpleDoubleProperty(this, MathFXAttributeNames.MINIMUM_X) {
@Override
protected void invalidated() {
final double currentMin = get();
final double currentMax = getMaxX();
if (currentMin > currentMax) {
// min-max constrain is broken
maxXProperty().set(currentMin);
}
}
};
}
return this.minX;
} | [
"@",
"Pure",
"public",
"DoubleProperty",
"minXProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"minX",
"==",
"null",
")",
"{",
"this",
".",
"minX",
"=",
"new",
"SimpleDoubleProperty",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"MINIMUM_X",
")",
"{",
... | Replies the property that is the minimum x coordinate of the box.
@return the minX property. | [
"Replies",
"the",
"property",
"that",
"is",
"the",
"minimum",
"x",
"coordinate",
"of",
"the",
"box",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/AbstractRectangularShape1dfx.java#L148-L164 |
phxql/argon2-jvm | src/main/java/de/mkammerer/argon2/Argon2Factory.java | Argon2Factory.createAdvanced | public static Argon2Advanced createAdvanced(Argon2Types type, int defaultSaltLength, int defaultHashLength) {
return createInternal(type, defaultSaltLength, defaultHashLength);
} | java | public static Argon2Advanced createAdvanced(Argon2Types type, int defaultSaltLength, int defaultHashLength) {
return createInternal(type, defaultSaltLength, defaultHashLength);
} | [
"public",
"static",
"Argon2Advanced",
"createAdvanced",
"(",
"Argon2Types",
"type",
",",
"int",
"defaultSaltLength",
",",
"int",
"defaultHashLength",
")",
"{",
"return",
"createInternal",
"(",
"type",
",",
"defaultSaltLength",
",",
"defaultHashLength",
")",
";",
"}"... | Creates a new {@link Argon2Advanced} instance with the given type.
@param type Argon2 type.
@param defaultSaltLength Default salt length in bytes. Can be overridden by some methods.
@param defaultHashLength Default hash length in bytes. Can be overridden by some methods.
@return Argon2Advanced instance. | [
"Creates",
"a",
"new",
"{",
"@link",
"Argon2Advanced",
"}",
"instance",
"with",
"the",
"given",
"type",
"."
] | train | https://github.com/phxql/argon2-jvm/blob/27a13907729e67e98cca53eba279e109b60f04f1/src/main/java/de/mkammerer/argon2/Argon2Factory.java#L83-L85 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/spi/properties/HazelcastProperties.java | HazelcastProperties.getEnum | public <E extends Enum> E getEnum(HazelcastProperty property, Class<E> enumClazz) {
String value = getString(property);
for (E enumConstant : enumClazz.getEnumConstants()) {
if (enumConstant.name().equalsIgnoreCase(value)) {
return enumConstant;
}
}
throw new IllegalArgumentException(format("value '%s' for property '%s' is not a valid %s value",
value, property.getName(), enumClazz.getName()));
} | java | public <E extends Enum> E getEnum(HazelcastProperty property, Class<E> enumClazz) {
String value = getString(property);
for (E enumConstant : enumClazz.getEnumConstants()) {
if (enumConstant.name().equalsIgnoreCase(value)) {
return enumConstant;
}
}
throw new IllegalArgumentException(format("value '%s' for property '%s' is not a valid %s value",
value, property.getName(), enumClazz.getName()));
} | [
"public",
"<",
"E",
"extends",
"Enum",
">",
"E",
"getEnum",
"(",
"HazelcastProperty",
"property",
",",
"Class",
"<",
"E",
">",
"enumClazz",
")",
"{",
"String",
"value",
"=",
"getString",
"(",
"property",
")",
";",
"for",
"(",
"E",
"enumConstant",
":",
... | Returns the configured enum value of a {@link GroupProperty}.
<p>
The case of the enum is ignored.
@param property the {@link GroupProperty} to get the value from
@return the enum
@throws IllegalArgumentException if the enum value can't be found | [
"Returns",
"the",
"configured",
"enum",
"value",
"of",
"a",
"{",
"@link",
"GroupProperty",
"}",
".",
"<p",
">",
"The",
"case",
"of",
"the",
"enum",
"is",
"ignored",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/spi/properties/HazelcastProperties.java#L289-L300 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Validate.java | Validate.isTrue | public static void isTrue(final boolean expression, final String message, final Object... values) {
if (!expression) {
throw new IllegalArgumentException(StringUtils.simpleFormat(message, values));
}
} | java | public static void isTrue(final boolean expression, final String message, final Object... values) {
if (!expression) {
throw new IllegalArgumentException(StringUtils.simpleFormat(message, values));
}
} | [
"public",
"static",
"void",
"isTrue",
"(",
"final",
"boolean",
"expression",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"!",
"expression",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"Strin... | <p>Validate that the argument 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.isTrue(i >= min && i <= max, "The value must be between %d and %d", min, max);
Validate.isTrue(myObject.isOk(), "The object is not okay");</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 IllegalArgumentException if expression is {@code false}
@see #isTrue(boolean)
@see #isTrue(boolean, String, long)
@see #isTrue(boolean, String, double) | [
"<p",
">",
"Validate",
"that",
"the",
"argument",
"condition",
"is",
"{",
"@code",
"true",
"}",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"the",
"specified",
"message",
".",
"This",
"method",
"is",
"useful",
"when",
"validating",
"according",
... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L158-L162 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java | JobScheduleOperations.terminateJobSchedule | public void terminateJobSchedule(String jobScheduleId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleTerminateOptions options = new JobScheduleTerminateOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobSchedules().terminate(jobScheduleId, options);
} | java | public void terminateJobSchedule(String jobScheduleId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException {
JobScheduleTerminateOptions options = new JobScheduleTerminateOptions();
BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors);
bhMgr.applyRequestBehaviors(options);
this.parentBatchClient.protocolLayer().jobSchedules().terminate(jobScheduleId, options);
} | [
"public",
"void",
"terminateJobSchedule",
"(",
"String",
"jobScheduleId",
",",
"Iterable",
"<",
"BatchClientBehavior",
">",
"additionalBehaviors",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"JobScheduleTerminateOptions",
"options",
"=",
"new",
"JobSche... | Terminates the specified job schedule.
@param jobScheduleId The ID of the job schedule.
@param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request.
@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. | [
"Terminates",
"the",
"specified",
"job",
"schedule",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L347-L353 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/config/Config.java | Config.setJobTrackerConfigs | public Config setJobTrackerConfigs(Map<String, JobTrackerConfig> jobTrackerConfigs) {
this.jobTrackerConfigs.clear();
this.jobTrackerConfigs.putAll(jobTrackerConfigs);
for (final Entry<String, JobTrackerConfig> entry : this.jobTrackerConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | java | public Config setJobTrackerConfigs(Map<String, JobTrackerConfig> jobTrackerConfigs) {
this.jobTrackerConfigs.clear();
this.jobTrackerConfigs.putAll(jobTrackerConfigs);
for (final Entry<String, JobTrackerConfig> entry : this.jobTrackerConfigs.entrySet()) {
entry.getValue().setName(entry.getKey());
}
return this;
} | [
"public",
"Config",
"setJobTrackerConfigs",
"(",
"Map",
"<",
"String",
",",
"JobTrackerConfig",
">",
"jobTrackerConfigs",
")",
"{",
"this",
".",
"jobTrackerConfigs",
".",
"clear",
"(",
")",
";",
"this",
".",
"jobTrackerConfigs",
".",
"putAll",
"(",
"jobTrackerCo... | Sets the map of job tracker configurations, mapped by config name.
The config name may be a pattern with which the configuration will be
obtained in the future.
@param jobTrackerConfigs the job tracker configuration map to set
@return this config instance | [
"Sets",
"the",
"map",
"of",
"job",
"tracker",
"configurations",
"mapped",
"by",
"config",
"name",
".",
"The",
"config",
"name",
"may",
"be",
"a",
"pattern",
"with",
"which",
"the",
"configuration",
"will",
"be",
"obtained",
"in",
"the",
"future",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2522-L2529 |
vkostyukov/la4j | src/main/java/org/la4j/Vectors.java | Vectors.mkEuclideanNormAccumulator | public static VectorAccumulator mkEuclideanNormAccumulator() {
return new VectorAccumulator() {
private BigDecimal result = BigDecimal.valueOf(0.0);
@Override
public void update(int i, double value) {
result = result.add(BigDecimal.valueOf(value * value));
}
@Override
public double accumulate() {
double value = result.setScale(Vectors.ROUND_FACTOR, RoundingMode.CEILING).doubleValue();
result = BigDecimal.valueOf(0.0);
return Math.sqrt(value);
}
};
} | java | public static VectorAccumulator mkEuclideanNormAccumulator() {
return new VectorAccumulator() {
private BigDecimal result = BigDecimal.valueOf(0.0);
@Override
public void update(int i, double value) {
result = result.add(BigDecimal.valueOf(value * value));
}
@Override
public double accumulate() {
double value = result.setScale(Vectors.ROUND_FACTOR, RoundingMode.CEILING).doubleValue();
result = BigDecimal.valueOf(0.0);
return Math.sqrt(value);
}
};
} | [
"public",
"static",
"VectorAccumulator",
"mkEuclideanNormAccumulator",
"(",
")",
"{",
"return",
"new",
"VectorAccumulator",
"(",
")",
"{",
"private",
"BigDecimal",
"result",
"=",
"BigDecimal",
".",
"valueOf",
"(",
"0.0",
")",
";",
"@",
"Override",
"public",
"voi... | Makes an Euclidean norm accumulator that allows to use
{@link org.la4j.Vector#fold(org.la4j.vector.functor.VectorAccumulator)} method for norm calculation.
@return an Euclidean norm accumulator | [
"Makes",
"an",
"Euclidean",
"norm",
"accumulator",
"that",
"allows",
"to",
"use",
"{",
"@link",
"org",
".",
"la4j",
".",
"Vector#fold",
"(",
"org",
".",
"la4j",
".",
"vector",
".",
"functor",
".",
"VectorAccumulator",
")",
"}",
"method",
"for",
"norm",
"... | train | https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Vectors.java#L329-L345 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_timeCondition_serviceName_condition_id_DELETE | public void billingAccount_timeCondition_serviceName_condition_id_DELETE(String billingAccount, String serviceName, Long id) throws IOException {
String qPath = "/telephony/{billingAccount}/timeCondition/{serviceName}/condition/{id}";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void billingAccount_timeCondition_serviceName_condition_id_DELETE(String billingAccount, String serviceName, Long id) throws IOException {
String qPath = "/telephony/{billingAccount}/timeCondition/{serviceName}/condition/{id}";
StringBuilder sb = path(qPath, billingAccount, serviceName, id);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"billingAccount_timeCondition_serviceName_condition_id_DELETE",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"id",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/telephony/{billingAccount}/timeCondition/{serviceNa... | Delete the given screen list
REST: DELETE /telephony/{billingAccount}/timeCondition/{serviceName}/condition/{id}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param id [required] Id of the object | [
"Delete",
"the",
"given",
"screen",
"list"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5855-L5859 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/io/StreamUtil.java | StreamUtil.routeStreamThroughProcess | public static InputStream routeStreamThroughProcess(final Process p, final InputStream origin, final boolean closeInput)
{
InputStream processSTDOUT = p.getInputStream();
OutputStream processSTDIN = p.getOutputStream();
// Kick off a background copy to the process
StreamUtil.doBackgroundCopy(origin, processSTDIN, DUMMY_MONITOR, true, closeInput);
return processSTDOUT;
} | java | public static InputStream routeStreamThroughProcess(final Process p, final InputStream origin, final boolean closeInput)
{
InputStream processSTDOUT = p.getInputStream();
OutputStream processSTDIN = p.getOutputStream();
// Kick off a background copy to the process
StreamUtil.doBackgroundCopy(origin, processSTDIN, DUMMY_MONITOR, true, closeInput);
return processSTDOUT;
} | [
"public",
"static",
"InputStream",
"routeStreamThroughProcess",
"(",
"final",
"Process",
"p",
",",
"final",
"InputStream",
"origin",
",",
"final",
"boolean",
"closeInput",
")",
"{",
"InputStream",
"processSTDOUT",
"=",
"p",
".",
"getInputStream",
"(",
")",
";",
... | Given a Process, this function will route the flow of data through it & out again
@param p
@param origin
@param closeInput
@return | [
"Given",
"a",
"Process",
"this",
"function",
"will",
"route",
"the",
"flow",
"of",
"data",
"through",
"it",
"&",
"out",
"again"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/io/StreamUtil.java#L105-L114 |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java | AnimationInteractivityManager.BuildInteractiveObjectFromAnchor | public void BuildInteractiveObjectFromAnchor(Sensor anchorSensor, String anchorDestination) {
InteractiveObject interactiveObject = new InteractiveObject();
interactiveObject.setSensor(anchorSensor, anchorDestination);
interactiveObjects.add(interactiveObject);
} | java | public void BuildInteractiveObjectFromAnchor(Sensor anchorSensor, String anchorDestination) {
InteractiveObject interactiveObject = new InteractiveObject();
interactiveObject.setSensor(anchorSensor, anchorDestination);
interactiveObjects.add(interactiveObject);
} | [
"public",
"void",
"BuildInteractiveObjectFromAnchor",
"(",
"Sensor",
"anchorSensor",
",",
"String",
"anchorDestination",
")",
"{",
"InteractiveObject",
"interactiveObject",
"=",
"new",
"InteractiveObject",
"(",
")",
";",
"interactiveObject",
".",
"setSensor",
"(",
"anch... | BuildInteractiveObjectFromAnchor is a special type of interactive object in that it does not get
built using ROUTE's.
@param anchorSensor is the Sensor that describes the sensor set to an Anchor
@param anchorDestination is either another Viewpoint, url to a web site or another x3d scene | [
"BuildInteractiveObjectFromAnchor",
"is",
"a",
"special",
"type",
"of",
"interactive",
"object",
"in",
"that",
"it",
"does",
"not",
"get",
"built",
"using",
"ROUTE",
"s",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/AnimationInteractivityManager.java#L502-L506 |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/RuleConditions.java | RuleConditions.checkNode | public static void checkNode(Node node, Node.Type... validTypes) {
for (Node.Type type : validTypes) {
if (node.getNodeType() == type) {
return;
}
}
StringJoiner sj = new StringJoiner(", ");
for (Node.Type type : validTypes) {
sj.add(type.toString());
}
String nodeName = node.getNodeType().name();
if (node instanceof NameBearer) {
nodeName = ((NameBearer) node).getName();
}
throw new FuzzerException(nodeName + ": invalid, must be one of " + sj.toString());
} | java | public static void checkNode(Node node, Node.Type... validTypes) {
for (Node.Type type : validTypes) {
if (node.getNodeType() == type) {
return;
}
}
StringJoiner sj = new StringJoiner(", ");
for (Node.Type type : validTypes) {
sj.add(type.toString());
}
String nodeName = node.getNodeType().name();
if (node instanceof NameBearer) {
nodeName = ((NameBearer) node).getName();
}
throw new FuzzerException(nodeName + ": invalid, must be one of " + sj.toString());
} | [
"public",
"static",
"void",
"checkNode",
"(",
"Node",
"node",
",",
"Node",
".",
"Type",
"...",
"validTypes",
")",
"{",
"for",
"(",
"Node",
".",
"Type",
"type",
":",
"validTypes",
")",
"{",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"==",
"type"... | Check a node for validity.
<p>
@param node the node
@param validTypes expected types | [
"Check",
"a",
"node",
"for",
"validity",
".",
"<p",
">"
] | train | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/RuleConditions.java#L77-L92 |
tango-controls/JTango | dao/src/main/java/fr/esrf/TangoDs/Util.java | Util.registerDeviceForJacorb | void registerDeviceForJacorb(final String name) {
// Get the 3 fields of device name
final StringTokenizer st = new StringTokenizer(name, "/");
final String[] field = new String[3];
for (int i = 0; i < 3 && st.countTokens() > 0; i++) {
field[i] = st.nextToken();
}
// After a header used by JacORB, in the device name
// the '/' char must be replaced by another separator
final String separator = "&%25";
final String targetname = "StandardImplName/nodb_poa/" + field[0] + separator + field[1]
+ separator + field[2];
// And set the JacORB objectKeyMap HashMap
final org.jacorb.orb.ORB jacorb = (org.jacorb.orb.ORB) orb;
// Method added by PV for server without database.
// in org/jacorb/orb/ORB.java
jacorb.addObjectKey(name, targetname);
} | java | void registerDeviceForJacorb(final String name) {
// Get the 3 fields of device name
final StringTokenizer st = new StringTokenizer(name, "/");
final String[] field = new String[3];
for (int i = 0; i < 3 && st.countTokens() > 0; i++) {
field[i] = st.nextToken();
}
// After a header used by JacORB, in the device name
// the '/' char must be replaced by another separator
final String separator = "&%25";
final String targetname = "StandardImplName/nodb_poa/" + field[0] + separator + field[1]
+ separator + field[2];
// And set the JacORB objectKeyMap HashMap
final org.jacorb.orb.ORB jacorb = (org.jacorb.orb.ORB) orb;
// Method added by PV for server without database.
// in org/jacorb/orb/ORB.java
jacorb.addObjectKey(name, targetname);
} | [
"void",
"registerDeviceForJacorb",
"(",
"final",
"String",
"name",
")",
"{",
"// Get the 3 fields of device name",
"final",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"name",
",",
"\"/\"",
")",
";",
"final",
"String",
"[",
"]",
"field",
"=",
"n... | WARNING: The following code is JacORB specific. The jacorb.jar must have
been modified by adding org.jacorb.orb.ORB.putObjectKeyMap method. public
void putObjectKeyMap(String s, String t) { objectKeyMap.put(s, t); }
Add device name in HashTable used for JacORB objectKeyMap if
_UseDb==false.
@param name
The device's name. | [
"WARNING",
":",
"The",
"following",
"code",
"is",
"JacORB",
"specific",
".",
"The",
"jacorb",
".",
"jar",
"must",
"have",
"been",
"modified",
"by",
"adding",
"org",
".",
"jacorb",
".",
"orb",
".",
"ORB",
".",
"putObjectKeyMap",
"method",
".",
"public",
"... | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/dao/src/main/java/fr/esrf/TangoDs/Util.java#L1484-L1503 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GJGeometryReader.java | GJGeometryReader.parseCoordinate | private Coordinate parseCoordinate(JsonParser jp) throws IOException {
jp.nextToken();
double x = jp.getDoubleValue();// VALUE_NUMBER_FLOAT
jp.nextToken(); // second value
double y = jp.getDoubleValue();
Coordinate coord;
//We look for a z value
jp.nextToken();
if (jp.getCurrentToken() == JsonToken.END_ARRAY) {
coord = new Coordinate(x, y);
} else {
double z = jp.getDoubleValue();
jp.nextToken(); // exit array
coord = new Coordinate(x, y, z);
}
jp.nextToken();
return coord;
} | java | private Coordinate parseCoordinate(JsonParser jp) throws IOException {
jp.nextToken();
double x = jp.getDoubleValue();// VALUE_NUMBER_FLOAT
jp.nextToken(); // second value
double y = jp.getDoubleValue();
Coordinate coord;
//We look for a z value
jp.nextToken();
if (jp.getCurrentToken() == JsonToken.END_ARRAY) {
coord = new Coordinate(x, y);
} else {
double z = jp.getDoubleValue();
jp.nextToken(); // exit array
coord = new Coordinate(x, y, z);
}
jp.nextToken();
return coord;
} | [
"private",
"Coordinate",
"parseCoordinate",
"(",
"JsonParser",
"jp",
")",
"throws",
"IOException",
"{",
"jp",
".",
"nextToken",
"(",
")",
";",
"double",
"x",
"=",
"jp",
".",
"getDoubleValue",
"(",
")",
";",
"// VALUE_NUMBER_FLOAT",
"jp",
".",
"nextToken",
"(... | Parses a GeoJSON coordinate array and returns a JTS coordinate. The first
token corresponds to the first X value. The last token correponds to the
end of the coordinate array "]".
Parsed syntax:
100.0, 0.0]
@param jp
@throws IOException
@return Coordinate | [
"Parses",
"a",
"GeoJSON",
"coordinate",
"array",
"and",
"returns",
"a",
"JTS",
"coordinate",
".",
"The",
"first",
"token",
"corresponds",
"to",
"the",
"first",
"X",
"value",
".",
"The",
"last",
"token",
"correponds",
"to",
"the",
"end",
"of",
"the",
"coord... | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GJGeometryReader.java#L348-L365 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java | DatabaseUtils.longForQuery | public static long longForQuery(SQLiteStatement prog, String[] selectionArgs) {
prog.bindAllArgsAsStrings(selectionArgs);
return prog.simpleQueryForLong();
} | java | public static long longForQuery(SQLiteStatement prog, String[] selectionArgs) {
prog.bindAllArgsAsStrings(selectionArgs);
return prog.simpleQueryForLong();
} | [
"public",
"static",
"long",
"longForQuery",
"(",
"SQLiteStatement",
"prog",
",",
"String",
"[",
"]",
"selectionArgs",
")",
"{",
"prog",
".",
"bindAllArgsAsStrings",
"(",
"selectionArgs",
")",
";",
"return",
"prog",
".",
"simpleQueryForLong",
"(",
")",
";",
"}"... | Utility method to run the pre-compiled query and return the value in the
first column of the first row. | [
"Utility",
"method",
"to",
"run",
"the",
"pre",
"-",
"compiled",
"query",
"and",
"return",
"the",
"value",
"in",
"the",
"first",
"column",
"of",
"the",
"first",
"row",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L845-L848 |
JodaOrg/joda-time | src/main/java/org/joda/time/Days.java | Days.daysBetween | public static Days daysBetween(ReadablePartial start, ReadablePartial end) {
if (start instanceof LocalDate && end instanceof LocalDate) {
Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
int days = chrono.days().getDifference(
((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis());
return Days.days(days);
}
int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
return Days.days(amount);
} | java | public static Days daysBetween(ReadablePartial start, ReadablePartial end) {
if (start instanceof LocalDate && end instanceof LocalDate) {
Chronology chrono = DateTimeUtils.getChronology(start.getChronology());
int days = chrono.days().getDifference(
((LocalDate) end).getLocalMillis(), ((LocalDate) start).getLocalMillis());
return Days.days(days);
}
int amount = BaseSingleFieldPeriod.between(start, end, ZERO);
return Days.days(amount);
} | [
"public",
"static",
"Days",
"daysBetween",
"(",
"ReadablePartial",
"start",
",",
"ReadablePartial",
"end",
")",
"{",
"if",
"(",
"start",
"instanceof",
"LocalDate",
"&&",
"end",
"instanceof",
"LocalDate",
")",
"{",
"Chronology",
"chrono",
"=",
"DateTimeUtils",
".... | Creates a <code>Days</code> representing the number of whole days
between the two specified partial datetimes.
<p>
The two partials must contain the same fields, for example you can specify
two <code>LocalDate</code> objects.
@param start the start partial date, must not be null
@param end the end partial date, must not be null
@return the period in days
@throws IllegalArgumentException if the partials are null or invalid | [
"Creates",
"a",
"<code",
">",
"Days<",
"/",
"code",
">",
"representing",
"the",
"number",
"of",
"whole",
"days",
"between",
"the",
"two",
"specified",
"partial",
"datetimes",
".",
"<p",
">",
"The",
"two",
"partials",
"must",
"contain",
"the",
"same",
"fiel... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Days.java#L134-L143 |
codelibs/jcifs | src/main/java/jcifs/smb1/smb1/AndXServerMessageBlock.java | AndXServerMessageBlock.encode | int encode( byte[] dst, int dstIndex ) {
int start = headerStart = dstIndex;
dstIndex += writeHeaderWireFormat( dst, dstIndex );
dstIndex += writeAndXWireFormat( dst, dstIndex );
length = dstIndex - start;
if( digest != null ) {
digest.sign( dst, headerStart, length, this, response );
}
return length;
} | java | int encode( byte[] dst, int dstIndex ) {
int start = headerStart = dstIndex;
dstIndex += writeHeaderWireFormat( dst, dstIndex );
dstIndex += writeAndXWireFormat( dst, dstIndex );
length = dstIndex - start;
if( digest != null ) {
digest.sign( dst, headerStart, length, this, response );
}
return length;
} | [
"int",
"encode",
"(",
"byte",
"[",
"]",
"dst",
",",
"int",
"dstIndex",
")",
"{",
"int",
"start",
"=",
"headerStart",
"=",
"dstIndex",
";",
"dstIndex",
"+=",
"writeHeaderWireFormat",
"(",
"dst",
",",
"dstIndex",
")",
";",
"dstIndex",
"+=",
"writeAndXWireFor... | /*
We overload this method from ServerMessageBlock because
we want writeAndXWireFormat to write the parameterWords
and bytes. This is so we can write batched smbs because
all but the first smb of the chaain do not have a header
and therefore we do not want to writeHeaderWireFormat. We
just recursivly call writeAndXWireFormat. | [
"/",
"*",
"We",
"overload",
"this",
"method",
"from",
"ServerMessageBlock",
"because",
"we",
"want",
"writeAndXWireFormat",
"to",
"write",
"the",
"parameterWords",
"and",
"bytes",
".",
"This",
"is",
"so",
"we",
"can",
"write",
"batched",
"smbs",
"because",
"al... | train | https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/AndXServerMessageBlock.java#L63-L75 |
UrielCh/ovh-java-sdk | ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java | ApiOvhEmaildomain.domain_account_accountName_GET | public OvhAccount domain_account_accountName_GET(String domain, String accountName) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}";
StringBuilder sb = path(qPath, domain, accountName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAccount.class);
} | java | public OvhAccount domain_account_accountName_GET(String domain, String accountName) throws IOException {
String qPath = "/email/domain/{domain}/account/{accountName}";
StringBuilder sb = path(qPath, domain, accountName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhAccount.class);
} | [
"public",
"OvhAccount",
"domain_account_accountName_GET",
"(",
"String",
"domain",
",",
"String",
"accountName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/email/domain/{domain}/account/{accountName}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
... | Get this object properties
REST: GET /email/domain/{domain}/account/{accountName}
@param domain [required] Name of your domain name
@param accountName [required] Name of account | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L828-L833 |
mangstadt/biweekly | src/main/java/biweekly/property/RecurrenceProperty.java | RecurrenceProperty.getDateIterator | public DateIterator getDateIterator(ICalDate startDate, TimeZone timezone) {
Recurrence recur = getValue();
return (recur == null) ? new Google2445Utils.EmptyDateIterator() : recur.getDateIterator(startDate, timezone);
} | java | public DateIterator getDateIterator(ICalDate startDate, TimeZone timezone) {
Recurrence recur = getValue();
return (recur == null) ? new Google2445Utils.EmptyDateIterator() : recur.getDateIterator(startDate, timezone);
} | [
"public",
"DateIterator",
"getDateIterator",
"(",
"ICalDate",
"startDate",
",",
"TimeZone",
"timezone",
")",
"{",
"Recurrence",
"recur",
"=",
"getValue",
"(",
")",
";",
"return",
"(",
"recur",
"==",
"null",
")",
"?",
"new",
"Google2445Utils",
".",
"EmptyDateIt... | Creates an iterator that computes the dates defined by this property.
@param startDate the date that the recurrence starts (typically, the
value of the accompanying {@link DateStart} property)
@param timezone the timezone to iterate in (typically, the timezone
associated with the {@link DateStart} property). This is needed in order
to adjust for when the iterator passes over a daylight savings boundary.
@return the iterator
@see <a
href="https://code.google.com/p/google-rfc-2445/">google-rfc-2445</a> | [
"Creates",
"an",
"iterator",
"that",
"computes",
"the",
"dates",
"defined",
"by",
"this",
"property",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/property/RecurrenceProperty.java#L88-L91 |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java | MonthView.setMonthParams | public void setMonthParams(int selectedDay, int year, int month, int weekStart) {
if (month == -1 && year == -1) {
throw new InvalidParameterException("You must specify month and year for this view");
}
mSelectedDay = selectedDay;
// Allocate space for caching the day numbers and focus values
mMonth = month;
mYear = year;
// Figure out what day today is
//final Time today = new Time(Time.getCurrentTimezone());
//today.setToNow();
final Calendar today = Calendar.getInstance(mController.getTimeZone(), mController.getLocale());
mHasToday = false;
mToday = -1;
mCalendar.set(Calendar.MONTH, mMonth);
mCalendar.set(Calendar.YEAR, mYear);
mCalendar.set(Calendar.DAY_OF_MONTH, 1);
mDayOfWeekStart = mCalendar.get(Calendar.DAY_OF_WEEK);
if (weekStart != -1) {
mWeekStart = weekStart;
} else {
mWeekStart = mCalendar.getFirstDayOfWeek();
}
mNumCells = mCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);
for (int i = 0; i < mNumCells; i++) {
final int day = i + 1;
if (sameDay(day, today)) {
mHasToday = true;
mToday = day;
}
}
mNumRows = calculateNumRows();
// Invalidate cached accessibility information.
mTouchHelper.invalidateRoot();
} | java | public void setMonthParams(int selectedDay, int year, int month, int weekStart) {
if (month == -1 && year == -1) {
throw new InvalidParameterException("You must specify month and year for this view");
}
mSelectedDay = selectedDay;
// Allocate space for caching the day numbers and focus values
mMonth = month;
mYear = year;
// Figure out what day today is
//final Time today = new Time(Time.getCurrentTimezone());
//today.setToNow();
final Calendar today = Calendar.getInstance(mController.getTimeZone(), mController.getLocale());
mHasToday = false;
mToday = -1;
mCalendar.set(Calendar.MONTH, mMonth);
mCalendar.set(Calendar.YEAR, mYear);
mCalendar.set(Calendar.DAY_OF_MONTH, 1);
mDayOfWeekStart = mCalendar.get(Calendar.DAY_OF_WEEK);
if (weekStart != -1) {
mWeekStart = weekStart;
} else {
mWeekStart = mCalendar.getFirstDayOfWeek();
}
mNumCells = mCalendar.getActualMaximum(Calendar.DAY_OF_MONTH);
for (int i = 0; i < mNumCells; i++) {
final int day = i + 1;
if (sameDay(day, today)) {
mHasToday = true;
mToday = day;
}
}
mNumRows = calculateNumRows();
// Invalidate cached accessibility information.
mTouchHelper.invalidateRoot();
} | [
"public",
"void",
"setMonthParams",
"(",
"int",
"selectedDay",
",",
"int",
"year",
",",
"int",
"month",
",",
"int",
"weekStart",
")",
"{",
"if",
"(",
"month",
"==",
"-",
"1",
"&&",
"year",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"InvalidParameterExce... | Sets all the parameters for displaying this week. The only required
parameter is the week number. Other parameters have a default value and
will only update if a new value is included, except for focus month,
which will always default to no focus month if no value is passed in. | [
"Sets",
"all",
"the",
"parameters",
"for",
"displaying",
"this",
"week",
".",
"The",
"only",
"required",
"parameter",
"is",
"the",
"week",
"number",
".",
"Other",
"parameters",
"have",
"a",
"default",
"value",
"and",
"will",
"only",
"update",
"if",
"a",
"n... | train | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java#L291-L332 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/UserApi.java | UserApi.deleteUser | public void deleteUser(Object userIdOrUsername, Boolean hardDelete) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("hard_delete ", hardDelete);
Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
delete(expectedStatus, formData.asMap(), "users", getUserIdOrUsername(userIdOrUsername));
} | java | public void deleteUser(Object userIdOrUsername, Boolean hardDelete) throws GitLabApiException {
GitLabApiForm formData = new GitLabApiForm().withParam("hard_delete ", hardDelete);
Response.Status expectedStatus = (isApiVersion(ApiVersion.V3) ? Response.Status.OK : Response.Status.NO_CONTENT);
delete(expectedStatus, formData.asMap(), "users", getUserIdOrUsername(userIdOrUsername));
} | [
"public",
"void",
"deleteUser",
"(",
"Object",
"userIdOrUsername",
",",
"Boolean",
"hardDelete",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"new",
"GitLabApiForm",
"(",
")",
".",
"withParam",
"(",
"\"hard_delete \"",
",",
"hardDelete... | Deletes a user. Available only for administrators.
<pre><code>GitLab Endpoint: DELETE /users/:id</code></pre>
@param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance
@param hardDelete If true, contributions that would usually be moved to the
ghost user will be deleted instead, as well as groups owned solely by this user
@throws GitLabApiException if any exception occurs | [
"Deletes",
"a",
"user",
".",
"Available",
"only",
"for",
"administrators",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L559-L563 |
caspervg/SC4D-LEX4J | lex4j/src/main/java/net/caspervg/lex4j/route/LotRoute.java | LotRoute.updateDependencyString | public void updateDependencyString(int id, String dep) {
ClientResource resource = new ClientResource(Route.DEPENDENCY_STRING.url(id));
Reference ref = resource.getReference();
Form form = new Form();
form.add("string", dep);
resource.setChallengeResponse(this.auth.toChallenge());
resource.put(form);
} | java | public void updateDependencyString(int id, String dep) {
ClientResource resource = new ClientResource(Route.DEPENDENCY_STRING.url(id));
Reference ref = resource.getReference();
Form form = new Form();
form.add("string", dep);
resource.setChallengeResponse(this.auth.toChallenge());
resource.put(form);
} | [
"public",
"void",
"updateDependencyString",
"(",
"int",
"id",
",",
"String",
"dep",
")",
"{",
"ClientResource",
"resource",
"=",
"new",
"ClientResource",
"(",
"Route",
".",
"DEPENDENCY_STRING",
".",
"url",
"(",
"id",
")",
")",
";",
"Reference",
"ref",
"=",
... | Updates the dependency string for a lot/file
@param id ID of the lot/file
@param dep new dependency string
@custom.require Authentication and Administration | [
"Updates",
"the",
"dependency",
"string",
"for",
"a",
"lot",
"/",
"file"
] | train | https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/LotRoute.java#L222-L231 |
kuali/ojb-1.0.4 | src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java | OjbTagsHandler.forAllProcedures | public void forAllProcedures(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _curClassDef.getProcedures(); it.hasNext(); )
{
_curProcedureDef = (ProcedureDef)it.next();
generate(template);
}
_curProcedureDef = null;
} | java | public void forAllProcedures(String template, Properties attributes) throws XDocletException
{
for (Iterator it = _curClassDef.getProcedures(); it.hasNext(); )
{
_curProcedureDef = (ProcedureDef)it.next();
generate(template);
}
_curProcedureDef = null;
} | [
"public",
"void",
"forAllProcedures",
"(",
"String",
"template",
",",
"Properties",
"attributes",
")",
"throws",
"XDocletException",
"{",
"for",
"(",
"Iterator",
"it",
"=",
"_curClassDef",
".",
"getProcedures",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
... | Processes the template for all procedures of the current class definition.
@param template The template
@param attributes The attributes of the tag
@exception XDocletException if an error occurs
@doc.tag type="block" | [
"Processes",
"the",
"template",
"for",
"all",
"procedures",
"of",
"the",
"current",
"class",
"definition",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L568-L576 |
google/jimfs | jimfs/src/main/java/com/google/common/jimfs/FileTree.java | FileTree.lookUp | @Nullable
private DirectoryEntry lookUp(
File dir, Iterable<Name> names, Set<? super LinkOption> options, int linkDepth)
throws IOException {
Iterator<Name> nameIterator = names.iterator();
Name name = nameIterator.next();
while (nameIterator.hasNext()) {
Directory directory = toDirectory(dir);
if (directory == null) {
return null;
}
DirectoryEntry entry = directory.get(name);
if (entry == null) {
return null;
}
File file = entry.file();
if (file.isSymbolicLink()) {
DirectoryEntry linkResult = followSymbolicLink(dir, (SymbolicLink) file, linkDepth);
if (linkResult == null) {
return null;
}
dir = linkResult.fileOrNull();
} else {
dir = file;
}
name = nameIterator.next();
}
return lookUpLast(dir, name, options, linkDepth);
} | java | @Nullable
private DirectoryEntry lookUp(
File dir, Iterable<Name> names, Set<? super LinkOption> options, int linkDepth)
throws IOException {
Iterator<Name> nameIterator = names.iterator();
Name name = nameIterator.next();
while (nameIterator.hasNext()) {
Directory directory = toDirectory(dir);
if (directory == null) {
return null;
}
DirectoryEntry entry = directory.get(name);
if (entry == null) {
return null;
}
File file = entry.file();
if (file.isSymbolicLink()) {
DirectoryEntry linkResult = followSymbolicLink(dir, (SymbolicLink) file, linkDepth);
if (linkResult == null) {
return null;
}
dir = linkResult.fileOrNull();
} else {
dir = file;
}
name = nameIterator.next();
}
return lookUpLast(dir, name, options, linkDepth);
} | [
"@",
"Nullable",
"private",
"DirectoryEntry",
"lookUp",
"(",
"File",
"dir",
",",
"Iterable",
"<",
"Name",
">",
"names",
",",
"Set",
"<",
"?",
"super",
"LinkOption",
">",
"options",
",",
"int",
"linkDepth",
")",
"throws",
"IOException",
"{",
"Iterator",
"<"... | Looks up the given names against the given base file. If the file is not a directory, the
lookup fails. | [
"Looks",
"up",
"the",
"given",
"names",
"against",
"the",
"given",
"base",
"file",
".",
"If",
"the",
"file",
"is",
"not",
"a",
"directory",
"the",
"lookup",
"fails",
"."
] | train | https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileTree.java#L117-L151 |
josesamuel/remoter | remoter/src/main/java/remoter/compiler/builder/BindingManager.java | BindingManager.getMethoddBuilder | MethodBuilder getMethoddBuilder(Element element) {
MethodBuilder methodBuilder = new MethodBuilder(messager, element);
methodBuilder.setBindingManager(this);
return methodBuilder;
} | java | MethodBuilder getMethoddBuilder(Element element) {
MethodBuilder methodBuilder = new MethodBuilder(messager, element);
methodBuilder.setBindingManager(this);
return methodBuilder;
} | [
"MethodBuilder",
"getMethoddBuilder",
"(",
"Element",
"element",
")",
"{",
"MethodBuilder",
"methodBuilder",
"=",
"new",
"MethodBuilder",
"(",
"messager",
",",
"element",
")",
";",
"methodBuilder",
".",
"setBindingManager",
"(",
"this",
")",
";",
"return",
"method... | Returns the {@link MethodBuilder} that adds methods to the class spec | [
"Returns",
"the",
"{"
] | train | https://github.com/josesamuel/remoter/blob/007401868c319740d40134ebc07c3406988f9a86/remoter/src/main/java/remoter/compiler/builder/BindingManager.java#L130-L134 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Graph.java | ST_Graph.createGraph | public static boolean createGraph(Connection connection,
String tableName,
String spatialFieldName,
double tolerance) throws SQLException {
// By default we do not orient by slope.
return createGraph(connection, tableName, spatialFieldName, tolerance, false);
} | java | public static boolean createGraph(Connection connection,
String tableName,
String spatialFieldName,
double tolerance) throws SQLException {
// By default we do not orient by slope.
return createGraph(connection, tableName, spatialFieldName, tolerance, false);
} | [
"public",
"static",
"boolean",
"createGraph",
"(",
"Connection",
"connection",
",",
"String",
"tableName",
",",
"String",
"spatialFieldName",
",",
"double",
"tolerance",
")",
"throws",
"SQLException",
"{",
"// By default we do not orient by slope.",
"return",
"createGraph... | Create the nodes and edges tables from the input table containing
LINESTRINGs in the given column and using the given
tolerance.
<p/>
The tolerance value is used specify the side length of a square Envelope
around each node used to snap together other nodes within the same
Envelope. Note, however, that edge geometries are left untouched.
Note also that coordinates within a given tolerance of each
other are not necessarily snapped together. Only the first and last
coordinates of a geometry are considered to be potential nodes, and
only nodes within a given tolerance of each other are snapped
together. The tolerance works only in metric units.
<p/>
If the input table has name 'input', then the output tables are named
'input_nodes' and 'input_edges'.
@param connection Connection
@param tableName Input table
@param spatialFieldName Name of column containing LINESTRINGs
@param tolerance Tolerance
@return true if both output tables were created
@throws SQLException | [
"Create",
"the",
"nodes",
"and",
"edges",
"tables",
"from",
"the",
"input",
"table",
"containing",
"LINESTRINGs",
"in",
"the",
"given",
"column",
"and",
"using",
"the",
"given",
"tolerance",
".",
"<p",
"/",
">",
"The",
"tolerance",
"value",
"is",
"used",
"... | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/topology/ST_Graph.java#L154-L160 |
pkiraly/metadata-qa-api | src/main/java/de/gwdg/metadataqa/api/uniqueness/UniquenessExtractor.java | UniquenessExtractor.extractNumFound | public Integer extractNumFound(String jsonString, String recordId) {
int numFound = 1;
if (StringUtils.isBlank(jsonString)) {
return numFound;
}
Object document = JSON_PROVIDER.parse(jsonString);
if (document instanceof LinkedHashMap) {
Map documentMap = (LinkedHashMap) document;
if (documentMap.containsKey("response")) {
Map response = (LinkedHashMap) documentMap.get("response");
numFound = (int) response.get("numFound");
} else {
LOGGER.severe("No 'response' part in Solr response: " + jsonString);
}
} else {
LOGGER.severe("Problem with parsing Solr response: >>" + document
+ "<< class:" + document.getClass());
}
return numFound;
} | java | public Integer extractNumFound(String jsonString, String recordId) {
int numFound = 1;
if (StringUtils.isBlank(jsonString)) {
return numFound;
}
Object document = JSON_PROVIDER.parse(jsonString);
if (document instanceof LinkedHashMap) {
Map documentMap = (LinkedHashMap) document;
if (documentMap.containsKey("response")) {
Map response = (LinkedHashMap) documentMap.get("response");
numFound = (int) response.get("numFound");
} else {
LOGGER.severe("No 'response' part in Solr response: " + jsonString);
}
} else {
LOGGER.severe("Problem with parsing Solr response: >>" + document
+ "<< class:" + document.getClass());
}
return numFound;
} | [
"public",
"Integer",
"extractNumFound",
"(",
"String",
"jsonString",
",",
"String",
"recordId",
")",
"{",
"int",
"numFound",
"=",
"1",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"jsonString",
")",
")",
"{",
"return",
"numFound",
";",
"}",
"Object"... | Extracts sums and average of TF-IDF value for the schema's Solr field array.
@param jsonString
The JSON string
@param recordId
The record identifier
@return
Sums and average of TF-IDF value | [
"Extracts",
"sums",
"and",
"average",
"of",
"TF",
"-",
"IDF",
"value",
"for",
"the",
"schema",
"s",
"Solr",
"field",
"array",
"."
] | train | https://github.com/pkiraly/metadata-qa-api/blob/622a69e7c1628ccf64047070817ecfaa68f15b1d/src/main/java/de/gwdg/metadataqa/api/uniqueness/UniquenessExtractor.java#L36-L57 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java | DirectoryConnection.sendAdminPacket | private void sendAdminPacket(ProtocolHeader header, Protocol protocol) throws IOException{
clientSocket.sendPacket(header, protocol);
} | java | private void sendAdminPacket(ProtocolHeader header, Protocol protocol) throws IOException{
clientSocket.sendPacket(header, protocol);
} | [
"private",
"void",
"sendAdminPacket",
"(",
"ProtocolHeader",
"header",
",",
"Protocol",
"protocol",
")",
"throws",
"IOException",
"{",
"clientSocket",
".",
"sendPacket",
"(",
"header",
",",
"protocol",
")",
";",
"}"
] | Send the packet to Directory Server directory.
It doesn't queue the packet in the pendingQueue. It used internally to send
administration Protocol.
@param header
@param protocol
@throws IOException | [
"Send",
"the",
"packet",
"to",
"Directory",
"Server",
"directory",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java#L786-L788 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java | AnycastOutputHandler.persistLockAndTick | public final AOValue persistLockAndTick(TransactionCommon t, AOStream stream, long tick,
SIMPMessage msg, int storagePolicy, long waitTime, long prevTick) throws Exception
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "persistLockAndTick",
new Object[] {t,
stream,
Long.valueOf(tick),
msg,
Integer.valueOf(storagePolicy),
Long.valueOf(waitTime),
Long.valueOf(prevTick)});
AOValue retvalue = null;
try
{
Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t);
msg.persistLock(msTran);
long plockId = msg.getLockID();
retvalue = new AOValue(tick, msg, msg.getID(), storagePolicy,
plockId, waitTime, prevTick);
stream.itemStream.addItem(retvalue, msTran);
}
catch (Exception e)
{
// No FFDC code needed
retvalue = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "persistLockAndTick", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "persistLockAndTick", retvalue);
return retvalue;
} | java | public final AOValue persistLockAndTick(TransactionCommon t, AOStream stream, long tick,
SIMPMessage msg, int storagePolicy, long waitTime, long prevTick) throws Exception
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "persistLockAndTick",
new Object[] {t,
stream,
Long.valueOf(tick),
msg,
Integer.valueOf(storagePolicy),
Long.valueOf(waitTime),
Long.valueOf(prevTick)});
AOValue retvalue = null;
try
{
Transaction msTran = mp.resolveAndEnlistMsgStoreTransaction(t);
msg.persistLock(msTran);
long plockId = msg.getLockID();
retvalue = new AOValue(tick, msg, msg.getID(), storagePolicy,
plockId, waitTime, prevTick);
stream.itemStream.addItem(retvalue, msTran);
}
catch (Exception e)
{
// No FFDC code needed
retvalue = null;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "persistLockAndTick", e);
throw e;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "persistLockAndTick", retvalue);
return retvalue;
} | [
"public",
"final",
"AOValue",
"persistLockAndTick",
"(",
"TransactionCommon",
"t",
",",
"AOStream",
"stream",
",",
"long",
"tick",
",",
"SIMPMessage",
"msg",
",",
"int",
"storagePolicy",
",",
"long",
"waitTime",
",",
"long",
"prevTick",
")",
"throws",
"Exception... | Helper method called by the AOStream when to persistently lock a message and create a persistent
tick in the protocol stream
@param t the transaction
@param stream the stream making this call
@param tick the tick in the stream
@param msg the message to be persistently locked (it is already non-persitently locked)
@param waitTime the time for this request to be satisfied
@param prevTick the previous tick of the same priority and QoS in the stream
@return The item representing the persistent tick
@throws Exception | [
"Helper",
"method",
"called",
"by",
"the",
"AOStream",
"when",
"to",
"persistently",
"lock",
"a",
"message",
"and",
"create",
"a",
"persistent",
"tick",
"in",
"the",
"protocol",
"stream"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L2626-L2662 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java | CommonOps_DDF2.add | public static void add( DMatrix2 a , DMatrix2 b , DMatrix2 c ) {
c.a1 = a.a1 + b.a1;
c.a2 = a.a2 + b.a2;
} | java | public static void add( DMatrix2 a , DMatrix2 b , DMatrix2 c ) {
c.a1 = a.a1 + b.a1;
c.a2 = a.a2 + b.a2;
} | [
"public",
"static",
"void",
"add",
"(",
"DMatrix2",
"a",
",",
"DMatrix2",
"b",
",",
"DMatrix2",
"c",
")",
"{",
"c",
".",
"a1",
"=",
"a",
".",
"a1",
"+",
"b",
".",
"a1",
";",
"c",
".",
"a2",
"=",
"a",
".",
"a2",
"+",
"b",
".",
"a2",
";",
"... | <p>Performs the following operation:<br>
<br>
c = a + b <br>
c<sub>i</sub> = a<sub>i</sub> + b<sub>i</sub> <br>
</p>
<p>
Vector C can be the same instance as Vector A and/or B.
</p>
@param a A Vector. Not modified.
@param b A Vector. Not modified.
@param c A Vector where the results are stored. Modified. | [
"<p",
">",
"Performs",
"the",
"following",
"operation",
":",
"<br",
">",
"<br",
">",
"c",
"=",
"a",
"+",
"b",
"<br",
">",
"c<sub",
">",
"i<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"i<",
"/",
"sub",
">",
"+",
"b<sub",
">",
"i<",
"/",
"sub",
">",... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF2.java#L69-L72 |
elki-project/elki | elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/LoggingConfiguration.java | LoggingConfiguration.privateReconfigureLogging | private void privateReconfigureLogging(String pkg, final String name) {
LogManager logManager = LogManager.getLogManager();
Logger logger = Logger.getLogger(LoggingConfiguration.class.getName());
// allow null as package name.
if(pkg == null) {
pkg = "";
}
// Load logging configuration from current directory
String cfgfile = name;
if(new File(name).exists()) {
cfgfile = name;
}
else {
// Fall back to full path / resources.
cfgfile = pkg.replace('.', File.separatorChar) + File.separatorChar + name;
}
try {
InputStream cfgdata = openSystemFile(cfgfile);
logManager.readConfiguration(cfgdata);
// also load as properties for us, to get debug flag.
InputStream cfgdata2 = openSystemFile(cfgfile);
Properties cfgprop = new Properties();
cfgprop.load(cfgdata2);
DEBUG = Boolean.parseBoolean(cfgprop.getProperty("debug"));
logger.info("Logging configuration read.");
}
catch(FileNotFoundException e) {
logger.log(Level.SEVERE, "Could not find logging configuration file: " + cfgfile, e);
}
catch(Exception e) {
logger.log(Level.SEVERE, "Failed to configure logging from file: " + cfgfile, e);
}
} | java | private void privateReconfigureLogging(String pkg, final String name) {
LogManager logManager = LogManager.getLogManager();
Logger logger = Logger.getLogger(LoggingConfiguration.class.getName());
// allow null as package name.
if(pkg == null) {
pkg = "";
}
// Load logging configuration from current directory
String cfgfile = name;
if(new File(name).exists()) {
cfgfile = name;
}
else {
// Fall back to full path / resources.
cfgfile = pkg.replace('.', File.separatorChar) + File.separatorChar + name;
}
try {
InputStream cfgdata = openSystemFile(cfgfile);
logManager.readConfiguration(cfgdata);
// also load as properties for us, to get debug flag.
InputStream cfgdata2 = openSystemFile(cfgfile);
Properties cfgprop = new Properties();
cfgprop.load(cfgdata2);
DEBUG = Boolean.parseBoolean(cfgprop.getProperty("debug"));
logger.info("Logging configuration read.");
}
catch(FileNotFoundException e) {
logger.log(Level.SEVERE, "Could not find logging configuration file: " + cfgfile, e);
}
catch(Exception e) {
logger.log(Level.SEVERE, "Failed to configure logging from file: " + cfgfile, e);
}
} | [
"private",
"void",
"privateReconfigureLogging",
"(",
"String",
"pkg",
",",
"final",
"String",
"name",
")",
"{",
"LogManager",
"logManager",
"=",
"LogManager",
".",
"getLogManager",
"(",
")",
";",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"Loggi... | Reconfigure logging.
@param pkg Package name the configuration file comes from
@param name File name. | [
"Reconfigure",
"logging",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-logging/src/main/java/de/lmu/ifi/dbs/elki/logging/LoggingConfiguration.java#L107-L141 |
bsblabs/embed-for-vaadin | com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/util/BrowserUtils.java | BrowserUtils.openBrowser | public static void openBrowser(String url) {
logger.debug("Launching browser at [" + url + "]");
try {
if (!openBrowserJava6(url)) {
final String[] command = getOpenBrowserCommand(url);
if (logger.isTraceEnabled()) {
logger.trace("Using command " + Arrays.asList(command));
}
Runtime.getRuntime().exec(command);
}
} catch (Exception e) {
throw new IllegalStateException("Failed to open browser", e);
}
} | java | public static void openBrowser(String url) {
logger.debug("Launching browser at [" + url + "]");
try {
if (!openBrowserJava6(url)) {
final String[] command = getOpenBrowserCommand(url);
if (logger.isTraceEnabled()) {
logger.trace("Using command " + Arrays.asList(command));
}
Runtime.getRuntime().exec(command);
}
} catch (Exception e) {
throw new IllegalStateException("Failed to open browser", e);
}
} | [
"public",
"static",
"void",
"openBrowser",
"(",
"String",
"url",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Launching browser at [\"",
"+",
"url",
"+",
"\"]\"",
")",
";",
"try",
"{",
"if",
"(",
"!",
"openBrowserJava6",
"(",
"url",
")",
")",
"{",
"final",
... | Opens the specified <tt>url</tt> in the default browser.
@param url the url to open | [
"Opens",
"the",
"specified",
"<tt",
">",
"url<",
"/",
"tt",
">",
"in",
"the",
"default",
"browser",
"."
] | train | https://github.com/bsblabs/embed-for-vaadin/blob/f902e70def56ab54d287d2600f9c6eef9e66c225/com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/util/BrowserUtils.java#L68-L83 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/db/util/ResourceTable.java | ResourceTable.syncTables | public Record syncTables(BaseTable tblAlt, Record recMain) throws DBException
{
Record recAlt = super.syncTables(tblAlt, recMain); // Read the mirrored record
if (recAlt.getEditMode() == Constants.EDIT_CURRENT)
this.syncRecords(recAlt, recMain);
return recAlt;
} | java | public Record syncTables(BaseTable tblAlt, Record recMain) throws DBException
{
Record recAlt = super.syncTables(tblAlt, recMain); // Read the mirrored record
if (recAlt.getEditMode() == Constants.EDIT_CURRENT)
this.syncRecords(recAlt, recMain);
return recAlt;
} | [
"public",
"Record",
"syncTables",
"(",
"BaseTable",
"tblAlt",
",",
"Record",
"recMain",
")",
"throws",
"DBException",
"{",
"Record",
"recAlt",
"=",
"super",
".",
"syncTables",
"(",
"tblAlt",
",",
"recMain",
")",
";",
"// Read the mirrored record",
"if",
"(",
"... | Read the mirrored record.
@param tblTarget The table to read the same record from.
@param recSource Source record
@return The target table's record. | [
"Read",
"the",
"mirrored",
"record",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/ResourceTable.java#L129-L135 |
ginere/ginere-base | src/main/java/eu/ginere/base/util/file/FileUtils.java | FileUtils.createPathAndGetFile | public static File createPathAndGetFile(File root, String relativePathToCreate) {
File target = new File(root, relativePathToCreate);
if (!target.exists()) {
if (target.mkdirs()){
return target;
} else {
log.warn("No se ha podido crear el directorio:'"+target.getAbsolutePath()+"'");
return null;
}
} else {
return target;
}
} | java | public static File createPathAndGetFile(File root, String relativePathToCreate) {
File target = new File(root, relativePathToCreate);
if (!target.exists()) {
if (target.mkdirs()){
return target;
} else {
log.warn("No se ha podido crear el directorio:'"+target.getAbsolutePath()+"'");
return null;
}
} else {
return target;
}
} | [
"public",
"static",
"File",
"createPathAndGetFile",
"(",
"File",
"root",
",",
"String",
"relativePathToCreate",
")",
"{",
"File",
"target",
"=",
"new",
"File",
"(",
"root",
",",
"relativePathToCreate",
")",
";",
"if",
"(",
"!",
"target",
".",
"exists",
"(",
... | Crea el directorio y devuelve el objeto File asociado, devuelve null si no se ha podido crear
@param root
@param relativePathToCreate
@return | [
"Crea",
"el",
"directorio",
"y",
"devuelve",
"el",
"objeto",
"File",
"asociado",
"devuelve",
"null",
"si",
"no",
"se",
"ha",
"podido",
"crear"
] | train | https://github.com/ginere/ginere-base/blob/b1cc1c5834bd8a31df475c6f3fc0ee51273c5a24/src/main/java/eu/ginere/base/util/file/FileUtils.java#L224-L237 |
drinkjava2/jDialects | core/src/main/java/com/github/drinkjava2/jdialects/TableModelUtils.java | TableModelUtils.bindGlobalModel | public static void bindGlobalModel(Class<?> entityClass, TableModel tableModel) {
TableModelUtilsOfEntity.globalTableModelCache.put(entityClass, tableModel);
} | java | public static void bindGlobalModel(Class<?> entityClass, TableModel tableModel) {
TableModelUtilsOfEntity.globalTableModelCache.put(entityClass, tableModel);
} | [
"public",
"static",
"void",
"bindGlobalModel",
"(",
"Class",
"<",
"?",
">",
"entityClass",
",",
"TableModel",
"tableModel",
")",
"{",
"TableModelUtilsOfEntity",
".",
"globalTableModelCache",
".",
"put",
"(",
"entityClass",
",",
"tableModel",
")",
";",
"}"
] | This method bind a tableModel to a entity class, this is a global setting | [
"This",
"method",
"bind",
"a",
"tableModel",
"to",
"a",
"entity",
"class",
"this",
"is",
"a",
"global",
"setting"
] | train | https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/TableModelUtils.java#L127-L129 |
azkaban/azkaban | azkaban-common/src/main/java/azkaban/executor/FetchActiveFlowDao.java | FetchActiveFlowDao.fetchActiveFlowByExecId | Pair<ExecutionReference, ExecutableFlow> fetchActiveFlowByExecId(final int execId)
throws ExecutorManagerException {
try {
return this.dbOperator.query(FetchActiveExecutableFlow
.FETCH_ACTIVE_EXECUTABLE_FLOW_BY_EXEC_ID,
new FetchActiveExecutableFlow(), execId);
} catch (final SQLException e) {
throw new ExecutorManagerException("Error fetching active flow by exec id" + execId, e);
}
} | java | Pair<ExecutionReference, ExecutableFlow> fetchActiveFlowByExecId(final int execId)
throws ExecutorManagerException {
try {
return this.dbOperator.query(FetchActiveExecutableFlow
.FETCH_ACTIVE_EXECUTABLE_FLOW_BY_EXEC_ID,
new FetchActiveExecutableFlow(), execId);
} catch (final SQLException e) {
throw new ExecutorManagerException("Error fetching active flow by exec id" + execId, e);
}
} | [
"Pair",
"<",
"ExecutionReference",
",",
"ExecutableFlow",
">",
"fetchActiveFlowByExecId",
"(",
"final",
"int",
"execId",
")",
"throws",
"ExecutorManagerException",
"{",
"try",
"{",
"return",
"this",
".",
"dbOperator",
".",
"query",
"(",
"FetchActiveExecutableFlow",
... | Fetch the flow that is dispatched and not yet finished by execution id.
@return active flow pair
@throws ExecutorManagerException the executor manager exception | [
"Fetch",
"the",
"flow",
"that",
"is",
"dispatched",
"and",
"not",
"yet",
"finished",
"by",
"execution",
"id",
"."
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/FetchActiveFlowDao.java#L161-L170 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PrefixMappedItemCache.java | PrefixMappedItemCache.getList | public synchronized List<GoogleCloudStorageItemInfo> getList(
String bucket, @Nullable String objectNamePrefix) {
PrefixKey key = new PrefixKey(bucket, objectNamePrefix);
Entry<PrefixKey, CacheValue<Object>> entry = getParentEntry(prefixMap, key);
if (entry == null) {
return null;
}
if (isExpired(entry.getValue())) {
cleanupLists(key);
return null;
}
return listItems(key);
} | java | public synchronized List<GoogleCloudStorageItemInfo> getList(
String bucket, @Nullable String objectNamePrefix) {
PrefixKey key = new PrefixKey(bucket, objectNamePrefix);
Entry<PrefixKey, CacheValue<Object>> entry = getParentEntry(prefixMap, key);
if (entry == null) {
return null;
}
if (isExpired(entry.getValue())) {
cleanupLists(key);
return null;
}
return listItems(key);
} | [
"public",
"synchronized",
"List",
"<",
"GoogleCloudStorageItemInfo",
">",
"getList",
"(",
"String",
"bucket",
",",
"@",
"Nullable",
"String",
"objectNamePrefix",
")",
"{",
"PrefixKey",
"key",
"=",
"new",
"PrefixKey",
"(",
"bucket",
",",
"objectNamePrefix",
")",
... | Gets the cached list associated with the given bucket and object name prefix.
@param bucket the bucket where the entries are being retrieved from.
@param objectNamePrefix the object name prefix to match against. If this is empty string or
null, it will match everything in the bucket.
@return a list of items matching in the given bucket matching the given object name prefix,
null if a list isn't found or the is expired. | [
"Gets",
"the",
"cached",
"list",
"associated",
"with",
"the",
"given",
"bucket",
"and",
"object",
"name",
"prefix",
"."
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PrefixMappedItemCache.java#L101-L116 |
apache/groovy | src/main/groovy/groovy/lang/GroovyClassLoader.java | GroovyClassLoader.parseClass | public Class parseClass(String text) throws CompilationFailedException {
return parseClass(text, "script" + System.currentTimeMillis() +
Math.abs(text.hashCode()) + ".groovy");
} | java | public Class parseClass(String text) throws CompilationFailedException {
return parseClass(text, "script" + System.currentTimeMillis() +
Math.abs(text.hashCode()) + ".groovy");
} | [
"public",
"Class",
"parseClass",
"(",
"String",
"text",
")",
"throws",
"CompilationFailedException",
"{",
"return",
"parseClass",
"(",
"text",
",",
"\"script\"",
"+",
"System",
".",
"currentTimeMillis",
"(",
")",
"+",
"Math",
".",
"abs",
"(",
"text",
".",
"h... | Parses the given text into a Java class capable of being run
@param text the text of the script/class to parse
@return the main class defined in the given script | [
"Parses",
"the",
"given",
"text",
"into",
"a",
"Java",
"class",
"capable",
"of",
"being",
"run"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L260-L263 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.copyFile | public static Path copyFile(Path src, Path dest, StandardCopyOption... options) throws IORuntimeException {
Assert.notNull(src, "Source File is null !");
Assert.notNull(dest, "Destination File or directiory is null !");
Path destPath = dest.toFile().isDirectory() ? dest.resolve(src.getFileName()) : dest;
try {
return Files.copy(src, destPath, options);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static Path copyFile(Path src, Path dest, StandardCopyOption... options) throws IORuntimeException {
Assert.notNull(src, "Source File is null !");
Assert.notNull(dest, "Destination File or directiory is null !");
Path destPath = dest.toFile().isDirectory() ? dest.resolve(src.getFileName()) : dest;
try {
return Files.copy(src, destPath, options);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"Path",
"copyFile",
"(",
"Path",
"src",
",",
"Path",
"dest",
",",
"StandardCopyOption",
"...",
"options",
")",
"throws",
"IORuntimeException",
"{",
"Assert",
".",
"notNull",
"(",
"src",
",",
"\"Source File is null !\"",
")",
";",
"Assert",
... | 通过JDK7+的 {@link Files#copy(Path, Path, CopyOption...)} 方法拷贝文件
@param src 源文件路径
@param dest 目标文件或目录,如果为目录使用与源文件相同的文件名
@param options {@link StandardCopyOption}
@return Path
@throws IORuntimeException IO异常 | [
"通过JDK7",
"+",
"的",
"{",
"@link",
"Files#copy",
"(",
"Path",
"Path",
"CopyOption",
"...",
")",
"}",
"方法拷贝文件"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L961-L971 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/ColumnMenuExample.java | ColumnMenuExample.buildColumnMenu | private WMenu buildColumnMenu(final WText selectedMenuText) {
WMenu menu = new WMenu(WMenu.MenuType.COLUMN);
menu.setSelectMode(SelectMode.SINGLE);
menu.setRows(8);
StringTreeNode root = getOrgHierarchyTree();
mapColumnHierarchy(menu, root, selectedMenuText);
// Demonstrate different menu modes
getSubMenuByText("Australia", menu).setAccessKey('A');
getSubMenuByText("NSW", menu).setMode(MenuMode.CLIENT);
getSubMenuByText("Branch 1", menu).setMode(MenuMode.DYNAMIC);
getSubMenuByText("VIC", menu).setMode(MenuMode.LAZY);
WMenuItem itemWithIcon = new WMenuItem("Help");
itemWithIcon.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
// do something
}
});
itemWithIcon.setHtmlClass(HtmlClassProperties.ICON_HELP_BEFORE);
menu.add(itemWithIcon);
return menu;
} | java | private WMenu buildColumnMenu(final WText selectedMenuText) {
WMenu menu = new WMenu(WMenu.MenuType.COLUMN);
menu.setSelectMode(SelectMode.SINGLE);
menu.setRows(8);
StringTreeNode root = getOrgHierarchyTree();
mapColumnHierarchy(menu, root, selectedMenuText);
// Demonstrate different menu modes
getSubMenuByText("Australia", menu).setAccessKey('A');
getSubMenuByText("NSW", menu).setMode(MenuMode.CLIENT);
getSubMenuByText("Branch 1", menu).setMode(MenuMode.DYNAMIC);
getSubMenuByText("VIC", menu).setMode(MenuMode.LAZY);
WMenuItem itemWithIcon = new WMenuItem("Help");
itemWithIcon.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
// do something
}
});
itemWithIcon.setHtmlClass(HtmlClassProperties.ICON_HELP_BEFORE);
menu.add(itemWithIcon);
return menu;
} | [
"private",
"WMenu",
"buildColumnMenu",
"(",
"final",
"WText",
"selectedMenuText",
")",
"{",
"WMenu",
"menu",
"=",
"new",
"WMenu",
"(",
"WMenu",
".",
"MenuType",
".",
"COLUMN",
")",
";",
"menu",
".",
"setSelectMode",
"(",
"SelectMode",
".",
"SINGLE",
")",
"... | Builds up a column menu for inclusion in the example.
@param selectedMenuText the WText to display the selected menu.
@return a column menu for the example. | [
"Builds",
"up",
"a",
"column",
"menu",
"for",
"inclusion",
"in",
"the",
"example",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/menu/ColumnMenuExample.java#L53-L77 |
alkacon/opencms-core | src/org/opencms/ui/apps/resourcetypes/CmsNewResourceTypeDialog.java | CmsNewResourceTypeDialog.setModule | protected void setModule(String moduleName, CmsBasicDialog dialog) {
Window window = CmsVaadinUtils.getWindow(dialog);
window.setContent(this);
m_module = OpenCms.getModuleManager().getModule(moduleName).clone();
CmsResourceInfo resInfo = new CmsResourceInfo(
m_module.getName(),
m_module.getNiceName(),
CmsModuleApp.Icons.RESINFO_ICON);
displayResourceInfoDirectly(Arrays.asList(resInfo));
fillFields();
} | java | protected void setModule(String moduleName, CmsBasicDialog dialog) {
Window window = CmsVaadinUtils.getWindow(dialog);
window.setContent(this);
m_module = OpenCms.getModuleManager().getModule(moduleName).clone();
CmsResourceInfo resInfo = new CmsResourceInfo(
m_module.getName(),
m_module.getNiceName(),
CmsModuleApp.Icons.RESINFO_ICON);
displayResourceInfoDirectly(Arrays.asList(resInfo));
fillFields();
} | [
"protected",
"void",
"setModule",
"(",
"String",
"moduleName",
",",
"CmsBasicDialog",
"dialog",
")",
"{",
"Window",
"window",
"=",
"CmsVaadinUtils",
".",
"getWindow",
"(",
"dialog",
")",
";",
"window",
".",
"setContent",
"(",
"this",
")",
";",
"m_module",
"=... | Sets the module name.<p>
@param moduleName to be set
@param dialog dialog | [
"Sets",
"the",
"module",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/resourcetypes/CmsNewResourceTypeDialog.java#L424-L435 |
BioPAX/Paxtools | gsea-converter/src/main/java/org/biopax/paxtools/io/gsea/GSEAConverter.java | GSEAConverter.writeToGSEA | public void writeToGSEA(final Model model, OutputStream out) throws IOException
{
Collection<GMTEntry> entries = convert(model);
if (entries.size() > 0)
{
Writer writer = new OutputStreamWriter(out);
for (GMTEntry entry : entries) {
if ((minNumOfGenesPerEntry <= 1 && !entry.identifiers().isEmpty())
|| entry.identifiers().size() >= minNumOfGenesPerEntry)
{
writer.write(entry.toString() + "\n");
}
}
writer.flush();
}
} | java | public void writeToGSEA(final Model model, OutputStream out) throws IOException
{
Collection<GMTEntry> entries = convert(model);
if (entries.size() > 0)
{
Writer writer = new OutputStreamWriter(out);
for (GMTEntry entry : entries) {
if ((minNumOfGenesPerEntry <= 1 && !entry.identifiers().isEmpty())
|| entry.identifiers().size() >= minNumOfGenesPerEntry)
{
writer.write(entry.toString() + "\n");
}
}
writer.flush();
}
} | [
"public",
"void",
"writeToGSEA",
"(",
"final",
"Model",
"model",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"Collection",
"<",
"GMTEntry",
">",
"entries",
"=",
"convert",
"(",
"model",
")",
";",
"if",
"(",
"entries",
".",
"size",
"(",
... | Converts model to GSEA (GMT) and writes to out.
See class declaration for more information.
@param model Model
@param out output stream to write the result to
@throws IOException when there's an output stream error | [
"Converts",
"model",
"to",
"GSEA",
"(",
"GMT",
")",
"and",
"writes",
"to",
"out",
".",
"See",
"class",
"declaration",
"for",
"more",
"information",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/gsea-converter/src/main/java/org/biopax/paxtools/io/gsea/GSEAConverter.java#L171-L186 |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java | Utils.performCopy | public static void performCopy(String filename, SarlConfiguration configuration) {
if (filename.isEmpty()) {
return;
}
try {
final DocFile fromfile = DocFile.createFileForInput(configuration, filename);
final DocPath path = DocPath.create(fromfile.getName());
final DocFile toFile = DocFile.createFileForOutput(configuration, path);
if (toFile.isSameFile(fromfile)) {
return;
}
configuration.message.notice((SourcePosition) null,
"doclet.Copying_File_0_To_File_1", //$NON-NLS-1$
fromfile.toString(), path.getPath());
toFile.copyFile(fromfile);
} catch (IOException exc) {
configuration.message.error((SourcePosition) null,
"doclet.perform_copy_exception_encountered", //$NON-NLS-1$
exc.toString());
throw new DocletAbortException(exc);
}
} | java | public static void performCopy(String filename, SarlConfiguration configuration) {
if (filename.isEmpty()) {
return;
}
try {
final DocFile fromfile = DocFile.createFileForInput(configuration, filename);
final DocPath path = DocPath.create(fromfile.getName());
final DocFile toFile = DocFile.createFileForOutput(configuration, path);
if (toFile.isSameFile(fromfile)) {
return;
}
configuration.message.notice((SourcePosition) null,
"doclet.Copying_File_0_To_File_1", //$NON-NLS-1$
fromfile.toString(), path.getPath());
toFile.copyFile(fromfile);
} catch (IOException exc) {
configuration.message.error((SourcePosition) null,
"doclet.perform_copy_exception_encountered", //$NON-NLS-1$
exc.toString());
throw new DocletAbortException(exc);
}
} | [
"public",
"static",
"void",
"performCopy",
"(",
"String",
"filename",
",",
"SarlConfiguration",
"configuration",
")",
"{",
"if",
"(",
"filename",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"final",
"DocFile",
"fromfile",
"=",
"DocF... | Copy the given file.
@param filename the file to copy.
@param configuration the configuration. | [
"Copy",
"the",
"given",
"file",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Utils.java#L403-L425 |
jbossws/jbossws-cxf | modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java | JBossWSInvoker.performInvocation | @Override
protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m, Object[] paramArray)
throws Exception
{
Endpoint ep = exchange.get(Endpoint.class);
final InvocationHandler invHandler = ep.getInvocationHandler();
final Invocation inv = createInvocation(invHandler, serviceObject, ep, m, paramArray);
if (factory != null) {
inv.getInvocationContext().setProperty("forceTargetBean", true);
}
Bus threadBus = BusFactory.getThreadDefaultBus(false);
BusFactory.setThreadDefaultBus(disableDepUserDefThreadBus ? null : ep.getAttachment(Bus.class));
setNamespaceContextSelector(exchange);
ClassLoader cl = SecurityActions.getContextClassLoader();
SecurityActions.setContextClassLoader(serviceObject.getClass().getClassLoader());
try {
invHandler.invoke(ep, inv);
return inv.getReturnValue();
} finally {
SecurityActions.setContextClassLoader(cl);
//make sure the right bus is restored after coming back from the endpoint method
BusFactory.setThreadDefaultBus(threadBus);
clearNamespaceContextSelector(exchange);
}
} | java | @Override
protected Object performInvocation(Exchange exchange, final Object serviceObject, Method m, Object[] paramArray)
throws Exception
{
Endpoint ep = exchange.get(Endpoint.class);
final InvocationHandler invHandler = ep.getInvocationHandler();
final Invocation inv = createInvocation(invHandler, serviceObject, ep, m, paramArray);
if (factory != null) {
inv.getInvocationContext().setProperty("forceTargetBean", true);
}
Bus threadBus = BusFactory.getThreadDefaultBus(false);
BusFactory.setThreadDefaultBus(disableDepUserDefThreadBus ? null : ep.getAttachment(Bus.class));
setNamespaceContextSelector(exchange);
ClassLoader cl = SecurityActions.getContextClassLoader();
SecurityActions.setContextClassLoader(serviceObject.getClass().getClassLoader());
try {
invHandler.invoke(ep, inv);
return inv.getReturnValue();
} finally {
SecurityActions.setContextClassLoader(cl);
//make sure the right bus is restored after coming back from the endpoint method
BusFactory.setThreadDefaultBus(threadBus);
clearNamespaceContextSelector(exchange);
}
} | [
"@",
"Override",
"protected",
"Object",
"performInvocation",
"(",
"Exchange",
"exchange",
",",
"final",
"Object",
"serviceObject",
",",
"Method",
"m",
",",
"Object",
"[",
"]",
"paramArray",
")",
"throws",
"Exception",
"{",
"Endpoint",
"ep",
"=",
"exchange",
".... | This overrides org.apache.cxf.jaxws.AbstractInvoker in order for using the JBossWS integration logic
to invoke the JBoss AS target bean. | [
"This",
"overrides",
"org",
".",
"apache",
".",
"cxf",
".",
"jaxws",
".",
"AbstractInvoker",
"in",
"order",
"for",
"using",
"the",
"JBossWS",
"integration",
"logic",
"to",
"invoke",
"the",
"JBoss",
"AS",
"target",
"bean",
"."
] | train | https://github.com/jbossws/jbossws-cxf/blob/e1d5df3664cbc2482ebc83cafd355a4d60d12150/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java#L153-L178 |
infinispan/infinispan | core/src/main/java/org/infinispan/util/concurrent/CompletableFutures.java | CompletableFutures.await | public static <T> T await(CompletableFuture<T> future) throws ExecutionException, InterruptedException {
try {
return Objects.requireNonNull(future, "Completable Future must be non-null.").get(BIG_DELAY_NANOS, TimeUnit.NANOSECONDS);
} catch (java.util.concurrent.TimeoutException e) {
throw new IllegalStateException("This should never happen!", e);
}
} | java | public static <T> T await(CompletableFuture<T> future) throws ExecutionException, InterruptedException {
try {
return Objects.requireNonNull(future, "Completable Future must be non-null.").get(BIG_DELAY_NANOS, TimeUnit.NANOSECONDS);
} catch (java.util.concurrent.TimeoutException e) {
throw new IllegalStateException("This should never happen!", e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"await",
"(",
"CompletableFuture",
"<",
"T",
">",
"future",
")",
"throws",
"ExecutionException",
",",
"InterruptedException",
"{",
"try",
"{",
"return",
"Objects",
".",
"requireNonNull",
"(",
"future",
",",
"\"Completabl... | Wait for a long time until the {@link CompletableFuture} is completed.
@param future the {@link CompletableFuture}.
@param <T> the return type.
@return the result value.
@throws ExecutionException if the {@link CompletableFuture} completed exceptionally.
@throws InterruptedException if the current thread was interrupted while waiting. | [
"Wait",
"for",
"a",
"long",
"time",
"until",
"the",
"{",
"@link",
"CompletableFuture",
"}",
"is",
"completed",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/CompletableFutures.java#L108-L114 |
playn/playn | core/src/playn/core/json/JsonObject.java | JsonObject.getArray | public Json.Array getArray(String key) {
return getArray(key, (Json.Array) null);
} | java | public Json.Array getArray(String key) {
return getArray(key, (Json.Array) null);
} | [
"public",
"Json",
".",
"Array",
"getArray",
"(",
"String",
"key",
")",
"{",
"return",
"getArray",
"(",
"key",
",",
"(",
"Json",
".",
"Array",
")",
"null",
")",
";",
"}"
] | Returns the {@link JsonArray} at the given key, or null if it does not exist or is the wrong
type. | [
"Returns",
"the",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonObject.java#L50-L52 |
mytechia/mytechia_commons | mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java | PrototypeContainer.getClone | public <T> T getClone( String key, Class<T> c )
{
IPrototype prototype = prototypes.get(new PrototypeKey(key, c));
if (prototype != null) {
return (T) prototype.clone();
}
else
return null;
} | java | public <T> T getClone( String key, Class<T> c )
{
IPrototype prototype = prototypes.get(new PrototypeKey(key, c));
if (prototype != null) {
return (T) prototype.clone();
}
else
return null;
} | [
"public",
"<",
"T",
">",
"T",
"getClone",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"c",
")",
"{",
"IPrototype",
"prototype",
"=",
"prototypes",
".",
"get",
"(",
"new",
"PrototypeKey",
"(",
"key",
",",
"c",
")",
")",
";",
"if",
"(",
"pro... | Obtains a key associated clone of the prototype for
the specified class and key
NOTE: IPrototype pattern
@param c class of the clone to be obtained | [
"Obtains",
"a",
"key",
"associated",
"clone",
"of",
"the",
"prototype",
"for",
"the",
"specified",
"class",
"and",
"key"
] | train | https://github.com/mytechia/mytechia_commons/blob/02251879085f271a1fb51663a1c8eddc8be78ae7/mytechia_commons_library/src/main/java/com/mytechia/commons/patterns/prototype/PrototypeContainer.java#L89-L100 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/HeapDumpForTaskUtils.java | HeapDumpForTaskUtils.generateDumpScript | public static void generateDumpScript(Path dumpScript, FileSystem fs, String heapFileName, String chmod)
throws IOException {
if (fs.exists(dumpScript)) {
LOG.info("Heap dump script already exists: " + dumpScript);
return;
}
try (BufferedWriter scriptWriter =
new BufferedWriter(new OutputStreamWriter(fs.create(dumpScript), ConfigurationKeys.DEFAULT_CHARSET_ENCODING))) {
Path dumpDir = new Path(dumpScript.getParent(), DUMP_FOLDER);
if (!fs.exists(dumpDir)) {
fs.mkdirs(dumpDir);
}
scriptWriter.write("#!/bin/sh\n");
scriptWriter.write("if [ -n \"$HADOOP_PREFIX\" ]; then\n");
scriptWriter
.write(" ${HADOOP_PREFIX}/bin/hadoop dfs -put " + heapFileName + " " + dumpDir + "/${PWD//\\//_}.hprof\n");
scriptWriter.write("else\n");
scriptWriter
.write(" ${HADOOP_HOME}/bin/hadoop dfs -put " + heapFileName + " " + dumpDir + "/${PWD//\\//_}.hprof\n");
scriptWriter.write("fi\n");
} catch (IOException ioe) {
LOG.error("Heap dump script is not generated successfully.");
if (fs.exists(dumpScript)) {
fs.delete(dumpScript, true);
}
throw ioe;
}
Runtime.getRuntime().exec(chmod + " " + dumpScript);
} | java | public static void generateDumpScript(Path dumpScript, FileSystem fs, String heapFileName, String chmod)
throws IOException {
if (fs.exists(dumpScript)) {
LOG.info("Heap dump script already exists: " + dumpScript);
return;
}
try (BufferedWriter scriptWriter =
new BufferedWriter(new OutputStreamWriter(fs.create(dumpScript), ConfigurationKeys.DEFAULT_CHARSET_ENCODING))) {
Path dumpDir = new Path(dumpScript.getParent(), DUMP_FOLDER);
if (!fs.exists(dumpDir)) {
fs.mkdirs(dumpDir);
}
scriptWriter.write("#!/bin/sh\n");
scriptWriter.write("if [ -n \"$HADOOP_PREFIX\" ]; then\n");
scriptWriter
.write(" ${HADOOP_PREFIX}/bin/hadoop dfs -put " + heapFileName + " " + dumpDir + "/${PWD//\\//_}.hprof\n");
scriptWriter.write("else\n");
scriptWriter
.write(" ${HADOOP_HOME}/bin/hadoop dfs -put " + heapFileName + " " + dumpDir + "/${PWD//\\//_}.hprof\n");
scriptWriter.write("fi\n");
} catch (IOException ioe) {
LOG.error("Heap dump script is not generated successfully.");
if (fs.exists(dumpScript)) {
fs.delete(dumpScript, true);
}
throw ioe;
}
Runtime.getRuntime().exec(chmod + " " + dumpScript);
} | [
"public",
"static",
"void",
"generateDumpScript",
"(",
"Path",
"dumpScript",
",",
"FileSystem",
"fs",
",",
"String",
"heapFileName",
",",
"String",
"chmod",
")",
"throws",
"IOException",
"{",
"if",
"(",
"fs",
".",
"exists",
"(",
"dumpScript",
")",
")",
"{",
... | Generate the dumpScript, which is used when OOM error is thrown during task execution.
The current content dumpScript puts the .prof files to the DUMP_FOLDER within the same directory of the dumpScript.
User needs to add the following options to the task java.opts:
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heapFileName.hprof -XX:OnOutOfMemoryError=./dumpScriptFileName
@param dumpScript The path to the dumpScript, which needs to be added to the Distributed cache.
To use it, simply put the path of dumpScript to the gobblin config: job.hdfs.files.
@param fs File system
@param heapFileName the name of the .prof file.
@param chmod chmod for the dump script. For hdfs file, e.g, "hadoop fs -chmod 755"
@throws IOException | [
"Generate",
"the",
"dumpScript",
"which",
"is",
"used",
"when",
"OOM",
"error",
"is",
"thrown",
"during",
"task",
"execution",
".",
"The",
"current",
"content",
"dumpScript",
"puts",
"the",
".",
"prof",
"files",
"to",
"the",
"DUMP_FOLDER",
"within",
"the",
"... | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HeapDumpForTaskUtils.java#L55-L86 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Collectors.java | Collectors.groupingByConcurrent | public static <T, K, A, D>
Collector<T, ?, ConcurrentMap<K, D>> groupingByConcurrent(Function<? super T, ? extends K> classifier,
Collector<? super T, A, D> downstream) {
return groupingByConcurrent(classifier, ConcurrentHashMap::new, downstream);
} | java | public static <T, K, A, D>
Collector<T, ?, ConcurrentMap<K, D>> groupingByConcurrent(Function<? super T, ? extends K> classifier,
Collector<? super T, A, D> downstream) {
return groupingByConcurrent(classifier, ConcurrentHashMap::new, downstream);
} | [
"public",
"static",
"<",
"T",
",",
"K",
",",
"A",
",",
"D",
">",
"Collector",
"<",
"T",
",",
"?",
",",
"ConcurrentMap",
"<",
"K",
",",
"D",
">",
">",
"groupingByConcurrent",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"K",
">",
... | Returns a concurrent {@code Collector} implementing a cascaded "group by"
operation on input elements of type {@code T}, grouping elements
according to a classification function, and then performing a reduction
operation on the values associated with a given key using the specified
downstream {@code Collector}.
<p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and
{@link Collector.Characteristics#UNORDERED unordered} Collector.
<p>The classification function maps elements to some key type {@code K}.
The downstream collector operates on elements of type {@code T} and
produces a result of type {@code D}. The resulting collector produces a
{@code Map<K, D>}.
<p>For example, to compute the set of last names of people in each city,
where the city names are sorted:
<pre>{@code
ConcurrentMap<City, Set<String>> namesByCity
= people.stream().collect(groupingByConcurrent(Person::getCity,
mapping(Person::getLastName, toSet())));
}</pre>
@param <T> the type of the input elements
@param <K> the type of the keys
@param <A> the intermediate accumulation type of the downstream collector
@param <D> the result type of the downstream reduction
@param classifier a classifier function mapping input elements to keys
@param downstream a {@code Collector} implementing the downstream reduction
@return a concurrent, unordered {@code Collector} implementing the cascaded group-by operation
@see #groupingBy(Function, Collector)
@see #groupingByConcurrent(Function)
@see #groupingByConcurrent(Function, Supplier, Collector) | [
"Returns",
"a",
"concurrent",
"{",
"@code",
"Collector",
"}",
"implementing",
"a",
"cascaded",
"group",
"by",
"operation",
"on",
"input",
"elements",
"of",
"type",
"{",
"@code",
"T",
"}",
"grouping",
"elements",
"according",
"to",
"a",
"classification",
"funct... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Collectors.java#L1005-L1009 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java | JavacState.performTranslation | public void performTranslation(File gensrcDir, Map<String,Transformer> suffixRules) {
Map<String,Transformer> sr = new HashMap<>();
for (Map.Entry<String,Transformer> e : suffixRules.entrySet()) {
Class<?> trClass = e.getValue().getClass();
if (trClass == CompileJavaPackages.class || trClass == CopyFile.class)
continue;
sr.put(e.getKey(), e.getValue());
}
perform(null, gensrcDir, sr);
} | java | public void performTranslation(File gensrcDir, Map<String,Transformer> suffixRules) {
Map<String,Transformer> sr = new HashMap<>();
for (Map.Entry<String,Transformer> e : suffixRules.entrySet()) {
Class<?> trClass = e.getValue().getClass();
if (trClass == CompileJavaPackages.class || trClass == CopyFile.class)
continue;
sr.put(e.getKey(), e.getValue());
}
perform(null, gensrcDir, sr);
} | [
"public",
"void",
"performTranslation",
"(",
"File",
"gensrcDir",
",",
"Map",
"<",
"String",
",",
"Transformer",
">",
"suffixRules",
")",
"{",
"Map",
"<",
"String",
",",
"Transformer",
">",
"sr",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
... | Run all the translators that translate into java source code.
I.e. all translators that are not copy nor compile_java_source. | [
"Run",
"all",
"the",
"translators",
"that",
"translate",
"into",
"java",
"source",
"code",
".",
"I",
".",
"e",
".",
"all",
"translators",
"that",
"are",
"not",
"copy",
"nor",
"compile_java_source",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java#L715-L725 |
mozilla/rhino | src/org/mozilla/javascript/FunctionObject.java | FunctionObject.createObject | @Override
public Scriptable createObject(Context cx, Scriptable scope) {
if (member.isCtor() || parmsLength == VARARGS_CTOR) {
return null;
}
Scriptable result;
try {
result = (Scriptable) member.getDeclaringClass().newInstance();
} catch (Exception ex) {
throw Context.throwAsScriptRuntimeEx(ex);
}
result.setPrototype(getClassPrototype());
result.setParentScope(getParentScope());
return result;
} | java | @Override
public Scriptable createObject(Context cx, Scriptable scope) {
if (member.isCtor() || parmsLength == VARARGS_CTOR) {
return null;
}
Scriptable result;
try {
result = (Scriptable) member.getDeclaringClass().newInstance();
} catch (Exception ex) {
throw Context.throwAsScriptRuntimeEx(ex);
}
result.setPrototype(getClassPrototype());
result.setParentScope(getParentScope());
return result;
} | [
"@",
"Override",
"public",
"Scriptable",
"createObject",
"(",
"Context",
"cx",
",",
"Scriptable",
"scope",
")",
"{",
"if",
"(",
"member",
".",
"isCtor",
"(",
")",
"||",
"parmsLength",
"==",
"VARARGS_CTOR",
")",
"{",
"return",
"null",
";",
"}",
"Scriptable"... | Return new {@link Scriptable} instance using the default
constructor for the class of the underlying Java method.
Return null to indicate that the call method should be used to create
new objects. | [
"Return",
"new",
"{"
] | train | https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/FunctionObject.java#L479-L494 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/types/StringValue.java | StringValue.setValueAscii | public void setValueAscii(byte[] bytes, int offset, int len) {
if (bytes == null) {
throw new NullPointerException("Bytes must not be null");
}
if (len < 0 | offset < 0 | offset > bytes.length - len) {
throw new IndexOutOfBoundsException();
}
ensureSize(len);
this.len = len;
this.hashCode = 0;
final char[] chars = this.value;
for (int i = 0, limit = offset + len; offset < limit; offset++, i++) {
chars[i] = (char) (bytes[offset] & 0xff);
}
} | java | public void setValueAscii(byte[] bytes, int offset, int len) {
if (bytes == null) {
throw new NullPointerException("Bytes must not be null");
}
if (len < 0 | offset < 0 | offset > bytes.length - len) {
throw new IndexOutOfBoundsException();
}
ensureSize(len);
this.len = len;
this.hashCode = 0;
final char[] chars = this.value;
for (int i = 0, limit = offset + len; offset < limit; offset++, i++) {
chars[i] = (char) (bytes[offset] & 0xff);
}
} | [
"public",
"void",
"setValueAscii",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Bytes must not be null\"",
")",
";",
"}",
"i... | Sets the value of this <code>StringValue</code>, assuming that the binary data is ASCII coded. The n-th character of the
<code>StringValue</code> corresponds directly to the n-th byte in the given array after the offset.
@param bytes The binary character data.
@param offset The offset in the array.
@param len The number of bytes to read from the array. | [
"Sets",
"the",
"value",
"of",
"this",
"<code",
">",
"StringValue<",
"/",
"code",
">",
"assuming",
"that",
"the",
"binary",
"data",
"is",
"ASCII",
"coded",
".",
"The",
"n",
"-",
"th",
"character",
"of",
"the",
"<code",
">",
"StringValue<",
"/",
"code",
... | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/types/StringValue.java#L236-L253 |
bwkimmel/java-util | src/main/java/ca/eandb/util/FloatArray.java | FloatArray.add | public void add(int index, float e) {
if (index < 0 || index > size) {
throw new IndexOutOfBoundsException();
}
ensureCapacity(size + 1);
if (index < size) {
for (int i = size; i > index; i--) {
elements[i] = elements[i - 1];
}
}
elements[index] = e;
size++;
} | java | public void add(int index, float e) {
if (index < 0 || index > size) {
throw new IndexOutOfBoundsException();
}
ensureCapacity(size + 1);
if (index < size) {
for (int i = size; i > index; i--) {
elements[i] = elements[i - 1];
}
}
elements[index] = e;
size++;
} | [
"public",
"void",
"add",
"(",
"int",
"index",
",",
"float",
"e",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">",
"size",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
"ensureCapacity",
"(",
"size",
"+",
"1",
... | Inserts a value into the array at the specified index.
@param index
The index at which to insert the new value.
@param e
The new value to insert.
@throws IndexOutOfBoundsException
if <code>index < 0 || index > size()</code>. | [
"Inserts",
"a",
"value",
"into",
"the",
"array",
"at",
"the",
"specified",
"index",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/FloatArray.java#L394-L406 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/workspace/VoiceApi.java | VoiceApi.attachUserData | public void attachUserData(String connId, KeyValueCollection userData) throws WorkspaceApiException {
try {
VoicecallsidcompleteData completeData = new VoicecallsidcompleteData();
completeData.setUserData(Util.toKVList(userData));
UserDataOperationId data = new UserDataOperationId();
data.data(completeData);
ApiSuccessResponse response = this.voiceApi.attachUserData(connId, data);
throwIfNotOk("attachUserData", response);
} catch (ApiException e) {
throw new WorkspaceApiException("attachUserData failed.", e);
}
} | java | public void attachUserData(String connId, KeyValueCollection userData) throws WorkspaceApiException {
try {
VoicecallsidcompleteData completeData = new VoicecallsidcompleteData();
completeData.setUserData(Util.toKVList(userData));
UserDataOperationId data = new UserDataOperationId();
data.data(completeData);
ApiSuccessResponse response = this.voiceApi.attachUserData(connId, data);
throwIfNotOk("attachUserData", response);
} catch (ApiException e) {
throw new WorkspaceApiException("attachUserData failed.", e);
}
} | [
"public",
"void",
"attachUserData",
"(",
"String",
"connId",
",",
"KeyValueCollection",
"userData",
")",
"throws",
"WorkspaceApiException",
"{",
"try",
"{",
"VoicecallsidcompleteData",
"completeData",
"=",
"new",
"VoicecallsidcompleteData",
"(",
")",
";",
"completeData"... | Attach the provided data to the call. This adds the data to the call even if data already exists
with the provided keys.
@param connId The connection ID of the call.
@param userData The data to attach to the call. This is an array of objects with the properties key, type, and value. | [
"Attach",
"the",
"provided",
"data",
"to",
"the",
"call",
".",
"This",
"adds",
"the",
"data",
"to",
"the",
"call",
"even",
"if",
"data",
"already",
"exists",
"with",
"the",
"provided",
"keys",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1066-L1078 |
ktoso/janbanery | janbanery-android/src/main/java/pl/project13/janbanery/android/util/Strings.java | Strings.joinAnd | public static <T> String joinAnd(final String delimiter, final String lastDelimiter, final Collection<T> objs) {
if (objs == null || objs.isEmpty()) {
return "";
}
final Iterator<T> iter = objs.iterator();
final StringBuffer buffer = new StringBuffer(Strings.toString(iter.next()));
int i = 1;
while (iter.hasNext()) {
final T obj = iter.next();
if (notEmpty(obj)) {
buffer.append(++i == objs.size() ? lastDelimiter : delimiter).append(Strings.toString(obj));
}
}
return buffer.toString();
} | java | public static <T> String joinAnd(final String delimiter, final String lastDelimiter, final Collection<T> objs) {
if (objs == null || objs.isEmpty()) {
return "";
}
final Iterator<T> iter = objs.iterator();
final StringBuffer buffer = new StringBuffer(Strings.toString(iter.next()));
int i = 1;
while (iter.hasNext()) {
final T obj = iter.next();
if (notEmpty(obj)) {
buffer.append(++i == objs.size() ? lastDelimiter : delimiter).append(Strings.toString(obj));
}
}
return buffer.toString();
} | [
"public",
"static",
"<",
"T",
">",
"String",
"joinAnd",
"(",
"final",
"String",
"delimiter",
",",
"final",
"String",
"lastDelimiter",
",",
"final",
"Collection",
"<",
"T",
">",
"objs",
")",
"{",
"if",
"(",
"objs",
"==",
"null",
"||",
"objs",
".",
"isEm... | Like join, but allows for a distinct final delimiter. For english sentences such
as "Alice, Bob and Charlie" use ", " and " and " as the delimiters.
@param delimiter usually ", "
@param lastDelimiter usually " and "
@param objs the objects
@param <T> the type
@return a string | [
"Like",
"join",
"but",
"allows",
"for",
"a",
"distinct",
"final",
"delimiter",
".",
"For",
"english",
"sentences",
"such",
"as",
"Alice",
"Bob",
"and",
"Charlie",
"use",
"and",
"and",
"as",
"the",
"delimiters",
"."
] | train | https://github.com/ktoso/janbanery/blob/cd77b774814c7fbb2a0c9c55d4c3f7e76affa636/janbanery-android/src/main/java/pl/project13/janbanery/android/util/Strings.java#L28-L43 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java | CPAttachmentFileEntryPersistenceImpl.removeByUuid_C | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPAttachmentFileEntry cpAttachmentFileEntry : findByUuid_C(uuid,
companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpAttachmentFileEntry);
}
} | java | @Override
public void removeByUuid_C(String uuid, long companyId) {
for (CPAttachmentFileEntry cpAttachmentFileEntry : findByUuid_C(uuid,
companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpAttachmentFileEntry);
}
} | [
"@",
"Override",
"public",
"void",
"removeByUuid_C",
"(",
"String",
"uuid",
",",
"long",
"companyId",
")",
"{",
"for",
"(",
"CPAttachmentFileEntry",
"cpAttachmentFileEntry",
":",
"findByUuid_C",
"(",
"uuid",
",",
"companyId",
",",
"QueryUtil",
".",
"ALL_POS",
",... | Removes all the cp attachment file entries where uuid = ? and companyId = ? from the database.
@param uuid the uuid
@param companyId the company ID | [
"Removes",
"all",
"the",
"cp",
"attachment",
"file",
"entries",
"where",
"uuid",
"=",
"?",
";",
"and",
"companyId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPAttachmentFileEntryPersistenceImpl.java#L1416-L1422 |
lagom/lagom | service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java | Descriptor.withMessageSerializer | public Descriptor withMessageSerializer(Type messageType, MessageSerializer<?, ?> messageSerializer) {
return replaceAllMessageSerializers(messageSerializers.plus(messageType, messageSerializer));
} | java | public Descriptor withMessageSerializer(Type messageType, MessageSerializer<?, ?> messageSerializer) {
return replaceAllMessageSerializers(messageSerializers.plus(messageType, messageSerializer));
} | [
"public",
"Descriptor",
"withMessageSerializer",
"(",
"Type",
"messageType",
",",
"MessageSerializer",
"<",
"?",
",",
"?",
">",
"messageSerializer",
")",
"{",
"return",
"replaceAllMessageSerializers",
"(",
"messageSerializers",
".",
"plus",
"(",
"messageType",
",",
... | Provide a custom MessageSerializer for the given message type.
@param messageType The type of the message.
@param messageSerializer The message serializer for that type.
@return A copy of this descriptor. | [
"Provide",
"a",
"custom",
"MessageSerializer",
"for",
"the",
"given",
"message",
"type",
"."
] | train | https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/Descriptor.java#L700-L702 |
apache/incubator-gobblin | gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java | State.getPropAsBoolean | public boolean getPropAsBoolean(String key, boolean def) {
return Boolean.parseBoolean(getProp(key, String.valueOf(def)));
} | java | public boolean getPropAsBoolean(String key, boolean def) {
return Boolean.parseBoolean(getProp(key, String.valueOf(def)));
} | [
"public",
"boolean",
"getPropAsBoolean",
"(",
"String",
"key",
",",
"boolean",
"def",
")",
"{",
"return",
"Boolean",
".",
"parseBoolean",
"(",
"getProp",
"(",
"key",
",",
"String",
".",
"valueOf",
"(",
"def",
")",
")",
")",
";",
"}"
] | Get the value of a property as a boolean, using the given default value if the property is not set.
@param key property key
@param def default value
@return boolean value associated with the key or the default value if the property is not set | [
"Get",
"the",
"value",
"of",
"a",
"property",
"as",
"a",
"boolean",
"using",
"the",
"given",
"default",
"value",
"if",
"the",
"property",
"is",
"not",
"set",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java#L470-L472 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.mergeToPrefixBlocks | public IPv6AddressSection[] mergeToPrefixBlocks(IPv6AddressSection ...sections) throws SizeMismatchException, AddressPositionException {
for(int i = 0; i < sections.length; i++) {
IPv6AddressSection section = sections[i];
if(section.addressSegmentIndex != addressSegmentIndex) {
throw new AddressPositionException(section, section.addressSegmentIndex, addressSegmentIndex);
}
}
List<IPAddressSegmentSeries> blocks = getMergedPrefixBlocks(this, sections, true);
return blocks.toArray(new IPv6AddressSection[blocks.size()]);
} | java | public IPv6AddressSection[] mergeToPrefixBlocks(IPv6AddressSection ...sections) throws SizeMismatchException, AddressPositionException {
for(int i = 0; i < sections.length; i++) {
IPv6AddressSection section = sections[i];
if(section.addressSegmentIndex != addressSegmentIndex) {
throw new AddressPositionException(section, section.addressSegmentIndex, addressSegmentIndex);
}
}
List<IPAddressSegmentSeries> blocks = getMergedPrefixBlocks(this, sections, true);
return blocks.toArray(new IPv6AddressSection[blocks.size()]);
} | [
"public",
"IPv6AddressSection",
"[",
"]",
"mergeToPrefixBlocks",
"(",
"IPv6AddressSection",
"...",
"sections",
")",
"throws",
"SizeMismatchException",
",",
"AddressPositionException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sections",
".",
"length",... | Merges this with the list of sections to produce the smallest array of prefix blocks, going from smallest to largest
@param sections the sections to merge with this
@return | [
"Merges",
"this",
"with",
"the",
"list",
"of",
"sections",
"to",
"produce",
"the",
"smallest",
"array",
"of",
"prefix",
"blocks",
"going",
"from",
"smallest",
"to",
"largest"
] | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L2050-L2059 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/PKIXRevocationChecker.java | PKIXRevocationChecker.setOcspResponses | public void setOcspResponses(Map<X509Certificate, byte[]> responses)
{
if (responses == null) {
this.ocspResponses = Collections.<X509Certificate, byte[]>emptyMap();
} else {
Map<X509Certificate, byte[]> copy = new HashMap<>(responses.size());
for (Map.Entry<X509Certificate, byte[]> e : responses.entrySet()) {
copy.put(e.getKey(), e.getValue().clone());
}
this.ocspResponses = copy;
}
} | java | public void setOcspResponses(Map<X509Certificate, byte[]> responses)
{
if (responses == null) {
this.ocspResponses = Collections.<X509Certificate, byte[]>emptyMap();
} else {
Map<X509Certificate, byte[]> copy = new HashMap<>(responses.size());
for (Map.Entry<X509Certificate, byte[]> e : responses.entrySet()) {
copy.put(e.getKey(), e.getValue().clone());
}
this.ocspResponses = copy;
}
} | [
"public",
"void",
"setOcspResponses",
"(",
"Map",
"<",
"X509Certificate",
",",
"byte",
"[",
"]",
">",
"responses",
")",
"{",
"if",
"(",
"responses",
"==",
"null",
")",
"{",
"this",
".",
"ocspResponses",
"=",
"Collections",
".",
"<",
"X509Certificate",
",",... | Sets the OCSP responses. These responses are used to determine
the revocation status of the specified certificates when OCSP is used.
@param responses a map of OCSP responses. Each key is an
{@code X509Certificate} that maps to the corresponding
DER-encoded OCSP response for that certificate. A deep copy of
the map is performed to protect against subsequent modification. | [
"Sets",
"the",
"OCSP",
"responses",
".",
"These",
"responses",
"are",
"used",
"to",
"determine",
"the",
"revocation",
"status",
"of",
"the",
"specified",
"certificates",
"when",
"OCSP",
"is",
"used",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/PKIXRevocationChecker.java#L194-L205 |
jenkinsci/jenkins | core/src/main/java/hudson/security/SidACL.java | SidACL.newInheritingACL | public final SidACL newInheritingACL(final SidACL parent) {
final SidACL child = this;
return new SidACL() {
protected Boolean hasPermission(Sid p, Permission permission) {
Boolean b = child.hasPermission(p, permission);
if(b!=null) return b;
return parent.hasPermission(p,permission);
}
};
} | java | public final SidACL newInheritingACL(final SidACL parent) {
final SidACL child = this;
return new SidACL() {
protected Boolean hasPermission(Sid p, Permission permission) {
Boolean b = child.hasPermission(p, permission);
if(b!=null) return b;
return parent.hasPermission(p,permission);
}
};
} | [
"public",
"final",
"SidACL",
"newInheritingACL",
"(",
"final",
"SidACL",
"parent",
")",
"{",
"final",
"SidACL",
"child",
"=",
"this",
";",
"return",
"new",
"SidACL",
"(",
")",
"{",
"protected",
"Boolean",
"hasPermission",
"(",
"Sid",
"p",
",",
"Permission",
... | Creates a new {@link SidACL} that first consults 'this' {@link SidACL} and then delegate to
the given parent {@link SidACL}. By doing this at the {@link SidACL} level and not at the
{@link ACL} level, this allows the child ACLs to have an explicit deny entry.
Note that the combined ACL calls hasPermission(Sid,Permission) in the child and parent
SidACLs directly, so if these override _hasPermission then this custom behavior will
not be applied. | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/SidACL.java#L138-L147 |
BellaDati/belladati-sdk-api | src/main/java/com/belladati/sdk/filter/FilterOperation.java | FilterOperation.createFilter | public F createFilter(BellaDatiService service, String dataSetId, String attributeCode) {
return createFilter(new FilterAttribute(service, dataSetId, attributeCode));
} | java | public F createFilter(BellaDatiService service, String dataSetId, String attributeCode) {
return createFilter(new FilterAttribute(service, dataSetId, attributeCode));
} | [
"public",
"F",
"createFilter",
"(",
"BellaDatiService",
"service",
",",
"String",
"dataSetId",
",",
"String",
"attributeCode",
")",
"{",
"return",
"createFilter",
"(",
"new",
"FilterAttribute",
"(",
"service",
",",
"dataSetId",
",",
"attributeCode",
")",
")",
";... | Creates a filter using just an attribute code. Can be used if the code is
already known to avoid having to make an extra API call loading report
attributes.
@param service service instance to connect to the server (to allow
retrieving the attribute's values)
@param dataSetId ID of the data set the attribute is defined in
@param attributeCode code of the attribute
@return a filter for the given attribute with this operation | [
"Creates",
"a",
"filter",
"using",
"just",
"an",
"attribute",
"code",
".",
"Can",
"be",
"used",
"if",
"the",
"code",
"is",
"already",
"known",
"to",
"avoid",
"having",
"to",
"make",
"an",
"extra",
"API",
"call",
"loading",
"report",
"attributes",
"."
] | train | https://github.com/BellaDati/belladati-sdk-api/blob/ec45a42048d8255838ad0200aa6784a8e8a121c1/src/main/java/com/belladati/sdk/filter/FilterOperation.java#L71-L73 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java | Annotate.annotateLater | public void annotateLater(List<JCAnnotation> annotations, Env<AttrContext> localEnv,
Symbol s, DiagnosticPosition deferPos)
{
if (annotations.isEmpty()) {
return;
}
s.resetAnnotations(); // mark Annotations as incomplete for now
normal(() -> {
// Packages are unusual, in that they are the only type of declaration that can legally appear
// more than once in a compilation, and in all cases refer to the same underlying symbol.
// This means they are the only kind of declaration that syntactically may have multiple sets
// of annotations, each on a different package declaration, even though that is ultimately
// forbidden by JLS 8 section 7.4.
// The corollary here is that all of the annotations on a package symbol may have already
// been handled, meaning that the set of annotations pending completion is now empty.
Assert.check(s.kind == PCK || s.annotationsPendingCompletion());
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
DiagnosticPosition prevLintPos =
deferPos != null
? deferredLintHandler.setPos(deferPos)
: deferredLintHandler.immediate();
Lint prevLint = deferPos != null ? null : chk.setLint(lint);
try {
if (s.hasAnnotations() && annotations.nonEmpty())
log.error(annotations.head.pos, "already.annotated", Kinds.kindName(s), s);
Assert.checkNonNull(s, "Symbol argument to actualEnterAnnotations is null");
// false is passed as fifth parameter since annotateLater is
// never called for a type parameter
annotateNow(s, annotations, localEnv, false, false);
} finally {
if (prevLint != null)
chk.setLint(prevLint);
deferredLintHandler.setPos(prevLintPos);
log.useSource(prev);
}
});
validate(() -> { //validate annotations
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
try {
chk.validateAnnotations(annotations, s);
} finally {
log.useSource(prev);
}
});
} | java | public void annotateLater(List<JCAnnotation> annotations, Env<AttrContext> localEnv,
Symbol s, DiagnosticPosition deferPos)
{
if (annotations.isEmpty()) {
return;
}
s.resetAnnotations(); // mark Annotations as incomplete for now
normal(() -> {
// Packages are unusual, in that they are the only type of declaration that can legally appear
// more than once in a compilation, and in all cases refer to the same underlying symbol.
// This means they are the only kind of declaration that syntactically may have multiple sets
// of annotations, each on a different package declaration, even though that is ultimately
// forbidden by JLS 8 section 7.4.
// The corollary here is that all of the annotations on a package symbol may have already
// been handled, meaning that the set of annotations pending completion is now empty.
Assert.check(s.kind == PCK || s.annotationsPendingCompletion());
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
DiagnosticPosition prevLintPos =
deferPos != null
? deferredLintHandler.setPos(deferPos)
: deferredLintHandler.immediate();
Lint prevLint = deferPos != null ? null : chk.setLint(lint);
try {
if (s.hasAnnotations() && annotations.nonEmpty())
log.error(annotations.head.pos, "already.annotated", Kinds.kindName(s), s);
Assert.checkNonNull(s, "Symbol argument to actualEnterAnnotations is null");
// false is passed as fifth parameter since annotateLater is
// never called for a type parameter
annotateNow(s, annotations, localEnv, false, false);
} finally {
if (prevLint != null)
chk.setLint(prevLint);
deferredLintHandler.setPos(prevLintPos);
log.useSource(prev);
}
});
validate(() -> { //validate annotations
JavaFileObject prev = log.useSource(localEnv.toplevel.sourcefile);
try {
chk.validateAnnotations(annotations, s);
} finally {
log.useSource(prev);
}
});
} | [
"public",
"void",
"annotateLater",
"(",
"List",
"<",
"JCAnnotation",
">",
"annotations",
",",
"Env",
"<",
"AttrContext",
">",
"localEnv",
",",
"Symbol",
"s",
",",
"DiagnosticPosition",
"deferPos",
")",
"{",
"if",
"(",
"annotations",
".",
"isEmpty",
"(",
")",... | Queue annotations for later attribution and entering. This is probably the method you are looking for.
@param annotations the list of JCAnnotations to attribute and enter
@param localEnv the enclosing env
@param s ths Symbol on which to enter the annotations
@param deferPos report errors here | [
"Queue",
"annotations",
"for",
"later",
"attribution",
"and",
"entering",
".",
"This",
"is",
"probably",
"the",
"method",
"you",
"are",
"looking",
"for",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Annotate.java#L228-L277 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortablePositionNavigator.java | PortablePositionNavigator.navigateToPathTokenWithoutQuantifier | private static PortablePosition navigateToPathTokenWithoutQuantifier(
PortableNavigatorContext ctx, PortablePathCursor path) throws IOException {
if (path.isLastToken()) {
// if it's a token that's on the last position we calculate its direct access position and return it for
// reading in the value reader.
return createPositionForReadAccess(ctx, path);
} else {
// if it's not a token that's on the last position in the path we advance the position to the next token
// we also adjust the context, since advancing means that we are in the context of other
// (and possibly different) portable type.
if (!navigateContextToNextPortableTokenFromPortableField(ctx)) {
// we return null if we didn't manage to advance from the current token to the next one.
// For example: it may happen if the current token points to a null object.
return nilNotLeafPosition();
}
}
return null;
} | java | private static PortablePosition navigateToPathTokenWithoutQuantifier(
PortableNavigatorContext ctx, PortablePathCursor path) throws IOException {
if (path.isLastToken()) {
// if it's a token that's on the last position we calculate its direct access position and return it for
// reading in the value reader.
return createPositionForReadAccess(ctx, path);
} else {
// if it's not a token that's on the last position in the path we advance the position to the next token
// we also adjust the context, since advancing means that we are in the context of other
// (and possibly different) portable type.
if (!navigateContextToNextPortableTokenFromPortableField(ctx)) {
// we return null if we didn't manage to advance from the current token to the next one.
// For example: it may happen if the current token points to a null object.
return nilNotLeafPosition();
}
}
return null;
} | [
"private",
"static",
"PortablePosition",
"navigateToPathTokenWithoutQuantifier",
"(",
"PortableNavigatorContext",
"ctx",
",",
"PortablePathCursor",
"path",
")",
"throws",
"IOException",
"{",
"if",
"(",
"path",
".",
"isLastToken",
"(",
")",
")",
"{",
"// if it's a token ... | Token without quantifier. It means it's just a simple field, not an array. | [
"Token",
"without",
"quantifier",
".",
"It",
"means",
"it",
"s",
"just",
"a",
"simple",
"field",
"not",
"an",
"array",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortablePositionNavigator.java#L170-L187 |
beanshell/beanshell | src/main/java/bsh/BshClassManager.java | BshClassManager.cacheClassInfo | public void cacheClassInfo( String name, Class<?> value ) {
if ( value != null ) {
absoluteClassCache.put(name, value);
// eagerly start the member cache
memberCache.init(value);
}
else
absoluteNonClasses.add( name );
} | java | public void cacheClassInfo( String name, Class<?> value ) {
if ( value != null ) {
absoluteClassCache.put(name, value);
// eagerly start the member cache
memberCache.init(value);
}
else
absoluteNonClasses.add( name );
} | [
"public",
"void",
"cacheClassInfo",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"absoluteClassCache",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"// eagerly start the member cache... | Cache info about whether name is a class or not.
@param value
if value is non-null, cache the class
if value is null, set the flag that it is *not* a class to
speed later resolution | [
"Cache",
"info",
"about",
"whether",
"name",
"is",
"a",
"class",
"or",
"not",
"."
] | train | https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/BshClassManager.java#L498-L506 |
apache/incubator-shardingsphere | sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/ExpressionParserFactory.java | ExpressionParserFactory.createAliasExpressionParser | public static AliasExpressionParser createAliasExpressionParser(final LexerEngine lexerEngine) {
switch (lexerEngine.getDatabaseType()) {
case H2:
return new MySQLAliasExpressionParser(lexerEngine);
case MySQL:
return new MySQLAliasExpressionParser(lexerEngine);
case Oracle:
return new OracleAliasExpressionParser(lexerEngine);
case SQLServer:
return new SQLServerAliasExpressionParser(lexerEngine);
case PostgreSQL:
return new PostgreSQLAliasExpressionParser(lexerEngine);
default:
throw new UnsupportedOperationException(String.format("Cannot support database type: %s", lexerEngine.getDatabaseType()));
}
} | java | public static AliasExpressionParser createAliasExpressionParser(final LexerEngine lexerEngine) {
switch (lexerEngine.getDatabaseType()) {
case H2:
return new MySQLAliasExpressionParser(lexerEngine);
case MySQL:
return new MySQLAliasExpressionParser(lexerEngine);
case Oracle:
return new OracleAliasExpressionParser(lexerEngine);
case SQLServer:
return new SQLServerAliasExpressionParser(lexerEngine);
case PostgreSQL:
return new PostgreSQLAliasExpressionParser(lexerEngine);
default:
throw new UnsupportedOperationException(String.format("Cannot support database type: %s", lexerEngine.getDatabaseType()));
}
} | [
"public",
"static",
"AliasExpressionParser",
"createAliasExpressionParser",
"(",
"final",
"LexerEngine",
"lexerEngine",
")",
"{",
"switch",
"(",
"lexerEngine",
".",
"getDatabaseType",
"(",
")",
")",
"{",
"case",
"H2",
":",
"return",
"new",
"MySQLAliasExpressionParser"... | Create alias parser instance.
@param lexerEngine lexical analysis engine.
@return alias parser instance | [
"Create",
"alias",
"parser",
"instance",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/dialect/ExpressionParserFactory.java#L44-L59 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/PippoSettings.java | PippoSettings.overrideSetting | public void overrideSetting(String name, float value) {
overrides.put(name, Float.toString(value));
} | java | public void overrideSetting(String name, float value) {
overrides.put(name, Float.toString(value));
} | [
"public",
"void",
"overrideSetting",
"(",
"String",
"name",
",",
"float",
"value",
")",
"{",
"overrides",
".",
"put",
"(",
"name",
",",
"Float",
".",
"toString",
"(",
"value",
")",
")",
";",
"}"
] | Override the setting at runtime with the specified value.
This change does not persist.
@param name
@param value | [
"Override",
"the",
"setting",
"at",
"runtime",
"with",
"the",
"specified",
"value",
".",
"This",
"change",
"does",
"not",
"persist",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L1067-L1069 |
aws/aws-sdk-java | aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/StartBulkDeploymentRequest.java | StartBulkDeploymentRequest.withTags | public StartBulkDeploymentRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public StartBulkDeploymentRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"StartBulkDeploymentRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | Tag(s) to add to the new resource
@param tags
Tag(s) to add to the new resource
@return Returns a reference to this object so that method calls can be chained together. | [
"Tag",
"(",
"s",
")",
"to",
"add",
"to",
"the",
"new",
"resource"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/StartBulkDeploymentRequest.java#L207-L210 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java | FourierTransform.transformBluestein | private static void transformBluestein(double[] real, double[] imag) {
int n = real.length;
int m = Integer.highestOneBit(n * 2 + 1) << 1;
// Trignometric tables
double[] cosTable = new double[n];
double[] sinTable = new double[n];
for (int i = 0; i < n; i++) {
int j = (int) ((long) i * i % (n * 2)); // This is more accurate than j = i * i
cosTable[i] = Math.cos(Math.PI * j / n);
sinTable[i] = Math.sin(Math.PI * j / n);
}
// Temporary vectors and preprocessing
double[] areal = new double[m];
double[] aimag = new double[m];
for (int i = 0; i < n; i++) {
areal[i] = real[i] * cosTable[i] + imag[i] * sinTable[i];
aimag[i] = -real[i] * sinTable[i] + imag[i] * cosTable[i];
}
double[] breal = new double[m];
double[] bimag = new double[m];
breal[0] = cosTable[0];
bimag[0] = sinTable[0];
for (int i = 1; i < n; i++) {
breal[i] = breal[m - i] = cosTable[i];
bimag[i] = bimag[m - i] = sinTable[i];
}
// Convolution
double[] creal = new double[m];
double[] cimag = new double[m];
convolve(areal, aimag, breal, bimag, creal, cimag);
// Postprocessing
for (int i = 0; i < n; i++) {
real[i] = creal[i] * cosTable[i] + cimag[i] * sinTable[i];
imag[i] = -creal[i] * sinTable[i] + cimag[i] * cosTable[i];
}
} | java | private static void transformBluestein(double[] real, double[] imag) {
int n = real.length;
int m = Integer.highestOneBit(n * 2 + 1) << 1;
// Trignometric tables
double[] cosTable = new double[n];
double[] sinTable = new double[n];
for (int i = 0; i < n; i++) {
int j = (int) ((long) i * i % (n * 2)); // This is more accurate than j = i * i
cosTable[i] = Math.cos(Math.PI * j / n);
sinTable[i] = Math.sin(Math.PI * j / n);
}
// Temporary vectors and preprocessing
double[] areal = new double[m];
double[] aimag = new double[m];
for (int i = 0; i < n; i++) {
areal[i] = real[i] * cosTable[i] + imag[i] * sinTable[i];
aimag[i] = -real[i] * sinTable[i] + imag[i] * cosTable[i];
}
double[] breal = new double[m];
double[] bimag = new double[m];
breal[0] = cosTable[0];
bimag[0] = sinTable[0];
for (int i = 1; i < n; i++) {
breal[i] = breal[m - i] = cosTable[i];
bimag[i] = bimag[m - i] = sinTable[i];
}
// Convolution
double[] creal = new double[m];
double[] cimag = new double[m];
convolve(areal, aimag, breal, bimag, creal, cimag);
// Postprocessing
for (int i = 0; i < n; i++) {
real[i] = creal[i] * cosTable[i] + cimag[i] * sinTable[i];
imag[i] = -creal[i] * sinTable[i] + cimag[i] * cosTable[i];
}
} | [
"private",
"static",
"void",
"transformBluestein",
"(",
"double",
"[",
"]",
"real",
",",
"double",
"[",
"]",
"imag",
")",
"{",
"int",
"n",
"=",
"real",
".",
"length",
";",
"int",
"m",
"=",
"Integer",
".",
"highestOneBit",
"(",
"n",
"*",
"2",
"+",
"... | /*
Computes the discrete Fourier transform (DFT) of the given complex vector, storing the result back into the vector.
The vector can have any length. This requires the convolution function, which in turn requires the radix-2 FFT function.
Uses Bluestein's chirp z-transform algorithm. | [
"/",
"*",
"Computes",
"the",
"discrete",
"Fourier",
"transform",
"(",
"DFT",
")",
"of",
"the",
"given",
"complex",
"vector",
"storing",
"the",
"result",
"back",
"into",
"the",
"vector",
".",
"The",
"vector",
"can",
"have",
"any",
"length",
".",
"This",
"... | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java#L303-L342 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchManager.java | CmsSearchManager.rebuildIndexes | public void rebuildIndexes(List<String> indexNames, I_CmsReport report) throws CmsException {
try {
SEARCH_MANAGER_LOCK.lock();
Iterator<String> i = indexNames.iterator();
while (i.hasNext()) {
String indexName = i.next();
// get the search index by name
I_CmsSearchIndex index = getIndex(indexName);
if (index != null) {
// update the index
updateIndex(index, report, null);
} else {
if (LOG.isWarnEnabled()) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_NO_INDEX_WITH_NAME_1, indexName));
}
}
}
// clean up the extraction result cache
cleanExtractionCache();
} finally {
SEARCH_MANAGER_LOCK.unlock();
}
} | java | public void rebuildIndexes(List<String> indexNames, I_CmsReport report) throws CmsException {
try {
SEARCH_MANAGER_LOCK.lock();
Iterator<String> i = indexNames.iterator();
while (i.hasNext()) {
String indexName = i.next();
// get the search index by name
I_CmsSearchIndex index = getIndex(indexName);
if (index != null) {
// update the index
updateIndex(index, report, null);
} else {
if (LOG.isWarnEnabled()) {
LOG.warn(Messages.get().getBundle().key(Messages.LOG_NO_INDEX_WITH_NAME_1, indexName));
}
}
}
// clean up the extraction result cache
cleanExtractionCache();
} finally {
SEARCH_MANAGER_LOCK.unlock();
}
} | [
"public",
"void",
"rebuildIndexes",
"(",
"List",
"<",
"String",
">",
"indexNames",
",",
"I_CmsReport",
"report",
")",
"throws",
"CmsException",
"{",
"try",
"{",
"SEARCH_MANAGER_LOCK",
".",
"lock",
"(",
")",
";",
"Iterator",
"<",
"String",
">",
"i",
"=",
"i... | Rebuilds (if required creates) the List of indexes with the given name.<p>
@param indexNames the names (String) of the index to rebuild
@param report the report object to write messages (or <code>null</code>)
@throws CmsException if something goes wrong | [
"Rebuilds",
"(",
"if",
"required",
"creates",
")",
"the",
"List",
"of",
"indexes",
"with",
"the",
"given",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchManager.java#L1731-L1754 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java | UCharacter.toTitleFirst | @Deprecated
public static String toTitleFirst(ULocale locale, String str) {
int c = 0;
for (int i = 0; i < str.length(); i += UCharacter.charCount(c)) {
c = UCharacter.codePointAt(str, i);
int propertyMask = UCharacter.getIntPropertyValue(c, UProperty.GENERAL_CATEGORY_MASK);
if ((propertyMask & BREAK_MASK) != 0) { // handle "49ers", initial CJK
break;
}
if (UCaseProps.INSTANCE.getType(c) == UCaseProps.NONE) {
continue;
}
// we now have the first cased character
// What we really want is something like:
// String titled = UCharacter.toTitleCase(locale, str, i, outputCharsTaken);
// That is, just give us the titlecased string, for the locale, at i and following,
// and tell us how many characters are replaced.
// The following won't work completely: it needs some more substantial changes to UCaseProps
String substring = str.substring(i, i+UCharacter.charCount(c));
String titled = UCharacter.toTitleCase(locale, substring, BreakIterator.getSentenceInstance(locale), 0);
// skip if no change
if (titled.codePointAt(0) == c) {
// Using 0 is safe, since any change in titling will not have first initial character
break;
}
StringBuilder result = new StringBuilder(str.length()).append(str, 0, i);
int startOfSuffix;
// handle dutch, but check first for 'i', since that's faster. Should be built into UCaseProps.
if (c == 'i' && locale.getLanguage().equals("nl") && i < str.length() && str.charAt(i+1) == 'j') {
result.append("IJ");
startOfSuffix = 2;
} else {
result.append(titled);
startOfSuffix = i + UCharacter.charCount(c);
}
// add the remainder, and return
return result.append(str, startOfSuffix, str.length()).toString();
}
return str; // no change
} | java | @Deprecated
public static String toTitleFirst(ULocale locale, String str) {
int c = 0;
for (int i = 0; i < str.length(); i += UCharacter.charCount(c)) {
c = UCharacter.codePointAt(str, i);
int propertyMask = UCharacter.getIntPropertyValue(c, UProperty.GENERAL_CATEGORY_MASK);
if ((propertyMask & BREAK_MASK) != 0) { // handle "49ers", initial CJK
break;
}
if (UCaseProps.INSTANCE.getType(c) == UCaseProps.NONE) {
continue;
}
// we now have the first cased character
// What we really want is something like:
// String titled = UCharacter.toTitleCase(locale, str, i, outputCharsTaken);
// That is, just give us the titlecased string, for the locale, at i and following,
// and tell us how many characters are replaced.
// The following won't work completely: it needs some more substantial changes to UCaseProps
String substring = str.substring(i, i+UCharacter.charCount(c));
String titled = UCharacter.toTitleCase(locale, substring, BreakIterator.getSentenceInstance(locale), 0);
// skip if no change
if (titled.codePointAt(0) == c) {
// Using 0 is safe, since any change in titling will not have first initial character
break;
}
StringBuilder result = new StringBuilder(str.length()).append(str, 0, i);
int startOfSuffix;
// handle dutch, but check first for 'i', since that's faster. Should be built into UCaseProps.
if (c == 'i' && locale.getLanguage().equals("nl") && i < str.length() && str.charAt(i+1) == 'j') {
result.append("IJ");
startOfSuffix = 2;
} else {
result.append(titled);
startOfSuffix = i + UCharacter.charCount(c);
}
// add the remainder, and return
return result.append(str, startOfSuffix, str.length()).toString();
}
return str; // no change
} | [
"@",
"Deprecated",
"public",
"static",
"String",
"toTitleFirst",
"(",
"ULocale",
"locale",
",",
"String",
"str",
")",
"{",
"int",
"c",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
"(",
")",
";",
"i",
"+=",... | Return a string with just the first word titlecased, for menus and UI, etc. This does not affect most of the string,
and sometimes has no effect at all; the original string is returned whenever casing
would not be appropriate for the first word (such as for CJK characters or initial numbers).
Initial non-letters are skipped in order to find the character to change.
Characters past the first affected are left untouched: see also TITLECASE_NO_LOWERCASE.
<p>Examples:
<table border='1'><tr><th>Source</th><th>Result</th><th>Locale</th></tr>
<tr><td>anglo-American locale</td><td>Anglo-American locale</td></tr>
<tr><td>“contact us”</td><td>“Contact us”</td></tr>
<tr><td>49ers win!</td><td>49ers win!</td></tr>
<tr><td>丰(abc)</td><td>丰(abc)</td></tr>
<tr><td>«ijs»</td><td>«Ijs»</td></tr>
<tr><td>«ijs»</td><td>«IJs»</td><td>nl-BE</td></tr>
<tr><td>«ijs»</td><td>«İjs»</td><td>tr-DE</td></tr>
</table>
@param locale the locale for accessing exceptional behavior (eg for tr).
@param str the source string to change
@return the modified string, or the original if no modifications were necessary.
@deprecated ICU internal only
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Return",
"a",
"string",
"with",
"just",
"the",
"first",
"word",
"titlecased",
"for",
"menus",
"and",
"UI",
"etc",
".",
"This",
"does",
"not",
"affect",
"most",
"of",
"the",
"string",
"and",
"sometimes",
"has",
"no",
"effect",
"at",
"all",
";",
"the",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L4557-L4602 |
h2oai/h2o-2 | h2o-samples/src/main/java/samples/launchers/CloudRemote.java | CloudRemote.launchIPs | public static void launchIPs(Class<? extends Job> job, String... ips) throws Exception {
Cloud cloud = new Cloud();
cloud.publicIPs.addAll(Arrays.asList(ips));
launch(cloud, job);
} | java | public static void launchIPs(Class<? extends Job> job, String... ips) throws Exception {
Cloud cloud = new Cloud();
cloud.publicIPs.addAll(Arrays.asList(ips));
launch(cloud, job);
} | [
"public",
"static",
"void",
"launchIPs",
"(",
"Class",
"<",
"?",
"extends",
"Job",
">",
"job",
",",
"String",
"...",
"ips",
")",
"throws",
"Exception",
"{",
"Cloud",
"cloud",
"=",
"new",
"Cloud",
"(",
")",
";",
"cloud",
".",
"publicIPs",
".",
"addAll",... | The current user is assumed to have ssh access (key-pair, no password) to the remote machines.
H2O will be deployed to '~/h2o_rsync/'. | [
"The",
"current",
"user",
"is",
"assumed",
"to",
"have",
"ssh",
"access",
"(",
"key",
"-",
"pair",
"no",
"password",
")",
"to",
"the",
"remote",
"machines",
".",
"H2O",
"will",
"be",
"deployed",
"to",
"~",
"/",
"h2o_rsync",
"/",
"."
] | train | https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/h2o-samples/src/main/java/samples/launchers/CloudRemote.java#L36-L40 |
cdapio/tigon | tigon-yarn/src/main/java/co/cask/tigon/internal/io/FieldAccessorGenerator.java | FieldAccessorGenerator.primitiveGetter | private void primitiveGetter(Field field) {
String typeName = field.getType().getName();
String methodName = String.format("get%c%s", Character.toUpperCase(typeName.charAt(0)), typeName.substring(1));
GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, getMethod(field.getType(), methodName, Object.class),
null, new Type[0], classWriter);
if (isPrivate) {
// get the value using the generic Object get(Object) method and unbox the value
mg.loadThis();
mg.loadArg(0);
mg.invokeVirtual(Type.getObjectType(className), getMethod(Object.class, "get", Object.class));
mg.unbox(Type.getType(field.getType()));
} else {
// Simply access the field.
mg.loadArg(0);
mg.checkCast(Type.getType(field.getDeclaringClass()));
mg.getField(Type.getType(field.getDeclaringClass()), field.getName(), Type.getType(field.getType()));
}
mg.returnValue();
mg.endMethod();
} | java | private void primitiveGetter(Field field) {
String typeName = field.getType().getName();
String methodName = String.format("get%c%s", Character.toUpperCase(typeName.charAt(0)), typeName.substring(1));
GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, getMethod(field.getType(), methodName, Object.class),
null, new Type[0], classWriter);
if (isPrivate) {
// get the value using the generic Object get(Object) method and unbox the value
mg.loadThis();
mg.loadArg(0);
mg.invokeVirtual(Type.getObjectType(className), getMethod(Object.class, "get", Object.class));
mg.unbox(Type.getType(field.getType()));
} else {
// Simply access the field.
mg.loadArg(0);
mg.checkCast(Type.getType(field.getDeclaringClass()));
mg.getField(Type.getType(field.getDeclaringClass()), field.getName(), Type.getType(field.getType()));
}
mg.returnValue();
mg.endMethod();
} | [
"private",
"void",
"primitiveGetter",
"(",
"Field",
"field",
")",
"{",
"String",
"typeName",
"=",
"field",
".",
"getType",
"(",
")",
".",
"getName",
"(",
")",
";",
"String",
"methodName",
"=",
"String",
".",
"format",
"(",
"\"get%c%s\"",
",",
"Character",
... | Generates the primitive getter (getXXX) based on the field type.
@param field The reflection field object. | [
"Generates",
"the",
"primitive",
"getter",
"(",
"getXXX",
")",
"based",
"on",
"the",
"field",
"type",
"."
] | train | https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-yarn/src/main/java/co/cask/tigon/internal/io/FieldAccessorGenerator.java#L271-L291 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.startPullSession | public StartPullSessionResponse startPullSession(StartPullSessionRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION,
request.getSessionId());
internalRequest.addParameter(PULL, null);
return invokeHttpClient(internalRequest, StartPullSessionResponse.class);
} | java | public StartPullSessionResponse startPullSession(StartPullSessionRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getSessionId(), "The parameter sessionId should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, LIVE_SESSION,
request.getSessionId());
internalRequest.addParameter(PULL, null);
return invokeHttpClient(internalRequest, StartPullSessionResponse.class);
} | [
"public",
"StartPullSessionResponse",
"startPullSession",
"(",
"StartPullSessionRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getSessionId",
"(",
")... | Start your pulling live session by live session id.
@param request The request object containing all parameters for starting pulling live session.
@return the response | [
"Start",
"your",
"pulling",
"live",
"session",
"by",
"live",
"session",
"id",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1031-L1038 |
steveohara/j2mod | src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java | AbstractModbusMaster.maskWriteRegister | public boolean maskWriteRegister(int ref, int andMask, int orMask) throws ModbusException {
return maskWriteRegister(DEFAULT_UNIT_ID, ref, andMask, orMask);
} | java | public boolean maskWriteRegister(int ref, int andMask, int orMask) throws ModbusException {
return maskWriteRegister(DEFAULT_UNIT_ID, ref, andMask, orMask);
} | [
"public",
"boolean",
"maskWriteRegister",
"(",
"int",
"ref",
",",
"int",
"andMask",
",",
"int",
"orMask",
")",
"throws",
"ModbusException",
"{",
"return",
"maskWriteRegister",
"(",
"DEFAULT_UNIT_ID",
",",
"ref",
",",
"andMask",
",",
"orMask",
")",
";",
"}"
] | Mask write a single register to the slave.
@param ref the offset of the register to start writing to.
@param andMask AND mask.
@param orMask OR mask.
@return true if success, i.e. response data equals to request data, false otherwise.
@throws ModbusException if an I/O error, a slave exception or
a transaction error occurs. | [
"Mask",
"write",
"a",
"single",
"register",
"to",
"the",
"slave",
"."
] | train | https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/facade/AbstractModbusMaster.java#L473-L475 |
bbottema/simple-java-mail | modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java | MimeMessageHelper.configureForwarding | static void configureForwarding(@Nonnull final Email email, @Nonnull final MimeMultipart multipartRootMixed) throws MessagingException {
if (email.getEmailToForward() != null) {
final BodyPart fordwardedMessage = new MimeBodyPart();
fordwardedMessage.setContent(email.getEmailToForward(), "message/rfc822");
multipartRootMixed.addBodyPart(fordwardedMessage);
}
} | java | static void configureForwarding(@Nonnull final Email email, @Nonnull final MimeMultipart multipartRootMixed) throws MessagingException {
if (email.getEmailToForward() != null) {
final BodyPart fordwardedMessage = new MimeBodyPart();
fordwardedMessage.setContent(email.getEmailToForward(), "message/rfc822");
multipartRootMixed.addBodyPart(fordwardedMessage);
}
} | [
"static",
"void",
"configureForwarding",
"(",
"@",
"Nonnull",
"final",
"Email",
"email",
",",
"@",
"Nonnull",
"final",
"MimeMultipart",
"multipartRootMixed",
")",
"throws",
"MessagingException",
"{",
"if",
"(",
"email",
".",
"getEmailToForward",
"(",
")",
"!=",
... | If provided, adds the {@code emailToForward} as a MimeBodyPart to the mixed multipart root.
<p>
<strong>Note:</strong> this is done without setting {@code Content-Disposition} so email clients can choose
how to display embedded forwards. Most client will show the forward as inline, some may show it as attachment. | [
"If",
"provided",
"adds",
"the",
"{"
] | train | https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java#L143-L149 |
alkacon/opencms-core | src/org/opencms/security/CmsPrincipal.java | CmsPrincipal.getDisplayName | public String getDisplayName(CmsObject cms, Locale locale) throws CmsException {
return Messages.get().getBundle(locale).key(
Messages.GUI_PRINCIPAL_DISPLAY_NAME_2,
getSimpleName(),
OpenCms.getOrgUnitManager().readOrganizationalUnit(cms, getOuFqn()).getDisplayName(locale));
} | java | public String getDisplayName(CmsObject cms, Locale locale) throws CmsException {
return Messages.get().getBundle(locale).key(
Messages.GUI_PRINCIPAL_DISPLAY_NAME_2,
getSimpleName(),
OpenCms.getOrgUnitManager().readOrganizationalUnit(cms, getOuFqn()).getDisplayName(locale));
} | [
"public",
"String",
"getDisplayName",
"(",
"CmsObject",
"cms",
",",
"Locale",
"locale",
")",
"throws",
"CmsException",
"{",
"return",
"Messages",
".",
"get",
"(",
")",
".",
"getBundle",
"(",
"locale",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_PRINCIPAL_DIS... | Returns the display name of this principal including the organizational unit.<p>
@param cms the cms context
@param locale the locale
@return the display name of this principal including the organizational unit
@throws CmsException if the organizational unit could not be read | [
"Returns",
"the",
"display",
"name",
"of",
"this",
"principal",
"including",
"the",
"organizational",
"unit",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsPrincipal.java#L408-L414 |
adorsys/hbci4java-adorsys | src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java | AbstractHBCIJob.saveBasicValues | private void saveBasicValues(HashMap<String, String> result, int ref) {
// wenn noch keine basic-daten gespeichert sind
if (jobResult.getDialogId() == null) {
// Pfad des originalen MsgHead-Segmentes holen und um "orig_" ergaenzen,
// um den Key fuer die entsprechenden Daten in das result-Property zu erhalten
String msgheadName = "orig_" + result.get("1");
jobResult.storeResult("basic.dialogid", result.get(msgheadName + ".dialogid"));
jobResult.storeResult("basic.msgnum", result.get(msgheadName + ".msgnum"));
jobResult.storeResult("basic.segnum", Integer.toString(ref));
log.debug("basic values for " + getName() + " set to "
+ jobResult.getDialogId() + "/"
+ jobResult.getMsgNum()
+ "/" + jobResult.getSegNum());
}
} | java | private void saveBasicValues(HashMap<String, String> result, int ref) {
// wenn noch keine basic-daten gespeichert sind
if (jobResult.getDialogId() == null) {
// Pfad des originalen MsgHead-Segmentes holen und um "orig_" ergaenzen,
// um den Key fuer die entsprechenden Daten in das result-Property zu erhalten
String msgheadName = "orig_" + result.get("1");
jobResult.storeResult("basic.dialogid", result.get(msgheadName + ".dialogid"));
jobResult.storeResult("basic.msgnum", result.get(msgheadName + ".msgnum"));
jobResult.storeResult("basic.segnum", Integer.toString(ref));
log.debug("basic values for " + getName() + " set to "
+ jobResult.getDialogId() + "/"
+ jobResult.getMsgNum()
+ "/" + jobResult.getSegNum());
}
} | [
"private",
"void",
"saveBasicValues",
"(",
"HashMap",
"<",
"String",
",",
"String",
">",
"result",
",",
"int",
"ref",
")",
"{",
"// wenn noch keine basic-daten gespeichert sind",
"if",
"(",
"jobResult",
".",
"getDialogId",
"(",
")",
"==",
"null",
")",
"{",
"//... | /* wenn wenigstens ein HBCI-Rückgabewert für den aktuellen GV gefunden wurde,
so werden im outStore zusätzlich die entsprechenden Dialog-Parameter
gespeichert (Property @c basic.*) | [
"/",
"*",
"wenn",
"wenigstens",
"ein",
"HBCI",
"-",
"Rückgabewert",
"für",
"den",
"aktuellen",
"GV",
"gefunden",
"wurde",
"so",
"werden",
"im",
"outStore",
"zusätzlich",
"die",
"entsprechenden",
"Dialog",
"-",
"Parameter",
"gespeichert",
"(",
"Property"
] | train | https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/GV/AbstractHBCIJob.java#L750-L766 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/util/Interval.java | Interval.toValidInterval | public static <E extends Comparable<E>> Interval<E> toValidInterval(E a, E b) {
return toValidInterval(a,b,0);
} | java | public static <E extends Comparable<E>> Interval<E> toValidInterval(E a, E b) {
return toValidInterval(a,b,0);
} | [
"public",
"static",
"<",
"E",
"extends",
"Comparable",
"<",
"E",
">",
">",
"Interval",
"<",
"E",
">",
"toValidInterval",
"(",
"E",
"a",
",",
"E",
"b",
")",
"{",
"return",
"toValidInterval",
"(",
"a",
",",
"b",
",",
"0",
")",
";",
"}"
] | Create an interval with the specified endpoints, reordering them as needed
@param a one of the endpoints
@param b the other endpoint
@param <E> type of the interval endpoints
@return Interval with endpoints re-ordered as needed | [
"Create",
"an",
"interval",
"with",
"the",
"specified",
"endpoints",
"reordering",
"them",
"as",
"needed"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Interval.java#L369-L371 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/painter/CirclePainter.java | CirclePainter.deleteShape | public void deleteShape(Paintable paintable, Object group, MapContext context) {
Circle circle = (Circle) paintable;
context.getVectorContext().deleteElement(group, circle.getId());
} | java | public void deleteShape(Paintable paintable, Object group, MapContext context) {
Circle circle = (Circle) paintable;
context.getVectorContext().deleteElement(group, circle.getId());
} | [
"public",
"void",
"deleteShape",
"(",
"Paintable",
"paintable",
",",
"Object",
"group",
",",
"MapContext",
"context",
")",
"{",
"Circle",
"circle",
"=",
"(",
"Circle",
")",
"paintable",
";",
"context",
".",
"getVectorContext",
"(",
")",
".",
"deleteElement",
... | Delete a {@link Paintable} object from the given {@link MapContext}. It the object does not exist,
nothing will be done.
@param paintable
The object to be painted.
@param group
The group where the object resides in (optional).
@param context
The context to paint on. | [
"Delete",
"a",
"{",
"@link",
"Paintable",
"}",
"object",
"from",
"the",
"given",
"{",
"@link",
"MapContext",
"}",
".",
"It",
"the",
"object",
"does",
"not",
"exist",
"nothing",
"will",
"be",
"done",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/painter/CirclePainter.java#L65-L68 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java | RouteTablesInner.updateTags | public RouteTableInner updateTags(String resourceGroupName, String routeTableName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, routeTableName, tags).toBlocking().last().body();
} | java | public RouteTableInner updateTags(String resourceGroupName, String routeTableName, Map<String, String> tags) {
return updateTagsWithServiceResponseAsync(resourceGroupName, routeTableName, tags).toBlocking().last().body();
} | [
"public",
"RouteTableInner",
"updateTags",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeTableName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"return",
"updateTagsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"routeTableN... | Updates a route table tags.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@param tags Resource tags.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RouteTableInner object if successful. | [
"Updates",
"a",
"route",
"table",
"tags",
"."
] | 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/RouteTablesInner.java#L681-L683 |
venmo/cursor-utils | cursor-utils/src/main/java/com/venmo/cursor/IterableCursorWrapper.java | IterableCursorWrapper.getDouble | public double getDouble(String columnName, double defaultValue) {
int index = getColumnIndex(columnName);
if (isValidIndex(index)) {
return getDouble(index);
} else {
return defaultValue;
}
} | java | public double getDouble(String columnName, double defaultValue) {
int index = getColumnIndex(columnName);
if (isValidIndex(index)) {
return getDouble(index);
} else {
return defaultValue;
}
} | [
"public",
"double",
"getDouble",
"(",
"String",
"columnName",
",",
"double",
"defaultValue",
")",
"{",
"int",
"index",
"=",
"getColumnIndex",
"(",
"columnName",
")",
";",
"if",
"(",
"isValidIndex",
"(",
"index",
")",
")",
"{",
"return",
"getDouble",
"(",
"... | Convenience alias to {@code getDouble\(getColumnIndex(columnName))}. If the column does not
exist for the cursor, return {@code defaultValue}. | [
"Convenience",
"alias",
"to",
"{"
] | train | https://github.com/venmo/cursor-utils/blob/52cf91c4253346632fe70b8d7b7eab8bbcc9b248/cursor-utils/src/main/java/com/venmo/cursor/IterableCursorWrapper.java#L130-L137 |
alipay/sofa-rpc | extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java | BoltServerProcessor.cannotFoundServiceMethod | private SofaRpcException cannotFoundServiceMethod(String appName, String serviceName, String methodName) {
String errorMsg = LogCodes.getLog(
LogCodes.ERROR_PROVIDER_SERVICE_METHOD_CANNOT_FOUND, serviceName, methodName);
LOGGER.errorWithApp(appName, errorMsg);
return new SofaRpcException(RpcErrorType.SERVER_NOT_FOUND_INVOKER, errorMsg);
} | java | private SofaRpcException cannotFoundServiceMethod(String appName, String serviceName, String methodName) {
String errorMsg = LogCodes.getLog(
LogCodes.ERROR_PROVIDER_SERVICE_METHOD_CANNOT_FOUND, serviceName, methodName);
LOGGER.errorWithApp(appName, errorMsg);
return new SofaRpcException(RpcErrorType.SERVER_NOT_FOUND_INVOKER, errorMsg);
} | [
"private",
"SofaRpcException",
"cannotFoundServiceMethod",
"(",
"String",
"appName",
",",
"String",
"serviceName",
",",
"String",
"methodName",
")",
"{",
"String",
"errorMsg",
"=",
"LogCodes",
".",
"getLog",
"(",
"LogCodes",
".",
"ERROR_PROVIDER_SERVICE_METHOD_CANNOT_FO... | 找不到服务方法
@param appName 应用
@param serviceName 服务
@param methodName 方法名
@return 找不到服务方法的异常 | [
"找不到服务方法"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-bolt/src/main/java/com/alipay/sofa/rpc/server/bolt/BoltServerProcessor.java#L262-L267 |
structr/structr | structr-neo4j-bolt-driver/src/main/java/org/structr/bolt/wrapper/NodeWrapper.java | NodeWrapper.evaluateCustomQuery | public boolean evaluateCustomQuery(final String customQuery, final Map<String, Object> parameters) {
final SessionTransaction tx = db.getCurrentTransaction();
boolean result = false;
try {
result = tx.getBoolean(customQuery, parameters);
} catch (Exception ignore) {}
return result;
} | java | public boolean evaluateCustomQuery(final String customQuery, final Map<String, Object> parameters) {
final SessionTransaction tx = db.getCurrentTransaction();
boolean result = false;
try {
result = tx.getBoolean(customQuery, parameters);
} catch (Exception ignore) {}
return result;
} | [
"public",
"boolean",
"evaluateCustomQuery",
"(",
"final",
"String",
"customQuery",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"{",
"final",
"SessionTransaction",
"tx",
"=",
"db",
".",
"getCurrentTransaction",
"(",
")",
";",
"boo... | Evaluate a custom query and return result as a boolean value
@param customQuery
@param parameters
@return | [
"Evaluate",
"a",
"custom",
"query",
"and",
"return",
"result",
"as",
"a",
"boolean",
"value"
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-neo4j-bolt-driver/src/main/java/org/structr/bolt/wrapper/NodeWrapper.java#L292-L303 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/Policy.java | Policy.fromJson | public static Policy fromJson(String jsonString, PolicyReaderOptions options) {
return new JsonPolicyReader(options).createPolicyFromJsonString(jsonString);
} | java | public static Policy fromJson(String jsonString, PolicyReaderOptions options) {
return new JsonPolicyReader(options).createPolicyFromJsonString(jsonString);
} | [
"public",
"static",
"Policy",
"fromJson",
"(",
"String",
"jsonString",
",",
"PolicyReaderOptions",
"options",
")",
"{",
"return",
"new",
"JsonPolicyReader",
"(",
"options",
")",
".",
"createPolicyFromJsonString",
"(",
"jsonString",
")",
";",
"}"
] | Returns an AWS access control policy object generated from JSON string. Allows configuring options for the JSON policy
reader (for example, to disable the stripping of dashes in the principal ID).
@param jsonString
The JSON string representation of this AWS access control policy.
@param options
Configuration for the JSON policy reader that affects the way in which it converts the JSON configuration.
@return An AWS access control policy object.
@throws IllegalArgumentException
If the specified JSON string is null or invalid and cannot be
converted to an AWS policy object. | [
"Returns",
"an",
"AWS",
"access",
"control",
"policy",
"object",
"generated",
"from",
"JSON",
"string",
".",
"Allows",
"configuring",
"options",
"for",
"the",
"JSON",
"policy",
"reader",
"(",
"for",
"example",
"to",
"disable",
"the",
"stripping",
"of",
"dashes... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/policy/Policy.java#L249-L251 |
alkacon/opencms-core | src-modules/org/opencms/workplace/list/CmsListDropdownAction.java | CmsListDropdownAction.addItem | public void addItem(String id, CmsMessageContainer name) {
m_ids.add(id);
m_items.addIdentifiableObject(id, name);
} | java | public void addItem(String id, CmsMessageContainer name) {
m_ids.add(id);
m_items.addIdentifiableObject(id, name);
} | [
"public",
"void",
"addItem",
"(",
"String",
"id",
",",
"CmsMessageContainer",
"name",
")",
"{",
"m_ids",
".",
"add",
"(",
"id",
")",
";",
"m_items",
".",
"addIdentifiableObject",
"(",
"id",
",",
"name",
")",
";",
"}"
] | Adds an item to be displayed in the drop-down list.<p>
@param id the id of the item
@param name the display name | [
"Adds",
"an",
"item",
"to",
"be",
"displayed",
"in",
"the",
"drop",
"-",
"down",
"list",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/list/CmsListDropdownAction.java#L79-L83 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/util/ImageHelper.java | ImageHelper.getScaledInstance | public static IIOImage getScaledInstance(IIOImage iioSource, float scale) {
if (!(iioSource.getRenderedImage() instanceof BufferedImage)) {
throw new IllegalArgumentException("RenderedImage in IIOImage must be BufferedImage");
}
if (Math.abs(scale - 1.0) < 0.001) {
return iioSource;
}
BufferedImage source = (BufferedImage) iioSource.getRenderedImage();
BufferedImage target = getScaledInstance(source, (int) (scale * source.getWidth()), (int) (scale * source.getHeight()));
return new IIOImage(target, null, null);
} | java | public static IIOImage getScaledInstance(IIOImage iioSource, float scale) {
if (!(iioSource.getRenderedImage() instanceof BufferedImage)) {
throw new IllegalArgumentException("RenderedImage in IIOImage must be BufferedImage");
}
if (Math.abs(scale - 1.0) < 0.001) {
return iioSource;
}
BufferedImage source = (BufferedImage) iioSource.getRenderedImage();
BufferedImage target = getScaledInstance(source, (int) (scale * source.getWidth()), (int) (scale * source.getHeight()));
return new IIOImage(target, null, null);
} | [
"public",
"static",
"IIOImage",
"getScaledInstance",
"(",
"IIOImage",
"iioSource",
",",
"float",
"scale",
")",
"{",
"if",
"(",
"!",
"(",
"iioSource",
".",
"getRenderedImage",
"(",
")",
"instanceof",
"BufferedImage",
")",
")",
"{",
"throw",
"new",
"IllegalArgum... | Convenience method that returns a scaled instance of the provided
{@code IIOImage}.
@param iioSource the original image to be scaled
@param scale the desired scale
@return a scaled version of the original {@code IIOImage} | [
"Convenience",
"method",
"that",
"returns",
"a",
"scaled",
"instance",
"of",
"the",
"provided",
"{",
"@code",
"IIOImage",
"}",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageHelper.java#L58-L70 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.