repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 194 | func_name stringlengths 6 111 | whole_func_string stringlengths 80 3.8k | language stringclasses 1
value | func_code_string stringlengths 80 3.8k | func_code_tokens listlengths 20 697 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 434 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.implementsZeroArgMethod | public static boolean implementsZeroArgMethod(ClassNode classNode, String methodName) {
MethodNode method = classNode.getDeclaredMethod(methodName, Parameter.EMPTY_ARRAY);
return method != null && (method.isPublic() || method.isProtected()) && !method.isAbstract();
} | java | public static boolean implementsZeroArgMethod(ClassNode classNode, String methodName) {
MethodNode method = classNode.getDeclaredMethod(methodName, Parameter.EMPTY_ARRAY);
return method != null && (method.isPublic() || method.isProtected()) && !method.isAbstract();
} | [
"public",
"static",
"boolean",
"implementsZeroArgMethod",
"(",
"ClassNode",
"classNode",
",",
"String",
"methodName",
")",
"{",
"MethodNode",
"method",
"=",
"classNode",
".",
"getDeclaredMethod",
"(",
"methodName",
",",
"Parameter",
".",
"EMPTY_ARRAY",
")",
";",
"... | Tests whether the ClasNode implements the specified method name.
@param classNode The ClassNode
@param methodName The method name
@return true if it does implement the method | [
"Tests",
"whether",
"the",
"ClasNode",
"implements",
"the",
"specified",
"method",
"name",
"."
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L163-L166 |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java | HypergraphSorter.generateAndSort | public boolean generateAndSort(final Iterator<long[]> iterator, final long seed) {
// We cache all variables for faster access
final int[] d = this.d;
final int[] e = new int[3];
cleanUpIfNecessary();
/* We build the XOR'd edge list and compute the degree of each vertex. */
for(int k = 0; k < numEdges; k++) {
tripleToEdge(iterator.next(), seed, numVertices, partSize, e);
xorEdge(k, e[0], e[1], e[2], false);
d[e[0]]++;
d[e[1]]++;
d[e[2]]++;
}
if (iterator.hasNext()) throw new IllegalStateException("This " + HypergraphSorter.class.getSimpleName() + " has " + numEdges + " edges, but the provided iterator returns more");
return sort();
} | java | public boolean generateAndSort(final Iterator<long[]> iterator, final long seed) {
// We cache all variables for faster access
final int[] d = this.d;
final int[] e = new int[3];
cleanUpIfNecessary();
/* We build the XOR'd edge list and compute the degree of each vertex. */
for(int k = 0; k < numEdges; k++) {
tripleToEdge(iterator.next(), seed, numVertices, partSize, e);
xorEdge(k, e[0], e[1], e[2], false);
d[e[0]]++;
d[e[1]]++;
d[e[2]]++;
}
if (iterator.hasNext()) throw new IllegalStateException("This " + HypergraphSorter.class.getSimpleName() + " has " + numEdges + " edges, but the provided iterator returns more");
return sort();
} | [
"public",
"boolean",
"generateAndSort",
"(",
"final",
"Iterator",
"<",
"long",
"[",
"]",
">",
"iterator",
",",
"final",
"long",
"seed",
")",
"{",
"// We cache all variables for faster access",
"final",
"int",
"[",
"]",
"d",
"=",
"this",
".",
"d",
";",
"final... | Generates a random 3-hypergraph and tries to sort its edges.
@param iterator an iterator returning {@link #numEdges} triples of longs.
@param seed a 64-bit random seed.
@return true if the sorting procedure succeeded. | [
"Generates",
"a",
"random",
"3",
"-",
"hypergraph",
"and",
"tries",
"to",
"sort",
"its",
"edges",
"."
] | train | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java#L339-L357 |
playframework/play-ws | play-ahc-ws-standalone/src/main/java/play/libs/oauth/OAuth.java | OAuth.retrieveAccessToken | public RequestToken retrieveAccessToken(RequestToken token, String verifier) {
OAuthConsumer consumer = new DefaultOAuthConsumer(info.key.key, info.key.secret);
consumer.setTokenWithSecret(token.token, token.secret);
try {
provider.retrieveAccessToken(consumer, verifier);
return new RequestToken(consumer.getToken(), consumer.getTokenSecret());
} catch (OAuthException ex) {
throw new RuntimeException(ex);
}
} | java | public RequestToken retrieveAccessToken(RequestToken token, String verifier) {
OAuthConsumer consumer = new DefaultOAuthConsumer(info.key.key, info.key.secret);
consumer.setTokenWithSecret(token.token, token.secret);
try {
provider.retrieveAccessToken(consumer, verifier);
return new RequestToken(consumer.getToken(), consumer.getTokenSecret());
} catch (OAuthException ex) {
throw new RuntimeException(ex);
}
} | [
"public",
"RequestToken",
"retrieveAccessToken",
"(",
"RequestToken",
"token",
",",
"String",
"verifier",
")",
"{",
"OAuthConsumer",
"consumer",
"=",
"new",
"DefaultOAuthConsumer",
"(",
"info",
".",
"key",
".",
"key",
",",
"info",
".",
"key",
".",
"secret",
")... | Exchange a request token for an access token.
@param token the token/secret pair obtained from a previous call
@param verifier a string you got through your user, with redirection
@return A Right(RequestToken) in case of success, Left(OAuthException) otherwise | [
"Exchange",
"a",
"request",
"token",
"for",
"an",
"access",
"token",
"."
] | train | https://github.com/playframework/play-ws/blob/fbc25196eb6295281e9b43810e45c252913fbfcf/play-ahc-ws-standalone/src/main/java/play/libs/oauth/OAuth.java#L61-L70 |
likethecolor/Alchemy-API | src/main/java/com/likethecolor/alchemy/api/parser/json/ImageParser.java | ImageParser.getImageKeyword | private JSONObject getImageKeyword(final JSONArray imageKeywords, final int index) {
JSONObject object = new JSONObject();
try {
object = (JSONObject) imageKeywords.get(index);
}
catch(JSONException e) {
e.printStackTrace();
}
return object;
} | java | private JSONObject getImageKeyword(final JSONArray imageKeywords, final int index) {
JSONObject object = new JSONObject();
try {
object = (JSONObject) imageKeywords.get(index);
}
catch(JSONException e) {
e.printStackTrace();
}
return object;
} | [
"private",
"JSONObject",
"getImageKeyword",
"(",
"final",
"JSONArray",
"imageKeywords",
",",
"final",
"int",
"index",
")",
"{",
"JSONObject",
"object",
"=",
"new",
"JSONObject",
"(",
")",
";",
"try",
"{",
"object",
"=",
"(",
"JSONObject",
")",
"imageKeywords",... | Return a json object from the provided array. Return an empty object if
there is any problems fetching the concept data.
@param imageKeywords array of image keyword data
@param index of the object to fetch
@return json object from the provided array | [
"Return",
"a",
"json",
"object",
"from",
"the",
"provided",
"array",
".",
"Return",
"an",
"empty",
"object",
"if",
"there",
"is",
"any",
"problems",
"fetching",
"the",
"concept",
"data",
"."
] | train | https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/ImageParser.java#L63-L72 |
googleapis/google-api-java-client | google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleCredential.java | GoogleCredential.fromStream | @Beta
public static GoogleCredential fromStream(InputStream credentialStream, HttpTransport transport,
JsonFactory jsonFactory) throws IOException {
Preconditions.checkNotNull(credentialStream);
Preconditions.checkNotNull(transport);
Preconditions.checkNotNull(jsonFactory);
JsonObjectParser parser = new JsonObjectParser(jsonFactory);
GenericJson fileContents = parser.parseAndClose(
credentialStream, OAuth2Utils.UTF_8, GenericJson.class);
String fileType = (String) fileContents.get("type");
if (fileType == null) {
throw new IOException("Error reading credentials from stream, 'type' field not specified.");
}
if (USER_FILE_TYPE.equals(fileType)) {
return fromStreamUser(fileContents, transport, jsonFactory);
}
if (SERVICE_ACCOUNT_FILE_TYPE.equals(fileType)) {
return fromStreamServiceAccount(fileContents, transport, jsonFactory);
}
throw new IOException(String.format(
"Error reading credentials from stream, 'type' value '%s' not recognized."
+ " Expecting '%s' or '%s'.",
fileType, USER_FILE_TYPE, SERVICE_ACCOUNT_FILE_TYPE));
} | java | @Beta
public static GoogleCredential fromStream(InputStream credentialStream, HttpTransport transport,
JsonFactory jsonFactory) throws IOException {
Preconditions.checkNotNull(credentialStream);
Preconditions.checkNotNull(transport);
Preconditions.checkNotNull(jsonFactory);
JsonObjectParser parser = new JsonObjectParser(jsonFactory);
GenericJson fileContents = parser.parseAndClose(
credentialStream, OAuth2Utils.UTF_8, GenericJson.class);
String fileType = (String) fileContents.get("type");
if (fileType == null) {
throw new IOException("Error reading credentials from stream, 'type' field not specified.");
}
if (USER_FILE_TYPE.equals(fileType)) {
return fromStreamUser(fileContents, transport, jsonFactory);
}
if (SERVICE_ACCOUNT_FILE_TYPE.equals(fileType)) {
return fromStreamServiceAccount(fileContents, transport, jsonFactory);
}
throw new IOException(String.format(
"Error reading credentials from stream, 'type' value '%s' not recognized."
+ " Expecting '%s' or '%s'.",
fileType, USER_FILE_TYPE, SERVICE_ACCOUNT_FILE_TYPE));
} | [
"@",
"Beta",
"public",
"static",
"GoogleCredential",
"fromStream",
"(",
"InputStream",
"credentialStream",
",",
"HttpTransport",
"transport",
",",
"JsonFactory",
"jsonFactory",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"credentialStre... | {@link Beta} <br/>
Return a credential defined by a Json file.
@param credentialStream the stream with the credential definition.
@param transport the transport for Http calls.
@param jsonFactory the factory for Json parsing and formatting.
@return the credential defined by the credentialStream.
@throws IOException if the credential cannot be created from the stream. | [
"{",
"@link",
"Beta",
"}",
"<br",
"/",
">",
"Return",
"a",
"credential",
"defined",
"by",
"a",
"Json",
"file",
"."
] | train | https://github.com/googleapis/google-api-java-client/blob/88decfd14fc40cae6eb6729a45c7d56a1132e450/google-api-client/src/main/java/com/google/api/client/googleapis/auth/oauth2/GoogleCredential.java#L242-L266 |
Jasig/uPortal | uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceIndividualGroupService.java | ReferenceIndividualGroupService.getEntity | @Override
public IEntity getEntity(String key, Class type) throws GroupsException {
IEntity ent = primGetEntity(key, type);
if (cacheInUse()) {
try {
IEntity cachedEnt = getEntityFromCache(ent.getEntityIdentifier().getKey());
if (cachedEnt == null) {
cacheAdd(ent);
} else {
ent = cachedEnt;
}
} catch (CachingException ce) {
throw new GroupsException(
"Problem retrieving group member " + type + "(" + key + ")", ce);
}
}
return ent;
} | java | @Override
public IEntity getEntity(String key, Class type) throws GroupsException {
IEntity ent = primGetEntity(key, type);
if (cacheInUse()) {
try {
IEntity cachedEnt = getEntityFromCache(ent.getEntityIdentifier().getKey());
if (cachedEnt == null) {
cacheAdd(ent);
} else {
ent = cachedEnt;
}
} catch (CachingException ce) {
throw new GroupsException(
"Problem retrieving group member " + type + "(" + key + ")", ce);
}
}
return ent;
} | [
"@",
"Override",
"public",
"IEntity",
"getEntity",
"(",
"String",
"key",
",",
"Class",
"type",
")",
"throws",
"GroupsException",
"{",
"IEntity",
"ent",
"=",
"primGetEntity",
"(",
"key",
",",
"type",
")",
";",
"if",
"(",
"cacheInUse",
"(",
")",
")",
"{",
... | Returns an <code>IEntity</code> representing a portal entity. This does not guarantee that
the underlying entity actually exists. | [
"Returns",
"an",
"<code",
">",
"IEntity<",
"/",
"code",
">",
"representing",
"a",
"portal",
"entity",
".",
"This",
"does",
"not",
"guarantee",
"that",
"the",
"underlying",
"entity",
"actually",
"exists",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceIndividualGroupService.java#L350-L368 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/CommonUtils.java | CommonUtils.unwrapResponseFrom | public static void unwrapResponseFrom(Protocol.Response response, Channel channel)
throws AlluxioStatusException {
Status status = ProtoUtils.fromProto(response.getStatus());
if (status != Status.OK) {
throw AlluxioStatusException.from(status.withDescription(
String.format("Channel to %s: %s", channel.remoteAddress(), response.getMessage())));
}
} | java | public static void unwrapResponseFrom(Protocol.Response response, Channel channel)
throws AlluxioStatusException {
Status status = ProtoUtils.fromProto(response.getStatus());
if (status != Status.OK) {
throw AlluxioStatusException.from(status.withDescription(
String.format("Channel to %s: %s", channel.remoteAddress(), response.getMessage())));
}
} | [
"public",
"static",
"void",
"unwrapResponseFrom",
"(",
"Protocol",
".",
"Response",
"response",
",",
"Channel",
"channel",
")",
"throws",
"AlluxioStatusException",
"{",
"Status",
"status",
"=",
"ProtoUtils",
".",
"fromProto",
"(",
"response",
".",
"getStatus",
"("... | Unwraps a {@link alluxio.proto.dataserver.Protocol.Response} associated with a channel.
@param response the response
@param channel the channel that receives this response | [
"Unwraps",
"a",
"{",
"@link",
"alluxio",
".",
"proto",
".",
"dataserver",
".",
"Protocol",
".",
"Response",
"}",
"associated",
"with",
"a",
"channel",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/CommonUtils.java#L581-L588 |
hawkular/hawkular-apm | server/elasticsearch/src/main/java/org/hawkular/apm/server/elasticsearch/ElasticsearchClient.java | ElasticsearchClient.prepareMapping | @SuppressWarnings("unchecked")
private boolean prepareMapping(String index, Map<String, Object> defaultMappings) {
boolean success = true;
for (Map.Entry<String, Object> stringObjectEntry : defaultMappings.entrySet()) {
Map<String, Object> mapping = (Map<String, Object>) stringObjectEntry.getValue();
if (mapping == null) {
throw new RuntimeException("type mapping not defined");
}
PutMappingRequestBuilder putMappingRequestBuilder = client.admin().indices().preparePutMapping()
.setIndices(index);
putMappingRequestBuilder.setType(stringObjectEntry.getKey());
putMappingRequestBuilder.setSource(mapping);
if (log.isLoggable(Level.FINE)) {
log.fine("Elasticsearch create mapping for index '"
+ index + " and type '" + stringObjectEntry.getKey() + "': " + mapping);
}
PutMappingResponse resp = putMappingRequestBuilder.execute().actionGet();
if (resp.isAcknowledged()) {
if (log.isLoggable(Level.FINE)) {
log.fine("Elasticsearch mapping for index '"
+ index + " and type '" + stringObjectEntry.getKey() + "' was acknowledged");
}
} else {
success = false;
log.warning("Elasticsearch mapping creation was not acknowledged for index '"
+ index + " and type '" + stringObjectEntry.getKey() + "'");
}
}
return success;
} | java | @SuppressWarnings("unchecked")
private boolean prepareMapping(String index, Map<String, Object> defaultMappings) {
boolean success = true;
for (Map.Entry<String, Object> stringObjectEntry : defaultMappings.entrySet()) {
Map<String, Object> mapping = (Map<String, Object>) stringObjectEntry.getValue();
if (mapping == null) {
throw new RuntimeException("type mapping not defined");
}
PutMappingRequestBuilder putMappingRequestBuilder = client.admin().indices().preparePutMapping()
.setIndices(index);
putMappingRequestBuilder.setType(stringObjectEntry.getKey());
putMappingRequestBuilder.setSource(mapping);
if (log.isLoggable(Level.FINE)) {
log.fine("Elasticsearch create mapping for index '"
+ index + " and type '" + stringObjectEntry.getKey() + "': " + mapping);
}
PutMappingResponse resp = putMappingRequestBuilder.execute().actionGet();
if (resp.isAcknowledged()) {
if (log.isLoggable(Level.FINE)) {
log.fine("Elasticsearch mapping for index '"
+ index + " and type '" + stringObjectEntry.getKey() + "' was acknowledged");
}
} else {
success = false;
log.warning("Elasticsearch mapping creation was not acknowledged for index '"
+ index + " and type '" + stringObjectEntry.getKey() + "'");
}
}
return success;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"boolean",
"prepareMapping",
"(",
"String",
"index",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"defaultMappings",
")",
"{",
"boolean",
"success",
"=",
"true",
";",
"for",
"(",
"Map",
".",
... | This method applies the supplied mapping to the index.
@param index The name of the index
@param defaultMappings The default mappings
@return true if the mapping was successful | [
"This",
"method",
"applies",
"the",
"supplied",
"mapping",
"to",
"the",
"index",
"."
] | train | https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/server/elasticsearch/src/main/java/org/hawkular/apm/server/elasticsearch/ElasticsearchClient.java#L273-L307 |
CloudSlang/cs-actions | cs-commons/src/main/java/io/cloudslang/content/utils/NumberUtilities.java | NumberUtilities.isValidDouble | public static boolean isValidDouble(@Nullable final String doubleStr, double lowerBound, double upperBound, final boolean includeLowerBound, final boolean includeUpperBound) {
if (lowerBound > upperBound) {
throw new IllegalArgumentException(ExceptionValues.INVALID_BOUNDS);
} else if (!isValidDouble(doubleStr)) {
return false;
}
final double aDouble = toDouble(doubleStr);
final boolean respectsLowerBound = includeLowerBound ? Double.compare(lowerBound, aDouble) <= 0 : lowerBound < aDouble;
final boolean respectsUpperBound = includeUpperBound ? Double.compare(aDouble, upperBound) <= 0 : aDouble < upperBound;
return respectsLowerBound && respectsUpperBound;
} | java | public static boolean isValidDouble(@Nullable final String doubleStr, double lowerBound, double upperBound, final boolean includeLowerBound, final boolean includeUpperBound) {
if (lowerBound > upperBound) {
throw new IllegalArgumentException(ExceptionValues.INVALID_BOUNDS);
} else if (!isValidDouble(doubleStr)) {
return false;
}
final double aDouble = toDouble(doubleStr);
final boolean respectsLowerBound = includeLowerBound ? Double.compare(lowerBound, aDouble) <= 0 : lowerBound < aDouble;
final boolean respectsUpperBound = includeUpperBound ? Double.compare(aDouble, upperBound) <= 0 : aDouble < upperBound;
return respectsLowerBound && respectsUpperBound;
} | [
"public",
"static",
"boolean",
"isValidDouble",
"(",
"@",
"Nullable",
"final",
"String",
"doubleStr",
",",
"double",
"lowerBound",
",",
"double",
"upperBound",
",",
"final",
"boolean",
"includeLowerBound",
",",
"final",
"boolean",
"includeUpperBound",
")",
"{",
"i... | Given an double string, it checks if it's a valid double (base on apaches NumberUtils.createDouble) and if
it's between the lowerBound and upperBound.
@param doubleStr the integer string to check
@param lowerBound the lower bound of the interval
@param upperBound the upper bound of the interval
@param includeLowerBound boolean if to include the lower bound of the interval
@param includeUpperBound boolean if to include the upper bound of the interval
@return true if the integer string is valid and in between the lowerBound and upperBound, false otherwise
@throws IllegalArgumentException if the lowerBound is not less than the upperBound | [
"Given",
"an",
"double",
"string",
"it",
"checks",
"if",
"it",
"s",
"a",
"valid",
"double",
"(",
"base",
"on",
"apaches",
"NumberUtils",
".",
"createDouble",
")",
"and",
"if",
"it",
"s",
"between",
"the",
"lowerBound",
"and",
"upperBound",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-commons/src/main/java/io/cloudslang/content/utils/NumberUtilities.java#L215-L225 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectUnionOfImpl_CustomFieldSerializer.java | OWLObjectUnionOfImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectUnionOfImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectUnionOfImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLObjectUnionOfImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"
] | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectUnionOfImpl_CustomFieldSerializer.java#L89-L92 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/util/PositionUtil.java | PositionUtil.toRangeAddress | public String toRangeAddress(final int row1, final int col1, final int row2, final int col2) {
return this.toCellAddress(row1, col1) + ":" + this.toCellAddress(row2, col2);
} | java | public String toRangeAddress(final int row1, final int col1, final int row2, final int col2) {
return this.toCellAddress(row1, col1) + ":" + this.toCellAddress(row2, col2);
} | [
"public",
"String",
"toRangeAddress",
"(",
"final",
"int",
"row1",
",",
"final",
"int",
"col1",
",",
"final",
"int",
"row2",
",",
"final",
"int",
"col2",
")",
"{",
"return",
"this",
".",
"toCellAddress",
"(",
"row1",
",",
"col1",
")",
"+",
"\":\"",
"+"... | Return the Excel/OO/LO address of a range
@param row1 the first row
@param col1 the first col
@param row2 the last row
@param col2 the last col
@return the Excel/OO/LO address | [
"Return",
"the",
"Excel",
"/",
"OO",
"/",
"LO",
"address",
"of",
"a",
"range"
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/util/PositionUtil.java#L260-L262 |
eclipse/hawkbit | hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/AbstractMetadataPopupLayout.java | AbstractMetadataPopupLayout.getWindow | public CommonDialogWindow getWindow(final E entity, final String metaDatakey) {
selectedEntity = entity;
metadataWindow = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW).caption(getMetadataCaption())
.content(this).cancelButtonClickListener(event -> onCancel())
.id(UIComponentIdProvider.METADATA_POPUP_ID).layout(mainLayout).i18n(i18n)
.saveDialogCloseListener(new SaveOnDialogCloseListener()).buildCommonDialogWindow();
metadataWindow.setHeight(550, Unit.PIXELS);
metadataWindow.setWidth(800, Unit.PIXELS);
metadataWindow.getMainLayout().setSizeFull();
metadataWindow.getButtonsLayout().setHeight("45px");
setUpDetails(entity.getId(), metaDatakey);
return metadataWindow;
} | java | public CommonDialogWindow getWindow(final E entity, final String metaDatakey) {
selectedEntity = entity;
metadataWindow = new WindowBuilder(SPUIDefinitions.CREATE_UPDATE_WINDOW).caption(getMetadataCaption())
.content(this).cancelButtonClickListener(event -> onCancel())
.id(UIComponentIdProvider.METADATA_POPUP_ID).layout(mainLayout).i18n(i18n)
.saveDialogCloseListener(new SaveOnDialogCloseListener()).buildCommonDialogWindow();
metadataWindow.setHeight(550, Unit.PIXELS);
metadataWindow.setWidth(800, Unit.PIXELS);
metadataWindow.getMainLayout().setSizeFull();
metadataWindow.getButtonsLayout().setHeight("45px");
setUpDetails(entity.getId(), metaDatakey);
return metadataWindow;
} | [
"public",
"CommonDialogWindow",
"getWindow",
"(",
"final",
"E",
"entity",
",",
"final",
"String",
"metaDatakey",
")",
"{",
"selectedEntity",
"=",
"entity",
";",
"metadataWindow",
"=",
"new",
"WindowBuilder",
"(",
"SPUIDefinitions",
".",
"CREATE_UPDATE_WINDOW",
")",
... | Returns metadata popup.
@param entity
entity for which metadata data is displayed
@param metaDatakey
metadata key to be selected
@return {@link CommonDialogWindow} | [
"Returns",
"metadata",
"popup",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/AbstractMetadataPopupLayout.java#L131-L145 |
threerings/nenya | core/src/main/java/com/threerings/media/FrameManager.java | FrameManager.newInstance | public static FrameManager newInstance (ManagedRoot root, MediaTimer timer)
{
FrameManager fmgr = (root instanceof ManagedJFrame && _useFlip.getValue()) ?
new FlipFrameManager() : new BackFrameManager();
fmgr.init(root, timer);
return fmgr;
} | java | public static FrameManager newInstance (ManagedRoot root, MediaTimer timer)
{
FrameManager fmgr = (root instanceof ManagedJFrame && _useFlip.getValue()) ?
new FlipFrameManager() : new BackFrameManager();
fmgr.init(root, timer);
return fmgr;
} | [
"public",
"static",
"FrameManager",
"newInstance",
"(",
"ManagedRoot",
"root",
",",
"MediaTimer",
"timer",
")",
"{",
"FrameManager",
"fmgr",
"=",
"(",
"root",
"instanceof",
"ManagedJFrame",
"&&",
"_useFlip",
".",
"getValue",
"(",
")",
")",
"?",
"new",
"FlipFra... | Constructs a frame manager that will do its rendering to the supplied root and use the
supplied media timer for timing information. | [
"Constructs",
"a",
"frame",
"manager",
"that",
"will",
"do",
"its",
"rendering",
"to",
"the",
"supplied",
"root",
"and",
"use",
"the",
"supplied",
"media",
"timer",
"for",
"timing",
"information",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/FrameManager.java#L159-L165 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java | Whitebox.getMethod | public static Method getMethod(Class<?> type, String methodName, Class<?>... parameterTypes) {
return WhiteboxImpl.getMethod(type, methodName, parameterTypes);
} | java | public static Method getMethod(Class<?> type, String methodName, Class<?>... parameterTypes) {
return WhiteboxImpl.getMethod(type, methodName, parameterTypes);
} | [
"public",
"static",
"Method",
"getMethod",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"return",
"WhiteboxImpl",
".",
"getMethod",
"(",
"type",
",",
"methodName",
",",
... | Convenience method to get a method from a class type without having to
catch the checked exceptions otherwise required. These exceptions are
wrapped as runtime exceptions.
<p>
The method will first try to look for a declared method in the same
class. If the method is not declared in this class it will look for the
method in the super class. This will continue throughout the whole class
hierarchy. If the method is not found an {@link IllegalArgumentException}
is thrown.
@param type
The type of the class where the method is located.
@param methodName
The method names.
@param parameterTypes
All parameter types of the method (may be {@code null}).
@return A {@code java.lang.reflect.Method}.
@throws MethodNotFoundException
If a method cannot be found in the hierarchy. | [
"Convenience",
"method",
"to",
"get",
"a",
"method",
"from",
"a",
"class",
"type",
"without",
"having",
"to",
"catch",
"the",
"checked",
"exceptions",
"otherwise",
"required",
".",
"These",
"exceptions",
"are",
"wrapped",
"as",
"runtime",
"exceptions",
".",
"<... | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/Whitebox.java#L93-L95 |
bazaarvoice/emodb | auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/jersey/AuthenticationResourceFilter.java | AuthenticationResourceFilter.setJettyAuthentication | private void setJettyAuthentication(Subject subject) {
// In unit test environments there may not be a current connection. If any nulls are encountered
// then, by definition, there is no container to update.
HttpConnection connection = HttpConnection.getCurrentConnection();
if (connection == null) {
return;
}
Request jettyRequest = connection.getHttpChannel().getRequest();
if (jettyRequest == null) {
return;
}
// This cast down is safe; subject is always created with this type of principal
PrincipalWithRoles principal = (PrincipalWithRoles) subject.getPrincipal();
UserIdentity identity = principal.toUserIdentity();
jettyRequest.setAuthentication(new UserAuthentication(SecurityContext.BASIC_AUTH, identity));
} | java | private void setJettyAuthentication(Subject subject) {
// In unit test environments there may not be a current connection. If any nulls are encountered
// then, by definition, there is no container to update.
HttpConnection connection = HttpConnection.getCurrentConnection();
if (connection == null) {
return;
}
Request jettyRequest = connection.getHttpChannel().getRequest();
if (jettyRequest == null) {
return;
}
// This cast down is safe; subject is always created with this type of principal
PrincipalWithRoles principal = (PrincipalWithRoles) subject.getPrincipal();
UserIdentity identity = principal.toUserIdentity();
jettyRequest.setAuthentication(new UserAuthentication(SecurityContext.BASIC_AUTH, identity));
} | [
"private",
"void",
"setJettyAuthentication",
"(",
"Subject",
"subject",
")",
"{",
"// In unit test environments there may not be a current connection. If any nulls are encountered",
"// then, by definition, there is no container to update.",
"HttpConnection",
"connection",
"=",
"HttpConne... | Certain aspects of the container, such as logging, need the authentication information to behave properly.
This method updates the request with the necessary objects to recognize the authenticated user. | [
"Certain",
"aspects",
"of",
"the",
"container",
"such",
"as",
"logging",
"need",
"the",
"authentication",
"information",
"to",
"behave",
"properly",
".",
"This",
"method",
"updates",
"the",
"request",
"with",
"the",
"necessary",
"objects",
"to",
"recognize",
"th... | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/jersey/AuthenticationResourceFilter.java#L79-L96 |
networknt/light-4j | metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java | InstrumentedExecutors.newCachedThreadPool | public static InstrumentedExecutorService newCachedThreadPool(MetricRegistry registry, String name) {
return new InstrumentedExecutorService(Executors.newCachedThreadPool(), registry, name);
} | java | public static InstrumentedExecutorService newCachedThreadPool(MetricRegistry registry, String name) {
return new InstrumentedExecutorService(Executors.newCachedThreadPool(), registry, name);
} | [
"public",
"static",
"InstrumentedExecutorService",
"newCachedThreadPool",
"(",
"MetricRegistry",
"registry",
",",
"String",
"name",
")",
"{",
"return",
"new",
"InstrumentedExecutorService",
"(",
"Executors",
".",
"newCachedThreadPool",
"(",
")",
",",
"registry",
",",
... | Creates an instrumented thread pool that creates new threads as needed, but
will reuse previously constructed threads when they are
available. These pools will typically improve the performance
of programs that execute many short-lived asynchronous tasks.
Calls to {@code execute} will reuse previously constructed
threads if available. If no existing thread is available, a new
thread will be created and added to the pool. Threads that have
not been used for sixty seconds are terminated and removed from
the cache. Thus, a pool that remains idle for long enough will
not consume any resource. Note that pools with similar
properties but different details (for example, timeout parameters)
may be created using {@link ThreadPoolExecutor} constructors.
@param registry the {@link MetricRegistry} that will contain the metrics.
@param name the (metrics) name for this executor service, see {@link MetricRegistry#name(String, String...)}.
@return the newly created thread pool
@see Executors#newCachedThreadPool() | [
"Creates",
"an",
"instrumented",
"thread",
"pool",
"that",
"creates",
"new",
"threads",
"as",
"needed",
"but",
"will",
"reuse",
"previously",
"constructed",
"threads",
"when",
"they",
"are",
"available",
".",
"These",
"pools",
"will",
"typically",
"improve",
"th... | train | https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/metrics/src/main/java/io/dropwizard/metrics/InstrumentedExecutors.java#L235-L237 |
apiman/apiman | manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/OrganizationResourceImpl.java | OrganizationResourceImpl.validateTimeSeriesMetric | private void validateTimeSeriesMetric(DateTime from, DateTime to, HistogramIntervalType interval)
throws InvalidMetricCriteriaException {
long millis = to.getMillis() - from.getMillis();
long divBy = ONE_DAY_MILLIS;
switch (interval) {
case day:
divBy = ONE_DAY_MILLIS;
break;
case hour:
divBy = ONE_HOUR_MILLIS;
break;
case minute:
divBy = ONE_MINUTE_MILLIS;
break;
case month:
divBy = ONE_MONTH_MILLIS;
break;
case week:
divBy = ONE_WEEK_MILLIS;
break;
default:
break;
}
long totalDataPoints = millis / divBy;
if (totalDataPoints > 5000) {
throw ExceptionFactory.invalidMetricCriteriaException(Messages.i18n.format("OrganizationResourceImpl.MetricDataSetTooLarge")); //$NON-NLS-1$
}
} | java | private void validateTimeSeriesMetric(DateTime from, DateTime to, HistogramIntervalType interval)
throws InvalidMetricCriteriaException {
long millis = to.getMillis() - from.getMillis();
long divBy = ONE_DAY_MILLIS;
switch (interval) {
case day:
divBy = ONE_DAY_MILLIS;
break;
case hour:
divBy = ONE_HOUR_MILLIS;
break;
case minute:
divBy = ONE_MINUTE_MILLIS;
break;
case month:
divBy = ONE_MONTH_MILLIS;
break;
case week:
divBy = ONE_WEEK_MILLIS;
break;
default:
break;
}
long totalDataPoints = millis / divBy;
if (totalDataPoints > 5000) {
throw ExceptionFactory.invalidMetricCriteriaException(Messages.i18n.format("OrganizationResourceImpl.MetricDataSetTooLarge")); //$NON-NLS-1$
}
} | [
"private",
"void",
"validateTimeSeriesMetric",
"(",
"DateTime",
"from",
",",
"DateTime",
"to",
",",
"HistogramIntervalType",
"interval",
")",
"throws",
"InvalidMetricCriteriaException",
"{",
"long",
"millis",
"=",
"to",
".",
"getMillis",
"(",
")",
"-",
"from",
"."... | Ensures that a time series can be created for the given date range and
interval, and that the | [
"Ensures",
"that",
"a",
"time",
"series",
"can",
"be",
"created",
"for",
"the",
"given",
"date",
"range",
"and",
"interval",
"and",
"that",
"the"
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/OrganizationResourceImpl.java#L3704-L3731 |
eclipse/hawkbit | hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java | RolloutStatusCache.getRolloutGroupStatus | public Map<Long, List<TotalTargetCountActionStatus>> getRolloutGroupStatus(final List<Long> rolloutGroups) {
final Cache cache = cacheManager.getCache(CACHE_GR_NAME);
return retrieveFromCache(rolloutGroups, cache);
} | java | public Map<Long, List<TotalTargetCountActionStatus>> getRolloutGroupStatus(final List<Long> rolloutGroups) {
final Cache cache = cacheManager.getCache(CACHE_GR_NAME);
return retrieveFromCache(rolloutGroups, cache);
} | [
"public",
"Map",
"<",
"Long",
",",
"List",
"<",
"TotalTargetCountActionStatus",
">",
">",
"getRolloutGroupStatus",
"(",
"final",
"List",
"<",
"Long",
">",
"rolloutGroups",
")",
"{",
"final",
"Cache",
"cache",
"=",
"cacheManager",
".",
"getCache",
"(",
"CACHE_G... | Retrieves cached list of {@link TotalTargetCountActionStatus} of
{@link RolloutGroup}s.
@param rolloutGroups
rolloutGroupsIds to retrieve cache entries for
@return map of cached entries | [
"Retrieves",
"cached",
"list",
"of",
"{",
"@link",
"TotalTargetCountActionStatus",
"}",
"of",
"{",
"@link",
"RolloutGroup",
"}",
"s",
"."
] | train | https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-core/src/main/java/org/eclipse/hawkbit/repository/RolloutStatusCache.java#L103-L107 |
alkacon/opencms-core | src-modules/org/opencms/workplace/explorer/CmsExplorer.java | CmsExplorer.getInitializationFooter | public String getInitializationFooter(int numberOfPages, int selectedPage) {
StringBuffer content = new StringBuffer(1024);
content.append("top.dU(document,");
content.append(numberOfPages);
content.append(",");
content.append(selectedPage);
content.append("); \n");
// display eventual error message
if (getSettings().getErrorMessage() != null) {
// display error message as JavaScript alert
content.append("alert(\"");
content.append(CmsStringUtil.escapeJavaScript(getSettings().getErrorMessage().key(getLocale())));
content.append("\");\n");
// delete error message container in settings
getSettings().setErrorMessage(null);
}
// display eventual broadcast message(s)
String message = getBroadcastMessageString();
if (CmsStringUtil.isNotEmpty(message)) {
// display broadcast as JavaScript alert
content.append("alert(decodeURIComponent(\"");
// the user has pending messages, display them all
content.append(CmsEncoder.escapeWBlanks(message, CmsEncoder.ENCODING_UTF_8));
content.append("\"));\n");
}
content.append("}\n");
return content.toString();
} | java | public String getInitializationFooter(int numberOfPages, int selectedPage) {
StringBuffer content = new StringBuffer(1024);
content.append("top.dU(document,");
content.append(numberOfPages);
content.append(",");
content.append(selectedPage);
content.append("); \n");
// display eventual error message
if (getSettings().getErrorMessage() != null) {
// display error message as JavaScript alert
content.append("alert(\"");
content.append(CmsStringUtil.escapeJavaScript(getSettings().getErrorMessage().key(getLocale())));
content.append("\");\n");
// delete error message container in settings
getSettings().setErrorMessage(null);
}
// display eventual broadcast message(s)
String message = getBroadcastMessageString();
if (CmsStringUtil.isNotEmpty(message)) {
// display broadcast as JavaScript alert
content.append("alert(decodeURIComponent(\"");
// the user has pending messages, display them all
content.append(CmsEncoder.escapeWBlanks(message, CmsEncoder.ENCODING_UTF_8));
content.append("\"));\n");
}
content.append("}\n");
return content.toString();
} | [
"public",
"String",
"getInitializationFooter",
"(",
"int",
"numberOfPages",
",",
"int",
"selectedPage",
")",
"{",
"StringBuffer",
"content",
"=",
"new",
"StringBuffer",
"(",
"1024",
")",
";",
"content",
".",
"append",
"(",
"\"top.dU(document,\"",
")",
";",
"cont... | Generates the footer of the explorer initialization code.<p>
@param numberOfPages the number of pages
@param selectedPage the selected page to display
@return js code for initializing the explorer view
@see #getInitializationHeader()
@see #getInitializationEntry(CmsResourceUtil, boolean, boolean, boolean, boolean, boolean, boolean, boolean, boolean, boolean, boolean) | [
"Generates",
"the",
"footer",
"of",
"the",
"explorer",
"initialization",
"code",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/explorer/CmsExplorer.java#L536-L567 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/device_profile.java | device_profile.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
device_profile_responses result = (device_profile_responses) service.get_payload_formatter().string_to_resource(device_profile_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.device_profile_response_array);
}
device_profile[] result_device_profile = new device_profile[result.device_profile_response_array.length];
for(int i = 0; i < result.device_profile_response_array.length; i++)
{
result_device_profile[i] = result.device_profile_response_array[i].device_profile[0];
}
return result_device_profile;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
device_profile_responses result = (device_profile_responses) service.get_payload_formatter().string_to_resource(device_profile_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.device_profile_response_array);
}
device_profile[] result_device_profile = new device_profile[result.device_profile_response_array.length];
for(int i = 0; i < result.device_profile_response_array.length; i++)
{
result_device_profile[i] = result.device_profile_response_array[i].device_profile[0];
}
return result_device_profile;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"device_profile_responses",
"result",
"=",
"(",
"device_profile_responses",
")",
"service",
".",
"get_payload_... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/device_profile.java#L569-L586 |
bazaarvoice/emodb | common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java | EmoUriComponent.decodePath | public static List<PathSegment> decodePath(URI u, boolean decode) {
String rawPath = u.getRawPath();
if (rawPath != null && rawPath.length() > 0 && rawPath.charAt(0) == '/') {
rawPath = rawPath.substring(1);
}
return decodePath(rawPath, decode);
} | java | public static List<PathSegment> decodePath(URI u, boolean decode) {
String rawPath = u.getRawPath();
if (rawPath != null && rawPath.length() > 0 && rawPath.charAt(0) == '/') {
rawPath = rawPath.substring(1);
}
return decodePath(rawPath, decode);
} | [
"public",
"static",
"List",
"<",
"PathSegment",
">",
"decodePath",
"(",
"URI",
"u",
",",
"boolean",
"decode",
")",
"{",
"String",
"rawPath",
"=",
"u",
".",
"getRawPath",
"(",
")",
";",
"if",
"(",
"rawPath",
"!=",
"null",
"&&",
"rawPath",
".",
"length",... | Decode the path component of a URI as path segments.
@param u the URI. If the path component is an absolute path component
then the leading '/' is ignored and is not considered a delimiator
of a path segment.
@param decode true if the path segments of the path component
should be in decoded form.
@return the list of path segments. | [
"Decode",
"the",
"path",
"component",
"of",
"a",
"URI",
"as",
"path",
"segments",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java#L590-L596 |
michael-rapp/AndroidMaterialValidation | library/src/main/java/de/mrapp/android/validation/Validators.java | Validators.minLength | public static Validator<CharSequence> minLength(@NonNull final CharSequence errorMessage,
final int minLength) {
return new MinLengthValidator(errorMessage, minLength);
} | java | public static Validator<CharSequence> minLength(@NonNull final CharSequence errorMessage,
final int minLength) {
return new MinLengthValidator(errorMessage, minLength);
} | [
"public",
"static",
"Validator",
"<",
"CharSequence",
">",
"minLength",
"(",
"@",
"NonNull",
"final",
"CharSequence",
"errorMessage",
",",
"final",
"int",
"minLength",
")",
"{",
"return",
"new",
"MinLengthValidator",
"(",
"errorMessage",
",",
"minLength",
")",
"... | Creates and returns a validator, which allows to validate texts to ensure, that they have at
least a specific length.
@param errorMessage
The error message, which should be shown, if the validation fails, as an instance of
the type {@link CharSequence}. The error message may not be null
@param minLength
The minimum length a text must have as an {@link Integer} value. The minimum length
must be at least 1
@return @return The validator, which has been created, as an instance of the type {@link
Validator} | [
"Creates",
"and",
"returns",
"a",
"validator",
"which",
"allows",
"to",
"validate",
"texts",
"to",
"ensure",
"that",
"they",
"have",
"at",
"least",
"a",
"specific",
"length",
"."
] | train | https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L403-L406 |
UrielCh/ovh-java-sdk | ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java | ApiOvhHostingprivateDatabase.serviceName_database_databaseName_extension_GET | public ArrayList<String> serviceName_database_databaseName_extension_GET(String serviceName, String databaseName, String extensionName, OvhStatus status) throws IOException {
String qPath = "/hosting/privateDatabase/{serviceName}/database/{databaseName}/extension";
StringBuilder sb = path(qPath, serviceName, databaseName);
query(sb, "extensionName", extensionName);
query(sb, "status", status);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> serviceName_database_databaseName_extension_GET(String serviceName, String databaseName, String extensionName, OvhStatus status) throws IOException {
String qPath = "/hosting/privateDatabase/{serviceName}/database/{databaseName}/extension";
StringBuilder sb = path(qPath, serviceName, databaseName);
query(sb, "extensionName", extensionName);
query(sb, "status", status);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"serviceName_database_databaseName_extension_GET",
"(",
"String",
"serviceName",
",",
"String",
"databaseName",
",",
"String",
"extensionName",
",",
"OvhStatus",
"status",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
... | Extensions linked to your database
REST: GET /hosting/privateDatabase/{serviceName}/database/{databaseName}/extension
@param extensionName [required] Filter the value of extensionName property (like)
@param status [required] Filter the value of status property (=)
@param serviceName [required] The internal name of your private database
@param databaseName [required] Database name | [
"Extensions",
"linked",
"to",
"your",
"database"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java#L461-L468 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java | TrueTypeFontUnicode.compare | public int compare(Object o1, Object o2) {
int m1 = ((int[])o1)[0];
int m2 = ((int[])o2)[0];
if (m1 < m2)
return -1;
if (m1 == m2)
return 0;
return 1;
} | java | public int compare(Object o1, Object o2) {
int m1 = ((int[])o1)[0];
int m2 = ((int[])o2)[0];
if (m1 < m2)
return -1;
if (m1 == m2)
return 0;
return 1;
} | [
"public",
"int",
"compare",
"(",
"Object",
"o1",
",",
"Object",
"o2",
")",
"{",
"int",
"m1",
"=",
"(",
"(",
"int",
"[",
"]",
")",
"o1",
")",
"[",
"0",
"]",
";",
"int",
"m2",
"=",
"(",
"(",
"int",
"[",
"]",
")",
"o2",
")",
"[",
"0",
"]",
... | The method used to sort the metrics array.
@param o1 the first element
@param o2 the second element
@return the comparison | [
"The",
"method",
"used",
"to",
"sort",
"the",
"metrics",
"array",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/TrueTypeFontUnicode.java#L378-L386 |
joniles/mpxj | src/main/java/net/sf/mpxj/GenericCriteria.java | GenericCriteria.setRightValue | public void setRightValue(int index, Object value)
{
m_definedRightValues[index] = value;
if (value instanceof FieldType)
{
m_symbolicValues = true;
}
else
{
if (value instanceof Duration)
{
if (((Duration) value).getUnits() != TimeUnit.HOURS)
{
value = ((Duration) value).convertUnits(TimeUnit.HOURS, m_properties);
}
}
}
m_workingRightValues[index] = value;
} | java | public void setRightValue(int index, Object value)
{
m_definedRightValues[index] = value;
if (value instanceof FieldType)
{
m_symbolicValues = true;
}
else
{
if (value instanceof Duration)
{
if (((Duration) value).getUnits() != TimeUnit.HOURS)
{
value = ((Duration) value).convertUnits(TimeUnit.HOURS, m_properties);
}
}
}
m_workingRightValues[index] = value;
} | [
"public",
"void",
"setRightValue",
"(",
"int",
"index",
",",
"Object",
"value",
")",
"{",
"m_definedRightValues",
"[",
"index",
"]",
"=",
"value",
";",
"if",
"(",
"value",
"instanceof",
"FieldType",
")",
"{",
"m_symbolicValues",
"=",
"true",
";",
"}",
"els... | Add the value to list of values to be used as part of the
evaluation of this indicator.
@param index position in the list
@param value evaluation value | [
"Add",
"the",
"value",
"to",
"list",
"of",
"values",
"to",
"be",
"used",
"as",
"part",
"of",
"the",
"evaluation",
"of",
"this",
"indicator",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/GenericCriteria.java#L95-L115 |
apache/incubator-gobblin | gobblin-compaction/src/main/java/org/apache/gobblin/compaction/source/CompactionSource.java | CompactionSource.initJobDir | private void initJobDir (SourceState state) throws IOException {
String tmpBase = state.getProp(MRCompactor.COMPACTION_TMP_DEST_DIR, MRCompactor.DEFAULT_COMPACTION_TMP_DEST_DIR);
String jobId;
if (state instanceof JobState) {
jobId = ((JobState) state).getJobId();
} else {
jobId = UUID.randomUUID().toString();
}
this.tmpJobDir = new Path (tmpBase, jobId);
this.fs.mkdirs(this.tmpJobDir);
state.setProp (MRCompactor.COMPACTION_JOB_DIR, tmpJobDir.toString());
log.info ("Job dir is created under {}", this.tmpJobDir);
} | java | private void initJobDir (SourceState state) throws IOException {
String tmpBase = state.getProp(MRCompactor.COMPACTION_TMP_DEST_DIR, MRCompactor.DEFAULT_COMPACTION_TMP_DEST_DIR);
String jobId;
if (state instanceof JobState) {
jobId = ((JobState) state).getJobId();
} else {
jobId = UUID.randomUUID().toString();
}
this.tmpJobDir = new Path (tmpBase, jobId);
this.fs.mkdirs(this.tmpJobDir);
state.setProp (MRCompactor.COMPACTION_JOB_DIR, tmpJobDir.toString());
log.info ("Job dir is created under {}", this.tmpJobDir);
} | [
"private",
"void",
"initJobDir",
"(",
"SourceState",
"state",
")",
"throws",
"IOException",
"{",
"String",
"tmpBase",
"=",
"state",
".",
"getProp",
"(",
"MRCompactor",
".",
"COMPACTION_TMP_DEST_DIR",
",",
"MRCompactor",
".",
"DEFAULT_COMPACTION_TMP_DEST_DIR",
")",
"... | Create a temporary job directory based on job id or (if not available) UUID | [
"Create",
"a",
"temporary",
"job",
"directory",
"based",
"on",
"job",
"id",
"or",
"(",
"if",
"not",
"available",
")",
"UUID"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/source/CompactionSource.java#L450-L464 |
bremersee/comparator | src/main/java/org/bremersee/comparator/ComparatorUtils.java | ComparatorUtils.doSetIgnoreCaseRecursively | public static void doSetIgnoreCaseRecursively(ComparatorItem comparatorItem, boolean ignoreCase) {
ComparatorItem tmp = comparatorItem;
while (tmp != null) {
tmp.setIgnoreCase(ignoreCase);
tmp = tmp.getNextComparatorItem();
}
} | java | public static void doSetIgnoreCaseRecursively(ComparatorItem comparatorItem, boolean ignoreCase) {
ComparatorItem tmp = comparatorItem;
while (tmp != null) {
tmp.setIgnoreCase(ignoreCase);
tmp = tmp.getNextComparatorItem();
}
} | [
"public",
"static",
"void",
"doSetIgnoreCaseRecursively",
"(",
"ComparatorItem",
"comparatorItem",
",",
"boolean",
"ignoreCase",
")",
"{",
"ComparatorItem",
"tmp",
"=",
"comparatorItem",
";",
"while",
"(",
"tmp",
"!=",
"null",
")",
"{",
"tmp",
".",
"setIgnoreCase"... | Sets whether the sort is case sensitive or not to all items.
@param comparatorItem the (root) item
@param ignoreCase {@code true} if the sort is case sensitive, otherwise {@code false} | [
"Sets",
"whether",
"the",
"sort",
"is",
"case",
"sensitive",
"or",
"not",
"to",
"all",
"items",
"."
] | train | https://github.com/bremersee/comparator/blob/6958e6e28a62589106705062f8ffc201a87d9b2a/src/main/java/org/bremersee/comparator/ComparatorUtils.java#L52-L58 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.addCustomPrebuiltIntentAsync | public Observable<UUID> addCustomPrebuiltIntentAsync(UUID appId, String versionId, PrebuiltDomainModelCreateObject prebuiltDomainModelCreateObject) {
return addCustomPrebuiltIntentWithServiceResponseAsync(appId, versionId, prebuiltDomainModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
} | java | public Observable<UUID> addCustomPrebuiltIntentAsync(UUID appId, String versionId, PrebuiltDomainModelCreateObject prebuiltDomainModelCreateObject) {
return addCustomPrebuiltIntentWithServiceResponseAsync(appId, versionId, prebuiltDomainModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() {
@Override
public UUID call(ServiceResponse<UUID> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"UUID",
">",
"addCustomPrebuiltIntentAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"PrebuiltDomainModelCreateObject",
"prebuiltDomainModelCreateObject",
")",
"{",
"return",
"addCustomPrebuiltIntentWithServiceResponseAsync",
"(",
"... | Adds a custom prebuilt intent model to the application.
@param appId The application ID.
@param versionId The version ID.
@param prebuiltDomainModelCreateObject A model object containing the name of the custom prebuilt intent and the name of the domain to which this model belongs.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the UUID object | [
"Adds",
"a",
"custom",
"prebuilt",
"intent",
"model",
"to",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L5740-L5747 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java | TheMovieDbApi.getCollectionInfo | public CollectionInfo getCollectionInfo(int collectionId, String language) throws MovieDbException {
return tmdbCollections.getCollectionInfo(collectionId, language);
} | java | public CollectionInfo getCollectionInfo(int collectionId, String language) throws MovieDbException {
return tmdbCollections.getCollectionInfo(collectionId, language);
} | [
"public",
"CollectionInfo",
"getCollectionInfo",
"(",
"int",
"collectionId",
",",
"String",
"language",
")",
"throws",
"MovieDbException",
"{",
"return",
"tmdbCollections",
".",
"getCollectionInfo",
"(",
"collectionId",
",",
"language",
")",
";",
"}"
] | This method is used to retrieve all of the basic information about a
movie collection.
You can get the ID needed for this method by making a getMovieInfo
request for the belongs_to_collection.
@param collectionId collectionId
@param language language
@return CollectionInfo
@throws MovieDbException exception | [
"This",
"method",
"is",
"used",
"to",
"retrieve",
"all",
"of",
"the",
"basic",
"information",
"about",
"a",
"movie",
"collection",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L512-L514 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.getDeletedCertificatesAsync | public Observable<Page<DeletedCertificateItem>> getDeletedCertificatesAsync(final String vaultBaseUrl, final Integer maxresults, final Boolean includePending) {
return getDeletedCertificatesWithServiceResponseAsync(vaultBaseUrl, maxresults, includePending)
.map(new Func1<ServiceResponse<Page<DeletedCertificateItem>>, Page<DeletedCertificateItem>>() {
@Override
public Page<DeletedCertificateItem> call(ServiceResponse<Page<DeletedCertificateItem>> response) {
return response.body();
}
});
} | java | public Observable<Page<DeletedCertificateItem>> getDeletedCertificatesAsync(final String vaultBaseUrl, final Integer maxresults, final Boolean includePending) {
return getDeletedCertificatesWithServiceResponseAsync(vaultBaseUrl, maxresults, includePending)
.map(new Func1<ServiceResponse<Page<DeletedCertificateItem>>, Page<DeletedCertificateItem>>() {
@Override
public Page<DeletedCertificateItem> call(ServiceResponse<Page<DeletedCertificateItem>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DeletedCertificateItem",
">",
">",
"getDeletedCertificatesAsync",
"(",
"final",
"String",
"vaultBaseUrl",
",",
"final",
"Integer",
"maxresults",
",",
"final",
"Boolean",
"includePending",
")",
"{",
"return",
"getDeletedCertif... | Lists the deleted certificates in the specified vault currently available for recovery.
The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state and ready for recovery or purging. This operation includes deletion-specific information. This operation requires the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results.
@param includePending Specifies whether to include certificates which are not completely provisioned.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DeletedCertificateItem> object | [
"Lists",
"the",
"deleted",
"certificates",
"in",
"the",
"specified",
"vault",
"currently",
"available",
"for",
"recovery",
".",
"The",
"GetDeletedCertificates",
"operation",
"retrieves",
"the",
"certificates",
"in",
"the",
"current",
"vault",
"which",
"are",
"in",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L8450-L8458 |
aws/aws-sdk-java | aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/GetMaintenanceWindowExecutionTaskResult.java | GetMaintenanceWindowExecutionTaskResult.setTaskParameters | public void setTaskParameters(java.util.Collection<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>> taskParameters) {
if (taskParameters == null) {
this.taskParameters = null;
return;
}
this.taskParameters = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>>(taskParameters);
} | java | public void setTaskParameters(java.util.Collection<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>> taskParameters) {
if (taskParameters == null) {
this.taskParameters = null;
return;
}
this.taskParameters = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, MaintenanceWindowTaskParameterValueExpression>>(taskParameters);
} | [
"public",
"void",
"setTaskParameters",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"MaintenanceWindowTaskParameterValueExpression",
">",
">",
"taskParameters",
")",
"{",
"if",
"(",
"taskParameters",
"=="... | <p>
The parameters passed to the task when it was run.
</p>
<note>
<p>
<code>TaskParameters</code> has been deprecated. To specify parameters to pass to a task when it runs, instead
use the <code>Parameters</code> option in the <code>TaskInvocationParameters</code> structure. For information
about how Systems Manager handles these options for the supported Maintenance Window task types, see
<a>MaintenanceWindowTaskInvocationParameters</a>.
</p>
</note>
<p>
The map has the following format:
</p>
<p>
Key: string, between 1 and 255 characters
</p>
<p>
Value: an array of strings, each string is between 1 and 255 characters
</p>
@param taskParameters
The parameters passed to the task when it was run.</p> <note>
<p>
<code>TaskParameters</code> has been deprecated. To specify parameters to pass to a task when it runs,
instead use the <code>Parameters</code> option in the <code>TaskInvocationParameters</code> structure. For
information about how Systems Manager handles these options for the supported Maintenance Window task
types, see <a>MaintenanceWindowTaskInvocationParameters</a>.
</p>
</note>
<p>
The map has the following format:
</p>
<p>
Key: string, between 1 and 255 characters
</p>
<p>
Value: an array of strings, each string is between 1 and 255 characters | [
"<p",
">",
"The",
"parameters",
"passed",
"to",
"the",
"task",
"when",
"it",
"was",
"run",
".",
"<",
"/",
"p",
">",
"<note",
">",
"<p",
">",
"<code",
">",
"TaskParameters<",
"/",
"code",
">",
"has",
"been",
"deprecated",
".",
"To",
"specify",
"parame... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/GetMaintenanceWindowExecutionTaskResult.java#L445-L452 |
lesaint/damapping | core-parent/util/src/main/java/fr/javatronic/damapping/util/Preconditions.java | Preconditions.checkNotNull | @Nonnull
public static <T> T checkNotNull(@Nullable T obj) {
return checkNotNull(obj, NPE_DEFAULT_MSG);
} | java | @Nonnull
public static <T> T checkNotNull(@Nullable T obj) {
return checkNotNull(obj, NPE_DEFAULT_MSG);
} | [
"@",
"Nonnull",
"public",
"static",
"<",
"T",
">",
"T",
"checkNotNull",
"(",
"@",
"Nullable",
"T",
"obj",
")",
"{",
"return",
"checkNotNull",
"(",
"obj",
",",
"NPE_DEFAULT_MSG",
")",
";",
"}"
] | Throws a NullPointerException with a generic message if the specified object is {@code null}, otherwise
returns it.
@param obj an object of any type or {@code null}
@param <T> any type
@return the argument | [
"Throws",
"a",
"NullPointerException",
"with",
"a",
"generic",
"message",
"if",
"the",
"specified",
"object",
"is",
"{",
"@code",
"null",
"}",
"otherwise",
"returns",
"it",
"."
] | train | https://github.com/lesaint/damapping/blob/357afa5866939fd2a18c09213975ffef4836f328/core-parent/util/src/main/java/fr/javatronic/damapping/util/Preconditions.java#L44-L47 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/ClusterSampling.java | ClusterSampling.randomSampling | public static TransposeDataCollection randomSampling(TransposeDataList clusterIdList, int sampleM) {
TransposeDataCollection sampledIds = new TransposeDataCollection();
Object[] selectedClusters = clusterIdList.keySet().toArray();
PHPMethods.<Object>shuffle(selectedClusters);
for(int i = 0; i<sampleM; ++i) {
Object cluster = selectedClusters[i];
sampledIds.put(cluster, clusterIdList.get(cluster).toFlatDataCollection());
}
return sampledIds;
} | java | public static TransposeDataCollection randomSampling(TransposeDataList clusterIdList, int sampleM) {
TransposeDataCollection sampledIds = new TransposeDataCollection();
Object[] selectedClusters = clusterIdList.keySet().toArray();
PHPMethods.<Object>shuffle(selectedClusters);
for(int i = 0; i<sampleM; ++i) {
Object cluster = selectedClusters[i];
sampledIds.put(cluster, clusterIdList.get(cluster).toFlatDataCollection());
}
return sampledIds;
} | [
"public",
"static",
"TransposeDataCollection",
"randomSampling",
"(",
"TransposeDataList",
"clusterIdList",
",",
"int",
"sampleM",
")",
"{",
"TransposeDataCollection",
"sampledIds",
"=",
"new",
"TransposeDataCollection",
"(",
")",
";",
"Object",
"[",
"]",
"selectedClust... | Samples m clusters by using Cluster Sampling
@param clusterIdList
@param sampleM
@return | [
"Samples",
"m",
"clusters",
"by",
"using",
"Cluster",
"Sampling"
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/ClusterSampling.java#L59-L72 |
knowm/Sundial | src/main/java/org/knowm/sundial/SundialJobScheduler.java | SundialJobScheduler.stopJob | public static void stopJob(String jobName, String key, String pValue)
throws SundialSchedulerException {
logger.debug("key= " + key);
logger.debug("value= " + pValue);
try {
List<JobExecutionContext> currentlyExecutingJobs = getScheduler().getCurrentlyExecutingJobs();
for (JobExecutionContext jobExecutionContext : currentlyExecutingJobs) {
String currentlyExecutingJobName = jobExecutionContext.getJobDetail().getName();
if (currentlyExecutingJobName.equals(jobName)) {
if (jobExecutionContext.getJobInstance() instanceof Job) {
JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap();
String value = jobDataMap.getString(key);
if (value != null & value.equalsIgnoreCase(pValue)) {
((Job) jobExecutionContext.getJobInstance()).interrupt();
}
} else {
logger.warn("CANNOT STOP NON-INTERRUPTABLE JOB!!!");
}
} else {
logger.debug("Non-matching Job found. Not Stopping!");
}
}
} catch (SchedulerException e) {
throw new SundialSchedulerException("ERROR DURING STOP JOB!!!", e);
}
} | java | public static void stopJob(String jobName, String key, String pValue)
throws SundialSchedulerException {
logger.debug("key= " + key);
logger.debug("value= " + pValue);
try {
List<JobExecutionContext> currentlyExecutingJobs = getScheduler().getCurrentlyExecutingJobs();
for (JobExecutionContext jobExecutionContext : currentlyExecutingJobs) {
String currentlyExecutingJobName = jobExecutionContext.getJobDetail().getName();
if (currentlyExecutingJobName.equals(jobName)) {
if (jobExecutionContext.getJobInstance() instanceof Job) {
JobDataMap jobDataMap = jobExecutionContext.getMergedJobDataMap();
String value = jobDataMap.getString(key);
if (value != null & value.equalsIgnoreCase(pValue)) {
((Job) jobExecutionContext.getJobInstance()).interrupt();
}
} else {
logger.warn("CANNOT STOP NON-INTERRUPTABLE JOB!!!");
}
} else {
logger.debug("Non-matching Job found. Not Stopping!");
}
}
} catch (SchedulerException e) {
throw new SundialSchedulerException("ERROR DURING STOP JOB!!!", e);
}
} | [
"public",
"static",
"void",
"stopJob",
"(",
"String",
"jobName",
",",
"String",
"key",
",",
"String",
"pValue",
")",
"throws",
"SundialSchedulerException",
"{",
"logger",
".",
"debug",
"(",
"\"key= \"",
"+",
"key",
")",
";",
"logger",
".",
"debug",
"(",
"\... | Triggers a Job interrupt on all Jobs matching the given Job Name, key and (String) value.
Doesn't work if the value is not a String. The Job termination mechanism works by setting a
flag that the Job should be terminated, but it is up to the logic in the Job to decide at what
point termination should occur. Therefore, in any long-running job that you anticipate the need
to terminate, put the method call checkTerminated() at an appropriate location.
@param jobName The job name
@param key The key in the job data map
@param pValue The value in the job data map | [
"Triggers",
"a",
"Job",
"interrupt",
"on",
"all",
"Jobs",
"matching",
"the",
"given",
"Job",
"Name",
"key",
"and",
"(",
"String",
")",
"value",
".",
"Doesn",
"t",
"work",
"if",
"the",
"value",
"is",
"not",
"a",
"String",
".",
"The",
"Job",
"termination... | train | https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/knowm/sundial/SundialJobScheduler.java#L358-L384 |
Faylixe/googlecodejam-client | src/main/java/fr/faylixe/googlecodejam/client/executor/HttpRequestExecutor.java | HttpRequestExecutor.buildFilePart | public static Part buildFilePart(final String name, final File file) throws IOException {
//Files.probeContentType(file.toPath()) always returns null due to unfixed jdk bug
//using Tika to fetch file mime type instead
final String type = new Tika().detect(file);
final FileContent content = new FileContent(type, file);
final Part part = new Part(content);
final HttpHeaders headers = new HttpHeaders();
final String disposition = String.format(Request.FILE_CONTENT_DISPOSITION, name, file.getName());
headers.set(Request.CONTENT_DISPOSITION, disposition);
part.setHeaders(headers);
return part;
} | java | public static Part buildFilePart(final String name, final File file) throws IOException {
//Files.probeContentType(file.toPath()) always returns null due to unfixed jdk bug
//using Tika to fetch file mime type instead
final String type = new Tika().detect(file);
final FileContent content = new FileContent(type, file);
final Part part = new Part(content);
final HttpHeaders headers = new HttpHeaders();
final String disposition = String.format(Request.FILE_CONTENT_DISPOSITION, name, file.getName());
headers.set(Request.CONTENT_DISPOSITION, disposition);
part.setHeaders(headers);
return part;
} | [
"public",
"static",
"Part",
"buildFilePart",
"(",
"final",
"String",
"name",
",",
"final",
"File",
"file",
")",
"throws",
"IOException",
"{",
"//Files.probeContentType(file.toPath()) always returns null due to unfixed jdk bug",
"//using Tika to fetch file mime type instead",
"fin... | Static factory method that creates a {@link Part} which contains
file form data.
@param name name Name of the POST file data to create part for.
@param file File of the POST data to create part for.
@return Created data part.
@throws IOException If any any error occurs during file type detection. | [
"Static",
"factory",
"method",
"that",
"creates",
"a",
"{",
"@link",
"Part",
"}",
"which",
"contains",
"file",
"form",
"data",
"."
] | train | https://github.com/Faylixe/googlecodejam-client/blob/84a5fed4e049dca48994dc3f70213976aaff4bd3/src/main/java/fr/faylixe/googlecodejam/client/executor/HttpRequestExecutor.java#L143-L154 |
strator-dev/greenpepper | greenpepper/greenpepper-server/src/main/java/com/greenpepper/server/GreenPepperServerServiceImpl.java | GreenPepperServerServiceImpl.getAllRunners | public List<Runner> getAllRunners() throws GreenPepperServerException {
try {
sessionService.startSession();
List<Runner> runners = sutDao.getAllRunners();
log.debug("Retrieved All Runner number: " + runners.size());
return runners;
} catch (Exception ex) {
throw handleException(ERROR, ex);
} finally {
sessionService.closeSession();
}
} | java | public List<Runner> getAllRunners() throws GreenPepperServerException {
try {
sessionService.startSession();
List<Runner> runners = sutDao.getAllRunners();
log.debug("Retrieved All Runner number: " + runners.size());
return runners;
} catch (Exception ex) {
throw handleException(ERROR, ex);
} finally {
sessionService.closeSession();
}
} | [
"public",
"List",
"<",
"Runner",
">",
"getAllRunners",
"(",
")",
"throws",
"GreenPepperServerException",
"{",
"try",
"{",
"sessionService",
".",
"startSession",
"(",
")",
";",
"List",
"<",
"Runner",
">",
"runners",
"=",
"sutDao",
".",
"getAllRunners",
"(",
"... | <p>getAllRunners.</p>
@inheritDoc NO NEEDS TO SECURE THIS
@return a {@link java.util.List} object.
@throws com.greenpepper.server.GreenPepperServerException if any. | [
"<p",
">",
"getAllRunners",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-server/src/main/java/com/greenpepper/server/GreenPepperServerServiceImpl.java#L186-L200 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java | CmsResultsTab.addContentItems | protected void addContentItems(List<CmsResultItemBean> list, boolean front, boolean showPath) {
if (front) {
list = Lists.reverse(list);
}
for (CmsResultItemBean resultItem : list) {
addSingleResult(resultItem, front, showPath);
}
if (isTilingViewAllowed()) {
m_selectView.getElement().getStyle().clearDisplay();
selectView(m_selectView.getFormValueAsString());
} else {
m_selectView.getElement().getStyle().setDisplay(Display.NONE);
selectView(DETAILS);
}
onContentChange();
} | java | protected void addContentItems(List<CmsResultItemBean> list, boolean front, boolean showPath) {
if (front) {
list = Lists.reverse(list);
}
for (CmsResultItemBean resultItem : list) {
addSingleResult(resultItem, front, showPath);
}
if (isTilingViewAllowed()) {
m_selectView.getElement().getStyle().clearDisplay();
selectView(m_selectView.getFormValueAsString());
} else {
m_selectView.getElement().getStyle().setDisplay(Display.NONE);
selectView(DETAILS);
}
onContentChange();
} | [
"protected",
"void",
"addContentItems",
"(",
"List",
"<",
"CmsResultItemBean",
">",
"list",
",",
"boolean",
"front",
",",
"boolean",
"showPath",
")",
"{",
"if",
"(",
"front",
")",
"{",
"list",
"=",
"Lists",
".",
"reverse",
"(",
"list",
")",
";",
"}",
"... | Adds list items for a list of search results.<p>
@param list the list of search results
@param front if true, list items will be added to the front of the list, else at the back
@param showPath <code>true</code> to show the resource path in sub title | [
"Adds",
"list",
"items",
"for",
"a",
"list",
"of",
"search",
"results",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsResultsTab.java#L517-L533 |
BlueBrain/bluima | modules/bluima_abbreviations/src/main/java/com/wcohen/ss/ApproxNeedlemanWunsch.java | ApproxNeedlemanWunsch.getAlignedChar | public int getAlignedChar(int iMinusOne,boolean preferHigherIndices)
{
// internally to this package, strings are indexed 1...N, so
// we need to convert from the usual 0...N-1 Java convention
int i = iMinusOne+1;
int bestJ = -1;
double bestScore = -Double.MAX_VALUE;
for (int j=mat.getFirstStoredEntryInRow(i); j<=mat.getLastStoredEntryInRow(i); j++) {
if (mat.outOfRange(i,j)) log.error("out of range: "+i+","+j);
double score = mat.get(i,j);
if ((score>bestScore) || (score==bestScore && preferHigherIndices)) {
bestScore = score; bestJ = j;
}
}
// convert back to the usual 0...N-1 Java convention
return bestJ-1;
} | java | public int getAlignedChar(int iMinusOne,boolean preferHigherIndices)
{
// internally to this package, strings are indexed 1...N, so
// we need to convert from the usual 0...N-1 Java convention
int i = iMinusOne+1;
int bestJ = -1;
double bestScore = -Double.MAX_VALUE;
for (int j=mat.getFirstStoredEntryInRow(i); j<=mat.getLastStoredEntryInRow(i); j++) {
if (mat.outOfRange(i,j)) log.error("out of range: "+i+","+j);
double score = mat.get(i,j);
if ((score>bestScore) || (score==bestScore && preferHigherIndices)) {
bestScore = score; bestJ = j;
}
}
// convert back to the usual 0...N-1 Java convention
return bestJ-1;
} | [
"public",
"int",
"getAlignedChar",
"(",
"int",
"iMinusOne",
",",
"boolean",
"preferHigherIndices",
")",
"{",
"// internally to this package, strings are indexed 1...N, so\r",
"// we need to convert from the usual 0...N-1 Java convention\r",
"int",
"i",
"=",
"iMinusOne",
"+",
"1",... | Find a character in the first string, s, that can be aligned
with the i-th character in the second string, t. | [
"Find",
"a",
"character",
"in",
"the",
"first",
"string",
"s",
"that",
"can",
"be",
"aligned",
"with",
"the",
"i",
"-",
"th",
"character",
"in",
"the",
"second",
"string",
"t",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/ApproxNeedlemanWunsch.java#L59-L76 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/CommonSteps.java | CommonSteps.doUntil | @Lorsque("Si '(.*)' vérifie '(.*)', je fais jusqu'à '(.*)' respecte '(.*)' avec '(.*)' essais maxi:")
@Then("If '(.*)' matches '(.*)', I do until '(.*)' respects '(.*)' with '(.*)' max tries:")
public void doUntil(String actual, String expected, String key, String breakCondition, int tries, List<GherkinConditionedLoopedStep> conditions) {
try {
if (new GherkinStepCondition("doUntilKey", expected, actual).checkCondition()) {
int i = 0;
do {
i++;
runAllStepsInLoop(conditions);
} while (!Pattern.compile(breakCondition).matcher(Context.getValue(key) == null ? "" : Context.getValue(key)).find() && i <= tries);
}
} catch (final TechnicalException e) {
throw new AssertError(Messages.getMessage(TechnicalException.TECHNICAL_SUBSTEP_ERROR_MESSAGE) + e.getMessage());
}
} | java | @Lorsque("Si '(.*)' vérifie '(.*)', je fais jusqu'à '(.*)' respecte '(.*)' avec '(.*)' essais maxi:")
@Then("If '(.*)' matches '(.*)', I do until '(.*)' respects '(.*)' with '(.*)' max tries:")
public void doUntil(String actual, String expected, String key, String breakCondition, int tries, List<GherkinConditionedLoopedStep> conditions) {
try {
if (new GherkinStepCondition("doUntilKey", expected, actual).checkCondition()) {
int i = 0;
do {
i++;
runAllStepsInLoop(conditions);
} while (!Pattern.compile(breakCondition).matcher(Context.getValue(key) == null ? "" : Context.getValue(key)).find() && i <= tries);
}
} catch (final TechnicalException e) {
throw new AssertError(Messages.getMessage(TechnicalException.TECHNICAL_SUBSTEP_ERROR_MESSAGE) + e.getMessage());
}
} | [
"@",
"Lorsque",
"(",
"\"Si '(.*)' vérifie '(.*)', je fais jusqu'à '(.*)' respecte '(.*)' avec '(.*)' essais maxi:\")\r",
"",
"@",
"Then",
"(",
"\"If '(.*)' matches '(.*)', I do until '(.*)' respects '(.*)' with '(.*)' max tries:\"",
")",
"public",
"void",
"doUntil",
"(",
"String",
"act... | Does steps execution until a given condition is unverified.
@param actual
actual value for global condition.
@param expected
expected value for global condition.
@param key
key of 'expected' values ('actual' values)
@param breakCondition
'expected' values
@param tries
number of max tries (no infinity loop).
@param conditions
list of steps run in a loop. | [
"Does",
"steps",
"execution",
"until",
"a",
"given",
"condition",
"is",
"unverified",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L160-L174 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.fromVisitedInstruction | public static SourceLineAnnotation fromVisitedInstruction(ClassContext classContext, Method method, InstructionHandle handle) {
return fromVisitedInstruction(classContext, method, handle.getPosition());
} | java | public static SourceLineAnnotation fromVisitedInstruction(ClassContext classContext, Method method, InstructionHandle handle) {
return fromVisitedInstruction(classContext, method, handle.getPosition());
} | [
"public",
"static",
"SourceLineAnnotation",
"fromVisitedInstruction",
"(",
"ClassContext",
"classContext",
",",
"Method",
"method",
",",
"InstructionHandle",
"handle",
")",
"{",
"return",
"fromVisitedInstruction",
"(",
"classContext",
",",
"method",
",",
"handle",
".",
... | Create from Method and InstructionHandle in a visited class.
@param classContext
ClassContext of visited class
@param method
Method in visited class
@param handle
InstructionHandle in visited class
@return SourceLineAnnotation describing visited instruction | [
"Create",
"from",
"Method",
"and",
"InstructionHandle",
"in",
"a",
"visited",
"class",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L414-L416 |
roboconf/roboconf-platform | core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/nagios/LiveStatusClient.java | LiveStatusClient.format | String format( String request, String liveStatusResponse ) {
String columnsDecl = null;
for( String s : request.split( "\n" )) {
s = s.trim();
if( s.toLowerCase().startsWith( NAGIOS_COLUMNS )) {
columnsDecl = s.substring( NAGIOS_COLUMNS.length()).trim();
break;
}
}
String result = liveStatusResponse;
if( columnsDecl != null ) {
columnsDecl = columnsDecl.replaceAll( "\\s+", ";" );
result = columnsDecl + "\n" + result;
}
return result;
} | java | String format( String request, String liveStatusResponse ) {
String columnsDecl = null;
for( String s : request.split( "\n" )) {
s = s.trim();
if( s.toLowerCase().startsWith( NAGIOS_COLUMNS )) {
columnsDecl = s.substring( NAGIOS_COLUMNS.length()).trim();
break;
}
}
String result = liveStatusResponse;
if( columnsDecl != null ) {
columnsDecl = columnsDecl.replaceAll( "\\s+", ";" );
result = columnsDecl + "\n" + result;
}
return result;
} | [
"String",
"format",
"(",
"String",
"request",
",",
"String",
"liveStatusResponse",
")",
"{",
"String",
"columnsDecl",
"=",
"null",
";",
"for",
"(",
"String",
"s",
":",
"request",
".",
"split",
"(",
"\"\\n\"",
")",
")",
"{",
"s",
"=",
"s",
".",
"trim",
... | When columns are specified, Live Status omits the column names.
<p>
This method adds them.
</p>
@param liveStatusResponse the (non-null) response
@return a non-null string | [
"When",
"columns",
"are",
"specified",
"Live",
"Status",
"omits",
"the",
"column",
"names",
".",
"<p",
">",
"This",
"method",
"adds",
"them",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/nagios/LiveStatusClient.java#L113-L131 |
ziccardi/jnrpe | jnrpe-lib/src/main/java/it/jnrpe/utils/PluginRepositoryUtil.java | PluginRepositoryUtil.parseCommandLine | @SuppressWarnings("rawtypes")
private static void parseCommandLine(final PluginDefinition pluginDef, final Element xmlPluginElement) {
Element commandLine = xmlPluginElement.element("command-line");
if (commandLine != null) {
// The plugin has a command line...
Element options = commandLine.element("options");
if (options == null) {
// The command line is empty...
return;
}
for (Iterator<Element> i = options.elementIterator(); i.hasNext();) {
pluginDef.addOption(parsePluginOption(i.next()));
}
}
} | java | @SuppressWarnings("rawtypes")
private static void parseCommandLine(final PluginDefinition pluginDef, final Element xmlPluginElement) {
Element commandLine = xmlPluginElement.element("command-line");
if (commandLine != null) {
// The plugin has a command line...
Element options = commandLine.element("options");
if (options == null) {
// The command line is empty...
return;
}
for (Iterator<Element> i = options.elementIterator(); i.hasNext();) {
pluginDef.addOption(parsePluginOption(i.next()));
}
}
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"private",
"static",
"void",
"parseCommandLine",
"(",
"final",
"PluginDefinition",
"pluginDef",
",",
"final",
"Element",
"xmlPluginElement",
")",
"{",
"Element",
"commandLine",
"=",
"xmlPluginElement",
".",
"element",... | Updates the plugin definition with the commandline read from the xml
file.
@param pluginDef
The plugin definition to be updated
@param xmlPluginElement
the xml element to be parsed | [
"Updates",
"the",
"plugin",
"definition",
"with",
"the",
"commandline",
"read",
"from",
"the",
"xml",
"file",
"."
] | train | https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/utils/PluginRepositoryUtil.java#L245-L262 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/protocol/AuroraProtocol.java | AuroraProtocol.resetHostList | private static void resetHostList(AuroraListener listener, Deque<HostAddress> loopAddresses) {
//if all servers have been connected without result
//add back all servers
List<HostAddress> servers = new ArrayList<>();
servers.addAll(listener.getUrlParser().getHostAddresses());
Collections.shuffle(servers);
//if cluster host is set, add it to the end of the list
if (listener.getClusterHostAddress() != null
&& listener.getUrlParser().getHostAddresses().size() < 2) {
servers.add(listener.getClusterHostAddress());
}
//remove current connected hosts to avoid reconnect them
servers.removeAll(listener.connectedHosts());
loopAddresses.clear();
loopAddresses.addAll(servers);
} | java | private static void resetHostList(AuroraListener listener, Deque<HostAddress> loopAddresses) {
//if all servers have been connected without result
//add back all servers
List<HostAddress> servers = new ArrayList<>();
servers.addAll(listener.getUrlParser().getHostAddresses());
Collections.shuffle(servers);
//if cluster host is set, add it to the end of the list
if (listener.getClusterHostAddress() != null
&& listener.getUrlParser().getHostAddresses().size() < 2) {
servers.add(listener.getClusterHostAddress());
}
//remove current connected hosts to avoid reconnect them
servers.removeAll(listener.connectedHosts());
loopAddresses.clear();
loopAddresses.addAll(servers);
} | [
"private",
"static",
"void",
"resetHostList",
"(",
"AuroraListener",
"listener",
",",
"Deque",
"<",
"HostAddress",
">",
"loopAddresses",
")",
"{",
"//if all servers have been connected without result",
"//add back all servers",
"List",
"<",
"HostAddress",
">",
"servers",
... | Reinitialize loopAddresses with all hosts : all servers in randomize order with cluster
address. If there is an active connection, connected host are remove from list.
@param listener current listener
@param loopAddresses the list to reinitialize | [
"Reinitialize",
"loopAddresses",
"with",
"all",
"hosts",
":",
"all",
"servers",
"in",
"randomize",
"order",
"with",
"cluster",
"address",
".",
"If",
"there",
"is",
"an",
"active",
"connection",
"connected",
"host",
"are",
"remove",
"from",
"list",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/protocol/AuroraProtocol.java#L306-L325 |
spotify/crtauth-java | src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java | CrtAuthCodec.getAuthenticationCode | private static byte[] getAuthenticationCode(byte[] secret, byte[] data, int length) {
try {
SecretKey secretKey = new SecretKeySpec(secret, MAC_ALGORITHM);
Mac mac = Mac.getInstance(MAC_ALGORITHM);
mac.init(secretKey);
mac.update(data, 0, length);
return mac.doFinal();
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | private static byte[] getAuthenticationCode(byte[] secret, byte[] data, int length) {
try {
SecretKey secretKey = new SecretKeySpec(secret, MAC_ALGORITHM);
Mac mac = Mac.getInstance(MAC_ALGORITHM);
mac.init(secretKey);
mac.update(data, 0, length);
return mac.doFinal();
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"private",
"static",
"byte",
"[",
"]",
"getAuthenticationCode",
"(",
"byte",
"[",
"]",
"secret",
",",
"byte",
"[",
"]",
"data",
",",
"int",
"length",
")",
"{",
"try",
"{",
"SecretKey",
"secretKey",
"=",
"new",
"SecretKeySpec",
"(",
"secret",
",",
"MAC_AL... | Calculate and return a keyed hash message authentication code, HMAC, as specified in RFC2104
using SHA256 as hash function.
@param secret the secret used to authenticate
@param data the data to authenticate
@param length the number of bytes from data to use when calculating the HMAC
@return an HMAC code for the specified data and secret | [
"Calculate",
"and",
"return",
"a",
"keyed",
"hash",
"message",
"authentication",
"code",
"HMAC",
"as",
"specified",
"in",
"RFC2104",
"using",
"SHA256",
"as",
"hash",
"function",
"."
] | train | https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/protocol/CrtAuthCodec.java#L183-L193 |
Terradue/jcatalogue-client | apis/src/main/java/com/terradue/jcatalogue/repository/Proxy.java | Proxy.setHost | public Proxy setHost( String host )
{
if ( this.host.equals( host ) || ( host == null && this.host.length() <= 0 ) )
{
return this;
}
return new Proxy( type, host, port, auth );
} | java | public Proxy setHost( String host )
{
if ( this.host.equals( host ) || ( host == null && this.host.length() <= 0 ) )
{
return this;
}
return new Proxy( type, host, port, auth );
} | [
"public",
"Proxy",
"setHost",
"(",
"String",
"host",
")",
"{",
"if",
"(",
"this",
".",
"host",
".",
"equals",
"(",
"host",
")",
"||",
"(",
"host",
"==",
"null",
"&&",
"this",
".",
"host",
".",
"length",
"(",
")",
"<=",
"0",
")",
")",
"{",
"retu... | Sets the host of the proxy.
@param host The host of the proxy, may be {@code null}.
@return The new proxy, never {@code null}. | [
"Sets",
"the",
"host",
"of",
"the",
"proxy",
"."
] | train | https://github.com/Terradue/jcatalogue-client/blob/1f24c4da952d8ad2373c4fa97eed48b0b8a88d21/apis/src/main/java/com/terradue/jcatalogue/repository/Proxy.java#L104-L111 |
JavaMoney/jsr354-ri-bp | src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryConversionsSingletonSpi.java | BaseMonetaryConversionsSingletonSpi.isConversionAvailable | public boolean isConversionAvailable(CurrencyUnit termCurrency, String... providers) {
return isConversionAvailable(
ConversionQueryBuilder.of().setTermCurrency(termCurrency).setProviderNames(providers).build());
} | java | public boolean isConversionAvailable(CurrencyUnit termCurrency, String... providers) {
return isConversionAvailable(
ConversionQueryBuilder.of().setTermCurrency(termCurrency).setProviderNames(providers).build());
} | [
"public",
"boolean",
"isConversionAvailable",
"(",
"CurrencyUnit",
"termCurrency",
",",
"String",
"...",
"providers",
")",
"{",
"return",
"isConversionAvailable",
"(",
"ConversionQueryBuilder",
".",
"of",
"(",
")",
".",
"setTermCurrency",
"(",
"termCurrency",
")",
"... | Allows to quickly check, if a {@link javax.money.convert.CurrencyConversion} is accessible for the given
{@link javax.money.convert.ConversionQuery}.
@param termCurrency the terminating/target currency unit, not null.
@param providers the provider names defines a corresponding
provider chain that must be encapsulated by the resulting {@link javax
.money.convert.CurrencyConversion}. By default the provider
chain as defined by #getDefaultRoundingProviderChain will be used.
@return {@code true}, if such a conversion is supported, meaning an according
{@link javax.money.convert.CurrencyConversion} can be
accessed.
@see #getConversion(javax.money.convert.ConversionQuery)
@see #getConversion(javax.money.CurrencyUnit, String...)} | [
"Allows",
"to",
"quickly",
"check",
"if",
"a",
"{",
"@link",
"javax",
".",
"money",
".",
"convert",
".",
"CurrencyConversion",
"}",
"is",
"accessible",
"for",
"the",
"given",
"{",
"@link",
"javax",
".",
"money",
".",
"convert",
".",
"ConversionQuery",
"}",... | train | https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/spi/base/BaseMonetaryConversionsSingletonSpi.java#L105-L108 |
javafxports/javafxmobile-plugin | src/main/java/org/javafxports/jfxmobile/plugin/android/task/ApkBuilder.java | ApkBuilder.checkFileForPackaging | public static boolean checkFileForPackaging(String fileName) {
String[] fileSegments = fileName.split("\\.");
String fileExt = "";
if (fileSegments.length > 1) {
fileExt = fileSegments[fileSegments.length-1];
}
return checkFileForPackaging(fileName, fileExt);
} | java | public static boolean checkFileForPackaging(String fileName) {
String[] fileSegments = fileName.split("\\.");
String fileExt = "";
if (fileSegments.length > 1) {
fileExt = fileSegments[fileSegments.length-1];
}
return checkFileForPackaging(fileName, fileExt);
} | [
"public",
"static",
"boolean",
"checkFileForPackaging",
"(",
"String",
"fileName",
")",
"{",
"String",
"[",
"]",
"fileSegments",
"=",
"fileName",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"String",
"fileExt",
"=",
"\"\"",
";",
"if",
"(",
"fileSegments",
".",... | Checks a file to make sure it should be packaged as standard resources.
@param fileName the name of the file (including extension)
@return true if the file should be packaged as standard java resources. | [
"Checks",
"a",
"file",
"to",
"make",
"sure",
"it",
"should",
"be",
"packaged",
"as",
"standard",
"resources",
"."
] | train | https://github.com/javafxports/javafxmobile-plugin/blob/a9bef513b7e1bfa85f9a668226e6943c6d9f847f/src/main/java/org/javafxports/jfxmobile/plugin/android/task/ApkBuilder.java#L1020-L1028 |
liferay/com-liferay-commerce | commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java | CommerceNotificationTemplatePersistenceImpl.removeByUUID_G | @Override
public CommerceNotificationTemplate removeByUUID_G(String uuid, long groupId)
throws NoSuchNotificationTemplateException {
CommerceNotificationTemplate commerceNotificationTemplate = findByUUID_G(uuid,
groupId);
return remove(commerceNotificationTemplate);
} | java | @Override
public CommerceNotificationTemplate removeByUUID_G(String uuid, long groupId)
throws NoSuchNotificationTemplateException {
CommerceNotificationTemplate commerceNotificationTemplate = findByUUID_G(uuid,
groupId);
return remove(commerceNotificationTemplate);
} | [
"@",
"Override",
"public",
"CommerceNotificationTemplate",
"removeByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchNotificationTemplateException",
"{",
"CommerceNotificationTemplate",
"commerceNotificationTemplate",
"=",
"findByUUID_G",
"(",
"uu... | Removes the commerce notification template where uuid = ? and groupId = ? from the database.
@param uuid the uuid
@param groupId the group ID
@return the commerce notification template that was removed | [
"Removes",
"the",
"commerce",
"notification",
"template",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"from",
"the",
"database",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L827-L834 |
VoltDB/voltdb | third_party/java/src/com/google_voltpatches/common/io/CharStreams.java | CharStreams.copy | @CanIgnoreReturnValue
public static long copy(Readable from, Appendable to) throws IOException {
checkNotNull(from);
checkNotNull(to);
CharBuffer buf = createBuffer();
long total = 0;
while (from.read(buf) != -1) {
buf.flip();
to.append(buf);
total += buf.remaining();
buf.clear();
}
return total;
} | java | @CanIgnoreReturnValue
public static long copy(Readable from, Appendable to) throws IOException {
checkNotNull(from);
checkNotNull(to);
CharBuffer buf = createBuffer();
long total = 0;
while (from.read(buf) != -1) {
buf.flip();
to.append(buf);
total += buf.remaining();
buf.clear();
}
return total;
} | [
"@",
"CanIgnoreReturnValue",
"public",
"static",
"long",
"copy",
"(",
"Readable",
"from",
",",
"Appendable",
"to",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"from",
")",
";",
"checkNotNull",
"(",
"to",
")",
";",
"CharBuffer",
"buf",
"=",
"creat... | Copies all characters between the {@link Readable} and {@link Appendable} objects. Does not
close or flush either object.
@param from the object to read from
@param to the object to write to
@return the number of characters copied
@throws IOException if an I/O error occurs | [
"Copies",
"all",
"characters",
"between",
"the",
"{",
"@link",
"Readable",
"}",
"and",
"{",
"@link",
"Appendable",
"}",
"objects",
".",
"Does",
"not",
"close",
"or",
"flush",
"either",
"object",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/io/CharStreams.java#L68-L81 |
elki-project/elki | elki-database/src/main/java/de/lmu/ifi/dbs/elki/database/query/knn/LinearScanDistanceKNNQuery.java | LinearScanDistanceKNNQuery.linearScanBatchKNN | private void linearScanBatchKNN(ArrayDBIDs ids, List<KNNHeap> heaps) {
final DistanceQuery<O> dq = distanceQuery;
// The distance is computed on database IDs
for(DBIDIter iter = getRelation().getDBIDs().iter(); iter.valid(); iter.advance()) {
int index = 0;
for(DBIDIter iter2 = ids.iter(); iter2.valid(); iter2.advance(), index++) {
KNNHeap heap = heaps.get(index);
heap.insert(dq.distance(iter2, iter), iter);
}
}
} | java | private void linearScanBatchKNN(ArrayDBIDs ids, List<KNNHeap> heaps) {
final DistanceQuery<O> dq = distanceQuery;
// The distance is computed on database IDs
for(DBIDIter iter = getRelation().getDBIDs().iter(); iter.valid(); iter.advance()) {
int index = 0;
for(DBIDIter iter2 = ids.iter(); iter2.valid(); iter2.advance(), index++) {
KNNHeap heap = heaps.get(index);
heap.insert(dq.distance(iter2, iter), iter);
}
}
} | [
"private",
"void",
"linearScanBatchKNN",
"(",
"ArrayDBIDs",
"ids",
",",
"List",
"<",
"KNNHeap",
">",
"heaps",
")",
"{",
"final",
"DistanceQuery",
"<",
"O",
">",
"dq",
"=",
"distanceQuery",
";",
"// The distance is computed on database IDs",
"for",
"(",
"DBIDIter",... | Linear batch knn for arbitrary distance functions.
@param ids DBIDs to process
@param heaps Heaps to store the results in | [
"Linear",
"batch",
"knn",
"for",
"arbitrary",
"distance",
"functions",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-database/src/main/java/de/lmu/ifi/dbs/elki/database/query/knn/LinearScanDistanceKNNQuery.java#L103-L113 |
landawn/AbacusUtil | src/com/landawn/abacus/util/DateUtil.java | DateUtil.parseGregorianCalendar | public static GregorianCalendar parseGregorianCalendar(final String calendar, final String format, final TimeZone timeZone) {
if (N.isNullOrEmpty(calendar) || (calendar.length() == 4 && "null".equalsIgnoreCase(calendar))) {
return null;
}
return createGregorianCalendar(parse(calendar, format, timeZone));
} | java | public static GregorianCalendar parseGregorianCalendar(final String calendar, final String format, final TimeZone timeZone) {
if (N.isNullOrEmpty(calendar) || (calendar.length() == 4 && "null".equalsIgnoreCase(calendar))) {
return null;
}
return createGregorianCalendar(parse(calendar, format, timeZone));
} | [
"public",
"static",
"GregorianCalendar",
"parseGregorianCalendar",
"(",
"final",
"String",
"calendar",
",",
"final",
"String",
"format",
",",
"final",
"TimeZone",
"timeZone",
")",
"{",
"if",
"(",
"N",
".",
"isNullOrEmpty",
"(",
"calendar",
")",
"||",
"(",
"cal... | Converts the specified <code>calendar</code> with the specified {@code format} to a new instance of GregorianCalendar.
<code>null</code> is returned if the specified <code>date</code> is null or empty.
@param calendar
@param format
@param timeZone
@return | [
"Converts",
"the",
"specified",
"<code",
">",
"calendar<",
"/",
"code",
">",
"with",
"the",
"specified",
"{",
"@code",
"format",
"}",
"to",
"a",
"new",
"instance",
"of",
"GregorianCalendar",
".",
"<code",
">",
"null<",
"/",
"code",
">",
"is",
"returned",
... | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L508-L514 |
apache/flink | flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java | SqlDateTimeUtils.dateToInternal | public static int dateToInternal(java.sql.Date date, TimeZone tz) {
long ts = date.getTime() + tz.getOffset(date.getTime());
return (int) (ts / MILLIS_PER_DAY);
} | java | public static int dateToInternal(java.sql.Date date, TimeZone tz) {
long ts = date.getTime() + tz.getOffset(date.getTime());
return (int) (ts / MILLIS_PER_DAY);
} | [
"public",
"static",
"int",
"dateToInternal",
"(",
"java",
".",
"sql",
".",
"Date",
"date",
",",
"TimeZone",
"tz",
")",
"{",
"long",
"ts",
"=",
"date",
".",
"getTime",
"(",
")",
"+",
"tz",
".",
"getOffset",
"(",
"date",
".",
"getTime",
"(",
")",
")"... | Converts the Java type used for UDF parameters of SQL DATE type
({@link java.sql.Date}) to internal representation (int).
<p>Converse of {@link #internalToDate(int)}. | [
"Converts",
"the",
"Java",
"type",
"used",
"for",
"UDF",
"parameters",
"of",
"SQL",
"DATE",
"type",
"(",
"{",
"@link",
"java",
".",
"sql",
".",
"Date",
"}",
")",
"to",
"internal",
"representation",
"(",
"int",
")",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/functions/SqlDateTimeUtils.java#L180-L183 |
apache/incubator-shardingsphere | sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/MySQLCommandPacketFactory.java | MySQLCommandPacketFactory.newInstance | public static MySQLCommandPacket newInstance(final MySQLCommandPacketType commandPacketType, final MySQLPacketPayload payload) throws SQLException {
switch (commandPacketType) {
case COM_QUIT:
return new MySQLComQuitPacket();
case COM_INIT_DB:
return new MySQLComInitDbPacket(payload);
case COM_FIELD_LIST:
return new MySQLComFieldListPacket(payload);
case COM_QUERY:
return new MySQLComQueryPacket(payload);
case COM_STMT_PREPARE:
return new MySQLComStmtPreparePacket(payload);
case COM_STMT_EXECUTE:
return new MySQLComStmtExecutePacket(payload);
case COM_STMT_CLOSE:
return new MySQLComStmtClosePacket(payload);
case COM_PING:
return new MySQLComPingPacket();
default:
return new MySQLUnsupportedCommandPacket(commandPacketType);
}
} | java | public static MySQLCommandPacket newInstance(final MySQLCommandPacketType commandPacketType, final MySQLPacketPayload payload) throws SQLException {
switch (commandPacketType) {
case COM_QUIT:
return new MySQLComQuitPacket();
case COM_INIT_DB:
return new MySQLComInitDbPacket(payload);
case COM_FIELD_LIST:
return new MySQLComFieldListPacket(payload);
case COM_QUERY:
return new MySQLComQueryPacket(payload);
case COM_STMT_PREPARE:
return new MySQLComStmtPreparePacket(payload);
case COM_STMT_EXECUTE:
return new MySQLComStmtExecutePacket(payload);
case COM_STMT_CLOSE:
return new MySQLComStmtClosePacket(payload);
case COM_PING:
return new MySQLComPingPacket();
default:
return new MySQLUnsupportedCommandPacket(commandPacketType);
}
} | [
"public",
"static",
"MySQLCommandPacket",
"newInstance",
"(",
"final",
"MySQLCommandPacketType",
"commandPacketType",
",",
"final",
"MySQLPacketPayload",
"payload",
")",
"throws",
"SQLException",
"{",
"switch",
"(",
"commandPacketType",
")",
"{",
"case",
"COM_QUIT",
":"... | Create new instance of command packet.
@param commandPacketType command packet type for MySQL
@param payload packet payload for MySQL
@return command packet for MySQL
@throws SQLException SQL exception | [
"Create",
"new",
"instance",
"of",
"command",
"packet",
"."
] | train | https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-transport/sharding-proxy-transport-mysql/src/main/java/org/apache/shardingsphere/shardingproxy/transport/mysql/packet/command/MySQLCommandPacketFactory.java#L53-L74 |
RestComm/jdiameter | core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/helpers/IPConverter.java | IPConverter.InetAddressByIPv6 | public static InetAddress InetAddressByIPv6(String address) {
StringTokenizer addressTokens = new StringTokenizer(address, ":");
byte[] bytes = new byte[16];
if (addressTokens.countTokens() == 8) {
int count = 0;
while (addressTokens.hasMoreTokens()) {
int word = Integer.parseInt(addressTokens.nextToken(), 16);
bytes[count * 2] = (byte) ((word >> 8) & 0xff);
bytes[count * 2 + 1] = (byte) (word & 0xff);
count++;
}
}
else {
return null;
}
try {
return InetAddress.getByAddress(bytes);
} catch (UnknownHostException e) {
return null;
}
} | java | public static InetAddress InetAddressByIPv6(String address) {
StringTokenizer addressTokens = new StringTokenizer(address, ":");
byte[] bytes = new byte[16];
if (addressTokens.countTokens() == 8) {
int count = 0;
while (addressTokens.hasMoreTokens()) {
int word = Integer.parseInt(addressTokens.nextToken(), 16);
bytes[count * 2] = (byte) ((word >> 8) & 0xff);
bytes[count * 2 + 1] = (byte) (word & 0xff);
count++;
}
}
else {
return null;
}
try {
return InetAddress.getByAddress(bytes);
} catch (UnknownHostException e) {
return null;
}
} | [
"public",
"static",
"InetAddress",
"InetAddressByIPv6",
"(",
"String",
"address",
")",
"{",
"StringTokenizer",
"addressTokens",
"=",
"new",
"StringTokenizer",
"(",
"address",
",",
"\":\"",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"16",
"... | Convert defined string to IPv6 object instance
@param address string representation of ip address
@return IPv6 object instance | [
"Convert",
"defined",
"string",
"to",
"IPv6",
"object",
"instance"
] | train | https://github.com/RestComm/jdiameter/blob/672134c378ea9704bf06dbe1985872ad4ebf4640/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/helpers/IPConverter.java#L95-L115 |
Axway/Grapes | server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java | OrganizationResource.removeCorporateGroupIdPrefix | @DELETE
@Path("/{name}" + ServerAPI.GET_CORPORATE_GROUPIDS)
public Response removeCorporateGroupIdPrefix(@Auth final DbCredential credential, @PathParam("name") final String organizationId, final String corporateGroupId){
LOG.info("Got an remove a corporate groupId prefix request for organization " + organizationId +".");
if(!credential.getRoles().contains(DbCredential.AvailableRoles.DATA_UPDATER)){
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
if(corporateGroupId == null || corporateGroupId.isEmpty()){
LOG.error("No corporate GroupId to remove!");
return Response.serverError().status(HttpStatus.BAD_REQUEST_400).build();
}
getOrganizationHandler().removeCorporateGroupId(organizationId, corporateGroupId);
return Response.ok("done").build();
} | java | @DELETE
@Path("/{name}" + ServerAPI.GET_CORPORATE_GROUPIDS)
public Response removeCorporateGroupIdPrefix(@Auth final DbCredential credential, @PathParam("name") final String organizationId, final String corporateGroupId){
LOG.info("Got an remove a corporate groupId prefix request for organization " + organizationId +".");
if(!credential.getRoles().contains(DbCredential.AvailableRoles.DATA_UPDATER)){
throw new WebApplicationException(Response.status(Response.Status.UNAUTHORIZED).build());
}
if(corporateGroupId == null || corporateGroupId.isEmpty()){
LOG.error("No corporate GroupId to remove!");
return Response.serverError().status(HttpStatus.BAD_REQUEST_400).build();
}
getOrganizationHandler().removeCorporateGroupId(organizationId, corporateGroupId);
return Response.ok("done").build();
} | [
"@",
"DELETE",
"@",
"Path",
"(",
"\"/{name}\"",
"+",
"ServerAPI",
".",
"GET_CORPORATE_GROUPIDS",
")",
"public",
"Response",
"removeCorporateGroupIdPrefix",
"(",
"@",
"Auth",
"final",
"DbCredential",
"credential",
",",
"@",
"PathParam",
"(",
"\"name\"",
")",
"final... | Remove an existing Corporate GroupId from an organization.
@return Response | [
"Remove",
"an",
"existing",
"Corporate",
"GroupId",
"from",
"an",
"organization",
"."
] | train | https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/server/src/main/java/org/axway/grapes/server/webapp/resources/OrganizationResource.java#L172-L188 |
infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/base/CommandInterceptor.java | CommandInterceptor.invokeNextInterceptor | public final Object invokeNextInterceptor(InvocationContext ctx, VisitableCommand command) throws Throwable {
Object maybeStage = nextInterceptor.visitCommand(ctx, command);
if (maybeStage instanceof SimpleAsyncInvocationStage) {
return ((InvocationStage) maybeStage).get();
} else {
return maybeStage;
}
} | java | public final Object invokeNextInterceptor(InvocationContext ctx, VisitableCommand command) throws Throwable {
Object maybeStage = nextInterceptor.visitCommand(ctx, command);
if (maybeStage instanceof SimpleAsyncInvocationStage) {
return ((InvocationStage) maybeStage).get();
} else {
return maybeStage;
}
} | [
"public",
"final",
"Object",
"invokeNextInterceptor",
"(",
"InvocationContext",
"ctx",
",",
"VisitableCommand",
"command",
")",
"throws",
"Throwable",
"{",
"Object",
"maybeStage",
"=",
"nextInterceptor",
".",
"visitCommand",
"(",
"ctx",
",",
"command",
")",
";",
"... | Invokes the next interceptor in the chain. This is how interceptor implementations should pass a call up the
chain to the next interceptor.
@param ctx invocation context
@param command command to pass up the chain.
@return return value of the invocation
@throws Throwable in the event of problems | [
"Invokes",
"the",
"next",
"interceptor",
"in",
"the",
"chain",
".",
"This",
"is",
"how",
"interceptor",
"implementations",
"should",
"pass",
"a",
"call",
"up",
"the",
"chain",
"to",
"the",
"next",
"interceptor",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/base/CommandInterceptor.java#L117-L124 |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java | SheetRenderer.encodeFooter | private void encodeFooter(final FacesContext context, final ResponseWriter responseWriter, final Sheet sheet)
throws IOException {
// footer
final UIComponent footer = sheet.getFacet("footer");
if (footer != null) {
responseWriter.startElement("div", null);
responseWriter.writeAttribute("class", "ui-datatable-footer ui-widget-header ui-corner-bottom", null);
footer.encodeAll(context);
responseWriter.endElement("div");
}
} | java | private void encodeFooter(final FacesContext context, final ResponseWriter responseWriter, final Sheet sheet)
throws IOException {
// footer
final UIComponent footer = sheet.getFacet("footer");
if (footer != null) {
responseWriter.startElement("div", null);
responseWriter.writeAttribute("class", "ui-datatable-footer ui-widget-header ui-corner-bottom", null);
footer.encodeAll(context);
responseWriter.endElement("div");
}
} | [
"private",
"void",
"encodeFooter",
"(",
"final",
"FacesContext",
"context",
",",
"final",
"ResponseWriter",
"responseWriter",
",",
"final",
"Sheet",
"sheet",
")",
"throws",
"IOException",
"{",
"// footer",
"final",
"UIComponent",
"footer",
"=",
"sheet",
".",
"getF... | Encode the sheet footer
@param context
@param responseWriter
@param sheet
@throws IOException | [
"Encode",
"the",
"sheet",
"footer"
] | train | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L664-L674 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/Validate.java | Validate.notEmpty | public static <T extends CharSequence> T notEmpty(final T chars, final String message, final Object... values) {
if (chars == null) {
throw new NullPointerException(StringUtils.simpleFormat(message, values));
}
if (chars.length() == 0) {
throw new IllegalArgumentException(StringUtils.simpleFormat(message, values));
}
return chars;
} | java | public static <T extends CharSequence> T notEmpty(final T chars, final String message, final Object... values) {
if (chars == null) {
throw new NullPointerException(StringUtils.simpleFormat(message, values));
}
if (chars.length() == 0) {
throw new IllegalArgumentException(StringUtils.simpleFormat(message, values));
}
return chars;
} | [
"public",
"static",
"<",
"T",
"extends",
"CharSequence",
">",
"T",
"notEmpty",
"(",
"final",
"T",
"chars",
",",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"chars",
"==",
"null",
")",
"{",
"throw",
"new",... | <p>Validate that the specified argument character sequence is
neither {@code null} nor a length of zero (no characters);
otherwise throwing an exception with the specified message.
<pre>Validate.notEmpty(myString, "The string must not be empty");</pre>
@param <T> the character sequence type
@param chars the character sequence to check, validated not null by this method
@param message the {@link String#format(String, Object...)} exception message if invalid, not null
@param values the optional values for the formatted exception message, null array not recommended
@return the validated character sequence (never {@code null} method for chaining)
@throws NullPointerException if the character sequence is {@code null}
@throws IllegalArgumentException if the character sequence is empty
@see #notEmpty(CharSequence) | [
"<p",
">",
"Validate",
"that",
"the",
"specified",
"argument",
"character",
"sequence",
"is",
"neither",
"{",
"@code",
"null",
"}",
"nor",
"a",
"length",
"of",
"zero",
"(",
"no",
"characters",
")",
";",
"otherwise",
"throwing",
"an",
"exception",
"with",
"... | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L398-L406 |
a-schild/jave2 | jave-core/src/main/java/ws/schild/jave/MultimediaObject.java | MultimediaObject.getInfo | public MultimediaInfo getInfo() throws InputFormatException,
EncoderException {
if (inputFile.canRead())
{
FFMPEGExecutor ffmpeg = locator.createExecutor();
ffmpeg.addArgument("-i");
ffmpeg.addArgument(inputFile.getAbsolutePath());
try
{
ffmpeg.execute();
} catch (IOException e)
{
throw new EncoderException(e);
}
try
{
RBufferedReader reader = new RBufferedReader(new InputStreamReader(ffmpeg
.getErrorStream()));
return parseMultimediaInfo(inputFile, reader);
} finally
{
ffmpeg.destroy();
}
} else
{
throw new EncoderException("Input file not found <" + inputFile.getAbsolutePath() + ">");
}
} | java | public MultimediaInfo getInfo() throws InputFormatException,
EncoderException {
if (inputFile.canRead())
{
FFMPEGExecutor ffmpeg = locator.createExecutor();
ffmpeg.addArgument("-i");
ffmpeg.addArgument(inputFile.getAbsolutePath());
try
{
ffmpeg.execute();
} catch (IOException e)
{
throw new EncoderException(e);
}
try
{
RBufferedReader reader = new RBufferedReader(new InputStreamReader(ffmpeg
.getErrorStream()));
return parseMultimediaInfo(inputFile, reader);
} finally
{
ffmpeg.destroy();
}
} else
{
throw new EncoderException("Input file not found <" + inputFile.getAbsolutePath() + ">");
}
} | [
"public",
"MultimediaInfo",
"getInfo",
"(",
")",
"throws",
"InputFormatException",
",",
"EncoderException",
"{",
"if",
"(",
"inputFile",
".",
"canRead",
"(",
")",
")",
"{",
"FFMPEGExecutor",
"ffmpeg",
"=",
"locator",
".",
"createExecutor",
"(",
")",
";",
"ffmp... | Returns a set informations about a multimedia file, if its format is
supported for decoding.
@return A set of informations about the file and its contents.
@throws InputFormatException If the format of the source file cannot be
recognized and decoded.
@throws EncoderException If a problem occurs calling the underlying
ffmpeg executable. | [
"Returns",
"a",
"set",
"informations",
"about",
"a",
"multimedia",
"file",
"if",
"its",
"format",
"is",
"supported",
"for",
"decoding",
"."
] | train | https://github.com/a-schild/jave2/blob/1e7d6a1ca7c27cc63570f1aabb5c84ee124f3e26/jave-core/src/main/java/ws/schild/jave/MultimediaObject.java#L95-L122 |
voldemort/voldemort | src/java/voldemort/utils/RebalanceUtils.java | RebalanceUtils.dumpAnalysisToFile | public static void dumpAnalysisToFile(String outputDirName,
String baseFileName,
PartitionBalance partitionBalance) {
if(outputDirName != null) {
File outputDir = new File(outputDirName);
if(!outputDir.exists()) {
Utils.mkdirs(outputDir);
}
try {
FileUtils.writeStringToFile(new File(outputDirName, baseFileName + ".analysis"),
partitionBalance.toString());
} catch(IOException e) {
logger.error("IOException during dumpAnalysisToFile: " + e);
}
}
} | java | public static void dumpAnalysisToFile(String outputDirName,
String baseFileName,
PartitionBalance partitionBalance) {
if(outputDirName != null) {
File outputDir = new File(outputDirName);
if(!outputDir.exists()) {
Utils.mkdirs(outputDir);
}
try {
FileUtils.writeStringToFile(new File(outputDirName, baseFileName + ".analysis"),
partitionBalance.toString());
} catch(IOException e) {
logger.error("IOException during dumpAnalysisToFile: " + e);
}
}
} | [
"public",
"static",
"void",
"dumpAnalysisToFile",
"(",
"String",
"outputDirName",
",",
"String",
"baseFileName",
",",
"PartitionBalance",
"partitionBalance",
")",
"{",
"if",
"(",
"outputDirName",
"!=",
"null",
")",
"{",
"File",
"outputDir",
"=",
"new",
"File",
"... | Prints a balance analysis to a file.
@param outputDirName
@param baseFileName suffix '.analysis' is appended to baseFileName.
@param partitionBalance | [
"Prints",
"a",
"balance",
"analysis",
"to",
"a",
"file",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L595-L611 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/Graphics.java | Graphics.getPixel | public Color getPixel(int x, int y) {
predraw();
GL.glReadPixels(x, screenHeight - y, 1, 1, SGL.GL_RGBA,
SGL.GL_UNSIGNED_BYTE, readBuffer);
postdraw();
return new Color(translate(readBuffer.get(0)), translate(readBuffer
.get(1)), translate(readBuffer.get(2)), translate(readBuffer
.get(3)));
} | java | public Color getPixel(int x, int y) {
predraw();
GL.glReadPixels(x, screenHeight - y, 1, 1, SGL.GL_RGBA,
SGL.GL_UNSIGNED_BYTE, readBuffer);
postdraw();
return new Color(translate(readBuffer.get(0)), translate(readBuffer
.get(1)), translate(readBuffer.get(2)), translate(readBuffer
.get(3)));
} | [
"public",
"Color",
"getPixel",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"predraw",
"(",
")",
";",
"GL",
".",
"glReadPixels",
"(",
"x",
",",
"screenHeight",
"-",
"y",
",",
"1",
",",
"1",
",",
"SGL",
".",
"GL_RGBA",
",",
"SGL",
".",
"GL_UNSIGNED... | Get the colour of a single pixel in this graphics context
@param x
The x coordinate of the pixel to read
@param y
The y coordinate of the pixel to read
@return The colour of the pixel at the specified location | [
"Get",
"the",
"colour",
"of",
"a",
"single",
"pixel",
"in",
"this",
"graphics",
"context"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Graphics.java#L1544-L1553 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cdn_dedicated_serviceName_quota_duration_POST | public OvhOrder cdn_dedicated_serviceName_quota_duration_POST(String serviceName, String duration, OvhOrderQuotaEnum quota) throws IOException {
String qPath = "/order/cdn/dedicated/{serviceName}/quota/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "quota", quota);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder cdn_dedicated_serviceName_quota_duration_POST(String serviceName, String duration, OvhOrderQuotaEnum quota) throws IOException {
String qPath = "/order/cdn/dedicated/{serviceName}/quota/{duration}";
StringBuilder sb = path(qPath, serviceName, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "quota", quota);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"cdn_dedicated_serviceName_quota_duration_POST",
"(",
"String",
"serviceName",
",",
"String",
"duration",
",",
"OvhOrderQuotaEnum",
"quota",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cdn/dedicated/{serviceName}/quota/{duration}\"... | Create order
REST: POST /order/cdn/dedicated/{serviceName}/quota/{duration}
@param quota [required] quota number in TB that will be added to the CDN service
@param serviceName [required] The internal name of your CDN offer
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5369-L5376 |
baratine/baratine | kraken/src/main/java/com/caucho/v5/kelp/PageTree.java | PageTree.copy | public PageTree copy(TableKelp table, int newPid)
{
PageTree newTree = new PageTree(newPid, getNextId(), getSequence(),
getMinKey(), getMaxKey());
for (BlockTree block : _blocks) {
block.copyTo(table, newTree);
}
return newTree;
} | java | public PageTree copy(TableKelp table, int newPid)
{
PageTree newTree = new PageTree(newPid, getNextId(), getSequence(),
getMinKey(), getMaxKey());
for (BlockTree block : _blocks) {
block.copyTo(table, newTree);
}
return newTree;
} | [
"public",
"PageTree",
"copy",
"(",
"TableKelp",
"table",
",",
"int",
"newPid",
")",
"{",
"PageTree",
"newTree",
"=",
"new",
"PageTree",
"(",
"newPid",
",",
"getNextId",
"(",
")",
",",
"getSequence",
"(",
")",
",",
"getMinKey",
"(",
")",
",",
"getMaxKey",... | /*
@InService(TableServiceImpl.class)
static PageTree read(TableKelp table,
TableServiceImpl pageActor,
ReadStream is,
int length,
int pid,
int nextPid,
long sequence)
throws IOException
{
byte []minKey = new byte[table.getKeyLength()];
byte []maxKey = new byte[table.getKeyLength()];
is.readAll(minKey, 0, minKey.length);
is.readAll(maxKey, 0, maxKey.length);
length -= minKey.length + maxKey.length;
PageTree page = new PageTree(pid, nextPid, sequence, minKey, maxKey);
int len = 2 * table.getKeyLength() + 4;
byte []min = new byte[table.getKeyLength()];
byte []max = new byte[table.getKeyLength()];
for (; length > 0; length -= len) {
is.readAll(min, 0, min.length);
is.readAll(max, 0, max.length);
int id = BitsUtil.readInt(is);
page.insert(min, max, id);
}
page.clearDirty();
return page;
} | [
"/",
"*",
"@InService",
"(",
"TableServiceImpl",
".",
"class",
")",
"static",
"PageTree",
"read",
"(",
"TableKelp",
"table",
"TableServiceImpl",
"pageActor",
"ReadStream",
"is",
"int",
"length",
"int",
"pid",
"int",
"nextPid",
"long",
"sequence",
")",
"throws",
... | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/PageTree.java#L522-L532 |
cdk/cdk | base/silent/src/main/java/org/openscience/cdk/silent/BioPolymer.java | BioPolymer.addAtom | @Override
public void addAtom(IAtom oAtom, IStrand oStrand) {
int atomCount = super.getAtomCount();
// Add atom to AtomContainer
super.addAtom(oAtom);
if (atomCount != super.getAtomCount() && oStrand != null) { // Maybe better to throw null pointer exception here, so user realises that
// Strand == null and Atom only gets added to this BioPolymer, but not to a Strand.
oStrand.addAtom(oAtom);
if (!strands.containsKey(oStrand.getStrandName())) {
strands.put(oStrand.getStrandName(), oStrand);
}
}
/*
* notifyChanged() is called by addAtom in AtomContainer
*/
} | java | @Override
public void addAtom(IAtom oAtom, IStrand oStrand) {
int atomCount = super.getAtomCount();
// Add atom to AtomContainer
super.addAtom(oAtom);
if (atomCount != super.getAtomCount() && oStrand != null) { // Maybe better to throw null pointer exception here, so user realises that
// Strand == null and Atom only gets added to this BioPolymer, but not to a Strand.
oStrand.addAtom(oAtom);
if (!strands.containsKey(oStrand.getStrandName())) {
strands.put(oStrand.getStrandName(), oStrand);
}
}
/*
* notifyChanged() is called by addAtom in AtomContainer
*/
} | [
"@",
"Override",
"public",
"void",
"addAtom",
"(",
"IAtom",
"oAtom",
",",
"IStrand",
"oStrand",
")",
"{",
"int",
"atomCount",
"=",
"super",
".",
"getAtomCount",
"(",
")",
";",
"// Add atom to AtomContainer",
"super",
".",
"addAtom",
"(",
"oAtom",
")",
";",
... | Adds the atom oAtom to a specified Strand, whereas the Monomer is unspecified. Hence
the atom will be added to a Monomer of type UNKNOWN in the specified Strand.
@param oAtom The atom to add
@param oStrand The strand the atom belongs to | [
"Adds",
"the",
"atom",
"oAtom",
"to",
"a",
"specified",
"Strand",
"whereas",
"the",
"Monomer",
"is",
"unspecified",
".",
"Hence",
"the",
"atom",
"will",
"be",
"added",
"to",
"a",
"Monomer",
"of",
"type",
"UNKNOWN",
"in",
"the",
"specified",
"Strand",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/silent/src/main/java/org/openscience/cdk/silent/BioPolymer.java#L78-L96 |
alkacon/opencms-core | src/org/opencms/ui/components/CmsToolBar.java | CmsToolBar.createButton | public static Button createButton(Resource icon, String title) {
return createButton(icon, title, false);
} | java | public static Button createButton(Resource icon, String title) {
return createButton(icon, title, false);
} | [
"public",
"static",
"Button",
"createButton",
"(",
"Resource",
"icon",
",",
"String",
"title",
")",
"{",
"return",
"createButton",
"(",
"icon",
",",
"title",
",",
"false",
")",
";",
"}"
] | Creates a properly styled toolbar button.<p>
@param icon the button icon
@param title the button title, will be used for the tooltip
@return the button | [
"Creates",
"a",
"properly",
"styled",
"toolbar",
"button",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsToolBar.java#L217-L220 |
Samsung/GearVRf | GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFString.java | MFString.setValue | public void setValue(int numStrings, String[] newValues) {
value.clear();
if (numStrings == newValues.length) {
for (int i = 0; i < newValues.length; i++) {
value.add(newValues[i]);
}
}
else {
Log.e(TAG, "X3D MFString setValue() numStrings not equal total newValues");
}
} | java | public void setValue(int numStrings, String[] newValues) {
value.clear();
if (numStrings == newValues.length) {
for (int i = 0; i < newValues.length; i++) {
value.add(newValues[i]);
}
}
else {
Log.e(TAG, "X3D MFString setValue() numStrings not equal total newValues");
}
} | [
"public",
"void",
"setValue",
"(",
"int",
"numStrings",
",",
"String",
"[",
"]",
"newValues",
")",
"{",
"value",
".",
"clear",
"(",
")",
";",
"if",
"(",
"numStrings",
"==",
"newValues",
".",
"length",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";"... | Assign a new value to this field.
@param numStrings - number of strings
@param newValues - the new strings | [
"Assign",
"a",
"new",
"value",
"to",
"this",
"field",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFString.java#L145-L155 |
Alluxio/alluxio | core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java | NetworkAddressUtils.parseInetSocketAddress | @Nullable
public static InetSocketAddress parseInetSocketAddress(String address) throws IOException {
if (address == null) {
return null;
}
String[] strArr = address.split(":");
if (strArr.length != 2) {
throw new IOException("Invalid InetSocketAddress " + address);
}
return new InetSocketAddress(strArr[0], Integer.parseInt(strArr[1]));
} | java | @Nullable
public static InetSocketAddress parseInetSocketAddress(String address) throws IOException {
if (address == null) {
return null;
}
String[] strArr = address.split(":");
if (strArr.length != 2) {
throw new IOException("Invalid InetSocketAddress " + address);
}
return new InetSocketAddress(strArr[0], Integer.parseInt(strArr[1]));
} | [
"@",
"Nullable",
"public",
"static",
"InetSocketAddress",
"parseInetSocketAddress",
"(",
"String",
"address",
")",
"throws",
"IOException",
"{",
"if",
"(",
"address",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"strArr",
"=",
"add... | Parses {@link InetSocketAddress} from a String.
@param address socket address to parse
@return InetSocketAddress of the String | [
"Parses",
"{",
"@link",
"InetSocketAddress",
"}",
"from",
"a",
"String",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java#L593-L603 |
apache/incubator-gobblin | gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/task/HiveConverterUtils.java | HiveConverterUtils.generateStagingCTASStatementFromSelectStar | public static String generateStagingCTASStatementFromSelectStar(HiveDatasetFinder.DbAndTable outputDbAndTable,
HiveDatasetFinder.DbAndTable sourceEntity, Map<String, String> partitionDMLInfo,
StorageFormat storageFormat, String outputTableLocation) {
StringBuilder sourceQueryBuilder = new StringBuilder("SELECT * FROM `").append(sourceEntity.getDb())
.append("`.`").append(sourceEntity.getTable()).append("`");
if (partitionDMLInfo != null && !partitionDMLInfo.isEmpty()) {
sourceQueryBuilder.append(" WHERE ");
sourceQueryBuilder.append(partitionDMLInfo.entrySet().stream()
.map(e -> "`" + e.getKey() + "`='" + e.getValue() + "'")
.collect(joining(" AND ")));
}
return generateStagingCTASStatement(outputDbAndTable, sourceQueryBuilder.toString(), storageFormat, outputTableLocation);
} | java | public static String generateStagingCTASStatementFromSelectStar(HiveDatasetFinder.DbAndTable outputDbAndTable,
HiveDatasetFinder.DbAndTable sourceEntity, Map<String, String> partitionDMLInfo,
StorageFormat storageFormat, String outputTableLocation) {
StringBuilder sourceQueryBuilder = new StringBuilder("SELECT * FROM `").append(sourceEntity.getDb())
.append("`.`").append(sourceEntity.getTable()).append("`");
if (partitionDMLInfo != null && !partitionDMLInfo.isEmpty()) {
sourceQueryBuilder.append(" WHERE ");
sourceQueryBuilder.append(partitionDMLInfo.entrySet().stream()
.map(e -> "`" + e.getKey() + "`='" + e.getValue() + "'")
.collect(joining(" AND ")));
}
return generateStagingCTASStatement(outputDbAndTable, sourceQueryBuilder.toString(), storageFormat, outputTableLocation);
} | [
"public",
"static",
"String",
"generateStagingCTASStatementFromSelectStar",
"(",
"HiveDatasetFinder",
".",
"DbAndTable",
"outputDbAndTable",
",",
"HiveDatasetFinder",
".",
"DbAndTable",
"sourceEntity",
",",
"Map",
"<",
"String",
",",
"String",
">",
"partitionDMLInfo",
","... | Generates a CTAS statement to dump the contents of a table / partition into a new table.
@param outputDbAndTable output db and table where contents should be written.
@param sourceEntity source table / partition.
@param partitionDMLInfo map of partition values.
@param storageFormat format of output table.
@param outputTableLocation location where files of output table should be written. | [
"Generates",
"a",
"CTAS",
"statement",
"to",
"dump",
"the",
"contents",
"of",
"a",
"table",
"/",
"partition",
"into",
"a",
"new",
"table",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/conversion/hive/task/HiveConverterUtils.java#L162-L174 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/fog/FogOfWar.java | FogOfWar.isVisited | public boolean isVisited(int tx, int ty)
{
return mapHidden.getTile(tx, ty).getNumber() == MapTileFog.NO_FOG;
} | java | public boolean isVisited(int tx, int ty)
{
return mapHidden.getTile(tx, ty).getNumber() == MapTileFog.NO_FOG;
} | [
"public",
"boolean",
"isVisited",
"(",
"int",
"tx",
",",
"int",
"ty",
")",
"{",
"return",
"mapHidden",
".",
"getTile",
"(",
"tx",
",",
"ty",
")",
".",
"getNumber",
"(",
")",
"==",
"MapTileFog",
".",
"NO_FOG",
";",
"}"
] | In case of active fog of war, check if tile has been discovered.
@param tx The horizontal tile.
@param ty The vertical tile.
@return <code>true</code> if already discovered, <code>false</code> else. | [
"In",
"case",
"of",
"active",
"fog",
"of",
"war",
"check",
"if",
"tile",
"has",
"been",
"discovered",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/fog/FogOfWar.java#L156-L159 |
GerdHolz/TOVAL | src/de/invation/code/toval/misc/SetUtils.java | SetUtils.getRandomSubset | public static <T> Set<T> getRandomSubset(Set<T> set) {
return getRandomSubsetMax(set, set.size());
} | java | public static <T> Set<T> getRandomSubset(Set<T> set) {
return getRandomSubsetMax(set, set.size());
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"getRandomSubset",
"(",
"Set",
"<",
"T",
">",
"set",
")",
"{",
"return",
"getRandomSubsetMax",
"(",
"set",
",",
"set",
".",
"size",
"(",
")",
")",
";",
"}"
] | Generates a subset of <code>set</code>, that contains a random number of
elements.
@param <T>
Type of set elements
@param set
Basic set for operation
@return A subset with a random number of elements | [
"Generates",
"a",
"subset",
"of",
"<code",
">",
"set<",
"/",
"code",
">",
"that",
"contains",
"a",
"random",
"number",
"of",
"elements",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/SetUtils.java#L30-L32 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.undeleteResource | public void undeleteResource(String resourcename, boolean recursive) throws CmsException {
CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
getResourceType(resource).undelete(this, m_securityManager, resource, recursive);
} | java | public void undeleteResource(String resourcename, boolean recursive) throws CmsException {
CmsResource resource = readResource(resourcename, CmsResourceFilter.ALL);
getResourceType(resource).undelete(this, m_securityManager, resource, recursive);
} | [
"public",
"void",
"undeleteResource",
"(",
"String",
"resourcename",
",",
"boolean",
"recursive",
")",
"throws",
"CmsException",
"{",
"CmsResource",
"resource",
"=",
"readResource",
"(",
"resourcename",
",",
"CmsResourceFilter",
".",
"ALL",
")",
";",
"getResourceTyp... | Undeletes a resource.<p>
Only resources that have already been published once can be undeleted,
if a "new" resource is deleted it can not be undeleted.<p>
@param resourcename the name of the resource to undelete
@param recursive if this operation is to be applied recursively to all resources in a folder
@throws CmsException if something goes wrong
@see CmsObject#undoChanges(String, CmsResource.CmsResourceUndoMode) | [
"Undeletes",
"a",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3872-L3876 |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.saturate | public static Expression saturate(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int increase = input.getExpectedIntParam(1);
return changeSaturation(color, increase);
} | java | public static Expression saturate(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int increase = input.getExpectedIntParam(1);
return changeSaturation(color, increase);
} | [
"public",
"static",
"Expression",
"saturate",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"Color",
"color",
"=",
"input",
".",
"getExpectedColorParam",
"(",
"0",
")",
";",
"int",
"increase",
"=",
"input",
".",
"getExpectedIntParam",
... | Increases the saturation of the given color by N percent.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Increases",
"the",
"saturation",
"of",
"the",
"given",
"color",
"by",
"N",
"percent",
"."
] | train | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L143-L147 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/tools/RuleMatchAsXmlSerializer.java | RuleMatchAsXmlSerializer.ruleMatchesToXml | public String ruleMatchesToXml(List<RuleMatch> ruleMatches, String text, int contextSize,
Language lang, Language motherTongue) {
return getXmlStart(lang, motherTongue) + ruleMatchesToXmlSnippet(ruleMatches, text, contextSize) + getXmlEnd();
} | java | public String ruleMatchesToXml(List<RuleMatch> ruleMatches, String text, int contextSize,
Language lang, Language motherTongue) {
return getXmlStart(lang, motherTongue) + ruleMatchesToXmlSnippet(ruleMatches, text, contextSize) + getXmlEnd();
} | [
"public",
"String",
"ruleMatchesToXml",
"(",
"List",
"<",
"RuleMatch",
">",
"ruleMatches",
",",
"String",
"text",
",",
"int",
"contextSize",
",",
"Language",
"lang",
",",
"Language",
"motherTongue",
")",
"{",
"return",
"getXmlStart",
"(",
"lang",
",",
"motherT... | Get an XML representation of the given rule matches.
@param text the original text that was checked, used to get the context of the matches
@param contextSize the desired context size in characters | [
"Get",
"an",
"XML",
"representation",
"of",
"the",
"given",
"rule",
"matches",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tools/RuleMatchAsXmlSerializer.java#L152-L155 |
shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.appendArray | public static String appendArray(final String value, final String[] appends) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (appends == null || appends.length == 0) {
return value;
}
StringJoiner joiner = new StringJoiner("");
for (String append : appends) {
joiner.add(append);
}
return value + joiner.toString();
} | java | public static String appendArray(final String value, final String[] appends) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
if (appends == null || appends.length == 0) {
return value;
}
StringJoiner joiner = new StringJoiner("");
for (String append : appends) {
joiner.add(append);
}
return value + joiner.toString();
} | [
"public",
"static",
"String",
"appendArray",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"[",
"]",
"appends",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"if",
"(",
"appends",
"==",
... | Append an array of String to value
@param value initial String
@param appends an array of strings to append
@return full String | [
"Append",
"an",
"array",
"of",
"String",
"to",
"value"
] | train | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L71-L81 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/system_settings.java | system_settings.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
system_settings_responses result = (system_settings_responses) service.get_payload_formatter().string_to_resource(system_settings_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.system_settings_response_array);
}
system_settings[] result_system_settings = new system_settings[result.system_settings_response_array.length];
for(int i = 0; i < result.system_settings_response_array.length; i++)
{
result_system_settings[i] = result.system_settings_response_array[i].system_settings[0];
}
return result_system_settings;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
system_settings_responses result = (system_settings_responses) service.get_payload_formatter().string_to_resource(system_settings_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.system_settings_response_array);
}
system_settings[] result_system_settings = new system_settings[result.system_settings_response_array.length];
for(int i = 0; i < result.system_settings_response_array.length; i++)
{
result_system_settings[i] = result.system_settings_response_array[i].system_settings[0];
}
return result_system_settings;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"system_settings_responses",
"result",
"=",
"(",
"system_settings_responses",
")",
"service",
".",
"get_payloa... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/system_settings.java#L329-L346 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java | TasksImpl.addCollection | public TaskAddCollectionResult addCollection(String jobId, List<TaskAddParameter> value) {
return addCollectionWithServiceResponseAsync(jobId, value).toBlocking().single().body();
} | java | public TaskAddCollectionResult addCollection(String jobId, List<TaskAddParameter> value) {
return addCollectionWithServiceResponseAsync(jobId, value).toBlocking().single().body();
} | [
"public",
"TaskAddCollectionResult",
"addCollection",
"(",
"String",
"jobId",
",",
"List",
"<",
"TaskAddParameter",
">",
"value",
")",
"{",
"return",
"addCollectionWithServiceResponseAsync",
"(",
"jobId",
",",
"value",
")",
".",
"toBlocking",
"(",
")",
".",
"singl... | Adds a collection of tasks to the specified job.
Note that each task must have a unique ID. The Batch service may not return the results for each task in the same order the tasks were submitted in this request. If the server times out or the connection is closed during the request, the request may have been partially or fully processed, or not at all. In such cases, the user should re-issue the request. Note that it is up to the user to correctly handle failures when re-issuing a request. For example, you should use the same task IDs during a retry so that if the prior operation succeeded, the retry will not create extra tasks unexpectedly. If the response contains any tasks which failed to add, a client can retry the request. In a retry, it is most efficient to resubmit only tasks that failed to add, and to omit tasks that were successfully added on the first attempt. The maximum lifetime of a task from addition to completion is 180 days. If a task has not completed within 180 days of being added it will be terminated by the Batch service and left in whatever state it was in at that time.
@param jobId The ID of the job to which the task collection is to be added.
@param value The collection of tasks to add. The maximum count of tasks is 100. The total serialized size of this collection must be less than 1MB. If it is greater than 1MB (for example if each task has 100's of resource files or environment variables), the request will fail with code 'RequestBodyTooLarge' and should be retried again with fewer tasks.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws BatchErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the TaskAddCollectionResult object if successful. | [
"Adds",
"a",
"collection",
"of",
"tasks",
"to",
"the",
"specified",
"job",
".",
"Note",
"that",
"each",
"task",
"must",
"have",
"a",
"unique",
"ID",
".",
"The",
"Batch",
"service",
"may",
"not",
"return",
"the",
"results",
"for",
"each",
"task",
"in",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/TasksImpl.java#L666-L668 |
LevelFourAB/commons | commons-serialization/src/main/java/se/l4/commons/serialization/AbstractSerializerCollection.java | AbstractSerializerCollection.registerIfNamed | protected void registerIfNamed(Class<?> from, Serializer<?> serializer)
{
if(from.isAnnotationPresent(Named.class))
{
Named named = from.getAnnotation(Named.class);
QualifiedName key = new QualifiedName(named.namespace(), named.name());
nameToSerializer.put(key, serializer);
serializerToName.put(serializer, key);
}
} | java | protected void registerIfNamed(Class<?> from, Serializer<?> serializer)
{
if(from.isAnnotationPresent(Named.class))
{
Named named = from.getAnnotation(Named.class);
QualifiedName key = new QualifiedName(named.namespace(), named.name());
nameToSerializer.put(key, serializer);
serializerToName.put(serializer, key);
}
} | [
"protected",
"void",
"registerIfNamed",
"(",
"Class",
"<",
"?",
">",
"from",
",",
"Serializer",
"<",
"?",
">",
"serializer",
")",
"{",
"if",
"(",
"from",
".",
"isAnnotationPresent",
"(",
"Named",
".",
"class",
")",
")",
"{",
"Named",
"named",
"=",
"fro... | Register the given serializer if it has a name.
@param from
@param serializer | [
"Register",
"the",
"given",
"serializer",
"if",
"it",
"has",
"a",
"name",
"."
] | train | https://github.com/LevelFourAB/commons/blob/aa121b3a5504b43d0c10450a1b984694fcd2b8ee/commons-serialization/src/main/java/se/l4/commons/serialization/AbstractSerializerCollection.java#L248-L257 |
JodaOrg/joda-money | src/main/java/org/joda/money/CurrencyUnit.java | CurrencyUnit.registerCurrency | public static synchronized CurrencyUnit registerCurrency(
String currencyCode, int numericCurrencyCode, int decimalPlaces, List<String> countryCodes) {
return registerCurrency(currencyCode, numericCurrencyCode, decimalPlaces, countryCodes, false);
} | java | public static synchronized CurrencyUnit registerCurrency(
String currencyCode, int numericCurrencyCode, int decimalPlaces, List<String> countryCodes) {
return registerCurrency(currencyCode, numericCurrencyCode, decimalPlaces, countryCodes, false);
} | [
"public",
"static",
"synchronized",
"CurrencyUnit",
"registerCurrency",
"(",
"String",
"currencyCode",
",",
"int",
"numericCurrencyCode",
",",
"int",
"decimalPlaces",
",",
"List",
"<",
"String",
">",
"countryCodes",
")",
"{",
"return",
"registerCurrency",
"(",
"curr... | Registers a currency and associated countries allowing it to be used.
<p>
This class only permits known currencies to be returned.
To achieve this, all currencies have to be registered in advance.
<p>
Since this method is public, it is possible to add currencies in
application code. It is recommended to do this only at startup, however
it is safe to do so later as the internal implementation is thread-safe.
<p>
The currency code must be three upper-case ASCII letters, based on ISO-4217.
The numeric code must be from 0 to 999, or -1 if not applicable.
@param currencyCode the three-letter upper-case currency code, not null
@param numericCurrencyCode the numeric currency code, from 0 to 999, -1 if none
@param decimalPlaces the number of decimal places that the currency
normally has, from 0 to 30 (normally 0, 2 or 3), or -1 for a pseudo-currency
@param countryCodes the country codes to register the currency under, not null
@return the new instance, never null
@throws IllegalArgumentException if the code is already registered, or the
specified data is invalid | [
"Registers",
"a",
"currency",
"and",
"associated",
"countries",
"allowing",
"it",
"to",
"be",
"used",
".",
"<p",
">",
"This",
"class",
"only",
"permits",
"known",
"currencies",
"to",
"be",
"returned",
".",
"To",
"achieve",
"this",
"all",
"currencies",
"have"... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/CurrencyUnit.java#L161-L164 |
Azure/azure-sdk-for-java | containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainerGroupsInner.java | ContainerGroupsInner.beginRestart | public void beginRestart(String resourceGroupName, String containerGroupName) {
beginRestartWithServiceResponseAsync(resourceGroupName, containerGroupName).toBlocking().single().body();
} | java | public void beginRestart(String resourceGroupName, String containerGroupName) {
beginRestartWithServiceResponseAsync(resourceGroupName, containerGroupName).toBlocking().single().body();
} | [
"public",
"void",
"beginRestart",
"(",
"String",
"resourceGroupName",
",",
"String",
"containerGroupName",
")",
"{",
"beginRestartWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"containerGroupName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",... | Restarts all containers in a container group.
Restarts all containers in a container group in place. If container image has updates, new image will be downloaded.
@param resourceGroupName The name of the resource group.
@param containerGroupName The name of the container group.
@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 | [
"Restarts",
"all",
"containers",
"in",
"a",
"container",
"group",
".",
"Restarts",
"all",
"containers",
"in",
"a",
"container",
"group",
"in",
"place",
".",
"If",
"container",
"image",
"has",
"updates",
"new",
"image",
"will",
"be",
"downloaded",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/containerinstance/v2018_10_01/implementation/ContainerGroupsInner.java#L893-L895 |
spring-projects/spring-boot | spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java | HealthStatusHttpMapper.setStatusMapping | public void setStatusMapping(Map<String, Integer> statusMapping) {
Assert.notNull(statusMapping, "StatusMapping must not be null");
this.statusMapping = new HashMap<>(statusMapping);
} | java | public void setStatusMapping(Map<String, Integer> statusMapping) {
Assert.notNull(statusMapping, "StatusMapping must not be null");
this.statusMapping = new HashMap<>(statusMapping);
} | [
"public",
"void",
"setStatusMapping",
"(",
"Map",
"<",
"String",
",",
"Integer",
">",
"statusMapping",
")",
"{",
"Assert",
".",
"notNull",
"(",
"statusMapping",
",",
"\"StatusMapping must not be null\"",
")",
";",
"this",
".",
"statusMapping",
"=",
"new",
"HashM... | Set specific status mappings.
@param statusMapping a map of health status code to HTTP status code | [
"Set",
"specific",
"status",
"mappings",
"."
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/HealthStatusHttpMapper.java#L53-L56 |
line/armeria | core/src/main/java/com/linecorp/armeria/server/throttling/ThrottlingRpcService.java | ThrottlingRpcService.onFailure | @Override
protected RpcResponse onFailure(ServiceRequestContext ctx, RpcRequest req, @Nullable Throwable cause)
throws Exception {
return RpcResponse.ofFailure(HttpStatusException.of(HttpStatus.SERVICE_UNAVAILABLE));
} | java | @Override
protected RpcResponse onFailure(ServiceRequestContext ctx, RpcRequest req, @Nullable Throwable cause)
throws Exception {
return RpcResponse.ofFailure(HttpStatusException.of(HttpStatus.SERVICE_UNAVAILABLE));
} | [
"@",
"Override",
"protected",
"RpcResponse",
"onFailure",
"(",
"ServiceRequestContext",
"ctx",
",",
"RpcRequest",
"req",
",",
"@",
"Nullable",
"Throwable",
"cause",
")",
"throws",
"Exception",
"{",
"return",
"RpcResponse",
".",
"ofFailure",
"(",
"HttpStatusException... | Invoked when {@code req} is throttled. By default, this method responds with a
{@link HttpStatusException} with {@code 503 Service Unavailable}. | [
"Invoked",
"when",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/throttling/ThrottlingRpcService.java#L58-L62 |
deephacks/confit | api-model/src/main/java/org/deephacks/confit/model/Bean.java | Bean.setReference | public void setReference(final String propertyName, final BeanId value) {
Preconditions.checkNotNull(propertyName);
if (value == null) {
references.put(propertyName, null);
return;
}
checkCircularReference(value);
List<BeanId> values = new ArrayList<>();
values.add(value);
references.put(propertyName, values);
} | java | public void setReference(final String propertyName, final BeanId value) {
Preconditions.checkNotNull(propertyName);
if (value == null) {
references.put(propertyName, null);
return;
}
checkCircularReference(value);
List<BeanId> values = new ArrayList<>();
values.add(value);
references.put(propertyName, values);
} | [
"public",
"void",
"setReference",
"(",
"final",
"String",
"propertyName",
",",
"final",
"BeanId",
"value",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"propertyName",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"references",
".",
"put",
... | Overwrite/replace the current references with a provided reference.
@param propertyName name of the property as defined by the bean's schema.
@param value override | [
"Overwrite",
"/",
"replace",
"the",
"current",
"references",
"with",
"a",
"provided",
"reference",
"."
] | train | https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/api-model/src/main/java/org/deephacks/confit/model/Bean.java#L390-L400 |
jamesdbloom/mockserver | mockserver-core/src/main/java/org/mockserver/model/HttpRequest.java | HttpRequest.withHeader | public HttpRequest withHeader(NottableString name, NottableString... values) {
this.headers.withEntry(header(name, values));
return this;
} | java | public HttpRequest withHeader(NottableString name, NottableString... values) {
this.headers.withEntry(header(name, values));
return this;
} | [
"public",
"HttpRequest",
"withHeader",
"(",
"NottableString",
"name",
",",
"NottableString",
"...",
"values",
")",
"{",
"this",
".",
"headers",
".",
"withEntry",
"(",
"header",
"(",
"name",
",",
"values",
")",
")",
";",
"return",
"this",
";",
"}"
] | Adds one header to match on or to not match on using the NottableString, each NottableString can either be a positive matching value,
such as string("match"), or a value to not match on, such as not("do not match"), the string values passed to the NottableString
can also be a plain string or a regex (for more details of the supported regex syntax
see http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html)
@param name the header name as a NottableString
@param values the header values which can be a varags of NottableStrings | [
"Adds",
"one",
"header",
"to",
"match",
"on",
"or",
"to",
"not",
"match",
"on",
"using",
"the",
"NottableString",
"each",
"NottableString",
"can",
"either",
"be",
"a",
"positive",
"matching",
"value",
"such",
"as",
"string",
"(",
"match",
")",
"or",
"a",
... | train | https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-core/src/main/java/org/mockserver/model/HttpRequest.java#L425-L428 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/ui/CmsVfsTab.java | CmsVfsTab.fillInitially | public void fillInitially(List<CmsVfsEntryBean> entries, String selectedSiteRoot) {
clear();
for (CmsVfsEntryBean entry : entries) {
if (entry != null) {
CmsLazyTreeItem item = createItem(entry);
addWidgetToList(item);
}
}
if (null != selectedSiteRoot) {
selectSite(selectedSiteRoot);
}
m_initialized = true;
} | java | public void fillInitially(List<CmsVfsEntryBean> entries, String selectedSiteRoot) {
clear();
for (CmsVfsEntryBean entry : entries) {
if (entry != null) {
CmsLazyTreeItem item = createItem(entry);
addWidgetToList(item);
}
}
if (null != selectedSiteRoot) {
selectSite(selectedSiteRoot);
}
m_initialized = true;
} | [
"public",
"void",
"fillInitially",
"(",
"List",
"<",
"CmsVfsEntryBean",
">",
"entries",
",",
"String",
"selectedSiteRoot",
")",
"{",
"clear",
"(",
")",
";",
"for",
"(",
"CmsVfsEntryBean",
"entry",
":",
"entries",
")",
"{",
"if",
"(",
"entry",
"!=",
"null",... | Sets the initial folders in the VFS tab.<p>
@param entries the root folders to display
@param selectedSiteRoot site root that should be selected in the select box | [
"Sets",
"the",
"initial",
"folders",
"in",
"the",
"VFS",
"tab",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsVfsTab.java#L207-L220 |
Erudika/para | para-client/src/main/java/com/erudika/para/client/ParaClient.java | ParaClient.findTagged | public <P extends ParaObject> List<P> findTagged(String type, String[] tags, Pager... pager) {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.put("tags", tags == null ? null : Arrays.asList(tags));
params.putSingle(Config._TYPE, type);
params.putAll(pagerToParams(pager));
return getItems(find("tagged", params), pager);
} | java | public <P extends ParaObject> List<P> findTagged(String type, String[] tags, Pager... pager) {
MultivaluedMap<String, String> params = new MultivaluedHashMap<>();
params.put("tags", tags == null ? null : Arrays.asList(tags));
params.putSingle(Config._TYPE, type);
params.putAll(pagerToParams(pager));
return getItems(find("tagged", params), pager);
} | [
"public",
"<",
"P",
"extends",
"ParaObject",
">",
"List",
"<",
"P",
">",
"findTagged",
"(",
"String",
"type",
",",
"String",
"[",
"]",
"tags",
",",
"Pager",
"...",
"pager",
")",
"{",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"params",
"=",
... | Searches for objects tagged with one or more tags.
@param <P> type of the object
@param type the type of object to search for. See {@link com.erudika.para.core.ParaObject#getType()}
@param tags the list of tags
@param pager a {@link com.erudika.para.utils.Pager}
@return a list of objects found | [
"Searches",
"for",
"objects",
"tagged",
"with",
"one",
"or",
"more",
"tags",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L780-L786 |
facebookarchive/hadoop-20 | src/tools/org/apache/hadoop/tools/HadoopArchives.java | HadoopArchives.createNewPartStream | private FSDataOutputStream createNewPartStream(Path dst, int partId) throws IOException {
String partName = PART_PREFIX + partId;
Path output = new Path(dst, partName);
FileSystem destFs = output.getFileSystem(conf);
FSDataOutputStream partStream = destFs.create(output, false,
conf.getInt("io.file.buffer.size", 4096), destFs.getDefaultReplication(),
conf.getLong(HAR_BLOCKSIZE_LABEL, HAR_BLOCKSIZE_DEFAULT));
return partStream;
} | java | private FSDataOutputStream createNewPartStream(Path dst, int partId) throws IOException {
String partName = PART_PREFIX + partId;
Path output = new Path(dst, partName);
FileSystem destFs = output.getFileSystem(conf);
FSDataOutputStream partStream = destFs.create(output, false,
conf.getInt("io.file.buffer.size", 4096), destFs.getDefaultReplication(),
conf.getLong(HAR_BLOCKSIZE_LABEL, HAR_BLOCKSIZE_DEFAULT));
return partStream;
} | [
"private",
"FSDataOutputStream",
"createNewPartStream",
"(",
"Path",
"dst",
",",
"int",
"partId",
")",
"throws",
"IOException",
"{",
"String",
"partName",
"=",
"PART_PREFIX",
"+",
"partId",
";",
"Path",
"output",
"=",
"new",
"Path",
"(",
"dst",
",",
"partName"... | Creates new stream to write actual file data
@param dst parent of the part-id file
@param partId id of the part
@return the open stream
@throws IOException | [
"Creates",
"new",
"stream",
"to",
"write",
"actual",
"file",
"data"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/HadoopArchives.java#L1110-L1118 |
hgoebl/DavidWebb | src/main/java/com/goebl/david/Webb.java | Webb.setGlobalHeader | public static void setGlobalHeader(String name, Object value) {
if (value != null) {
globalHeaders.put(name, value);
} else {
globalHeaders.remove(name);
}
} | java | public static void setGlobalHeader(String name, Object value) {
if (value != null) {
globalHeaders.put(name, value);
} else {
globalHeaders.remove(name);
}
} | [
"public",
"static",
"void",
"setGlobalHeader",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"globalHeaders",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"}",
"else",
"{",
"globalHeaders",
"."... | Set the value for a named header which is valid for all requests in the running JVM.
<br>
The value can be overwritten by calling {@link Webb#setDefaultHeader(String, Object)} and/or
{@link com.goebl.david.Request#header(String, Object)}.
<br>
For the supported types for values see {@link Request#header(String, Object)}.
@param name name of the header (regarding HTTP it is not case-sensitive, but here case is important).
@param value value of the header. If <code>null</code> the header value is cleared (effectively not set).
@see #setDefaultHeader(String, Object)
@see com.goebl.david.Request#header(String, Object) | [
"Set",
"the",
"value",
"for",
"a",
"named",
"header",
"which",
"is",
"valid",
"for",
"all",
"requests",
"in",
"the",
"running",
"JVM",
".",
"<br",
">",
"The",
"value",
"can",
"be",
"overwritten",
"by",
"calling",
"{",
"@link",
"Webb#setDefaultHeader",
"(",... | train | https://github.com/hgoebl/DavidWebb/blob/4f1532fbc3d817886d38de24eacc02b44b910b42/src/main/java/com/goebl/david/Webb.java#L80-L86 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/IntStream.java | IntStream.mapToLong | @NotNull
public LongStream mapToLong(@NotNull final IntToLongFunction mapper) {
return new LongStream(params, new IntMapToLong(iterator, mapper));
} | java | @NotNull
public LongStream mapToLong(@NotNull final IntToLongFunction mapper) {
return new LongStream(params, new IntMapToLong(iterator, mapper));
} | [
"@",
"NotNull",
"public",
"LongStream",
"mapToLong",
"(",
"@",
"NotNull",
"final",
"IntToLongFunction",
"mapper",
")",
"{",
"return",
"new",
"LongStream",
"(",
"params",
",",
"new",
"IntMapToLong",
"(",
"iterator",
",",
"mapper",
")",
")",
";",
"}"
] | Returns a {@code LongStream} consisting of the results of applying the given
function to the elements of this stream.
<p> This is an intermediate operation.
@param mapper the mapper function used to apply to each element
@return the new {@code LongStream}
@since 1.1.4
@see #flatMap(com.annimon.stream.function.IntFunction) | [
"Returns",
"a",
"{",
"@code",
"LongStream",
"}",
"consisting",
"of",
"the",
"results",
"of",
"applying",
"the",
"given",
"function",
"to",
"the",
"elements",
"of",
"this",
"stream",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/IntStream.java#L542-L545 |
pryzach/midao | midao-jdbc-core/src/main/java/org/midao/jdbc/core/AbstractQueryRunner.java | AbstractQueryRunner.createStatement | protected Statement createStatement(Connection conn, OutputHandler outputHandler, String sql)
throws SQLException {
Statement result = null;
Integer resultSetType = null;
Integer resultSetConcurrency = null;
if (outputHandler instanceof LazyScrollOutputHandler) {
if (overrider.hasOverride(MjdbcConstants.OVERRIDE_LAZY_SCROLL_CHANGE_SENSITIVE) == true) {
// read value
overrider.getOverride(MjdbcConstants.OVERRIDE_LAZY_SCROLL_CHANGE_SENSITIVE);
resultSetType = ResultSet.TYPE_SCROLL_SENSITIVE;
} else {
resultSetType = ResultSet.TYPE_SCROLL_INSENSITIVE;
}
}
if (outputHandler instanceof LazyUpdateOutputHandler) {
resultSetConcurrency = ResultSet.CONCUR_UPDATABLE;
}
if (resultSetType == null && resultSetConcurrency == null) {
result = conn.createStatement();
} else {
resultSetType = (resultSetType == null ? ResultSet.TYPE_FORWARD_ONLY : resultSetType);
resultSetConcurrency = (resultSetConcurrency == null ? ResultSet.CONCUR_READ_ONLY : resultSetConcurrency);
result = conn.createStatement(resultSetType, resultSetConcurrency);
}
return result;
} | java | protected Statement createStatement(Connection conn, OutputHandler outputHandler, String sql)
throws SQLException {
Statement result = null;
Integer resultSetType = null;
Integer resultSetConcurrency = null;
if (outputHandler instanceof LazyScrollOutputHandler) {
if (overrider.hasOverride(MjdbcConstants.OVERRIDE_LAZY_SCROLL_CHANGE_SENSITIVE) == true) {
// read value
overrider.getOverride(MjdbcConstants.OVERRIDE_LAZY_SCROLL_CHANGE_SENSITIVE);
resultSetType = ResultSet.TYPE_SCROLL_SENSITIVE;
} else {
resultSetType = ResultSet.TYPE_SCROLL_INSENSITIVE;
}
}
if (outputHandler instanceof LazyUpdateOutputHandler) {
resultSetConcurrency = ResultSet.CONCUR_UPDATABLE;
}
if (resultSetType == null && resultSetConcurrency == null) {
result = conn.createStatement();
} else {
resultSetType = (resultSetType == null ? ResultSet.TYPE_FORWARD_ONLY : resultSetType);
resultSetConcurrency = (resultSetConcurrency == null ? ResultSet.CONCUR_READ_ONLY : resultSetConcurrency);
result = conn.createStatement(resultSetType, resultSetConcurrency);
}
return result;
} | [
"protected",
"Statement",
"createStatement",
"(",
"Connection",
"conn",
",",
"OutputHandler",
"outputHandler",
",",
"String",
"sql",
")",
"throws",
"SQLException",
"{",
"Statement",
"result",
"=",
"null",
";",
"Integer",
"resultSetType",
"=",
"null",
";",
"Integer... | Creates new {@link Statement} instance
@param conn SQL Connection
@param sql SQL Query string
@return new {@link Statement} instance
@throws SQLException if exception would be thrown by Driver/Database | [
"Creates",
"new",
"{",
"@link",
"Statement",
"}",
"instance"
] | train | https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/AbstractQueryRunner.java#L364-L398 |
wildfly/wildfly-core | deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java | PathUtil.resolveSecurely | public static final Path resolveSecurely(Path rootPath, String path) {
Path resolvedPath;
if(path == null || path.isEmpty()) {
resolvedPath = rootPath.normalize();
} else {
String relativePath = removeSuperflousSlashes(path);
resolvedPath = rootPath.resolve(relativePath).normalize();
}
if(!resolvedPath.startsWith(rootPath)) {
throw DeploymentRepositoryLogger.ROOT_LOGGER.forbiddenPath(path);
}
return resolvedPath;
} | java | public static final Path resolveSecurely(Path rootPath, String path) {
Path resolvedPath;
if(path == null || path.isEmpty()) {
resolvedPath = rootPath.normalize();
} else {
String relativePath = removeSuperflousSlashes(path);
resolvedPath = rootPath.resolve(relativePath).normalize();
}
if(!resolvedPath.startsWith(rootPath)) {
throw DeploymentRepositoryLogger.ROOT_LOGGER.forbiddenPath(path);
}
return resolvedPath;
} | [
"public",
"static",
"final",
"Path",
"resolveSecurely",
"(",
"Path",
"rootPath",
",",
"String",
"path",
")",
"{",
"Path",
"resolvedPath",
";",
"if",
"(",
"path",
"==",
"null",
"||",
"path",
".",
"isEmpty",
"(",
")",
")",
"{",
"resolvedPath",
"=",
"rootPa... | Resolve a path from the rootPath checking that it doesn't go out of the rootPath.
@param rootPath the starting point for resolution.
@param path the path we want to resolve.
@return the resolved path.
@throws IllegalArgumentException if the resolved path is out of the rootPath or if the resolution failed. | [
"Resolve",
"a",
"path",
"from",
"the",
"rootPath",
"checking",
"that",
"it",
"doesn",
"t",
"go",
"out",
"of",
"the",
"rootPath",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java#L142-L154 |
Impetus/Kundera | src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java | OracleNoSQLClient.setField | private void setField(Row row, Table schemaTable, Object embeddedObject, Attribute embeddedAttrib)
{
Field field = (Field) embeddedAttrib.getJavaMember();
FieldDef fieldDef = schemaTable.getField(((AbstractAttribute) embeddedAttrib).getJPAColumnName());
Object valueObj = PropertyAccessorHelper.getObject(embeddedObject, field);
if (valueObj != null)
NoSqlDBUtils.add(fieldDef, row, valueObj, ((AbstractAttribute) embeddedAttrib).getJPAColumnName());
} | java | private void setField(Row row, Table schemaTable, Object embeddedObject, Attribute embeddedAttrib)
{
Field field = (Field) embeddedAttrib.getJavaMember();
FieldDef fieldDef = schemaTable.getField(((AbstractAttribute) embeddedAttrib).getJPAColumnName());
Object valueObj = PropertyAccessorHelper.getObject(embeddedObject, field);
if (valueObj != null)
NoSqlDBUtils.add(fieldDef, row, valueObj, ((AbstractAttribute) embeddedAttrib).getJPAColumnName());
} | [
"private",
"void",
"setField",
"(",
"Row",
"row",
",",
"Table",
"schemaTable",
",",
"Object",
"embeddedObject",
",",
"Attribute",
"embeddedAttrib",
")",
"{",
"Field",
"field",
"=",
"(",
"Field",
")",
"embeddedAttrib",
".",
"getJavaMember",
"(",
")",
";",
"Fi... | setter field.
@param row
the row
@param schemaTable
the schema table
@param embeddedObject
the embedded object
@param embeddedAttrib
the embedded attrib | [
"setter",
"field",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-oracle-nosql/src/main/java/com/impetus/client/oraclenosql/OracleNoSQLClient.java#L1173-L1183 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/csv/CsvToSqlExtensions.java | CsvToSqlExtensions.getCsvFileAsSqlInsertScript | public static String getCsvFileAsSqlInsertScript(final String tableName, final String[] headers,
final String[] columnTypes, final List<String[]> lines)
{
return getCsvFileAsSqlInsertScript(tableName, new CsvBean(headers, columnTypes, lines));
} | java | public static String getCsvFileAsSqlInsertScript(final String tableName, final String[] headers,
final String[] columnTypes, final List<String[]> lines)
{
return getCsvFileAsSqlInsertScript(tableName, new CsvBean(headers, columnTypes, lines));
} | [
"public",
"static",
"String",
"getCsvFileAsSqlInsertScript",
"(",
"final",
"String",
"tableName",
",",
"final",
"String",
"[",
"]",
"headers",
",",
"final",
"String",
"[",
"]",
"columnTypes",
",",
"final",
"List",
"<",
"String",
"[",
"]",
">",
"lines",
")",
... | Gets the csv file as sql insert script.
@param tableName
the table name
@param headers
the headers
@param columnTypes
the column types
@param lines
the lines
@return the csv file as sql insert script | [
"Gets",
"the",
"csv",
"file",
"as",
"sql",
"insert",
"script",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvToSqlExtensions.java#L132-L136 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/refer/DependencyResolver.java | DependencyResolver.getOneOptional | public <T> T getOneOptional(Class<T> type, String name) {
Object locator = find(name);
return locator != null ? _references.getOneOptional(type, locator) : null;
} | java | public <T> T getOneOptional(Class<T> type, String name) {
Object locator = find(name);
return locator != null ? _references.getOneOptional(type, locator) : null;
} | [
"public",
"<",
"T",
">",
"T",
"getOneOptional",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"name",
")",
"{",
"Object",
"locator",
"=",
"find",
"(",
"name",
")",
";",
"return",
"locator",
"!=",
"null",
"?",
"_references",
".",
"getOneOptional",... | Gets one optional dependency by its name and matching to the specified type.
@param type the Class type that defined the type of the result.
@param name the dependency name to locate.
@return a dependency reference or null of the dependency was not found | [
"Gets",
"one",
"optional",
"dependency",
"by",
"its",
"name",
"and",
"matching",
"to",
"the",
"specified",
"type",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/refer/DependencyResolver.java#L239-L242 |
keenlabs/KeenClient-Java | core/src/main/java/io/keen/client/java/KeenClient.java | KeenClient.handleFailure | private void handleFailure(KeenCallback callback, Exception e) {
if (isDebugMode) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException(e);
}
} else {
KeenLogging.log("Encountered error: " + e.getMessage());
if (callback != null) {
try {
callback.onFailure(e);
} catch (Exception userException) {
// Do nothing. Issue #98
}
}
}
} | java | private void handleFailure(KeenCallback callback, Exception e) {
if (isDebugMode) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException(e);
}
} else {
KeenLogging.log("Encountered error: " + e.getMessage());
if (callback != null) {
try {
callback.onFailure(e);
} catch (Exception userException) {
// Do nothing. Issue #98
}
}
}
} | [
"private",
"void",
"handleFailure",
"(",
"KeenCallback",
"callback",
",",
"Exception",
"e",
")",
"{",
"if",
"(",
"isDebugMode",
")",
"{",
"if",
"(",
"e",
"instanceof",
"RuntimeException",
")",
"{",
"throw",
"(",
"RuntimeException",
")",
"e",
";",
"}",
"els... | Handles a failure in the Keen library. If the client is running in debug mode, this will
immediately throw a runtime exception. Otherwise, this will log an error message and, if the
callback is non-null, call the {@link KeenCallback#onFailure(Exception)} method. Any
exceptions thrown by the callback are silently ignored.
@param callback A callback; may be null.
@param e The exception which caused the failure. | [
"Handles",
"a",
"failure",
"in",
"the",
"Keen",
"library",
".",
"If",
"the",
"client",
"is",
"running",
"in",
"debug",
"mode",
"this",
"will",
"immediately",
"throw",
"a",
"runtime",
"exception",
".",
"Otherwise",
"this",
"will",
"log",
"an",
"error",
"mes... | train | https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/KeenClient.java#L1642-L1659 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxRetentionPolicyAssignment.java | BoxRetentionPolicyAssignment.createAssignmentToMetadata | public static BoxRetentionPolicyAssignment.Info createAssignmentToMetadata(BoxAPIConnection api,
String policyID,
String templateID,
MetadataFieldFilter... filter) {
JsonObject assignTo = new JsonObject().add("type", TYPE_METADATA).add("id", templateID);
JsonArray filters = null;
if (filter.length > 0) {
filters = new JsonArray();
for (MetadataFieldFilter f : filter) {
filters.add(f.getJsonObject());
}
}
return createAssignment(api, policyID, assignTo, filters);
} | java | public static BoxRetentionPolicyAssignment.Info createAssignmentToMetadata(BoxAPIConnection api,
String policyID,
String templateID,
MetadataFieldFilter... filter) {
JsonObject assignTo = new JsonObject().add("type", TYPE_METADATA).add("id", templateID);
JsonArray filters = null;
if (filter.length > 0) {
filters = new JsonArray();
for (MetadataFieldFilter f : filter) {
filters.add(f.getJsonObject());
}
}
return createAssignment(api, policyID, assignTo, filters);
} | [
"public",
"static",
"BoxRetentionPolicyAssignment",
".",
"Info",
"createAssignmentToMetadata",
"(",
"BoxAPIConnection",
"api",
",",
"String",
"policyID",
",",
"String",
"templateID",
",",
"MetadataFieldFilter",
"...",
"filter",
")",
"{",
"JsonObject",
"assignTo",
"=",
... | Assigns a retention policy to all items with a given metadata template, optionally matching on fields.
@param api the API connection to be used by the created assignment.
@param policyID id of the assigned retention policy.
@param templateID the ID of the metadata template to assign the policy to.
@param filter optional fields to match against in the metadata template.
@return info about the created assignment. | [
"Assigns",
"a",
"retention",
"policy",
"to",
"all",
"items",
"with",
"a",
"given",
"metadata",
"template",
"optionally",
"matching",
"on",
"fields",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxRetentionPolicyAssignment.java#L90-L103 |
JetBrains/xodus | environment/src/main/java/jetbrains/exodus/tree/btree/InternalPage.java | InternalPage.binarySearchGuessUnsafe | protected static int binarySearchGuessUnsafe(@NotNull final BasePage page, @NotNull final ByteIterable key) {
int index = page.binarySearch(key);
if (index < 0) {
index = -index - 2;
}
return index;
} | java | protected static int binarySearchGuessUnsafe(@NotNull final BasePage page, @NotNull final ByteIterable key) {
int index = page.binarySearch(key);
if (index < 0) {
index = -index - 2;
}
return index;
} | [
"protected",
"static",
"int",
"binarySearchGuessUnsafe",
"(",
"@",
"NotNull",
"final",
"BasePage",
"page",
",",
"@",
"NotNull",
"final",
"ByteIterable",
"key",
")",
"{",
"int",
"index",
"=",
"page",
".",
"binarySearch",
"(",
"key",
")",
";",
"if",
"(",
"in... | /*
Returns unsafe binary search index.
@return index (non-negative or -1 which means that nothing was found) | [
"/",
"*",
"Returns",
"unsafe",
"binary",
"search",
"index",
"."
] | train | https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/environment/src/main/java/jetbrains/exodus/tree/btree/InternalPage.java#L203-L209 |
apache/reef | lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/JettyHandler.java | JettyHandler.writeMessage | private void writeMessage(final HttpServletResponse response, final String message, final int status)
throws IOException {
response.getWriter().println(message);
response.setStatus(status);
} | java | private void writeMessage(final HttpServletResponse response, final String message, final int status)
throws IOException {
response.getWriter().println(message);
response.setStatus(status);
} | [
"private",
"void",
"writeMessage",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"String",
"message",
",",
"final",
"int",
"status",
")",
"throws",
"IOException",
"{",
"response",
".",
"getWriter",
"(",
")",
".",
"println",
"(",
"message",
")"... | process write message and status on the response.
@param response
@param message
@param status
@throws IOException | [
"process",
"write",
"message",
"and",
"status",
"on",
"the",
"response",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-webserver/src/main/java/org/apache/reef/webserver/JettyHandler.java#L142-L146 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.ip_mitigation_ipOnMitigation_stats_GET | public ArrayList<OvhMitigationStats> ip_mitigation_ipOnMitigation_stats_GET(String ip, String ipOnMitigation, Date from, OvhMitigationStatsScaleEnum scale, Date to) throws IOException {
String qPath = "/ip/{ip}/mitigation/{ipOnMitigation}/stats";
StringBuilder sb = path(qPath, ip, ipOnMitigation);
query(sb, "from", from);
query(sb, "scale", scale);
query(sb, "to", to);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | java | public ArrayList<OvhMitigationStats> ip_mitigation_ipOnMitigation_stats_GET(String ip, String ipOnMitigation, Date from, OvhMitigationStatsScaleEnum scale, Date to) throws IOException {
String qPath = "/ip/{ip}/mitigation/{ipOnMitigation}/stats";
StringBuilder sb = path(qPath, ip, ipOnMitigation);
query(sb, "from", from);
query(sb, "scale", scale);
query(sb, "to", to);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t4);
} | [
"public",
"ArrayList",
"<",
"OvhMitigationStats",
">",
"ip_mitigation_ipOnMitigation_stats_GET",
"(",
"String",
"ip",
",",
"String",
"ipOnMitigation",
",",
"Date",
"from",
",",
"OvhMitigationStatsScaleEnum",
"scale",
",",
"Date",
"to",
")",
"throws",
"IOException",
"{... | AntiDDOS option. Get statistics about your traffic in and out during this mitigation
REST: GET /ip/{ip}/mitigation/{ipOnMitigation}/stats
@param to [required] End date
@param from [required] Start date
@param scale [required] Scale of aggregation
@param ip [required]
@param ipOnMitigation [required] | [
"AntiDDOS",
"option",
".",
"Get",
"statistics",
"about",
"your",
"traffic",
"in",
"and",
"out",
"during",
"this",
"mitigation"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L741-L749 |
javabits/pojo-mbean | pojo-mbean-impl/src/main/java/org/softee/management/helper/IntrospectedDynamicMBean.java | IntrospectedDynamicMBean.getAnnotation | private static <A extends Annotation> A getAnnotation(AnnotatedElement element, Class<A> annotationClass) {
return (element != null) ? element.getAnnotation(annotationClass) : null;
} | java | private static <A extends Annotation> A getAnnotation(AnnotatedElement element, Class<A> annotationClass) {
return (element != null) ? element.getAnnotation(annotationClass) : null;
} | [
"private",
"static",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"getAnnotation",
"(",
"AnnotatedElement",
"element",
",",
"Class",
"<",
"A",
">",
"annotationClass",
")",
"{",
"return",
"(",
"element",
"!=",
"null",
")",
"?",
"element",
".",
"getAnnotation"... | Null safe annotation checker
@param <A>
@param element element or null
@param annotationClass
@return the annotation, if element is not null and the annotation is present. Otherwise null | [
"Null",
"safe",
"annotation",
"checker"
] | train | https://github.com/javabits/pojo-mbean/blob/9aa7fb065e560ec1e3e63373b28cd95ad438b26a/pojo-mbean-impl/src/main/java/org/softee/management/helper/IntrospectedDynamicMBean.java#L493-L495 |
xetorthio/jedis | src/main/java/redis/clients/jedis/BinaryJedis.java | BinaryJedis.hexists | @Override
public Boolean hexists(final byte[] key, final byte[] field) {
checkIsInMultiOrPipeline();
client.hexists(key, field);
return client.getIntegerReply() == 1;
} | java | @Override
public Boolean hexists(final byte[] key, final byte[] field) {
checkIsInMultiOrPipeline();
client.hexists(key, field);
return client.getIntegerReply() == 1;
} | [
"@",
"Override",
"public",
"Boolean",
"hexists",
"(",
"final",
"byte",
"[",
"]",
"key",
",",
"final",
"byte",
"[",
"]",
"field",
")",
"{",
"checkIsInMultiOrPipeline",
"(",
")",
";",
"client",
".",
"hexists",
"(",
"key",
",",
"field",
")",
";",
"return"... | Test for existence of a specified field in a hash. <b>Time complexity:</b> O(1)
@param key
@param field
@return Return true if the hash stored at key contains the specified field. Return false if the key is
not found or the field is not present. | [
"Test",
"for",
"existence",
"of",
"a",
"specified",
"field",
"in",
"a",
"hash",
".",
"<b",
">",
"Time",
"complexity",
":",
"<",
"/",
"b",
">",
"O",
"(",
"1",
")"
] | train | https://github.com/xetorthio/jedis/blob/ef4ab403f9d8fd88bd05092fea96de2e9db0bede/src/main/java/redis/clients/jedis/BinaryJedis.java#L1028-L1033 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.