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
oboehm/jfachwert
src/main/java/de/jfachwert/bank/Geldbetrag.java
Geldbetrag.valueOf
public static Geldbetrag valueOf(String other) { try { return DEFAULT_FORMATTER.parse(other); } catch (MonetaryParseException ex) { throw new IllegalArgumentException(other, ex); } }
java
public static Geldbetrag valueOf(String other) { try { return DEFAULT_FORMATTER.parse(other); } catch (MonetaryParseException ex) { throw new IllegalArgumentException(other, ex); } }
[ "public", "static", "Geldbetrag", "valueOf", "(", "String", "other", ")", "{", "try", "{", "return", "DEFAULT_FORMATTER", ".", "parse", "(", "other", ")", ";", "}", "catch", "(", "MonetaryParseException", "ex", ")", "{", "throw", "new", "IllegalArgumentExcepti...
Wandelt den angegebenen MonetaryAmount in einen Geldbetrag um. Um die Anzahl von Objekten gering zu halten, wird nur dann tatsaechlich eine neues Objekt erzeugt, wenn es sich nicht vermeiden laesst. <p> In Anlehnung an {@link BigDecimal} heisst die Methode "valueOf". </p> @param other the other @return ein Geldbetrag
[ "Wandelt", "den", "angegebenen", "MonetaryAmount", "in", "einen", "Geldbetrag", "um", ".", "Um", "die", "Anzahl", "von", "Objekten", "gering", "zu", "halten", "wird", "nur", "dann", "tatsaechlich", "eine", "neues", "Objekt", "erzeugt", "wenn", "es", "sich", "n...
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/Geldbetrag.java#L238-L244
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageReadChannel.java
GoogleCloudStorageReadChannel.openFooterStream
private InputStream openFooterStream() { contentChannelPosition = currentPosition; int offset = Math.toIntExact(currentPosition - (size - footerContent.length)); int length = footerContent.length - offset; logger.atFine().log( "Opened stream (prefetched footer) from %s position for '%s'", currentPosition, resourceIdString); return new ByteArrayInputStream(footerContent, offset, length); }
java
private InputStream openFooterStream() { contentChannelPosition = currentPosition; int offset = Math.toIntExact(currentPosition - (size - footerContent.length)); int length = footerContent.length - offset; logger.atFine().log( "Opened stream (prefetched footer) from %s position for '%s'", currentPosition, resourceIdString); return new ByteArrayInputStream(footerContent, offset, length); }
[ "private", "InputStream", "openFooterStream", "(", ")", "{", "contentChannelPosition", "=", "currentPosition", ";", "int", "offset", "=", "Math", ".", "toIntExact", "(", "currentPosition", "-", "(", "size", "-", "footerContent", ".", "length", ")", ")", ";", "...
Opens the underlying stream from {@link #footerContent}, sets its position to the {@link #currentPosition}.
[ "Opens", "the", "underlying", "stream", "from", "{" ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageReadChannel.java#L865-L873
codeprimate-software/cp-elements
src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java
AbstractConfiguration.getPropertyValueAs
public <T> T getPropertyValueAs(final String propertyName, final boolean required, final Class<T> type) { try { return convert(getPropertyValue(propertyName, required), type); } catch (ConversionException e) { if (required) { throw new ConfigurationException(String.format( "Failed to get the value of configuration setting property (%1$s) as type (%2$s)!", propertyName, ClassUtils.getName(type)), e); } return null; } }
java
public <T> T getPropertyValueAs(final String propertyName, final boolean required, final Class<T> type) { try { return convert(getPropertyValue(propertyName, required), type); } catch (ConversionException e) { if (required) { throw new ConfigurationException(String.format( "Failed to get the value of configuration setting property (%1$s) as type (%2$s)!", propertyName, ClassUtils.getName(type)), e); } return null; } }
[ "public", "<", "T", ">", "T", "getPropertyValueAs", "(", "final", "String", "propertyName", ",", "final", "boolean", "required", ",", "final", "Class", "<", "T", ">", "type", ")", "{", "try", "{", "return", "convert", "(", "getPropertyValue", "(", "propert...
Gets the value of the configuration property identified by name as a value of the specified Class type. The required parameter can be used to indicate the property is not required and that a ConfigurationException should not be thrown if the property is undeclared or undefined. @param propertyName a String value indicating the name of the configuration property. @param required used to indicate whether the configuration property is required to be declared and defined. @param type the expected Class type of the configuration property value. @return the value of the configuration property identified by name. @throws ConfigurationException if and only if the property is required and the property is either undeclared or undefined.
[ "Gets", "the", "value", "of", "the", "configuration", "property", "identified", "by", "name", "as", "a", "value", "of", "the", "specified", "Class", "type", ".", "The", "required", "parameter", "can", "be", "used", "to", "indicate", "the", "property", "is", ...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L247-L260
BioPAX/Paxtools
paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/BFS.java
BFS.isEquivalentInTheSet
protected boolean isEquivalentInTheSet(Node node, boolean direction, Set<Node> set) { for (Node eq : direction == UPWARD ? node.getUpperEquivalent() : node.getLowerEquivalent()) { if (set.contains(eq)) return true; boolean isIn = isEquivalentInTheSet(eq, direction, set); if (isIn) return true; } return false; }
java
protected boolean isEquivalentInTheSet(Node node, boolean direction, Set<Node> set) { for (Node eq : direction == UPWARD ? node.getUpperEquivalent() : node.getLowerEquivalent()) { if (set.contains(eq)) return true; boolean isIn = isEquivalentInTheSet(eq, direction, set); if (isIn) return true; } return false; }
[ "protected", "boolean", "isEquivalentInTheSet", "(", "Node", "node", ",", "boolean", "direction", ",", "Set", "<", "Node", ">", "set", ")", "{", "for", "(", "Node", "eq", ":", "direction", "==", "UPWARD", "?", "node", ".", "getUpperEquivalent", "(", ")", ...
Checks if an equivalent of the given node is in the set. @param node Node to check equivalents @param direction Direction to go to get equivalents @param set Node set @return true if an equivalent is in the set
[ "Checks", "if", "an", "equivalent", "of", "the", "given", "node", "is", "in", "the", "set", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/algorithm/BFS.java#L280-L289
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java
LoadJobConfiguration.newBuilder
public static Builder newBuilder( TableId destinationTable, List<String> sourceUris, FormatOptions format) { return newBuilder(destinationTable, sourceUris).setFormatOptions(format); }
java
public static Builder newBuilder( TableId destinationTable, List<String> sourceUris, FormatOptions format) { return newBuilder(destinationTable, sourceUris).setFormatOptions(format); }
[ "public", "static", "Builder", "newBuilder", "(", "TableId", "destinationTable", ",", "List", "<", "String", ">", "sourceUris", ",", "FormatOptions", "format", ")", "{", "return", "newBuilder", "(", "destinationTable", ",", "sourceUris", ")", ".", "setFormatOption...
Creates a builder for a BigQuery Load Job configuration given the destination table, format and source URIs.
[ "Creates", "a", "builder", "for", "a", "BigQuery", "Load", "Job", "configuration", "given", "the", "destination", "table", "format", "and", "source", "URIs", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java#L517-L520
graknlabs/grakn
server/src/server/kb/concept/TypeImpl.java
TypeImpl.checkNonOverlapOfImplicitRelations
private void checkNonOverlapOfImplicitRelations(Schema.ImplicitType implicitType, AttributeType attributeType) { if (attributes(implicitType).anyMatch(rt -> rt.equals(attributeType))) { throw TransactionException.duplicateHas(this, attributeType); } }
java
private void checkNonOverlapOfImplicitRelations(Schema.ImplicitType implicitType, AttributeType attributeType) { if (attributes(implicitType).anyMatch(rt -> rt.equals(attributeType))) { throw TransactionException.duplicateHas(this, attributeType); } }
[ "private", "void", "checkNonOverlapOfImplicitRelations", "(", "Schema", ".", "ImplicitType", "implicitType", ",", "AttributeType", "attributeType", ")", "{", "if", "(", "attributes", "(", "implicitType", ")", ".", "anyMatch", "(", "rt", "->", "rt", ".", "equals", ...
Checks if the provided AttributeType is already used in an other implicit relation. @param implicitType The implicit relation to check against. @param attributeType The AttributeType which should not be in that implicit relation @throws TransactionException when the AttributeType is already used in another implicit relation
[ "Checks", "if", "the", "provided", "AttributeType", "is", "already", "used", "in", "an", "other", "implicit", "relation", "." ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/TypeImpl.java#L453-L457
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/validate/ValidationException.java
ValidationException.fromResults
public static ValidationException fromResults(String correlationId, List<ValidationResult> results, boolean strict) throws ValidationException { boolean hasErrors = false; for (ValidationResult result : results) { if (result.getType() == ValidationResultType.Error) hasErrors = true; if (strict && result.getType() == ValidationResultType.Warning) hasErrors = true; } return hasErrors ? new ValidationException(correlationId, results) : null; }
java
public static ValidationException fromResults(String correlationId, List<ValidationResult> results, boolean strict) throws ValidationException { boolean hasErrors = false; for (ValidationResult result : results) { if (result.getType() == ValidationResultType.Error) hasErrors = true; if (strict && result.getType() == ValidationResultType.Warning) hasErrors = true; } return hasErrors ? new ValidationException(correlationId, results) : null; }
[ "public", "static", "ValidationException", "fromResults", "(", "String", "correlationId", ",", "List", "<", "ValidationResult", ">", "results", ",", "boolean", "strict", ")", "throws", "ValidationException", "{", "boolean", "hasErrors", "=", "false", ";", "for", "...
Creates a new ValidationException based on errors in validation results. If validation results have no errors, than null is returned. @param correlationId (optional) transaction id to trace execution through call chain. @param results list of validation results that may contain errors @param strict true to treat warnings as errors. @return a newly created ValidationException or null if no errors in found. @throws ValidationException when errors occured in validation. @see ValidationResult
[ "Creates", "a", "new", "ValidationException", "based", "on", "errors", "in", "validation", "results", ".", "If", "validation", "results", "have", "no", "errors", "than", "null", "is", "returned", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/validate/ValidationException.java#L88-L99
youngmonkeys/ezyfox-sfs2x
src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/UserZoneEventHandler.java
UserZoneEventHandler.notifyHandlers
private void notifyHandlers(ApiZone apiZone, User sfsUser) { ApiUser apiUser = fetchUserAgent(sfsUser); for (ZoneHandlerClass handler : handlers) { Object userAgent = checkUserAgent(handler, apiUser); if (!checkHandler(handler, apiZone)) continue; notifyHandler(handler, apiZone, userAgent); } }
java
private void notifyHandlers(ApiZone apiZone, User sfsUser) { ApiUser apiUser = fetchUserAgent(sfsUser); for (ZoneHandlerClass handler : handlers) { Object userAgent = checkUserAgent(handler, apiUser); if (!checkHandler(handler, apiZone)) continue; notifyHandler(handler, apiZone, userAgent); } }
[ "private", "void", "notifyHandlers", "(", "ApiZone", "apiZone", ",", "User", "sfsUser", ")", "{", "ApiUser", "apiUser", "=", "fetchUserAgent", "(", "sfsUser", ")", ";", "for", "(", "ZoneHandlerClass", "handler", ":", "handlers", ")", "{", "Object", "userAgent"...
Propagate event to handlers @param apiZone api zone reference @param sfsUser smartfox user object
[ "Propagate", "event", "to", "handlers" ]
train
https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/UserZoneEventHandler.java#L75-L83
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/script/Script.java
Script.getPubKeyHash
public byte[] getPubKeyHash() throws ScriptException { if (ScriptPattern.isP2PKH(this)) return ScriptPattern.extractHashFromP2PKH(this); else if (ScriptPattern.isP2SH(this)) return ScriptPattern.extractHashFromP2SH(this); else if (ScriptPattern.isP2WH(this)) return ScriptPattern.extractHashFromP2WH(this); else throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Script not in the standard scriptPubKey form"); }
java
public byte[] getPubKeyHash() throws ScriptException { if (ScriptPattern.isP2PKH(this)) return ScriptPattern.extractHashFromP2PKH(this); else if (ScriptPattern.isP2SH(this)) return ScriptPattern.extractHashFromP2SH(this); else if (ScriptPattern.isP2WH(this)) return ScriptPattern.extractHashFromP2WH(this); else throw new ScriptException(ScriptError.SCRIPT_ERR_UNKNOWN_ERROR, "Script not in the standard scriptPubKey form"); }
[ "public", "byte", "[", "]", "getPubKeyHash", "(", ")", "throws", "ScriptException", "{", "if", "(", "ScriptPattern", ".", "isP2PKH", "(", "this", ")", ")", "return", "ScriptPattern", ".", "extractHashFromP2PKH", "(", "this", ")", ";", "else", "if", "(", "S...
<p>If the program somehow pays to a hash, returns the hash.</p> <p>Otherwise this method throws a ScriptException.</p>
[ "<p", ">", "If", "the", "program", "somehow", "pays", "to", "a", "hash", "returns", "the", "hash", ".", "<", "/", "p", ">" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/Script.java#L255-L264
rzwitserloot/lombok
src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
PatchVal.skipResolveInitializerIfAlreadyCalled
public static TypeBinding skipResolveInitializerIfAlreadyCalled(Expression expr, BlockScope scope) { if (expr.resolvedType != null) return expr.resolvedType; try { return expr.resolveType(scope); } catch (NullPointerException e) { return null; } catch (ArrayIndexOutOfBoundsException e) { // This will occur internally due to for example 'val x = mth("X");', where mth takes 2 arguments. return null; } }
java
public static TypeBinding skipResolveInitializerIfAlreadyCalled(Expression expr, BlockScope scope) { if (expr.resolvedType != null) return expr.resolvedType; try { return expr.resolveType(scope); } catch (NullPointerException e) { return null; } catch (ArrayIndexOutOfBoundsException e) { // This will occur internally due to for example 'val x = mth("X");', where mth takes 2 arguments. return null; } }
[ "public", "static", "TypeBinding", "skipResolveInitializerIfAlreadyCalled", "(", "Expression", "expr", ",", "BlockScope", "scope", ")", "{", "if", "(", "expr", ".", "resolvedType", "!=", "null", ")", "return", "expr", ".", "resolvedType", ";", "try", "{", "retur...
and patches .resolve() on LocalDeclaration itself to just-in-time replace the 'val' vartype with the right one.
[ "and", "patches", ".", "resolve", "()", "on", "LocalDeclaration", "itself", "to", "just", "-", "in", "-", "time", "replace", "the", "val", "vartype", "with", "the", "right", "one", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java#L61-L71
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrieBuilder.java
CharsTrieBuilder.writeDeltaTo
@Deprecated @Override protected int writeDeltaTo(int jumpTarget) { int i=charsLength-jumpTarget; assert(i>=0); if(i<=CharsTrie.kMaxOneUnitDelta) { return write(i); } int length; if(i<=CharsTrie.kMaxTwoUnitDelta) { intUnits[0]=(char)(CharsTrie.kMinTwoUnitDeltaLead+(i>>16)); length=1; } else { intUnits[0]=(char)(CharsTrie.kThreeUnitDeltaLead); intUnits[1]=(char)(i>>16); length=2; } intUnits[length++]=(char)i; return write(intUnits, length); }
java
@Deprecated @Override protected int writeDeltaTo(int jumpTarget) { int i=charsLength-jumpTarget; assert(i>=0); if(i<=CharsTrie.kMaxOneUnitDelta) { return write(i); } int length; if(i<=CharsTrie.kMaxTwoUnitDelta) { intUnits[0]=(char)(CharsTrie.kMinTwoUnitDeltaLead+(i>>16)); length=1; } else { intUnits[0]=(char)(CharsTrie.kThreeUnitDeltaLead); intUnits[1]=(char)(i>>16); length=2; } intUnits[length++]=(char)i; return write(intUnits, length); }
[ "@", "Deprecated", "@", "Override", "protected", "int", "writeDeltaTo", "(", "int", "jumpTarget", ")", "{", "int", "i", "=", "charsLength", "-", "jumpTarget", ";", "assert", "(", "i", ">=", "0", ")", ";", "if", "(", "i", "<=", "CharsTrie", ".", "kMaxOn...
{@inheritDoc} @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrieBuilder.java#L251-L270
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBMapperFieldModel.java
DynamoDBMapperFieldModel.betweenAny
public final Condition betweenAny(final V lo, final V hi) { return lo == null ? (hi == null ? null : le(hi)) : (hi == null ? ge(lo) : (lo.equals(hi) ? eq(lo) : between(lo,hi))); }
java
public final Condition betweenAny(final V lo, final V hi) { return lo == null ? (hi == null ? null : le(hi)) : (hi == null ? ge(lo) : (lo.equals(hi) ? eq(lo) : between(lo,hi))); }
[ "public", "final", "Condition", "betweenAny", "(", "final", "V", "lo", ",", "final", "V", "hi", ")", "{", "return", "lo", "==", "null", "?", "(", "hi", "==", "null", "?", "null", ":", "le", "(", "hi", ")", ")", ":", "(", "hi", "==", "null", "?"...
Creates a condition which filters on any non-null argument; if {@code lo} is null a {@code LE} condition is applied on {@code hi}, if {@code hi} is null a {@code GE} condition is applied on {@code lo}. @param lo The start of the range (inclusive). @param hi The end of the range (inclusive). @return The condition or null if both arguments are null. @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#BETWEEN @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#EQ @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#GE @see com.amazonaws.services.dynamodbv2.model.ComparisonOperator#LE @see com.amazonaws.services.dynamodbv2.model.Condition
[ "Creates", "a", "condition", "which", "filters", "on", "any", "non", "-", "null", "argument", ";", "if", "{" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBMapperFieldModel.java#L385-L387
elastic/elasticsearch-hadoop
mr/src/main/java/org/elasticsearch/hadoop/rest/pooling/PooledHttpTransportFactory.java
PooledHttpTransportFactory.borrowFrom
private Transport borrowFrom(TransportPool pool, String hostInfo) { if (!pool.getJobPoolingKey().equals(jobKey)) { throw new EsHadoopIllegalArgumentException("PooledTransportFactory found a pool with a different owner than this job. " + "This could be a different job incorrectly polluting the TransportPool. Bailing out..."); } try { return pool.borrowTransport(); } catch (Exception ex) { throw new EsHadoopException( String.format("Could not get a Transport from the Transport Pool for host [%s]", hostInfo), ex ); } }
java
private Transport borrowFrom(TransportPool pool, String hostInfo) { if (!pool.getJobPoolingKey().equals(jobKey)) { throw new EsHadoopIllegalArgumentException("PooledTransportFactory found a pool with a different owner than this job. " + "This could be a different job incorrectly polluting the TransportPool. Bailing out..."); } try { return pool.borrowTransport(); } catch (Exception ex) { throw new EsHadoopException( String.format("Could not get a Transport from the Transport Pool for host [%s]", hostInfo), ex ); } }
[ "private", "Transport", "borrowFrom", "(", "TransportPool", "pool", ",", "String", "hostInfo", ")", "{", "if", "(", "!", "pool", ".", "getJobPoolingKey", "(", ")", ".", "equals", "(", "jobKey", ")", ")", "{", "throw", "new", "EsHadoopIllegalArgumentException",...
Creates a Transport using the given TransportPool. @param pool Transport is borrowed from @param hostInfo For logging purposes @return A Transport backed by a pooled resource
[ "Creates", "a", "Transport", "using", "the", "given", "TransportPool", "." ]
train
https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/rest/pooling/PooledHttpTransportFactory.java#L101-L114
super-csv/super-csv
super-csv/src/main/java/org/supercsv/util/MethodCache.java
MethodCache.getGetMethod
public Method getGetMethod(final Object object, final String fieldName) { if( object == null ) { throw new NullPointerException("object should not be null"); } else if( fieldName == null ) { throw new NullPointerException("fieldName should not be null"); } Method method = getCache.get(object.getClass().getName(), fieldName); if( method == null ) { method = ReflectionUtils.findGetter(object, fieldName); getCache.set(object.getClass().getName(), fieldName, method); } return method; }
java
public Method getGetMethod(final Object object, final String fieldName) { if( object == null ) { throw new NullPointerException("object should not be null"); } else if( fieldName == null ) { throw new NullPointerException("fieldName should not be null"); } Method method = getCache.get(object.getClass().getName(), fieldName); if( method == null ) { method = ReflectionUtils.findGetter(object, fieldName); getCache.set(object.getClass().getName(), fieldName, method); } return method; }
[ "public", "Method", "getGetMethod", "(", "final", "Object", "object", ",", "final", "String", "fieldName", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"object should not be null\"", ")", ";", "}", "else...
Returns the getter method for field on an object. @param object the object @param fieldName the field name @return the getter associated with the field on the object @throws NullPointerException if object or fieldName is null @throws SuperCsvReflectionException if the getter doesn't exist or is not visible
[ "Returns", "the", "getter", "method", "for", "field", "on", "an", "object", "." ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/MethodCache.java#L53-L66
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AuditResources.java
AuditResources.findByEntityId
@GET @Path("/entity/{entityid}") @Description("Returns the audit trail for an entity.") @Produces(MediaType.APPLICATION_JSON) public List<AuditDto> findByEntityId(@PathParam("entityid") BigInteger entityid, @QueryParam("limit") BigInteger limit) { if (entityid == null || entityid.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Entity ID cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (limit != null && limit.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Limit must be a positive non-zero number.", Status.BAD_REQUEST); } List<Audit> auditList = limit == null ? _auditService.findByEntity(entityid) : _auditService.findByEntity(entityid, limit); if (auditList != null && auditList.size() > 0) { return AuditDto.transformToDto(auditList); } else { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } }
java
@GET @Path("/entity/{entityid}") @Description("Returns the audit trail for an entity.") @Produces(MediaType.APPLICATION_JSON) public List<AuditDto> findByEntityId(@PathParam("entityid") BigInteger entityid, @QueryParam("limit") BigInteger limit) { if (entityid == null || entityid.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Entity ID cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (limit != null && limit.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Limit must be a positive non-zero number.", Status.BAD_REQUEST); } List<Audit> auditList = limit == null ? _auditService.findByEntity(entityid) : _auditService.findByEntity(entityid, limit); if (auditList != null && auditList.size() > 0) { return AuditDto.transformToDto(auditList); } else { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } }
[ "@", "GET", "@", "Path", "(", "\"/entity/{entityid}\"", ")", "@", "Description", "(", "\"Returns the audit trail for an entity.\"", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "public", "List", "<", "AuditDto", ">", "findByEntityId", "(", ...
Returns the audit record for the given id. @param entityid The entity Id. Cannot be null. @param limit max no of records @return The audit object. @throws WebApplicationException Throws the exception for invalid input data.
[ "Returns", "the", "audit", "record", "for", "the", "given", "id", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/AuditResources.java#L75-L95
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/objdetect/Yolo2OutputLayer.java
Yolo2OutputLayer.getConfidenceMatrix
public INDArray getConfidenceMatrix(INDArray networkOutput, int example, int bbNumber){ //Input format: [minibatch, 5B+C, H, W], with order [x,y,w,h,c] //Therefore: confidences are at depths 4 + bbNumber * 5 INDArray conf = networkOutput.get(point(example), point(4+bbNumber*5), all(), all()); return conf; }
java
public INDArray getConfidenceMatrix(INDArray networkOutput, int example, int bbNumber){ //Input format: [minibatch, 5B+C, H, W], with order [x,y,w,h,c] //Therefore: confidences are at depths 4 + bbNumber * 5 INDArray conf = networkOutput.get(point(example), point(4+bbNumber*5), all(), all()); return conf; }
[ "public", "INDArray", "getConfidenceMatrix", "(", "INDArray", "networkOutput", ",", "int", "example", ",", "int", "bbNumber", ")", "{", "//Input format: [minibatch, 5B+C, H, W], with order [x,y,w,h,c]", "//Therefore: confidences are at depths 4 + bbNumber * 5", "INDArray", "conf", ...
Get the confidence matrix (confidence for all x/y positions) for the specified bounding box, from the network output activations array @param networkOutput Network output activations @param example Example number, in minibatch @param bbNumber Bounding box number @return Confidence matrix
[ "Get", "the", "confidence", "matrix", "(", "confidence", "for", "all", "x", "/", "y", "positions", ")", "for", "the", "specified", "bounding", "box", "from", "the", "network", "output", "activations", "array" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/objdetect/Yolo2OutputLayer.java#L648-L655
scireum/server-sass
src/main/java/org/serversass/Functions.java
Functions.rgba
public static Expression rgba(Generator generator, FunctionCall input) { if (input.getParameters().size() == 4) { return new Color(input.getExpectedIntParam(0), input.getExpectedIntParam(1), input.getExpectedIntParam(2), input.getExpectedFloatParam(3)); } if (input.getParameters().size() == 2) { Color color = input.getExpectedColorParam(0); float newA = input.getExpectedFloatParam(1); return new Color(color.getR(), color.getG(), color.getB(), newA); } throw new IllegalArgumentException("rgba must be called with either 2 or 4 parameters. Function call: " + input); }
java
public static Expression rgba(Generator generator, FunctionCall input) { if (input.getParameters().size() == 4) { return new Color(input.getExpectedIntParam(0), input.getExpectedIntParam(1), input.getExpectedIntParam(2), input.getExpectedFloatParam(3)); } if (input.getParameters().size() == 2) { Color color = input.getExpectedColorParam(0); float newA = input.getExpectedFloatParam(1); return new Color(color.getR(), color.getG(), color.getB(), newA); } throw new IllegalArgumentException("rgba must be called with either 2 or 4 parameters. Function call: " + input); }
[ "public", "static", "Expression", "rgba", "(", "Generator", "generator", ",", "FunctionCall", "input", ")", "{", "if", "(", "input", ".", "getParameters", "(", ")", ".", "size", "(", ")", "==", "4", ")", "{", "return", "new", "Color", "(", "input", "."...
Creates a color from given RGB and alpha values. @param generator the surrounding generator @param input the function call to evaluate @return the result of the evaluation
[ "Creates", "a", "color", "from", "given", "RGB", "and", "alpha", "values", "." ]
train
https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L55-L69
CleverTap/clevertap-android-sdk
clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java
CleverTapAPI.pushGcmRegistrationId
@SuppressWarnings("WeakerAccess") public void pushGcmRegistrationId(String gcmId, boolean register) { pushDeviceToken(gcmId, register, PushType.GCM); }
java
@SuppressWarnings("WeakerAccess") public void pushGcmRegistrationId(String gcmId, boolean register) { pushDeviceToken(gcmId, register, PushType.GCM); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "void", "pushGcmRegistrationId", "(", "String", "gcmId", ",", "boolean", "register", ")", "{", "pushDeviceToken", "(", "gcmId", ",", "register", ",", "PushType", ".", "GCM", ")", ";", "}" ]
Sends the GCM registration ID to CleverTap. @param gcmId The GCM registration ID @param register Boolean indicating whether to register or not for receiving push messages from CleverTap. Set this to true to receive push messages from CleverTap, and false to not receive any messages from CleverTap.
[ "Sends", "the", "GCM", "registration", "ID", "to", "CleverTap", "." ]
train
https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/CleverTapAPI.java#L4807-L4810
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java
DependencyBundlingAnalyzer.hashesMatch
private boolean hashesMatch(Dependency dependency1, Dependency dependency2) { if (dependency1 == null || dependency2 == null || dependency1.getSha1sum() == null || dependency2.getSha1sum() == null) { return false; } return dependency1.getSha1sum().equals(dependency2.getSha1sum()); }
java
private boolean hashesMatch(Dependency dependency1, Dependency dependency2) { if (dependency1 == null || dependency2 == null || dependency1.getSha1sum() == null || dependency2.getSha1sum() == null) { return false; } return dependency1.getSha1sum().equals(dependency2.getSha1sum()); }
[ "private", "boolean", "hashesMatch", "(", "Dependency", "dependency1", ",", "Dependency", "dependency2", ")", "{", "if", "(", "dependency1", "==", "null", "||", "dependency2", "==", "null", "||", "dependency1", ".", "getSha1sum", "(", ")", "==", "null", "||", ...
Compares the SHA1 hashes of two dependencies to determine if they are equal. @param dependency1 a dependency object to compare @param dependency2 a dependency object to compare @return true if the sha1 hashes of the two dependencies match; otherwise false
[ "Compares", "the", "SHA1", "hashes", "of", "two", "dependencies", "to", "determine", "if", "they", "are", "equal", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java#L390-L395
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaGraphicsUnmapResources
public static int cudaGraphicsUnmapResources(int count, cudaGraphicsResource resources[], cudaStream_t stream) { return checkResult(cudaGraphicsUnmapResourcesNative(count, resources, stream)); }
java
public static int cudaGraphicsUnmapResources(int count, cudaGraphicsResource resources[], cudaStream_t stream) { return checkResult(cudaGraphicsUnmapResourcesNative(count, resources, stream)); }
[ "public", "static", "int", "cudaGraphicsUnmapResources", "(", "int", "count", ",", "cudaGraphicsResource", "resources", "[", "]", ",", "cudaStream_t", "stream", ")", "{", "return", "checkResult", "(", "cudaGraphicsUnmapResourcesNative", "(", "count", ",", "resources",...
Unmap graphics resources. <pre> cudaError_t cudaGraphicsUnmapResources ( int count, cudaGraphicsResource_t* resources, cudaStream_t stream = 0 ) </pre> <div> <p>Unmap graphics resources. Unmaps the <tt>count</tt> graphics resources in <tt>resources</tt>. </p> <p>Once unmapped, the resources in <tt>resources</tt> may not be accessed by CUDA until they are mapped again. </p> <p>This function provides the synchronization guarantee that any CUDA work issued in <tt>stream</tt> before cudaGraphicsUnmapResources() will complete before any subsequently issued graphics work begins. </p> <p>If <tt>resources</tt> contains any duplicate entries then cudaErrorInvalidResourceHandle is returned. If any of <tt>resources</tt> are not presently mapped for access by CUDA then cudaErrorUnknown is returned. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param count Number of resources to unmap @param resources Resources to unmap @param stream Stream for synchronization @return cudaSuccess, cudaErrorInvalidResourceHandle, cudaErrorUnknown @see JCuda#cudaGraphicsMapResources
[ "Unmap", "graphics", "resources", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L11559-L11562
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java
DateControl.setDefaultCalendarProvider
public final void setDefaultCalendarProvider(Callback<DateControl, Calendar> provider) { requireNonNull(provider); defaultCalendarProviderProperty().set(provider); }
java
public final void setDefaultCalendarProvider(Callback<DateControl, Calendar> provider) { requireNonNull(provider); defaultCalendarProviderProperty().set(provider); }
[ "public", "final", "void", "setDefaultCalendarProvider", "(", "Callback", "<", "DateControl", ",", "Calendar", ">", "provider", ")", "{", "requireNonNull", "(", "provider", ")", ";", "defaultCalendarProviderProperty", "(", ")", ".", "set", "(", "provider", ")", ...
Sets the value of {@link #defaultCalendarProviderProperty()}. @param provider the default calendar provider
[ "Sets", "the", "value", "of", "{", "@link", "#defaultCalendarProviderProperty", "()", "}", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/view/DateControl.java#L1383-L1386
deephacks/confit
api-model/src/main/java/org/deephacks/confit/model/Bean.java
Bean.addProperty
public void addProperty(final String propertyName, final String value) { Preconditions.checkNotNull(propertyName); Preconditions.checkNotNull(value); List<String> values = properties.get(propertyName); if (values == null) { values = new ArrayList<>(); values.add(value); properties.put(propertyName, values); } else { values.add(value); } }
java
public void addProperty(final String propertyName, final String value) { Preconditions.checkNotNull(propertyName); Preconditions.checkNotNull(value); List<String> values = properties.get(propertyName); if (values == null) { values = new ArrayList<>(); values.add(value); properties.put(propertyName, values); } else { values.add(value); } }
[ "public", "void", "addProperty", "(", "final", "String", "propertyName", ",", "final", "String", "value", ")", "{", "Preconditions", ".", "checkNotNull", "(", "propertyName", ")", ";", "Preconditions", ".", "checkNotNull", "(", "value", ")", ";", "List", "<", ...
Add a value to a property on this bean. @param propertyName name of the property as defined by the bean's schema. @param value final String representations of the property that conforms to its type as defined by the bean's schema.
[ "Add", "a", "value", "to", "a", "property", "on", "this", "bean", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/api-model/src/main/java/org/deephacks/confit/model/Bean.java#L163-L174
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/utils/LoadedClassCache.java
LoadedClassCache.getClass
public static Class getClass(final ClassLoader cl, final String className) throws ClassNotFoundException { if (LOADED_PLUGINS.get(cl) == null) { LOADED_PLUGINS.put(cl, new ClassesData()); } ClassesData cd = LOADED_PLUGINS.get(cl); Class clazz = cd.getClass(className); if (clazz == null) { clazz = cl.loadClass(className); saveClass(cl, clazz); } return clazz; }
java
public static Class getClass(final ClassLoader cl, final String className) throws ClassNotFoundException { if (LOADED_PLUGINS.get(cl) == null) { LOADED_PLUGINS.put(cl, new ClassesData()); } ClassesData cd = LOADED_PLUGINS.get(cl); Class clazz = cd.getClass(className); if (clazz == null) { clazz = cl.loadClass(className); saveClass(cl, clazz); } return clazz; }
[ "public", "static", "Class", "getClass", "(", "final", "ClassLoader", "cl", ",", "final", "String", "className", ")", "throws", "ClassNotFoundException", "{", "if", "(", "LOADED_PLUGINS", ".", "get", "(", "cl", ")", "==", "null", ")", "{", "LOADED_PLUGINS", ...
Returns a class object. If the class is new, a new Class object is created, otherwise the cached object is returned. @param cl the classloader @param className the class name @return the class object associated to the given class name * @throws ClassNotFoundException if the class can't be loaded
[ "Returns", "a", "class", "object", ".", "If", "the", "class", "is", "new", "a", "new", "Class", "object", "is", "created", "otherwise", "the", "cached", "object", "is", "returned", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/utils/LoadedClassCache.java#L139-L152
algolia/instantsearch-android
core/src/main/java/com/algolia/instantsearch/core/utils/JSONUtils.java
JSONUtils.getMapFromJSONPath
public static HashMap<String, String> getMapFromJSONPath(JSONObject record, String path) { return getObjectFromJSONPath(record, path); }
java
public static HashMap<String, String> getMapFromJSONPath(JSONObject record, String path) { return getObjectFromJSONPath(record, path); }
[ "public", "static", "HashMap", "<", "String", ",", "String", ">", "getMapFromJSONPath", "(", "JSONObject", "record", ",", "String", "path", ")", "{", "return", "getObjectFromJSONPath", "(", "record", ",", "path", ")", ";", "}" ]
Gets a Map of attributes from a json object given a path to traverse. @param record a JSONObject to traverse. @param path the json path to follow. @return the attributes as a {@link HashMap}, or null if it was not found.
[ "Gets", "a", "Map", "of", "attributes", "from", "a", "json", "object", "given", "a", "path", "to", "traverse", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/core/src/main/java/com/algolia/instantsearch/core/utils/JSONUtils.java#L33-L35
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/SRTOutputStream.java
SRTOutputStream.write
public void write(byte[] b, int off, int len) throws IOException { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"write", "Writing"); } if (_observer != null) _observer.alertFirstWrite(); _conn.write(b, off, len); }
java
public void write(byte[] b, int off, int len) throws IOException { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) { //306998.15 logger.logp(Level.FINE, CLASS_NAME,"write", "Writing"); } if (_observer != null) _observer.alertFirstWrite(); _conn.write(b, off, len); }
[ "public", "void", "write", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "if", "(", "com", ".", "ibm", ".", "ejs", ".", "ras", ".", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", ...
This method was created in VisualAge. @param b byte[] @param off int @param len int
[ "This", "method", "was", "created", "in", "VisualAge", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/srt/SRTOutputStream.java#L120-L129
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.displayMessageAtTheBeginningOfMethod
protected void displayMessageAtTheBeginningOfMethod(String methodName, String act, String concernedActivity, List<String> concernedActivities) { logger.debug("{} {}: {} with {} concernedActivity(ies)", act, methodName, concernedActivity, concernedActivities.size()); int i = 0; for (final String activity : concernedActivities) { i++; logger.debug(" activity N°{}={}", i, activity); } }
java
protected void displayMessageAtTheBeginningOfMethod(String methodName, String act, String concernedActivity, List<String> concernedActivities) { logger.debug("{} {}: {} with {} concernedActivity(ies)", act, methodName, concernedActivity, concernedActivities.size()); int i = 0; for (final String activity : concernedActivities) { i++; logger.debug(" activity N°{}={}", i, activity); } }
[ "protected", "void", "displayMessageAtTheBeginningOfMethod", "(", "String", "methodName", ",", "String", "act", ",", "String", "concernedActivity", ",", "List", "<", "String", ">", "concernedActivities", ")", "{", "logger", ".", "debug", "(", "\"{} {}: {} with {} conc...
Displays message (concerned activity and list of authorized activities) at the beginning of method in logs. @param methodName is name of java method @param act is name of activity @param concernedActivity is concerned activity @param concernedActivities is a list of authorized activities
[ "Displays", "message", "(", "concerned", "activity", "and", "list", "of", "authorized", "activities", ")", "at", "the", "beginning", "of", "method", "in", "logs", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L825-L832
square/picasso
picasso/src/main/java/com/squareup/picasso3/Picasso.java
Picasso.cancelTag
public void cancelTag(@NonNull Object tag) { checkMain(); checkNotNull(tag, "tag == null"); List<Action> actions = new ArrayList<>(targetToAction.values()); //noinspection ForLoopReplaceableByForEach for (int i = 0, n = actions.size(); i < n; i++) { Action action = actions.get(i); if (tag.equals(action.getTag())) { cancelExistingRequest(action.getTarget()); } } List<DeferredRequestCreator> deferredRequestCreators = new ArrayList<>(targetToDeferredRequestCreator.values()); //noinspection ForLoopReplaceableByForEach for (int i = 0, n = deferredRequestCreators.size(); i < n; i++) { DeferredRequestCreator deferredRequestCreator = deferredRequestCreators.get(i); if (tag.equals(deferredRequestCreator.getTag())) { deferredRequestCreator.cancel(); } } }
java
public void cancelTag(@NonNull Object tag) { checkMain(); checkNotNull(tag, "tag == null"); List<Action> actions = new ArrayList<>(targetToAction.values()); //noinspection ForLoopReplaceableByForEach for (int i = 0, n = actions.size(); i < n; i++) { Action action = actions.get(i); if (tag.equals(action.getTag())) { cancelExistingRequest(action.getTarget()); } } List<DeferredRequestCreator> deferredRequestCreators = new ArrayList<>(targetToDeferredRequestCreator.values()); //noinspection ForLoopReplaceableByForEach for (int i = 0, n = deferredRequestCreators.size(); i < n; i++) { DeferredRequestCreator deferredRequestCreator = deferredRequestCreators.get(i); if (tag.equals(deferredRequestCreator.getTag())) { deferredRequestCreator.cancel(); } } }
[ "public", "void", "cancelTag", "(", "@", "NonNull", "Object", "tag", ")", "{", "checkMain", "(", ")", ";", "checkNotNull", "(", "tag", ",", "\"tag == null\"", ")", ";", "List", "<", "Action", ">", "actions", "=", "new", "ArrayList", "<>", "(", "targetToA...
Cancel any existing requests with given tag. You can set a tag on new requests with {@link RequestCreator#tag(Object)}. @see RequestCreator#tag(Object)
[ "Cancel", "any", "existing", "requests", "with", "given", "tag", ".", "You", "can", "set", "a", "tag", "on", "new", "requests", "with", "{", "@link", "RequestCreator#tag", "(", "Object", ")", "}", "." ]
train
https://github.com/square/picasso/blob/89f55b76e3be2b65e5997b7698f782f16f8547e3/picasso/src/main/java/com/squareup/picasso3/Picasso.java#L242-L264
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.setDefaultSREInstall
public static void setDefaultSREInstall(ISREInstall sre, IProgressMonitor monitor) throws CoreException { setDefaultSREInstall(sre, monitor, true); }
java
public static void setDefaultSREInstall(ISREInstall sre, IProgressMonitor monitor) throws CoreException { setDefaultSREInstall(sre, monitor, true); }
[ "public", "static", "void", "setDefaultSREInstall", "(", "ISREInstall", "sre", ",", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "setDefaultSREInstall", "(", "sre", ",", "monitor", ",", "true", ")", ";", "}" ]
Sets a SRE as the system-wide default SRE, and notifies registered SRE install change listeners of the change. @param sre The SRE to make the default. May be <code>null</code> to clear the default. @param monitor progress monitor or <code>null</code> @throws CoreException if trying to set the default SRE install encounters problems
[ "Sets", "a", "SRE", "as", "the", "system", "-", "wide", "default", "SRE", "and", "notifies", "registered", "SRE", "install", "change", "listeners", "of", "the", "change", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L345-L347
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/util/event/EventDispatcherBase.java
EventDispatcherBase.dispatchEvent
protected <T> void dispatchEvent(DispatchQueueSelector queueSelector, List<T> listeners, Consumer<T> consumer) { api.getThreadPool().getSingleThreadExecutorService("Event Dispatch Queues Manager").submit(() -> { if (queueSelector != null) { // Object dependent listeners // Don't allow adding of more events while there are unfinished object independent tasks Queue<Runnable> objectIndependentQueue = queuedListenerTasks.get(null); while (!objectIndependentQueue.isEmpty()) { try { synchronized (queuedListenerTasks) { // Just to be on the safe side, we use a timeout of 5 seconds queuedListenerTasks.wait(5000); } } catch (InterruptedException ignored) { } } } Queue<Runnable> queue = queuedListenerTasks.computeIfAbsent( queueSelector, o -> new ConcurrentLinkedQueue<>()); listeners.forEach(listener -> queue.add(() -> consumer.accept(listener))); checkRunningListenersAndStartIfPossible(queueSelector); }); }
java
protected <T> void dispatchEvent(DispatchQueueSelector queueSelector, List<T> listeners, Consumer<T> consumer) { api.getThreadPool().getSingleThreadExecutorService("Event Dispatch Queues Manager").submit(() -> { if (queueSelector != null) { // Object dependent listeners // Don't allow adding of more events while there are unfinished object independent tasks Queue<Runnable> objectIndependentQueue = queuedListenerTasks.get(null); while (!objectIndependentQueue.isEmpty()) { try { synchronized (queuedListenerTasks) { // Just to be on the safe side, we use a timeout of 5 seconds queuedListenerTasks.wait(5000); } } catch (InterruptedException ignored) { } } } Queue<Runnable> queue = queuedListenerTasks.computeIfAbsent( queueSelector, o -> new ConcurrentLinkedQueue<>()); listeners.forEach(listener -> queue.add(() -> consumer.accept(listener))); checkRunningListenersAndStartIfPossible(queueSelector); }); }
[ "protected", "<", "T", ">", "void", "dispatchEvent", "(", "DispatchQueueSelector", "queueSelector", ",", "List", "<", "T", ">", "listeners", ",", "Consumer", "<", "T", ">", "consumer", ")", "{", "api", ".", "getThreadPool", "(", ")", ".", "getSingleThreadExe...
Dispatches an event to the given listeners using the provided consumer. Calling this method usually looks like this: {@code dispatchEvent(server, listeners, listener -> listener.onXyz(event));} @param queueSelector The object which is used to determine in which queue the event should be dispatched. Usually the object is a server object (for server-dependent events), a discord api instance (for server-independent events, like DMs or GMs) or {@code null} (for lifecycle events, like connection lost, resume or reconnect). Providing {@code null} means, that already started dispatchings are going to be finished, then all events with a {@code null} queue selector are dispatched and finally other events are dispatched like normal again. Events with the same queue selector are dispatched sequentially in the correct order of enqueueal, but on arbitrary threads from a thread pool. Events with different queue selectors are dispatched in parallel. @param listeners A list with listeners which get consumed by the given consumer. @param consumer A consumer which consumes all listeners from the given list and is meant to call their {@code onXyz(Event)} method. @param <T> The type of the listener.
[ "Dispatches", "an", "event", "to", "the", "given", "listeners", "using", "the", "provided", "consumer", ".", "Calling", "this", "method", "usually", "looks", "like", "this", ":", "{", "@code", "dispatchEvent", "(", "server", "listeners", "listener", "-", ">", ...
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/util/event/EventDispatcherBase.java#L181-L200
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
Configuration.getEnum
@PublicEvolving public <T extends Enum<T>> T getEnum( final Class<T> enumClass, final ConfigOption<String> configOption) { checkNotNull(enumClass, "enumClass must not be null"); checkNotNull(configOption, "configOption must not be null"); final String configValue = getString(configOption); try { return Enum.valueOf(enumClass, configValue.toUpperCase(Locale.ROOT)); } catch (final IllegalArgumentException | NullPointerException e) { final String errorMessage = String.format("Value for config option %s must be one of %s (was %s)", configOption.key(), Arrays.toString(enumClass.getEnumConstants()), configValue); throw new IllegalArgumentException(errorMessage, e); } }
java
@PublicEvolving public <T extends Enum<T>> T getEnum( final Class<T> enumClass, final ConfigOption<String> configOption) { checkNotNull(enumClass, "enumClass must not be null"); checkNotNull(configOption, "configOption must not be null"); final String configValue = getString(configOption); try { return Enum.valueOf(enumClass, configValue.toUpperCase(Locale.ROOT)); } catch (final IllegalArgumentException | NullPointerException e) { final String errorMessage = String.format("Value for config option %s must be one of %s (was %s)", configOption.key(), Arrays.toString(enumClass.getEnumConstants()), configValue); throw new IllegalArgumentException(errorMessage, e); } }
[ "@", "PublicEvolving", "public", "<", "T", "extends", "Enum", "<", "T", ">", ">", "T", "getEnum", "(", "final", "Class", "<", "T", ">", "enumClass", ",", "final", "ConfigOption", "<", "String", ">", "configOption", ")", "{", "checkNotNull", "(", "enumCla...
Returns the value associated with the given config option as an enum. @param enumClass The return enum class @param configOption The configuration option @throws IllegalArgumentException If the string associated with the given config option cannot be parsed as a value of the provided enum class.
[ "Returns", "the", "value", "associated", "with", "the", "given", "config", "option", "as", "an", "enum", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L622-L639
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.getTileGridWGS84
public static TileGrid getTileGridWGS84(BoundingBox boundingBox, int zoom) { int tilesPerLat = tilesPerWGS84LatSide(zoom); int tilesPerLon = tilesPerWGS84LonSide(zoom); double tileSizeLat = tileSizeLatPerWGS84Side(tilesPerLat); double tileSizeLon = tileSizeLonPerWGS84Side(tilesPerLon); int minX = (int) ((boundingBox.getMinLongitude() + ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) / tileSizeLon); double tempMaxX = (boundingBox.getMaxLongitude() + ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) / tileSizeLon; int maxX = (int) tempMaxX; if (tempMaxX % 1 == 0) { maxX--; } maxX = Math.min(maxX, tilesPerLon - 1); int minY = (int) (((boundingBox.getMaxLatitude() - ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT) * -1) / tileSizeLat); double tempMaxY = ((boundingBox.getMinLatitude() - ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT) * -1) / tileSizeLat; int maxY = (int) tempMaxY; if (tempMaxY % 1 == 0) { maxY--; } maxY = Math.min(maxY, tilesPerLat - 1); TileGrid grid = new TileGrid(minX, minY, maxX, maxY); return grid; }
java
public static TileGrid getTileGridWGS84(BoundingBox boundingBox, int zoom) { int tilesPerLat = tilesPerWGS84LatSide(zoom); int tilesPerLon = tilesPerWGS84LonSide(zoom); double tileSizeLat = tileSizeLatPerWGS84Side(tilesPerLat); double tileSizeLon = tileSizeLonPerWGS84Side(tilesPerLon); int minX = (int) ((boundingBox.getMinLongitude() + ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) / tileSizeLon); double tempMaxX = (boundingBox.getMaxLongitude() + ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) / tileSizeLon; int maxX = (int) tempMaxX; if (tempMaxX % 1 == 0) { maxX--; } maxX = Math.min(maxX, tilesPerLon - 1); int minY = (int) (((boundingBox.getMaxLatitude() - ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT) * -1) / tileSizeLat); double tempMaxY = ((boundingBox.getMinLatitude() - ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT) * -1) / tileSizeLat; int maxY = (int) tempMaxY; if (tempMaxY % 1 == 0) { maxY--; } maxY = Math.min(maxY, tilesPerLat - 1); TileGrid grid = new TileGrid(minX, minY, maxX, maxY); return grid; }
[ "public", "static", "TileGrid", "getTileGridWGS84", "(", "BoundingBox", "boundingBox", ",", "int", "zoom", ")", "{", "int", "tilesPerLat", "=", "tilesPerWGS84LatSide", "(", "zoom", ")", ";", "int", "tilesPerLon", "=", "tilesPerWGS84LonSide", "(", "zoom", ")", ";...
Get the tile grid that includes the entire tile bounding box @param boundingBox wgs84 bounding box @param zoom zoom level @return tile grid @since 1.2.0
[ "Get", "the", "tile", "grid", "that", "includes", "the", "entire", "tile", "bounding", "box" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L1135-L1164
aehrc/ontology-core
ontology-import/src/main/java/au/csiro/ontology/importer/rf2/RF2Importer.java
RF2Importer.getOntologyBuilder
protected OntologyBuilder getOntologyBuilder(VersionRows vr, String rootModuleId, String rootModuleVersion, Map<String, String> metadata) { return new OntologyBuilder(vr, rootModuleId, rootModuleVersion, metadata); }
java
protected OntologyBuilder getOntologyBuilder(VersionRows vr, String rootModuleId, String rootModuleVersion, Map<String, String> metadata) { return new OntologyBuilder(vr, rootModuleId, rootModuleVersion, metadata); }
[ "protected", "OntologyBuilder", "getOntologyBuilder", "(", "VersionRows", "vr", ",", "String", "rootModuleId", ",", "String", "rootModuleVersion", ",", "Map", "<", "String", ",", "String", ">", "metadata", ")", "{", "return", "new", "OntologyBuilder", "(", "vr", ...
Hook method for subclasses to override. @param vr @param rootModuleId @param rootModuleVersion @param includeInactiveAxioms @return
[ "Hook", "method", "for", "subclasses", "to", "override", "." ]
train
https://github.com/aehrc/ontology-core/blob/446aa691119f2bbcb8d184566084b8da7a07a44e/ontology-import/src/main/java/au/csiro/ontology/importer/rf2/RF2Importer.java#L663-L666
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java
OjbTagsHandler.processNested
public String processNested(Properties attributes) throws XDocletException { String name = OjbMemberTagsHandler.getMemberName(); XClass type = OjbMemberTagsHandler.getMemberType(); int dim = OjbMemberTagsHandler.getMemberDimension(); NestedDef nestedDef = _curClassDef.getNested(name); if (type == null) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.COULD_NOT_DETERMINE_TYPE_OF_MEMBER, new String[]{name})); } if (dim > 0) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.MEMBER_CANNOT_BE_NESTED, new String[]{name, _curClassDef.getName()})); } ClassDescriptorDef nestedTypeDef = _model.getClass(type.getQualifiedName()); if (nestedTypeDef == null) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.COULD_NOT_DETERMINE_TYPE_OF_MEMBER, new String[]{name})); } if (nestedDef == null) { nestedDef = new NestedDef(name, nestedTypeDef); _curClassDef.addNested(nestedDef); } LogHelper.debug(false, OjbTagsHandler.class, "processNested", " Processing nested object "+nestedDef.getName()+" of type "+nestedTypeDef.getName()); String attrName; for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); ) { attrName = (String)attrNames.nextElement(); nestedDef.setProperty(attrName, attributes.getProperty(attrName)); } return ""; }
java
public String processNested(Properties attributes) throws XDocletException { String name = OjbMemberTagsHandler.getMemberName(); XClass type = OjbMemberTagsHandler.getMemberType(); int dim = OjbMemberTagsHandler.getMemberDimension(); NestedDef nestedDef = _curClassDef.getNested(name); if (type == null) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.COULD_NOT_DETERMINE_TYPE_OF_MEMBER, new String[]{name})); } if (dim > 0) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.MEMBER_CANNOT_BE_NESTED, new String[]{name, _curClassDef.getName()})); } ClassDescriptorDef nestedTypeDef = _model.getClass(type.getQualifiedName()); if (nestedTypeDef == null) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.COULD_NOT_DETERMINE_TYPE_OF_MEMBER, new String[]{name})); } if (nestedDef == null) { nestedDef = new NestedDef(name, nestedTypeDef); _curClassDef.addNested(nestedDef); } LogHelper.debug(false, OjbTagsHandler.class, "processNested", " Processing nested object "+nestedDef.getName()+" of type "+nestedTypeDef.getName()); String attrName; for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); ) { attrName = (String)attrNames.nextElement(); nestedDef.setProperty(attrName, attributes.getProperty(attrName)); } return ""; }
[ "public", "String", "processNested", "(", "Properties", "attributes", ")", "throws", "XDocletException", "{", "String", "name", "=", "OjbMemberTagsHandler", ".", "getMemberName", "(", ")", ";", "XClass", "type", "=", "OjbMemberTagsHandler", ".", "getMemberType", "("...
Addes the current member as a nested object. @param template The template @param attributes The attributes of the tag @exception XDocletException If an error occurs @doc.tag type="content"
[ "Addes", "the", "current", "member", "as", "a", "nested", "object", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L1084-L1127
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/xml/XMLOutputUtil.java
XMLOutputUtil.writeElementList
public static void writeElementList(XMLOutput xmlOutput, String tagName, Iterator<String> listValueIterator) throws IOException { while (listValueIterator.hasNext()) { xmlOutput.openTag(tagName); xmlOutput.writeText(listValueIterator.next()); xmlOutput.closeTag(tagName); } }
java
public static void writeElementList(XMLOutput xmlOutput, String tagName, Iterator<String> listValueIterator) throws IOException { while (listValueIterator.hasNext()) { xmlOutput.openTag(tagName); xmlOutput.writeText(listValueIterator.next()); xmlOutput.closeTag(tagName); } }
[ "public", "static", "void", "writeElementList", "(", "XMLOutput", "xmlOutput", ",", "String", "tagName", ",", "Iterator", "<", "String", ">", "listValueIterator", ")", "throws", "IOException", "{", "while", "(", "listValueIterator", ".", "hasNext", "(", ")", ")"...
Write a list of Strings to document as elements with given tag name. @param xmlOutput the XMLOutput object to write to @param tagName the tag name @param listValueIterator Iterator over String values to write
[ "Write", "a", "list", "of", "Strings", "to", "document", "as", "elements", "with", "given", "tag", "name", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/xml/XMLOutputUtil.java#L58-L65
threerings/narya
core/src/main/java/com/threerings/presents/data/TimeBaseObject.java
TimeBaseObject.getDelta
protected long getDelta (long timeStamp, long maxValue) { boolean even = (evenBase > oddBase); long base = even ? evenBase : oddBase; long delta = timeStamp - base; // make sure this timestamp is not sufficiently old that we can't // generate a delta time with it if (delta < 0) { String errmsg = "Time stamp too old for conversion to delta time"; throw new IllegalArgumentException(errmsg); } // see if it's time to swap if (delta > maxValue) { if (even) { setOddBase(timeStamp); } else { setEvenBase(timeStamp); } delta = 0; } // if we're odd, we need to mark the value as such if (!even) { delta = (-1 - delta); } return delta; }
java
protected long getDelta (long timeStamp, long maxValue) { boolean even = (evenBase > oddBase); long base = even ? evenBase : oddBase; long delta = timeStamp - base; // make sure this timestamp is not sufficiently old that we can't // generate a delta time with it if (delta < 0) { String errmsg = "Time stamp too old for conversion to delta time"; throw new IllegalArgumentException(errmsg); } // see if it's time to swap if (delta > maxValue) { if (even) { setOddBase(timeStamp); } else { setEvenBase(timeStamp); } delta = 0; } // if we're odd, we need to mark the value as such if (!even) { delta = (-1 - delta); } return delta; }
[ "protected", "long", "getDelta", "(", "long", "timeStamp", ",", "long", "maxValue", ")", "{", "boolean", "even", "=", "(", "evenBase", ">", "oddBase", ")", ";", "long", "base", "=", "even", "?", "evenBase", ":", "oddBase", ";", "long", "delta", "=", "t...
Obtains a delta with the specified maximum value, swapping from even to odd, if necessary.
[ "Obtains", "a", "delta", "with", "the", "specified", "maximum", "value", "swapping", "from", "even", "to", "odd", "if", "necessary", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/data/TimeBaseObject.java#L103-L132
lucee/Lucee
core/src/main/java/lucee/runtime/PageSourcePool.java
PageSourcePool.getPageSource
public PageSource getPageSource(String key, boolean updateAccesTime) { // DO NOT CHANGE INTERFACE (used by Argus Monitor) PageSource ps = pageSources.get(key.toLowerCase()); if (ps == null) return null; if (updateAccesTime) ps.setLastAccessTime(); return ps; }
java
public PageSource getPageSource(String key, boolean updateAccesTime) { // DO NOT CHANGE INTERFACE (used by Argus Monitor) PageSource ps = pageSources.get(key.toLowerCase()); if (ps == null) return null; if (updateAccesTime) ps.setLastAccessTime(); return ps; }
[ "public", "PageSource", "getPageSource", "(", "String", "key", ",", "boolean", "updateAccesTime", ")", "{", "// DO NOT CHANGE INTERFACE (used by Argus Monitor)", "PageSource", "ps", "=", "pageSources", ".", "get", "(", "key", ".", "toLowerCase", "(", ")", ")", ";", ...
return pages matching to key @param key key for the page @param updateAccesTime define if do update access time @return page
[ "return", "pages", "matching", "to", "key" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/PageSourcePool.java#L67-L72
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java
EnhancedBigtableStub.createSampleRowKeysCallable
private UnaryCallable<String, List<KeyOffset>> createSampleRowKeysCallable() { UnaryCallable<SampleRowKeysRequest, List<SampleRowKeysResponse>> spoolable = stub.sampleRowKeysCallable().all(); UnaryCallable<SampleRowKeysRequest, List<SampleRowKeysResponse>> retryable = Callables.retrying(spoolable, settings.sampleRowKeysSettings(), clientContext); return createUserFacingUnaryCallable( "SampleRowKeys", new SampleRowKeysCallable(retryable, requestContext)); }
java
private UnaryCallable<String, List<KeyOffset>> createSampleRowKeysCallable() { UnaryCallable<SampleRowKeysRequest, List<SampleRowKeysResponse>> spoolable = stub.sampleRowKeysCallable().all(); UnaryCallable<SampleRowKeysRequest, List<SampleRowKeysResponse>> retryable = Callables.retrying(spoolable, settings.sampleRowKeysSettings(), clientContext); return createUserFacingUnaryCallable( "SampleRowKeys", new SampleRowKeysCallable(retryable, requestContext)); }
[ "private", "UnaryCallable", "<", "String", ",", "List", "<", "KeyOffset", ">", ">", "createSampleRowKeysCallable", "(", ")", "{", "UnaryCallable", "<", "SampleRowKeysRequest", ",", "List", "<", "SampleRowKeysResponse", ">", ">", "spoolable", "=", "stub", ".", "s...
Creates a callable chain to handle SampleRowKeys RPcs. The chain will: <ul> <li>Convert a table id to a {@link com.google.bigtable.v2.SampleRowKeysRequest}. <li>Dispatch the request to the GAPIC's {@link BigtableStub#sampleRowKeysCallable()}. <li>Spool responses into a list. <li>Retry on failure. <li>Convert the responses into {@link KeyOffset}s. </ul>
[ "Creates", "a", "callable", "chain", "to", "handle", "SampleRowKeys", "RPcs", ".", "The", "chain", "will", ":" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java#L279-L288
zaproxy/zaproxy
src/org/parosproxy/paros/core/scanner/VariantURLQuery.java
VariantURLQuery.getEscapedValue
@Override protected String getEscapedValue(HttpMessage msg, String value) { // ZAP: unfortunately the method setQuery() defined inside the httpclient Apache component // create trouble when special characters like ?+? are set inside the parameter, // because this method implementation simply doesn't encode them. // So we have to explicitly encode values using the URLEncoder component before setting it. return (value != null) ? AbstractPlugin.getURLEncode(value) : ""; }
java
@Override protected String getEscapedValue(HttpMessage msg, String value) { // ZAP: unfortunately the method setQuery() defined inside the httpclient Apache component // create trouble when special characters like ?+? are set inside the parameter, // because this method implementation simply doesn't encode them. // So we have to explicitly encode values using the URLEncoder component before setting it. return (value != null) ? AbstractPlugin.getURLEncode(value) : ""; }
[ "@", "Override", "protected", "String", "getEscapedValue", "(", "HttpMessage", "msg", ",", "String", "value", ")", "{", "// ZAP: unfortunately the method setQuery() defined inside the httpclient Apache component\r", "// create trouble when special characters like ?+? are set inside the p...
Encode the parameter for a correct URL introduction @param msg the message object @param value the value that need to be encoded @return the Encoded value
[ "Encode", "the", "parameter", "for", "a", "correct", "URL", "introduction" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/core/scanner/VariantURLQuery.java#L51-L59
datasift/datasift-java
src/main/java/com/datasift/client/accounts/DataSiftAccount.java
DataSiftAccount.getToken
public FutureData<Token> getToken(String identity, String service) { FutureData<Token> future = new FutureData<>(); URI uri = newParams().put("id", identity) .forURL(config.newAPIEndpointURI(IDENTITY + "/" + identity + "/token/" + service)); Request request = config.http(). GET(uri, new PageReader(newRequestCallback(future, new Token(), config))); performRequest(future, request); return future; }
java
public FutureData<Token> getToken(String identity, String service) { FutureData<Token> future = new FutureData<>(); URI uri = newParams().put("id", identity) .forURL(config.newAPIEndpointURI(IDENTITY + "/" + identity + "/token/" + service)); Request request = config.http(). GET(uri, new PageReader(newRequestCallback(future, new Token(), config))); performRequest(future, request); return future; }
[ "public", "FutureData", "<", "Token", ">", "getToken", "(", "String", "identity", ",", "String", "service", ")", "{", "FutureData", "<", "Token", ">", "future", "=", "new", "FutureData", "<>", "(", ")", ";", "URI", "uri", "=", "newParams", "(", ")", "....
/* Fetch a token using it's service ID and it's Identity's ID @param identity the ID of the identity to query @param service the service of the token to fetch @return The identity for the ID provided
[ "/", "*", "Fetch", "a", "token", "using", "it", "s", "service", "ID", "and", "it", "s", "Identity", "s", "ID" ]
train
https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/accounts/DataSiftAccount.java#L209-L217
apache/incubator-heron
heron/spi/src/java/org/apache/heron/spi/utils/NetworkUtils.java
NetworkUtils.getInetSocketAddress
public static InetSocketAddress getInetSocketAddress(String endpoint) { String[] array = endpoint.split(":"); return new InetSocketAddress(array[0], Integer.parseInt(array[1])); }
java
public static InetSocketAddress getInetSocketAddress(String endpoint) { String[] array = endpoint.split(":"); return new InetSocketAddress(array[0], Integer.parseInt(array[1])); }
[ "public", "static", "InetSocketAddress", "getInetSocketAddress", "(", "String", "endpoint", ")", "{", "String", "[", "]", "array", "=", "endpoint", ".", "split", "(", "\":\"", ")", ";", "return", "new", "InetSocketAddress", "(", "array", "[", "0", "]", ",", ...
Convert an endpoint from String (host:port) to InetSocketAddress @param endpoint a String in (host:port) format @return an InetSocketAddress representing the endpoint
[ "Convert", "an", "endpoint", "from", "String", "(", "host", ":", "port", ")", "to", "InetSocketAddress" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/utils/NetworkUtils.java#L534-L537
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.trClass
public static String trClass(String clazz, String... content) { return tagClass(Html.Tag.TR, clazz, content); }
java
public static String trClass(String clazz, String... content) { return tagClass(Html.Tag.TR, clazz, content); }
[ "public", "static", "String", "trClass", "(", "String", "clazz", ",", "String", "...", "content", ")", "{", "return", "tagClass", "(", "Html", ".", "Tag", ".", "TR", ",", "clazz", ",", "content", ")", ";", "}" ]
Build a HTML TableRow with given CSS class for a string. Given content does <b>not</b> consists of HTML snippets and as such is being prepared with {@link HtmlBuilder#htmlEncode(String)}. @param clazz class for tr element @param content content string @return HTML tr element as string
[ "Build", "a", "HTML", "TableRow", "with", "given", "CSS", "class", "for", "a", "string", ".", "Given", "content", "does", "<b", ">", "not<", "/", "b", ">", "consists", "of", "HTML", "snippets", "and", "as", "such", "is", "being", "prepared", "with", "{...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L140-L142
redkale/redkale
src/org/redkale/net/http/HttpRequest.java
HttpRequest.getHeader
public String getHeader(String name, String defaultValue) { return header.getValue(name, defaultValue); }
java
public String getHeader(String name, String defaultValue) { return header.getValue(name, defaultValue); }
[ "public", "String", "getHeader", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "return", "header", ".", "getValue", "(", "name", ",", "defaultValue", ")", ";", "}" ]
获取指定的header值, 没有返回默认值 @param name header名 @param defaultValue 默认值 @return header值
[ "获取指定的header值", "没有返回默认值" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L1016-L1018
tvesalainen/util
util/src/main/java/org/vesalainen/bean/BeanHelper.java
BeanHelper.getField
public static Field getField(Class cls, String fieldname) throws NoSuchFieldException { while (true) { try { return cls.getDeclaredField(fieldname); } catch (NoSuchFieldException ex) { cls = cls.getSuperclass(); if (Object.class.equals(cls)) { throw ex; } } catch (SecurityException ex) { throw new IllegalArgumentException(ex); } } }
java
public static Field getField(Class cls, String fieldname) throws NoSuchFieldException { while (true) { try { return cls.getDeclaredField(fieldname); } catch (NoSuchFieldException ex) { cls = cls.getSuperclass(); if (Object.class.equals(cls)) { throw ex; } } catch (SecurityException ex) { throw new IllegalArgumentException(ex); } } }
[ "public", "static", "Field", "getField", "(", "Class", "cls", ",", "String", "fieldname", ")", "throws", "NoSuchFieldException", "{", "while", "(", "true", ")", "{", "try", "{", "return", "cls", ".", "getDeclaredField", "(", "fieldname", ")", ";", "}", "ca...
Returns Declared field either from given class or it's super class @param cls @param fieldname @return @throws NoSuchFieldException
[ "Returns", "Declared", "field", "either", "from", "given", "class", "or", "it", "s", "super", "class" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L269-L290
JadiraOrg/jadira
cloning/src/main/java/org/jadira/reflection/core/misc/ClassUtils.java
ClassUtils.collectFields
public static Field[] collectFields(Class<?> c, int inclusiveModifiers, int exclusiveModifiers) { return collectFields(c, inclusiveModifiers, exclusiveModifiers, Object.class); }
java
public static Field[] collectFields(Class<?> c, int inclusiveModifiers, int exclusiveModifiers) { return collectFields(c, inclusiveModifiers, exclusiveModifiers, Object.class); }
[ "public", "static", "Field", "[", "]", "collectFields", "(", "Class", "<", "?", ">", "c", ",", "int", "inclusiveModifiers", ",", "int", "exclusiveModifiers", ")", "{", "return", "collectFields", "(", "c", ",", "inclusiveModifiers", ",", "exclusiveModifiers", "...
Produces an array with all the instance fields of the specified class which match the supplied rules @param c The class specified @param inclusiveModifiers An int indicating the {@link Modifier}s that may be applied @param exclusiveModifiers An int indicating the {@link Modifier}s that must be excluded @return The array of matched Fields
[ "Produces", "an", "array", "with", "all", "the", "instance", "fields", "of", "the", "specified", "class", "which", "match", "the", "supplied", "rules" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/core/misc/ClassUtils.java#L203-L206
RestComm/sip-servlets
containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/startup/SipNamingContextListener.java
SipNamingContextListener.removeSipFactory
public static void removeSipFactory(Context envCtx, String appName, SipFactory sipFactory) { if(envCtx != null) { try { javax.naming.Context sipContext = (javax.naming.Context)envCtx.lookup(SIP_SUBCONTEXT + "/" + appName); sipContext.unbind(SIP_FACTORY_JNDI_NAME); } catch (NamingException e) { logger.error(sm.getString("naming.unbindFailed", e)); } } }
java
public static void removeSipFactory(Context envCtx, String appName, SipFactory sipFactory) { if(envCtx != null) { try { javax.naming.Context sipContext = (javax.naming.Context)envCtx.lookup(SIP_SUBCONTEXT + "/" + appName); sipContext.unbind(SIP_FACTORY_JNDI_NAME); } catch (NamingException e) { logger.error(sm.getString("naming.unbindFailed", e)); } } }
[ "public", "static", "void", "removeSipFactory", "(", "Context", "envCtx", ",", "String", "appName", ",", "SipFactory", "sipFactory", ")", "{", "if", "(", "envCtx", "!=", "null", ")", "{", "try", "{", "javax", ".", "naming", ".", "Context", "sipContext", "=...
Removes the sip factory binding from the jndi mapping @param appName the application name subcontext @param sipFactory the sip factory to remove
[ "Removes", "the", "sip", "factory", "binding", "from", "the", "jndi", "mapping" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/startup/SipNamingContextListener.java#L295-L304
roboconf/roboconf-platform
core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/reconfigurables/ReconfigurableClient.java
ReconfigurableClient.switchMessagingType
public void switchMessagingType( String factoryName ) { // Create a new client this.logger.fine( "The messaging is requested to switch its type to " + factoryName + "." ); JmxWrapperForMessagingClient newMessagingClient = null; try { IMessagingClient rawClient = createMessagingClient( factoryName ); if( rawClient != null ) { newMessagingClient = new JmxWrapperForMessagingClient( rawClient ); newMessagingClient.setMessageQueue( this.messageProcessor.getMessageQueue()); openConnection( newMessagingClient ); } } catch( Exception e ) { this.logger.warning( "An error occurred while creating a new messaging client. " + e.getMessage()); Utils.logException( this.logger, e ); // #594: print a message to be visible in a console StringBuilder sb = new StringBuilder(); sb.append( "\n\n**** WARNING ****\n" ); sb.append( "Connection failed at " ); sb.append( new SimpleDateFormat( "HH:mm:ss, 'on' EEEE dd (MMMM)" ).format( new Date())); sb.append( ".\n" ); sb.append( "The messaging configuration may be invalid.\n" ); sb.append( "Or the messaging server may not be started yet.\n\n" ); sb.append( "Consider using the 'roboconf:force-reconnect' command if you forgot to start the messaging server.\n" ); sb.append( "**** WARNING ****\n" ); this.console.println( sb.toString()); } // Replace the current client IMessagingClient oldClient; synchronized( this ) { // Simple changes this.messagingType = factoryName; oldClient = this.messagingClient; // The messaging client can NEVER be null if( newMessagingClient != null ) this.messagingClient = newMessagingClient; else resetInternalClient(); } terminateClient( oldClient, "The previous client could not be terminated correctly.", this.logger ); }
java
public void switchMessagingType( String factoryName ) { // Create a new client this.logger.fine( "The messaging is requested to switch its type to " + factoryName + "." ); JmxWrapperForMessagingClient newMessagingClient = null; try { IMessagingClient rawClient = createMessagingClient( factoryName ); if( rawClient != null ) { newMessagingClient = new JmxWrapperForMessagingClient( rawClient ); newMessagingClient.setMessageQueue( this.messageProcessor.getMessageQueue()); openConnection( newMessagingClient ); } } catch( Exception e ) { this.logger.warning( "An error occurred while creating a new messaging client. " + e.getMessage()); Utils.logException( this.logger, e ); // #594: print a message to be visible in a console StringBuilder sb = new StringBuilder(); sb.append( "\n\n**** WARNING ****\n" ); sb.append( "Connection failed at " ); sb.append( new SimpleDateFormat( "HH:mm:ss, 'on' EEEE dd (MMMM)" ).format( new Date())); sb.append( ".\n" ); sb.append( "The messaging configuration may be invalid.\n" ); sb.append( "Or the messaging server may not be started yet.\n\n" ); sb.append( "Consider using the 'roboconf:force-reconnect' command if you forgot to start the messaging server.\n" ); sb.append( "**** WARNING ****\n" ); this.console.println( sb.toString()); } // Replace the current client IMessagingClient oldClient; synchronized( this ) { // Simple changes this.messagingType = factoryName; oldClient = this.messagingClient; // The messaging client can NEVER be null if( newMessagingClient != null ) this.messagingClient = newMessagingClient; else resetInternalClient(); } terminateClient( oldClient, "The previous client could not be terminated correctly.", this.logger ); }
[ "public", "void", "switchMessagingType", "(", "String", "factoryName", ")", "{", "// Create a new client", "this", ".", "logger", ".", "fine", "(", "\"The messaging is requested to switch its type to \"", "+", "factoryName", "+", "\".\"", ")", ";", "JmxWrapperForMessaging...
Changes the internal messaging client. @param factoryName the factory name (see {@link MessagingConstants})
[ "Changes", "the", "internal", "messaging", "client", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/reconfigurables/ReconfigurableClient.java#L160-L206
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java
ArabicShaping.deshapeNormalize
private int deshapeNormalize(char[] dest, int start, int length) { int lacount = 0; int yehHamzaComposeEnabled = 0; int seenComposeEnabled = 0; yehHamzaComposeEnabled = ((options&YEHHAMZA_MASK) == YEHHAMZA_TWOCELL_NEAR) ? 1 : 0; seenComposeEnabled = ((options&SEEN_MASK) == SEEN_TWOCELL_NEAR)? 1 : 0; for (int i = start, e = i + length; i < e; ++i) { char ch = dest[i]; if( (yehHamzaComposeEnabled == 1) && ((ch == HAMZA06_CHAR) || (ch == HAMZAFE_CHAR)) && (i < (length - 1)) && isAlefMaksouraChar(dest[i+1] )) { dest[i] = SPACE_CHAR; dest[i+1] = YEH_HAMZA_CHAR; } else if ( (seenComposeEnabled == 1) && (isTailChar(ch)) && (i< (length - 1)) && (isSeenTailFamilyChar(dest[i+1])==1) ) { dest[i] = SPACE_CHAR; } else if (ch >= '\uFE70' && ch <= '\uFEFC') { if (isLamAlefChar(ch)) { ++lacount; } dest[i] = (char)convertFEto06[ch - '\uFE70']; } } return lacount; }
java
private int deshapeNormalize(char[] dest, int start, int length) { int lacount = 0; int yehHamzaComposeEnabled = 0; int seenComposeEnabled = 0; yehHamzaComposeEnabled = ((options&YEHHAMZA_MASK) == YEHHAMZA_TWOCELL_NEAR) ? 1 : 0; seenComposeEnabled = ((options&SEEN_MASK) == SEEN_TWOCELL_NEAR)? 1 : 0; for (int i = start, e = i + length; i < e; ++i) { char ch = dest[i]; if( (yehHamzaComposeEnabled == 1) && ((ch == HAMZA06_CHAR) || (ch == HAMZAFE_CHAR)) && (i < (length - 1)) && isAlefMaksouraChar(dest[i+1] )) { dest[i] = SPACE_CHAR; dest[i+1] = YEH_HAMZA_CHAR; } else if ( (seenComposeEnabled == 1) && (isTailChar(ch)) && (i< (length - 1)) && (isSeenTailFamilyChar(dest[i+1])==1) ) { dest[i] = SPACE_CHAR; } else if (ch >= '\uFE70' && ch <= '\uFEFC') { if (isLamAlefChar(ch)) { ++lacount; } dest[i] = (char)convertFEto06[ch - '\uFE70']; } } return lacount; }
[ "private", "int", "deshapeNormalize", "(", "char", "[", "]", "dest", ",", "int", "start", ",", "int", "length", ")", "{", "int", "lacount", "=", "0", ";", "int", "yehHamzaComposeEnabled", "=", "0", ";", "int", "seenComposeEnabled", "=", "0", ";", "yehHam...
/* Name : deshapeNormalize Function: Convert the input buffer from FExx Range into 06xx Range even the lamalef is converted to the special region in the 06xx range. According to the options the user enters, all seen family characters followed by a tail character are merged to seen tail family character and any yeh followed by a hamza character are merged to yehhamza character. Method returns the number of lamalef chars found.
[ "/", "*", "Name", ":", "deshapeNormalize", "Function", ":", "Convert", "the", "input", "buffer", "from", "FExx", "Range", "into", "06xx", "Range", "even", "the", "lamalef", "is", "converted", "to", "the", "special", "region", "in", "the", "06xx", "range", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java#L1587-L1614
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.findIndexValues
public static <T> List<Number> findIndexValues(Iterable<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) { return findIndexValues(self, 0, condition); }
java
public static <T> List<Number> findIndexValues(Iterable<T> self, @ClosureParams(FirstParam.FirstGenericType.class) Closure condition) { return findIndexValues(self, 0, condition); }
[ "public", "static", "<", "T", ">", "List", "<", "Number", ">", "findIndexValues", "(", "Iterable", "<", "T", ">", "self", ",", "@", "ClosureParams", "(", "FirstParam", ".", "FirstGenericType", ".", "class", ")", "Closure", "condition", ")", "{", "return", ...
Iterates over the elements of an Iterable and returns the index values of the items that match the condition specified in the closure. @param self an Iterable @param condition the matching condition @return a list of numbers corresponding to the index values of all matched objects @since 2.5.0
[ "Iterates", "over", "the", "elements", "of", "an", "Iterable", "and", "returns", "the", "index", "values", "of", "the", "items", "that", "match", "the", "condition", "specified", "in", "the", "closure", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17013-L17015
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java
JBBPUtils.ulong2str
public static String ulong2str(final long ulongValue, final int radix, final char[] charBuffer) { if (radix < 2 || radix > 36) { throw new IllegalArgumentException("Illegal radix [" + radix + ']'); } if (ulongValue == 0) { return "0"; } else { final String result; if (ulongValue > 0) { result = Long.toString(ulongValue, radix).toUpperCase(Locale.ENGLISH); } else { final char[] buffer = charBuffer == null || charBuffer.length < 64 ? new char[64] : charBuffer; int pos = buffer.length; long topPart = ulongValue >>> 32; long bottomPart = (ulongValue & 0xFFFFFFFFL) + ((topPart % radix) << 32); topPart /= radix; while ((bottomPart | topPart) > 0) { final int val = (int) (bottomPart % radix); buffer[--pos] = (char) (val < 10 ? '0' + val : 'A' + val - 10); bottomPart = (bottomPart / radix) + ((topPart % radix) << 32); topPart /= radix; } result = new String(buffer, pos, buffer.length - pos); } return result; } }
java
public static String ulong2str(final long ulongValue, final int radix, final char[] charBuffer) { if (radix < 2 || radix > 36) { throw new IllegalArgumentException("Illegal radix [" + radix + ']'); } if (ulongValue == 0) { return "0"; } else { final String result; if (ulongValue > 0) { result = Long.toString(ulongValue, radix).toUpperCase(Locale.ENGLISH); } else { final char[] buffer = charBuffer == null || charBuffer.length < 64 ? new char[64] : charBuffer; int pos = buffer.length; long topPart = ulongValue >>> 32; long bottomPart = (ulongValue & 0xFFFFFFFFL) + ((topPart % radix) << 32); topPart /= radix; while ((bottomPart | topPart) > 0) { final int val = (int) (bottomPart % radix); buffer[--pos] = (char) (val < 10 ? '0' + val : 'A' + val - 10); bottomPart = (bottomPart / radix) + ((topPart % radix) << 32); topPart /= radix; } result = new String(buffer, pos, buffer.length - pos); } return result; } }
[ "public", "static", "String", "ulong2str", "(", "final", "long", "ulongValue", ",", "final", "int", "radix", ",", "final", "char", "[", "]", "charBuffer", ")", "{", "if", "(", "radix", "<", "2", "||", "radix", ">", "36", ")", "{", "throw", "new", "Il...
Convert unsigned long value into string representation with defined radix base. @param ulongValue value to be converted in string @param radix radix base to be used for conversion, must be 2..36 @param charBuffer char buffer to be used for conversion operations, should be not less than 64 char length, if length is less than 64 or null then new one will be created @return converted value as upper case string @throws IllegalArgumentException for wrong radix base @since 1.1
[ "Convert", "unsigned", "long", "value", "into", "string", "representation", "with", "defined", "radix", "base", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPUtils.java#L773-L800
rundeck/rundeck
examples/example-java-step-plugin/src/main/java/com/dtolabs/rundeck/plugin/example/ExampleNodeStepPlugin.java
ExampleNodeStepPlugin.executeNodeStep
public void executeNodeStep(final PluginStepContext context, final Map<String, Object> configuration, final INodeEntry entry) throws NodeStepException { System.out.println("Example node step executing on node: " + entry.getNodename()); System.out.println("Example step extra config: " + configuration); System.out.println("Example step num: " + context.getStepNumber()); System.out.println("Example step context: " + context.getStepContext()); if ("true".equals(configuration.get("pancake"))) { //throw exception indicating the cause of the error throw new NodeStepException("pancake was true", Reason.PancakeReason, entry.getNodename()); } }
java
public void executeNodeStep(final PluginStepContext context, final Map<String, Object> configuration, final INodeEntry entry) throws NodeStepException { System.out.println("Example node step executing on node: " + entry.getNodename()); System.out.println("Example step extra config: " + configuration); System.out.println("Example step num: " + context.getStepNumber()); System.out.println("Example step context: " + context.getStepContext()); if ("true".equals(configuration.get("pancake"))) { //throw exception indicating the cause of the error throw new NodeStepException("pancake was true", Reason.PancakeReason, entry.getNodename()); } }
[ "public", "void", "executeNodeStep", "(", "final", "PluginStepContext", "context", ",", "final", "Map", "<", "String", ",", "Object", ">", "configuration", ",", "final", "INodeEntry", "entry", ")", "throws", "NodeStepException", "{", "System", ".", "out", ".", ...
The {@link #performNodeStep(com.dtolabs.rundeck.plugins.step.PluginStepContext, com.dtolabs.rundeck.core.common.INodeEntry)} method is invoked when your plugin should perform its logic for the appropriate node. The {@link PluginStepContext} provides access to the configuration of the plugin, and details about the step number and context. <p/> The {@link INodeEntry} parameter is the node that should be executed on. Your plugin should make use of the node's attributes (such has "hostname" or any others required by your plugin) to perform the appropriate action.
[ "The", "{" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/examples/example-java-step-plugin/src/main/java/com/dtolabs/rundeck/plugin/example/ExampleNodeStepPlugin.java#L129-L141
CloudSlang/cs-actions
cs-vmware/src/main/java/io/cloudslang/content/vmware/services/GuestService.java
GuestService.mountTools
public Map<String, String> mountTools(HttpInputs httpInputs, VmInputs vmInputs) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { ManagedObjectReference vmMor = new MorObjectHandler() .getMor(connectionResources, ManagedObjectType.VIRTUAL_MACHINE.getValue(), vmInputs.getVirtualMachineName()); if (vmMor != null) { connectionResources.getVimPortType().mountToolsInstaller(vmMor); return ResponseUtils.getResultsMap(INITIATED_TOOLS_INSTALLER_MOUNT + vmInputs.getVirtualMachineName(), Outputs.RETURN_CODE_SUCCESS); } else { return ResponseUtils.getVmNotFoundResultsMap(vmInputs); } } catch (Exception ex) { return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
java
public Map<String, String> mountTools(HttpInputs httpInputs, VmInputs vmInputs) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { ManagedObjectReference vmMor = new MorObjectHandler() .getMor(connectionResources, ManagedObjectType.VIRTUAL_MACHINE.getValue(), vmInputs.getVirtualMachineName()); if (vmMor != null) { connectionResources.getVimPortType().mountToolsInstaller(vmMor); return ResponseUtils.getResultsMap(INITIATED_TOOLS_INSTALLER_MOUNT + vmInputs.getVirtualMachineName(), Outputs.RETURN_CODE_SUCCESS); } else { return ResponseUtils.getVmNotFoundResultsMap(vmInputs); } } catch (Exception ex) { return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
[ "public", "Map", "<", "String", ",", "String", ">", "mountTools", "(", "HttpInputs", "httpInputs", ",", "VmInputs", "vmInputs", ")", "throws", "Exception", "{", "ConnectionResources", "connectionResources", "=", "new", "ConnectionResources", "(", "httpInputs", ",", ...
Method used to connect to specified data center and start the Install Tools process on virtual machine identified by the inputs provided. @param httpInputs Object that has all the inputs necessary to made a connection to data center @param vmInputs Object that has all the specific inputs necessary to identify the targeted virtual machine @return Map with String as key and value that contains returnCode of the operation, success message or failure message and the exception if there is one @throws Exception
[ "Method", "used", "to", "connect", "to", "specified", "data", "center", "and", "start", "the", "Install", "Tools", "process", "on", "virtual", "machine", "identified", "by", "the", "inputs", "provided", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-vmware/src/main/java/io/cloudslang/content/vmware/services/GuestService.java#L81-L101
gosu-lang/gosu-lang
gosu-lab/src/main/java/editor/util/EditorUtilities.java
EditorUtilities.findAncestor
public static <T> T findAncestor( Component start, Class<T> aClass ) { if( start == null ) { return null; } return findAtOrAbove( start.getParent(), aClass ); }
java
public static <T> T findAncestor( Component start, Class<T> aClass ) { if( start == null ) { return null; } return findAtOrAbove( start.getParent(), aClass ); }
[ "public", "static", "<", "T", ">", "T", "findAncestor", "(", "Component", "start", ",", "Class", "<", "T", ">", "aClass", ")", "{", "if", "(", "start", "==", "null", ")", "{", "return", "null", ";", "}", "return", "findAtOrAbove", "(", "start", ".", ...
Finds the first widget above the passed in widget of the given class
[ "Finds", "the", "first", "widget", "above", "the", "passed", "in", "widget", "of", "the", "given", "class" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/EditorUtilities.java#L757-L764
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.createPrebuiltEntityRole
public UUID createPrebuiltEntityRole(UUID appId, String versionId, UUID entityId, CreatePrebuiltEntityRoleOptionalParameter createPrebuiltEntityRoleOptionalParameter) { return createPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createPrebuiltEntityRoleOptionalParameter).toBlocking().single().body(); }
java
public UUID createPrebuiltEntityRole(UUID appId, String versionId, UUID entityId, CreatePrebuiltEntityRoleOptionalParameter createPrebuiltEntityRoleOptionalParameter) { return createPrebuiltEntityRoleWithServiceResponseAsync(appId, versionId, entityId, createPrebuiltEntityRoleOptionalParameter).toBlocking().single().body(); }
[ "public", "UUID", "createPrebuiltEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "CreatePrebuiltEntityRoleOptionalParameter", "createPrebuiltEntityRoleOptionalParameter", ")", "{", "return", "createPrebuiltEntityRoleWithServiceResponse...
Create an entity role for an entity in the application. @param appId The application ID. @param versionId The version ID. @param entityId The entity model ID. @param createPrebuiltEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the UUID object if successful.
[ "Create", "an", "entity", "role", "for", "an", "entity", "in", "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#L8032-L8034
dihedron/dihedron-commons
src/main/java/org/dihedron/core/streams/Streams.java
Streams.copy
public static long copy(InputStream input, OutputStream output) throws IOException { return copy(input, output, false); }
java
public static long copy(InputStream input, OutputStream output) throws IOException { return copy(input, output, false); }
[ "public", "static", "long", "copy", "(", "InputStream", "input", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "return", "copy", "(", "input", ",", "output", ",", "false", ")", ";", "}" ]
Copies all the bytes it can read from the input stream into the output stream; input and output streams management (opening, flushing, closing) are all up to the caller. @param input an open and ready-to-be-read input stream. @param output an open output stream. @return the total number of bytes copied. @throws IOException
[ "Copies", "all", "the", "bytes", "it", "can", "read", "from", "the", "input", "stream", "into", "the", "output", "stream", ";", "input", "and", "output", "streams", "management", "(", "opening", "flushing", "closing", ")", "are", "all", "up", "to", "the", ...
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/streams/Streams.java#L56-L58
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java
GeneratedDContactDaoImpl.queryByTags
public Iterable<DContact> queryByTags(Object parent, java.lang.Object tags) { return queryByField(parent, DContactMapper.Field.TAGS.getFieldName(), tags); }
java
public Iterable<DContact> queryByTags(Object parent, java.lang.Object tags) { return queryByField(parent, DContactMapper.Field.TAGS.getFieldName(), tags); }
[ "public", "Iterable", "<", "DContact", ">", "queryByTags", "(", "Object", "parent", ",", "java", ".", "lang", ".", "Object", "tags", ")", "{", "return", "queryByField", "(", "parent", ",", "DContactMapper", ".", "Field", ".", "TAGS", ".", "getFieldName", "...
query-by method for field tags @param tags the specified attribute @return an Iterable of DContacts for the specified tags
[ "query", "-", "by", "method", "for", "field", "tags" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L268-L270
apache/groovy
subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java
DateTimeExtensions.downto
public static void downto(Temporal from, Temporal to, Closure closure) { downto(from, to, defaultUnitFor(from), closure); }
java
public static void downto(Temporal from, Temporal to, Closure closure) { downto(from, to, defaultUnitFor(from), closure); }
[ "public", "static", "void", "downto", "(", "Temporal", "from", ",", "Temporal", "to", ",", "Closure", "closure", ")", "{", "downto", "(", "from", ",", "to", ",", "defaultUnitFor", "(", "from", ")", ",", "closure", ")", ";", "}" ]
Iterates from this to the {@code to} {@link java.time.temporal.Temporal}, inclusive, decrementing by one unit each iteration, calling the closure once per iteration. The closure may accept a single {@link java.time.temporal.Temporal} argument. <p> The particular unit decremented by depends on the specific sub-type of {@link java.time.temporal.Temporal}. Most sub-types use a unit of {@link java.time.temporal.ChronoUnit#SECONDS} except for <ul> <li>{@link java.time.chrono.ChronoLocalDate} and its sub-types use {@link java.time.temporal.ChronoUnit#DAYS}. <li>{@link java.time.YearMonth} uses {@link java.time.temporal.ChronoUnit#MONTHS}. <li>{@link java.time.Year} uses {@link java.time.temporal.ChronoUnit#YEARS}. </ul> @param from the starting Temporal @param to the ending Temporal @param closure the zero or one-argument closure to call @throws GroovyRuntimeException if this value is earlier than {@code to} @throws GroovyRuntimeException if {@code to} is a different type than this @since 2.5.0
[ "Iterates", "from", "this", "to", "the", "{", "@code", "to", "}", "{", "@link", "java", ".", "time", ".", "temporal", ".", "Temporal", "}", "inclusive", "decrementing", "by", "one", "unit", "each", "iteration", "calling", "the", "closure", "once", "per", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L201-L203
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_vserver_appflow_config.java
ns_vserver_appflow_config.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_vserver_appflow_config_responses result = (ns_vserver_appflow_config_responses) service.get_payload_formatter().string_to_resource(ns_vserver_appflow_config_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.ns_vserver_appflow_config_response_array); } ns_vserver_appflow_config[] result_ns_vserver_appflow_config = new ns_vserver_appflow_config[result.ns_vserver_appflow_config_response_array.length]; for(int i = 0; i < result.ns_vserver_appflow_config_response_array.length; i++) { result_ns_vserver_appflow_config[i] = result.ns_vserver_appflow_config_response_array[i].ns_vserver_appflow_config[0]; } return result_ns_vserver_appflow_config; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_vserver_appflow_config_responses result = (ns_vserver_appflow_config_responses) service.get_payload_formatter().string_to_resource(ns_vserver_appflow_config_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.ns_vserver_appflow_config_response_array); } ns_vserver_appflow_config[] result_ns_vserver_appflow_config = new ns_vserver_appflow_config[result.ns_vserver_appflow_config_response_array.length]; for(int i = 0; i < result.ns_vserver_appflow_config_response_array.length; i++) { result_ns_vserver_appflow_config[i] = result.ns_vserver_appflow_config_response_array[i].ns_vserver_appflow_config[0]; } return result_ns_vserver_appflow_config; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ns_vserver_appflow_config_responses", "result", "=", "(", "ns_vserver_appflow_config_responses", ")", "service", ...
<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/ns/ns_vserver_appflow_config.java#L470-L487
netty/netty
resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java
DnsNameResolver.resolveAll
public final Future<List<DnsRecord>> resolveAll(DnsQuestion question) { return resolveAll(question, EMPTY_ADDITIONALS, executor().<List<DnsRecord>>newPromise()); }
java
public final Future<List<DnsRecord>> resolveAll(DnsQuestion question) { return resolveAll(question, EMPTY_ADDITIONALS, executor().<List<DnsRecord>>newPromise()); }
[ "public", "final", "Future", "<", "List", "<", "DnsRecord", ">", ">", "resolveAll", "(", "DnsQuestion", "question", ")", "{", "return", "resolveAll", "(", "question", ",", "EMPTY_ADDITIONALS", ",", "executor", "(", ")", ".", "<", "List", "<", "DnsRecord", ...
Resolves the {@link DnsRecord}s that are matched by the specified {@link DnsQuestion}. Unlike {@link #query(DnsQuestion)}, this method handles redirection, CNAMEs and multiple name servers. If the specified {@link DnsQuestion} is {@code A} or {@code AAAA}, this method looks up the configured {@link HostsFileEntries} before sending a query to the name servers. If a match is found in the {@link HostsFileEntries}, a synthetic {@code A} or {@code AAAA} record will be returned. @param question the question @return the list of the {@link DnsRecord}s as the result of the resolution
[ "Resolves", "the", "{", "@link", "DnsRecord", "}", "s", "that", "are", "matched", "by", "the", "specified", "{", "@link", "DnsQuestion", "}", ".", "Unlike", "{", "@link", "#query", "(", "DnsQuestion", ")", "}", "this", "method", "handles", "redirection", "...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolver.java#L711-L713
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_protocol_activeSyncMailNotification_POST
public OvhTask organizationName_service_exchangeService_protocol_activeSyncMailNotification_POST(String organizationName, String exchangeService, Long notifiedAccountId) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/protocol/activeSyncMailNotification"; StringBuilder sb = path(qPath, organizationName, exchangeService); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "notifiedAccountId", notifiedAccountId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask organizationName_service_exchangeService_protocol_activeSyncMailNotification_POST(String organizationName, String exchangeService, Long notifiedAccountId) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/protocol/activeSyncMailNotification"; StringBuilder sb = path(qPath, organizationName, exchangeService); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "notifiedAccountId", notifiedAccountId); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "organizationName_service_exchangeService_protocol_activeSyncMailNotification_POST", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "Long", "notifiedAccountId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/...
Subscribe new address to ActiveSync quarantine notifications REST: POST /email/exchange/{organizationName}/service/{exchangeService}/protocol/activeSyncMailNotification @param notifiedAccountId [required] Exchange Account Id @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service
[ "Subscribe", "new", "address", "to", "ActiveSync", "quarantine", "notifications" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L2355-L2362
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/square/BaseDetectFiducialSquare.java
BaseDetectFiducialSquare.prepareForOutput
private void prepareForOutput(Polygon2D_F64 imageShape, Result result) { // the rotation estimate, apply in counter clockwise direction // since result.rotation is a clockwise rotation in the visual sense, which // is CCW on the grid int rotationCCW = (4-result.rotation)%4; for (int j = 0; j < rotationCCW; j++) { UtilPolygons2D_F64.shiftUp(imageShape); } // save the results for output FoundFiducial f = found.grow(); f.id = result.which; for (int i = 0; i < 4; i++) { Point2D_F64 a = imageShape.get(i); undistToDist.compute(a.x, a.y, f.distortedPixels.get(i)); } }
java
private void prepareForOutput(Polygon2D_F64 imageShape, Result result) { // the rotation estimate, apply in counter clockwise direction // since result.rotation is a clockwise rotation in the visual sense, which // is CCW on the grid int rotationCCW = (4-result.rotation)%4; for (int j = 0; j < rotationCCW; j++) { UtilPolygons2D_F64.shiftUp(imageShape); } // save the results for output FoundFiducial f = found.grow(); f.id = result.which; for (int i = 0; i < 4; i++) { Point2D_F64 a = imageShape.get(i); undistToDist.compute(a.x, a.y, f.distortedPixels.get(i)); } }
[ "private", "void", "prepareForOutput", "(", "Polygon2D_F64", "imageShape", ",", "Result", "result", ")", "{", "// the rotation estimate, apply in counter clockwise direction", "// since result.rotation is a clockwise rotation in the visual sense, which", "// is CCW on the grid", "int", ...
Takes the found quadrilateral and the computed 3D information and prepares it for output
[ "Takes", "the", "found", "quadrilateral", "and", "the", "computed", "3D", "information", "and", "prepares", "it", "for", "output" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/square/BaseDetectFiducialSquare.java#L397-L414
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setNumber
public void setNumber(int index, Number value) { set(selectField(AssignmentFieldLists.CUSTOM_NUMBER, index), value); }
java
public void setNumber(int index, Number value) { set(selectField(AssignmentFieldLists.CUSTOM_NUMBER, index), value); }
[ "public", "void", "setNumber", "(", "int", "index", ",", "Number", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "CUSTOM_NUMBER", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a number value. @param index number index (1-20) @param value number value
[ "Set", "a", "number", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1606-L1609
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java
Duration.minus
public Duration minus(Duration duration) { long secsToSubtract = duration.getSeconds(); int nanosToSubtract = duration.getNano(); if (secsToSubtract == Long.MIN_VALUE) { return plus(Long.MAX_VALUE, -nanosToSubtract).plus(1, 0); } return plus(-secsToSubtract, -nanosToSubtract); }
java
public Duration minus(Duration duration) { long secsToSubtract = duration.getSeconds(); int nanosToSubtract = duration.getNano(); if (secsToSubtract == Long.MIN_VALUE) { return plus(Long.MAX_VALUE, -nanosToSubtract).plus(1, 0); } return plus(-secsToSubtract, -nanosToSubtract); }
[ "public", "Duration", "minus", "(", "Duration", "duration", ")", "{", "long", "secsToSubtract", "=", "duration", ".", "getSeconds", "(", ")", ";", "int", "nanosToSubtract", "=", "duration", ".", "getNano", "(", ")", ";", "if", "(", "secsToSubtract", "==", ...
Returns a copy of this duration with the specified duration subtracted. <p> This instance is immutable and unaffected by this method call. @param duration the duration to subtract, positive or negative, not null @return a {@code Duration} based on this duration with the specified duration subtracted, not null @throws ArithmeticException if numeric overflow occurs
[ "Returns", "a", "copy", "of", "this", "duration", "with", "the", "specified", "duration", "subtracted", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java#L826-L833
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BreakIterator.java
BreakIterator.registerInstance
public static Object registerInstance(BreakIterator iter, Locale locale, int kind) { return registerInstance(iter, ULocale.forLocale(locale), kind); }
java
public static Object registerInstance(BreakIterator iter, Locale locale, int kind) { return registerInstance(iter, ULocale.forLocale(locale), kind); }
[ "public", "static", "Object", "registerInstance", "(", "BreakIterator", "iter", ",", "Locale", "locale", ",", "int", "kind", ")", "{", "return", "registerInstance", "(", "iter", ",", "ULocale", ".", "forLocale", "(", "locale", ")", ",", "kind", ")", ";", "...
<strong>[icu]</strong> Registers a new break iterator of the indicated kind, to use in the given locale. Clones of the iterator will be returned if a request for a break iterator of the given kind matches or falls back to this locale. <p>Because ICU may choose to cache BreakIterator objects internally, this must be called at application startup, prior to any calls to BreakIterator.getInstance to avoid undefined behavior. @param iter the BreakIterator instance to adopt. @param locale the Locale for which this instance is to be registered @param kind the type of iterator for which this instance is to be registered @return a registry key that can be used to unregister this instance @hide unsupported on Android
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Registers", "a", "new", "break", "iterator", "of", "the", "indicated", "kind", "to", "use", "in", "the", "given", "locale", ".", "Clones", "of", "the", "iterator", "will", "be", "returned", "if...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BreakIterator.java#L729-L731
alkacon/opencms-core
src/org/opencms/db/CmsUserSettings.java
CmsUserSettings.getAdditionalPreference
public String getAdditionalPreference(String name, boolean useDefault) { String value = m_additionalPreferences.get(name); if ((value == null) && useDefault) { I_CmsPreference pref = OpenCms.getWorkplaceManager().getDefaultUserSettings().getPreferences().get(name); if (pref != null) { value = pref.getDefaultValue(); } } return value; }
java
public String getAdditionalPreference(String name, boolean useDefault) { String value = m_additionalPreferences.get(name); if ((value == null) && useDefault) { I_CmsPreference pref = OpenCms.getWorkplaceManager().getDefaultUserSettings().getPreferences().get(name); if (pref != null) { value = pref.getDefaultValue(); } } return value; }
[ "public", "String", "getAdditionalPreference", "(", "String", "name", ",", "boolean", "useDefault", ")", "{", "String", "value", "=", "m_additionalPreferences", ".", "get", "(", "name", ")", ";", "if", "(", "(", "value", "==", "null", ")", "&&", "useDefault"...
Gets the value for a user defined preference.<p> @param name the name of the preference @param useDefault true if the default value should be returned in case the preference is not set @return the preference value
[ "Gets", "the", "value", "for", "a", "user", "defined", "preference", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsUserSettings.java#L489-L499
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.deleteCustomAttribute
public void deleteCustomAttribute(final Object userIdOrUsername, final CustomAttribute customAttribute) throws GitLabApiException { if (Objects.isNull(customAttribute)) { throw new IllegalArgumentException("customAttributes can't be null"); } deleteCustomAttribute(userIdOrUsername, customAttribute.getKey()); }
java
public void deleteCustomAttribute(final Object userIdOrUsername, final CustomAttribute customAttribute) throws GitLabApiException { if (Objects.isNull(customAttribute)) { throw new IllegalArgumentException("customAttributes can't be null"); } deleteCustomAttribute(userIdOrUsername, customAttribute.getKey()); }
[ "public", "void", "deleteCustomAttribute", "(", "final", "Object", "userIdOrUsername", ",", "final", "CustomAttribute", "customAttribute", ")", "throws", "GitLabApiException", "{", "if", "(", "Objects", ".", "isNull", "(", "customAttribute", ")", ")", "{", "throw", ...
Delete a custom attribute for the given user @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param customAttribute to remove @throws GitLabApiException on failure while deleting customAttributes
[ "Delete", "a", "custom", "attribute", "for", "the", "given", "user" ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L965-L971
UrielCh/ovh-java-sdk
ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java
ApiOvhHorizonView.serviceName_customerNetwork_customerNetworkId_DELETE
public ArrayList<OvhTask> serviceName_customerNetwork_customerNetworkId_DELETE(String serviceName, Long customerNetworkId) throws IOException { String qPath = "/horizonView/{serviceName}/customerNetwork/{customerNetworkId}"; StringBuilder sb = path(qPath, serviceName, customerNetworkId); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<OvhTask> serviceName_customerNetwork_customerNetworkId_DELETE(String serviceName, Long customerNetworkId) throws IOException { String qPath = "/horizonView/{serviceName}/customerNetwork/{customerNetworkId}"; StringBuilder sb = path(qPath, serviceName, customerNetworkId); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "OvhTask", ">", "serviceName_customerNetwork_customerNetworkId_DELETE", "(", "String", "serviceName", ",", "Long", "customerNetworkId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/horizonView/{serviceName}/customerNetwork/{customer...
Delete this Customer Network REST: DELETE /horizonView/{serviceName}/customerNetwork/{customerNetworkId} @param serviceName [required] Domain of the service @param customerNetworkId [required] Customer Network id
[ "Delete", "this", "Customer", "Network" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java#L445-L450
demidenko05/beigesoft-accounting
src/main/java/org/beigesoft/accounting/processor/PrcManufactureSave.java
PrcManufactureSave.makeOtherEntries
@Override public final void makeOtherEntries(final Map<String, Object> pAddParam, final Manufacture pEntity, final IRequestData pRequestData, final boolean pIsNew) throws Exception { //always new ManufactureForDraw manufactureForDraw = new ManufactureForDraw(pEntity); if (pEntity.getReversedId() != null) { //reverse draw product in process from warehouse getSrvWarehouseEntry().reverseDraw(pAddParam, manufactureForDraw); //reverse draw product in process from manufacturing process useMaterialReverse(pAddParam, pEntity); //reverse acc.entries already done } else { //draw product in process from warehouse getSrvWarehouseEntry().withdrawal(pAddParam, manufactureForDraw, pEntity.getWarehouseSiteFo()); //draw product in process from manufacturing process useMaterial(pAddParam, pEntity); //it will update this doc: getSrvAccEntry().makeEntries(pAddParam, pEntity); } //load(put) or reverse product or created material on warehouse getSrvWarehouseEntry().load(pAddParam, pEntity, pEntity.getWarehouseSite()); }
java
@Override public final void makeOtherEntries(final Map<String, Object> pAddParam, final Manufacture pEntity, final IRequestData pRequestData, final boolean pIsNew) throws Exception { //always new ManufactureForDraw manufactureForDraw = new ManufactureForDraw(pEntity); if (pEntity.getReversedId() != null) { //reverse draw product in process from warehouse getSrvWarehouseEntry().reverseDraw(pAddParam, manufactureForDraw); //reverse draw product in process from manufacturing process useMaterialReverse(pAddParam, pEntity); //reverse acc.entries already done } else { //draw product in process from warehouse getSrvWarehouseEntry().withdrawal(pAddParam, manufactureForDraw, pEntity.getWarehouseSiteFo()); //draw product in process from manufacturing process useMaterial(pAddParam, pEntity); //it will update this doc: getSrvAccEntry().makeEntries(pAddParam, pEntity); } //load(put) or reverse product or created material on warehouse getSrvWarehouseEntry().load(pAddParam, pEntity, pEntity.getWarehouseSite()); }
[ "@", "Override", "public", "final", "void", "makeOtherEntries", "(", "final", "Map", "<", "String", ",", "Object", ">", "pAddParam", ",", "final", "Manufacture", "pEntity", ",", "final", "IRequestData", "pRequestData", ",", "final", "boolean", "pIsNew", ")", "...
<p>Make other entries include reversing if it's need when save.</p> @param pAddParam additional param @param pEntity entity @param pRequestData Request Data @param pIsNew if entity was new @throws Exception - an exception
[ "<p", ">", "Make", "other", "entries", "include", "reversing", "if", "it", "s", "need", "when", "save", ".", "<", "/", "p", ">" ]
train
https://github.com/demidenko05/beigesoft-accounting/blob/e6f423949008218ddd05953b078f1ea8805095c1/src/main/java/org/beigesoft/accounting/processor/PrcManufactureSave.java#L116-L139
playn/playn
scene/src/playn/scene/LayerUtil.java
LayerUtil.screenToLayer
public static Point screenToLayer(Layer layer, float x, float y) { Point into = new Point(x, y); return screenToLayer(layer, into, into); }
java
public static Point screenToLayer(Layer layer, float x, float y) { Point into = new Point(x, y); return screenToLayer(layer, into, into); }
[ "public", "static", "Point", "screenToLayer", "(", "Layer", "layer", ",", "float", "x", ",", "float", "y", ")", "{", "Point", "into", "=", "new", "Point", "(", "x", ",", "y", ")", ";", "return", "screenToLayer", "(", "layer", ",", "into", ",", "into"...
Converts the supplied point from screen coordinates to coordinates relative to the specified layer.
[ "Converts", "the", "supplied", "point", "from", "screen", "coordinates", "to", "coordinates", "relative", "to", "the", "specified", "layer", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L94-L97
pip-services3-java/pip-services3-components-java
src/org/pipservices3/components/config/YamlConfigReader.java
YamlConfigReader.readObject
public static Object readObject(String correlationId, String path, ConfigParams parameters) throws ApplicationException { return new YamlConfigReader(path).readObject(correlationId, parameters); }
java
public static Object readObject(String correlationId, String path, ConfigParams parameters) throws ApplicationException { return new YamlConfigReader(path).readObject(correlationId, parameters); }
[ "public", "static", "Object", "readObject", "(", "String", "correlationId", ",", "String", "path", ",", "ConfigParams", "parameters", ")", "throws", "ApplicationException", "{", "return", "new", "YamlConfigReader", "(", "path", ")", ".", "readObject", "(", "correl...
Reads configuration file, parameterizes its content and converts it into JSON object. @param correlationId (optional) transaction id to trace execution through call chain. @param path a path to configuration file. @param parameters values to parameters the configuration. @return a JSON object with configuration. @throws ApplicationException when error occured.
[ "Reads", "configuration", "file", "parameterizes", "its", "content", "and", "converts", "it", "into", "JSON", "object", "." ]
train
https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/config/YamlConfigReader.java#L113-L116
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
DBCleanService.getRepositoryDBCleaner
public static DBCleanerTool getRepositoryDBCleaner(Connection jdbcConn, RepositoryEntry rEntry) throws DBCleanException { SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); WorkspaceEntry wsEntry = rEntry.getWorkspaceEntries().get(0); boolean multiDb = getMultiDbParameter(wsEntry); if (multiDb) { throw new DBCleanException( "It is not possible to create cleaner with common connection for multi database repository configuration"); } String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); DBCleaningScripts scripts = DBCleaningScriptsFactory.prepareScripts(dialect, rEntry); return new DBCleanerTool(jdbcConn, autoCommit, scripts.getCleaningScripts(), scripts.getCommittingScripts(), scripts.getRollbackingScripts()); }
java
public static DBCleanerTool getRepositoryDBCleaner(Connection jdbcConn, RepositoryEntry rEntry) throws DBCleanException { SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); WorkspaceEntry wsEntry = rEntry.getWorkspaceEntries().get(0); boolean multiDb = getMultiDbParameter(wsEntry); if (multiDb) { throw new DBCleanException( "It is not possible to create cleaner with common connection for multi database repository configuration"); } String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); DBCleaningScripts scripts = DBCleaningScriptsFactory.prepareScripts(dialect, rEntry); return new DBCleanerTool(jdbcConn, autoCommit, scripts.getCleaningScripts(), scripts.getCommittingScripts(), scripts.getRollbackingScripts()); }
[ "public", "static", "DBCleanerTool", "getRepositoryDBCleaner", "(", "Connection", "jdbcConn", ",", "RepositoryEntry", "rEntry", ")", "throws", "DBCleanException", "{", "SecurityHelper", ".", "validateSecurityPermission", "(", "JCRRuntimePermissions", ".", "MANAGE_REPOSITORY_P...
Returns database cleaner for repository. @param jdbcConn database connection which need to use @param rEntry repository configuration @return DBCleanerTool @throws DBCleanException
[ "Returns", "database", "cleaner", "for", "repository", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java#L158-L179
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java
SparseCpuLevel1.droti
@Override protected void droti(long N, INDArray X, DataBuffer indexes, INDArray Y, double c, double s) { cblas_droti((int) N, (DoublePointer) X.data().addressPointer(), (IntPointer) indexes.addressPointer(), (DoublePointer) Y.data().addressPointer(), c, s); }
java
@Override protected void droti(long N, INDArray X, DataBuffer indexes, INDArray Y, double c, double s) { cblas_droti((int) N, (DoublePointer) X.data().addressPointer(), (IntPointer) indexes.addressPointer(), (DoublePointer) Y.data().addressPointer(), c, s); }
[ "@", "Override", "protected", "void", "droti", "(", "long", "N", ",", "INDArray", "X", ",", "DataBuffer", "indexes", ",", "INDArray", "Y", ",", "double", "c", ",", "double", "s", ")", "{", "cblas_droti", "(", "(", "int", ")", "N", ",", "(", "DoublePo...
Applies Givens rotation to sparse vectors one of which is in compressed form. @param N The number of elements in vectors X and Y @param X a double sparse vector @param indexes The indexes of the sparse vector @param Y a double full-storage vector @param c a scalar @param s a scalar
[ "Applies", "Givens", "rotation", "to", "sparse", "vectors", "one", "of", "which", "is", "in", "compressed", "form", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/blas/SparseCpuLevel1.java#L232-L236
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/font/effects/OutlineEffect.java
OutlineEffect.getStroke
public Stroke getStroke() { if (stroke == null) { return new BasicStroke(width, BasicStroke.CAP_SQUARE, join); } return stroke; }
java
public Stroke getStroke() { if (stroke == null) { return new BasicStroke(width, BasicStroke.CAP_SQUARE, join); } return stroke; }
[ "public", "Stroke", "getStroke", "(", ")", "{", "if", "(", "stroke", "==", "null", ")", "{", "return", "new", "BasicStroke", "(", "width", ",", "BasicStroke", ".", "CAP_SQUARE", ",", "join", ")", ";", "}", "return", "stroke", ";", "}" ]
Get the stroke being used to draw the outline @return The stroke being used to draw the outline
[ "Get", "the", "stroke", "being", "used", "to", "draw", "the", "outline" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/effects/OutlineEffect.java#L113-L119
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/RestClient.java
RestClient.getAttachmentMetaData
public Attachment getAttachmentMetaData(String assetId, String attachmentId) throws IOException, BadVersionException, RequestFailureException { // At the moment can only get all attachments Asset ass = getAsset(assetId); List<Attachment> allAttachments = ass.getAttachments(); for (Attachment attachment : allAttachments) { if (attachmentId.equals(attachment.get_id())) { return attachment; } } // Didn't find it so just return null return null; }
java
public Attachment getAttachmentMetaData(String assetId, String attachmentId) throws IOException, BadVersionException, RequestFailureException { // At the moment can only get all attachments Asset ass = getAsset(assetId); List<Attachment> allAttachments = ass.getAttachments(); for (Attachment attachment : allAttachments) { if (attachmentId.equals(attachment.get_id())) { return attachment; } } // Didn't find it so just return null return null; }
[ "public", "Attachment", "getAttachmentMetaData", "(", "String", "assetId", ",", "String", "attachmentId", ")", "throws", "IOException", ",", "BadVersionException", ",", "RequestFailureException", "{", "// At the moment can only get all attachments", "Asset", "ass", "=", "ge...
Returns the meta data about an attachment @param assetId The ID of the asset owning the attachment @param attachmentId The ID of the attachment @return The attachment meta data @throws IOException @throws RequestFailureException
[ "Returns", "the", "meta", "data", "about", "an", "attachment" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/RestClient.java#L503-L515
apache/groovy
src/main/groovy/groovy/util/Node.java
Node.breadthFirst
public void breadthFirst(Map<String, Object> options, Closure c) { boolean preorder = Boolean.valueOf(options.get("preorder").toString()); if (preorder) callClosureForNode(c, this, 1); breadthFirstRest(preorder, 2, c); if (!preorder) callClosureForNode(c, this, 1); }
java
public void breadthFirst(Map<String, Object> options, Closure c) { boolean preorder = Boolean.valueOf(options.get("preorder").toString()); if (preorder) callClosureForNode(c, this, 1); breadthFirstRest(preorder, 2, c); if (!preorder) callClosureForNode(c, this, 1); }
[ "public", "void", "breadthFirst", "(", "Map", "<", "String", ",", "Object", ">", "options", ",", "Closure", "c", ")", "{", "boolean", "preorder", "=", "Boolean", ".", "valueOf", "(", "options", ".", "get", "(", "\"preorder\"", ")", ".", "toString", "(", ...
Calls the provided closure for all the nodes in the tree using a breadth-first traversal. A boolean 'preorder' options is supported. @param options map containing options @param c the closure to run for each node (a one or two parameter can be used; if one parameter is given the closure will be passed the node, for a two param closure the second parameter will be the level). @since 2.5.0
[ "Calls", "the", "provided", "closure", "for", "all", "the", "nodes", "in", "the", "tree", "using", "a", "breadth", "-", "first", "traversal", ".", "A", "boolean", "preorder", "options", "is", "supported", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/Node.java#L711-L716
kaazing/java.client
amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java
AmqpClient.closeConnection
AmqpClient closeConnection(int replyCode, String replyText, int classId, int methodId1) { this.closeConnection(replyCode, replyText, classId, methodId1, null, null); return this; }
java
AmqpClient closeConnection(int replyCode, String replyText, int classId, int methodId1) { this.closeConnection(replyCode, replyText, classId, methodId1, null, null); return this; }
[ "AmqpClient", "closeConnection", "(", "int", "replyCode", ",", "String", "replyText", ",", "int", "classId", ",", "int", "methodId1", ")", "{", "this", ".", "closeConnection", "(", "replyCode", ",", "replyText", ",", "classId", ",", "methodId1", ",", "null", ...
Closes the Amqp Server connection. @param replyCode @param replyText @param classId @param methodId1 @return AmqpClient
[ "Closes", "the", "Amqp", "Server", "connection", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/amqp-0-9-1/amqp/src/main/java/org/kaazing/net/ws/amqp/AmqpClient.java#L882-L885
jbundle/webapp
base/src/main/java/org/jbundle/util/webapp/base/BaseWebappServlet.java
BaseWebappServlet.copyStream
public static void copyStream(Reader inStream, Writer outStream, boolean ignoreErrors) { char[] data = new char[BUFFER]; int count; try { while((count = inStream.read(data, 0, BUFFER)) != -1) { outStream.write(data, 0, count); } } catch (IOException e) { if (!ignoreErrors) e.printStackTrace(); } }
java
public static void copyStream(Reader inStream, Writer outStream, boolean ignoreErrors) { char[] data = new char[BUFFER]; int count; try { while((count = inStream.read(data, 0, BUFFER)) != -1) { outStream.write(data, 0, count); } } catch (IOException e) { if (!ignoreErrors) e.printStackTrace(); } }
[ "public", "static", "void", "copyStream", "(", "Reader", "inStream", ",", "Writer", "outStream", ",", "boolean", "ignoreErrors", ")", "{", "char", "[", "]", "data", "=", "new", "char", "[", "BUFFER", "]", ";", "int", "count", ";", "try", "{", "while", ...
Copy the input stream to the output stream @param inStream @param outStream @param ignoreErrors
[ "Copy", "the", "input", "stream", "to", "the", "output", "stream" ]
train
https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/base/src/main/java/org/jbundle/util/webapp/base/BaseWebappServlet.java#L165-L178
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/NotificationDto.java
NotificationDto.transformToDto
public static NotificationDto transformToDto(Notification notification) { if (notification == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } NotificationDto result = createDtoObject(NotificationDto.class, notification); result.setAlertId(notification.getAlert().getId()); for (Trigger trigger : notification.getTriggers()) { result.addTriggersIds(trigger); } return result; }
java
public static NotificationDto transformToDto(Notification notification) { if (notification == null) { throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR); } NotificationDto result = createDtoObject(NotificationDto.class, notification); result.setAlertId(notification.getAlert().getId()); for (Trigger trigger : notification.getTriggers()) { result.addTriggersIds(trigger); } return result; }
[ "public", "static", "NotificationDto", "transformToDto", "(", "Notification", "notification", ")", "{", "if", "(", "notification", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Null entity object cannot be converted to Dto object.\"", ",", "St...
Converts notification entity object to notificationDto object. @param notification notification entity. Cannot be null. @return notificationDto. @throws WebApplicationException If an error occurs.
[ "Converts", "notification", "entity", "object", "to", "notificationDto", "object", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/NotificationDto.java#L78-L90
networknt/light-4j
client/src/main/java/com/networknt/client/oauth/OauthHelper.java
OauthHelper.adjustNoChunkedEncoding
public static void adjustNoChunkedEncoding(ClientRequest request, String requestBody) { String fixedLengthString = request.getRequestHeaders().getFirst(Headers.CONTENT_LENGTH); String transferEncodingString = request.getRequestHeaders().getLast(Headers.TRANSFER_ENCODING); if(transferEncodingString != null) { request.getRequestHeaders().remove(Headers.TRANSFER_ENCODING); } //if already specify a content-length, should use what they provided if(fixedLengthString != null && Long.parseLong(fixedLengthString) > 0) { return; } if(!StringUtils.isEmpty(requestBody)) { long contentLength = requestBody.getBytes(UTF_8).length; request.getRequestHeaders().put(Headers.CONTENT_LENGTH, contentLength); } }
java
public static void adjustNoChunkedEncoding(ClientRequest request, String requestBody) { String fixedLengthString = request.getRequestHeaders().getFirst(Headers.CONTENT_LENGTH); String transferEncodingString = request.getRequestHeaders().getLast(Headers.TRANSFER_ENCODING); if(transferEncodingString != null) { request.getRequestHeaders().remove(Headers.TRANSFER_ENCODING); } //if already specify a content-length, should use what they provided if(fixedLengthString != null && Long.parseLong(fixedLengthString) > 0) { return; } if(!StringUtils.isEmpty(requestBody)) { long contentLength = requestBody.getBytes(UTF_8).length; request.getRequestHeaders().put(Headers.CONTENT_LENGTH, contentLength); } }
[ "public", "static", "void", "adjustNoChunkedEncoding", "(", "ClientRequest", "request", ",", "String", "requestBody", ")", "{", "String", "fixedLengthString", "=", "request", ".", "getRequestHeaders", "(", ")", ".", "getFirst", "(", "Headers", ".", "CONTENT_LENGTH",...
this method is to support sending a server which doesn't support chunked transfer encoding.
[ "this", "method", "is", "to", "support", "sending", "a", "server", "which", "doesn", "t", "support", "chunked", "transfer", "encoding", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L736-L751
actorapp/actor-platform
actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/collections/SparseBooleanArray.java
SparseBooleanArray.append
public void append(int key, boolean value) { if (mSize != 0 && key <= mKeys[mSize - 1]) { put(key, value); return; } mKeys = GrowingArrayUtils.append(mKeys, mSize, key); mValues = GrowingArrayUtils.append(mValues, mSize, value); mSize++; }
java
public void append(int key, boolean value) { if (mSize != 0 && key <= mKeys[mSize - 1]) { put(key, value); return; } mKeys = GrowingArrayUtils.append(mKeys, mSize, key); mValues = GrowingArrayUtils.append(mValues, mSize, value); mSize++; }
[ "public", "void", "append", "(", "int", "key", ",", "boolean", "value", ")", "{", "if", "(", "mSize", "!=", "0", "&&", "key", "<=", "mKeys", "[", "mSize", "-", "1", "]", ")", "{", "put", "(", "key", ",", "value", ")", ";", "return", ";", "}", ...
Puts a key/value pair into the array, optimizing for the case where the key is greater than all existing keys in the array.
[ "Puts", "a", "key", "/", "value", "pair", "into", "the", "array", "optimizing", "for", "the", "case", "where", "the", "key", "is", "greater", "than", "all", "existing", "keys", "in", "the", "array", "." ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/collections/SparseBooleanArray.java#L212-L220
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java
TurboProjectReader.defineField
private static void defineField(Map<String, FieldType> container, String name, FieldType type, String alias) { container.put(name, type); if (alias != null) { ALIASES.put(type, alias); } }
java
private static void defineField(Map<String, FieldType> container, String name, FieldType type, String alias) { container.put(name, type); if (alias != null) { ALIASES.put(type, alias); } }
[ "private", "static", "void", "defineField", "(", "Map", "<", "String", ",", "FieldType", ">", "container", ",", "String", "name", ",", "FieldType", "type", ",", "String", "alias", ")", "{", "container", ".", "put", "(", "name", ",", "type", ")", ";", "...
Configure the mapping between a database column and a field, including definition of an alias. @param container column to field map @param name column name @param type field type @param alias field alias
[ "Configure", "the", "mapping", "between", "a", "database", "column", "and", "a", "field", "including", "definition", "of", "an", "alias", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L504-L511
pac4j/pac4j
pac4j-core/src/main/java/org/pac4j/core/exception/http/RedirectionActionHelper.java
RedirectionActionHelper.buildRedirectUrlAction
public static RedirectionAction buildRedirectUrlAction(final WebContext context, final String location) { if (ContextHelper.isPost(context) && useModernHttpCodes) { return new SeeOtherAction(location); } else { return new FoundAction(location); } }
java
public static RedirectionAction buildRedirectUrlAction(final WebContext context, final String location) { if (ContextHelper.isPost(context) && useModernHttpCodes) { return new SeeOtherAction(location); } else { return new FoundAction(location); } }
[ "public", "static", "RedirectionAction", "buildRedirectUrlAction", "(", "final", "WebContext", "context", ",", "final", "String", "location", ")", "{", "if", "(", "ContextHelper", ".", "isPost", "(", "context", ")", "&&", "useModernHttpCodes", ")", "{", "return", ...
Build the appropriate redirection action for a location. @param context the web context @param location the location @return the appropriate redirection action
[ "Build", "the", "appropriate", "redirection", "action", "for", "a", "location", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/exception/http/RedirectionActionHelper.java#L25-L31
dita-ot/dita-ot
src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/writer/CHMIndexWriter.java
CHMIndexWriter.outputIndexTerm
private void outputIndexTerm(final IndexTerm term, final XMLSerializer serializer) throws SAXException { List<IndexTermTarget> targets = term.getTargetList(); final List<IndexTerm> subTerms = term.getSubTerms(); int targetNum = targets.size(); final int subTermNum = subTerms.size(); serializer.writeStartElement("li"); serializer.writeStartElement("object"); serializer.writeAttribute("type", "text/sitemap"); serializer.writeStartElement("param"); serializer.writeAttribute("name", "Name"); serializer.writeAttribute("value", term.getTermFullName()); serializer.writeEndElement(); // param //if term doesn't has target to link to, it won't appear in the index tab //we need to create links for such terms if (targets.isEmpty()){ findTargets(term); targets = term.getTargetList(); targetNum = targets.size(); } for (int i = 0; i < targetNum; i++) { final IndexTermTarget target = targets.get(i); serializer.writeStartElement("param"); serializer.writeAttribute("name", "Name"); serializer.writeAttribute("value", target.getTargetName()); serializer.writeEndElement(); // param serializer.writeStartElement("param"); serializer.writeAttribute("name", "Local"); serializer.writeAttribute("value", target.getTargetURI()); serializer.writeEndElement(); // param } serializer.writeEndElement(); // object if (subTermNum > 0) { serializer.writeStartElement("ul"); for (final IndexTerm subTerm : subTerms) { outputIndexTerm(subTerm, serializer); } serializer.writeEndElement(); // ul } serializer.writeEndElement(); // li }
java
private void outputIndexTerm(final IndexTerm term, final XMLSerializer serializer) throws SAXException { List<IndexTermTarget> targets = term.getTargetList(); final List<IndexTerm> subTerms = term.getSubTerms(); int targetNum = targets.size(); final int subTermNum = subTerms.size(); serializer.writeStartElement("li"); serializer.writeStartElement("object"); serializer.writeAttribute("type", "text/sitemap"); serializer.writeStartElement("param"); serializer.writeAttribute("name", "Name"); serializer.writeAttribute("value", term.getTermFullName()); serializer.writeEndElement(); // param //if term doesn't has target to link to, it won't appear in the index tab //we need to create links for such terms if (targets.isEmpty()){ findTargets(term); targets = term.getTargetList(); targetNum = targets.size(); } for (int i = 0; i < targetNum; i++) { final IndexTermTarget target = targets.get(i); serializer.writeStartElement("param"); serializer.writeAttribute("name", "Name"); serializer.writeAttribute("value", target.getTargetName()); serializer.writeEndElement(); // param serializer.writeStartElement("param"); serializer.writeAttribute("name", "Local"); serializer.writeAttribute("value", target.getTargetURI()); serializer.writeEndElement(); // param } serializer.writeEndElement(); // object if (subTermNum > 0) { serializer.writeStartElement("ul"); for (final IndexTerm subTerm : subTerms) { outputIndexTerm(subTerm, serializer); } serializer.writeEndElement(); // ul } serializer.writeEndElement(); // li }
[ "private", "void", "outputIndexTerm", "(", "final", "IndexTerm", "term", ",", "final", "XMLSerializer", "serializer", ")", "throws", "SAXException", "{", "List", "<", "IndexTermTarget", ">", "targets", "=", "term", ".", "getTargetList", "(", ")", ";", "final", ...
Output the given indexterm into the XML writer. @param term term to serialize @param serializer XML output to write to
[ "Output", "the", "given", "indexterm", "into", "the", "XML", "writer", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/writer/CHMIndexWriter.java#L87-L127
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java
DisksInner.grantAccess
public AccessUriInner grantAccess(String resourceGroupName, String diskName, GrantAccessData grantAccessData) { return grantAccessWithServiceResponseAsync(resourceGroupName, diskName, grantAccessData).toBlocking().last().body(); }
java
public AccessUriInner grantAccess(String resourceGroupName, String diskName, GrantAccessData grantAccessData) { return grantAccessWithServiceResponseAsync(resourceGroupName, diskName, grantAccessData).toBlocking().last().body(); }
[ "public", "AccessUriInner", "grantAccess", "(", "String", "resourceGroupName", ",", "String", "diskName", ",", "GrantAccessData", "grantAccessData", ")", "{", "return", "grantAccessWithServiceResponseAsync", "(", "resourceGroupName", ",", "diskName", ",", "grantAccessData",...
Grants access to a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @param grantAccessData Access data object supplied in the body of the get disk access operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AccessUriInner object if successful.
[ "Grants", "access", "to", "a", "disk", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L951-L953
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java
ReflectionUtils.assertNoPrimitiveParameters
public static void assertNoPrimitiveParameters(final Method method, Class<? extends Annotation> annotation) { for (Class<?> type : method.getParameterTypes()) { if (type.isPrimitive()) { throw annotation == null ? MESSAGES.methodCannotDeclarePrimitiveParameters(method) : MESSAGES.methodCannotDeclarePrimitiveParameters2(method, annotation); } } }
java
public static void assertNoPrimitiveParameters(final Method method, Class<? extends Annotation> annotation) { for (Class<?> type : method.getParameterTypes()) { if (type.isPrimitive()) { throw annotation == null ? MESSAGES.methodCannotDeclarePrimitiveParameters(method) : MESSAGES.methodCannotDeclarePrimitiveParameters2(method, annotation); } } }
[ "public", "static", "void", "assertNoPrimitiveParameters", "(", "final", "Method", "method", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "for", "(", "Class", "<", "?", ">", "type", ":", "method", ".", "getParameterTypes", "(...
Asserts method don't declare primitive parameters. @param method to validate @param annotation annotation to propagate in exception message
[ "Asserts", "method", "don", "t", "declare", "primitive", "parameters", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/injection/finders/ReflectionUtils.java#L53-L62
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyDecoder.java
KeyDecoder.decodeBooleanDesc
public static boolean decodeBooleanDesc(byte[] src, int srcOffset) throws CorruptEncodingException { try { return src[srcOffset] == 127; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
java
public static boolean decodeBooleanDesc(byte[] src, int srcOffset) throws CorruptEncodingException { try { return src[srcOffset] == 127; } catch (IndexOutOfBoundsException e) { throw new CorruptEncodingException(null, e); } }
[ "public", "static", "boolean", "decodeBooleanDesc", "(", "byte", "[", "]", "src", ",", "int", "srcOffset", ")", "throws", "CorruptEncodingException", "{", "try", "{", "return", "src", "[", "srcOffset", "]", "==", "127", ";", "}", "catch", "(", "IndexOutOfBou...
Decodes a boolean from exactly 1 byte, as encoded for descending order. @param src source of encoded bytes @param srcOffset offset into source array @return boolean value
[ "Decodes", "a", "boolean", "from", "exactly", "1", "byte", "as", "encoded", "for", "descending", "order", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L234-L242
wildfly/wildfly-core
embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java
EmbeddedProcessFactory.createHostController
public static HostController createHostController(String jbossHomePath, String modulePath, String[] systemPackages, String[] cmdargs) { if (jbossHomePath == null || jbossHomePath.isEmpty()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } File jbossHomeDir = new File(jbossHomePath); if (!jbossHomeDir.isDirectory()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } return createHostController( Configuration.Builder.of(jbossHomeDir) .setModulePath(modulePath) .setSystemPackages(systemPackages) .setCommandArguments(cmdargs) .build() ); }
java
public static HostController createHostController(String jbossHomePath, String modulePath, String[] systemPackages, String[] cmdargs) { if (jbossHomePath == null || jbossHomePath.isEmpty()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } File jbossHomeDir = new File(jbossHomePath); if (!jbossHomeDir.isDirectory()) { throw EmbeddedLogger.ROOT_LOGGER.invalidJBossHome(jbossHomePath); } return createHostController( Configuration.Builder.of(jbossHomeDir) .setModulePath(modulePath) .setSystemPackages(systemPackages) .setCommandArguments(cmdargs) .build() ); }
[ "public", "static", "HostController", "createHostController", "(", "String", "jbossHomePath", ",", "String", "modulePath", ",", "String", "[", "]", "systemPackages", ",", "String", "[", "]", "cmdargs", ")", "{", "if", "(", "jbossHomePath", "==", "null", "||", ...
Create an embedded host controller. @param jbossHomePath the location of the root of the host controller installation. Cannot be {@code null} or empty. @param modulePath the location of the root of the module repository. May be {@code null} if the standard location under {@code jbossHomePath} should be used @param systemPackages names of any packages that must be treated as system packages, with the same classes visible to the caller's classloader visible to host-controller-side classes loaded from the server's modular classloader @param cmdargs any additional arguments to pass to the embedded host controller (e.g. -b=192.168.100.10) @return the server. Will not be {@code null}
[ "Create", "an", "embedded", "host", "controller", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/EmbeddedProcessFactory.java#L206-L221
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java
SightResourcesImpl.moveSight
public Sight moveSight(long sightId, ContainerDestination destination) throws SmartsheetException { return this.createResource("sights/" + sightId + "/move", Sight.class, destination); }
java
public Sight moveSight(long sightId, ContainerDestination destination) throws SmartsheetException { return this.createResource("sights/" + sightId + "/move", Sight.class, destination); }
[ "public", "Sight", "moveSight", "(", "long", "sightId", ",", "ContainerDestination", "destination", ")", "throws", "SmartsheetException", "{", "return", "this", ".", "createResource", "(", "\"sights/\"", "+", "sightId", "+", "\"/move\"", ",", "Sight", ".", "class"...
Creates s copy of the specified Sight. It mirrors to the following Smartsheet REST API method: POST /sights/{sightId}/move @param sightId the Id of the Sight @param destination the destination to copy to @return the newly created Sight resource. @throws IllegalArgumentException if any argument is null or empty string @throws InvalidRequestException if there is any problem with the REST API request @throws AuthorizationException if there is any problem with the REST API authorization (access token) @throws ResourceNotFoundException if the resource cannot be found @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting) @throws SmartsheetException if there is any other error during the operation
[ "Creates", "s", "copy", "of", "the", "specified", "Sight", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/SightResourcesImpl.java#L203-L205
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.putAt
public static void putAt(BitSet self, IntRange range, boolean value) { RangeInfo info = subListBorders(self.length(), range); self.set(info.from, info.to, value); }
java
public static void putAt(BitSet self, IntRange range, boolean value) { RangeInfo info = subListBorders(self.length(), range); self.set(info.from, info.to, value); }
[ "public", "static", "void", "putAt", "(", "BitSet", "self", ",", "IntRange", "range", ",", "boolean", "value", ")", "{", "RangeInfo", "info", "=", "subListBorders", "(", "self", ".", "length", "(", ")", ",", "range", ")", ";", "self", ".", "set", "(", ...
Support assigning a range of values with a single assignment statement. @param self a BitSet @param range the range of values to set @param value value @see java.util.BitSet @see groovy.lang.Range @since 1.5.0
[ "Support", "assigning", "a", "range", "of", "values", "with", "a", "single", "assignment", "statement", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14151-L14154
etourdot/xincproc
xpointer/src/main/java/org/etourdot/xincproc/xpointer/XPointerEngine.java
XPointerEngine.executeToDestination
public int executeToDestination(final String pointerStr, final Source source, final Destination destination) throws XPointerException { final Pointer pointer = getPointer(pointerStr); final XdmNode node = processor.newDocumentBuilder().wrap(source); if (pointer != null) { if (pointer.isShortHandPresent()) { return executeShorthandPointer(pointer.getShortHand(), node, destination); } else if (pointer.isSchemeBased()) { return executeSchemaPointer(pointer, node, destination); } else { throw new XPointerResourceException("Unknown pointer expression"); } } else { throw new XPointerResourceException("Unknown pointer expression"); } }
java
public int executeToDestination(final String pointerStr, final Source source, final Destination destination) throws XPointerException { final Pointer pointer = getPointer(pointerStr); final XdmNode node = processor.newDocumentBuilder().wrap(source); if (pointer != null) { if (pointer.isShortHandPresent()) { return executeShorthandPointer(pointer.getShortHand(), node, destination); } else if (pointer.isSchemeBased()) { return executeSchemaPointer(pointer, node, destination); } else { throw new XPointerResourceException("Unknown pointer expression"); } } else { throw new XPointerResourceException("Unknown pointer expression"); } }
[ "public", "int", "executeToDestination", "(", "final", "String", "pointerStr", ",", "final", "Source", "source", ",", "final", "Destination", "destination", ")", "throws", "XPointerException", "{", "final", "Pointer", "pointer", "=", "getPointer", "(", "pointerStr",...
Execute a xpointer expression on a xml source. The result is send to a Saxon {@link net.sf.saxon.s9api.Destination} @param pointerStr xpointer expression @param source xml source @param destination Saxon destination of result stream @return number of elements in result infoset excluding comments et processing instructions @throws XPointerException the x pointer exception
[ "Execute", "a", "xpointer", "expression", "on", "a", "xml", "source", ".", "The", "result", "is", "send", "to", "a", "Saxon", "{", "@link", "net", ".", "sf", ".", "saxon", ".", "s9api", ".", "Destination", "}" ]
train
https://github.com/etourdot/xincproc/blob/6e9e9352e1975957ae6821a04c248ea49c7323ec/xpointer/src/main/java/org/etourdot/xincproc/xpointer/XPointerEngine.java#L192-L216
Coveros/selenified
src/main/java/com/coveros/selenified/element/Element.java
Element.isNotEnabled
private boolean isNotEnabled(String action, String expected, String extra) { // wait for element to be displayed if (!is.enabled()) { waitForState.enabled(); } if (!is.enabled()) { reporter.fail(action, expected, extra + prettyOutput() + NOT_ENABLED); // indicates element not enabled return true; } return false; }
java
private boolean isNotEnabled(String action, String expected, String extra) { // wait for element to be displayed if (!is.enabled()) { waitForState.enabled(); } if (!is.enabled()) { reporter.fail(action, expected, extra + prettyOutput() + NOT_ENABLED); // indicates element not enabled return true; } return false; }
[ "private", "boolean", "isNotEnabled", "(", "String", "action", ",", "String", "expected", ",", "String", "extra", ")", "{", "// wait for element to be displayed", "if", "(", "!", "is", ".", "enabled", "(", ")", ")", "{", "waitForState", ".", "enabled", "(", ...
Determines if the element is displayed. If it isn't, it'll wait up to the default time (5 seconds) for the element to be displayed @param action - what action is occurring @param expected - what is the expected result @param extra - what actually is occurring @return Boolean: is the element enabled?
[ "Determines", "if", "the", "element", "is", "displayed", ".", "If", "it", "isn", "t", "it", "ll", "wait", "up", "to", "the", "default", "time", "(", "5", "seconds", ")", "for", "the", "element", "to", "be", "displayed" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/Element.java#L637-L648
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/workflow/OutputStep.java
OutputStep.runResultHandlers
public void runResultHandlers(ResultHierarchy hier, Database db) { // Run result handlers for(ResultHandler resulthandler : resulthandlers) { Thread.currentThread().setName(resulthandler.toString()); resulthandler.processNewResult(hier, db); } }
java
public void runResultHandlers(ResultHierarchy hier, Database db) { // Run result handlers for(ResultHandler resulthandler : resulthandlers) { Thread.currentThread().setName(resulthandler.toString()); resulthandler.processNewResult(hier, db); } }
[ "public", "void", "runResultHandlers", "(", "ResultHierarchy", "hier", ",", "Database", "db", ")", "{", "// Run result handlers", "for", "(", "ResultHandler", "resulthandler", ":", "resulthandlers", ")", "{", "Thread", ".", "currentThread", "(", ")", ".", "setName...
Run the result handlers. @param hier Result to run on @param db Database
[ "Run", "the", "result", "handlers", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/workflow/OutputStep.java#L66-L72
jhunters/jprotobuf
jprotobuf-precompile-plugin/src/main/java/com/baidu/jprotobuf/mojo/JprotobufPreCompileMain.java
JprotobufPreCompileMain.isStartWith
private static boolean isStartWith(String testString, String[] targetStrings) { for (String s : targetStrings) { if (testString.startsWith(s)) { return true; } } return false; }
java
private static boolean isStartWith(String testString, String[] targetStrings) { for (String s : targetStrings) { if (testString.startsWith(s)) { return true; } } return false; }
[ "private", "static", "boolean", "isStartWith", "(", "String", "testString", ",", "String", "[", "]", "targetStrings", ")", "{", "for", "(", "String", "s", ":", "targetStrings", ")", "{", "if", "(", "testString", ".", "startsWith", "(", "s", ")", ")", "{"...
Checks if is start with. @param testString the test string @param targetStrings the target strings @return true, if is start with
[ "Checks", "if", "is", "start", "with", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/jprotobuf-precompile-plugin/src/main/java/com/baidu/jprotobuf/mojo/JprotobufPreCompileMain.java#L112-L120
Azure/autorest-clientruntime-for-java
azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java
AzureClient.updateStateFromGetResourceOperationAsync
private <T> Observable<PollingState<T>> updateStateFromGetResourceOperationAsync(final PollingState<T> pollingState, String url) { return pollAsync(url, pollingState.loggingContext()) .flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() { @Override public Observable<PollingState<T>> call(Response<ResponseBody> response) { try { pollingState.updateFromResponseOnPutPatch(response); return Observable.just(pollingState); } catch (CloudException | IOException e) { return Observable.error(e); } } }); }
java
private <T> Observable<PollingState<T>> updateStateFromGetResourceOperationAsync(final PollingState<T> pollingState, String url) { return pollAsync(url, pollingState.loggingContext()) .flatMap(new Func1<Response<ResponseBody>, Observable<PollingState<T>>>() { @Override public Observable<PollingState<T>> call(Response<ResponseBody> response) { try { pollingState.updateFromResponseOnPutPatch(response); return Observable.just(pollingState); } catch (CloudException | IOException e) { return Observable.error(e); } } }); }
[ "private", "<", "T", ">", "Observable", "<", "PollingState", "<", "T", ">", ">", "updateStateFromGetResourceOperationAsync", "(", "final", "PollingState", "<", "T", ">", "pollingState", ",", "String", "url", ")", "{", "return", "pollAsync", "(", "url", ",", ...
Polls from the provided URL and updates the polling state with the polling response. @param pollingState the polling state for the current operation. @param url the url to poll from @param <T> the return type of the caller.
[ "Polls", "from", "the", "provided", "URL", "and", "updates", "the", "polling", "state", "with", "the", "polling", "response", "." ]
train
https://github.com/Azure/autorest-clientruntime-for-java/blob/04621e07dbb0456dd5459dd641f06a9fd4f3abad/azure-client-runtime/src/main/java/com/microsoft/azure/AzureClient.java#L621-L634
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/DBTransaction.java
DBTransaction.addColumn
public void addColumn(String storeName, String rowKey, String columnName, String columnValue) { addColumn(storeName, rowKey, columnName, Utils.toBytes(columnValue)); }
java
public void addColumn(String storeName, String rowKey, String columnName, String columnValue) { addColumn(storeName, rowKey, columnName, Utils.toBytes(columnValue)); }
[ "public", "void", "addColumn", "(", "String", "storeName", ",", "String", "rowKey", ",", "String", "columnName", ",", "String", "columnValue", ")", "{", "addColumn", "(", "storeName", ",", "rowKey", ",", "columnName", ",", "Utils", ".", "toBytes", "(", "colu...
Add or set a column with the given string value. The column value is converted to binary form using UTF-8. @param storeName Name of store that owns row. @param rowKey Key of row that owns column. @param columnName Name of column. @param columnValue Column value as a string.
[ "Add", "or", "set", "a", "column", "with", "the", "given", "string", "value", ".", "The", "column", "value", "is", "converted", "to", "binary", "form", "using", "UTF", "-", "8", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/DBTransaction.java#L206-L208
ManfredTremmel/gwt-bean-validators
gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/java/net/URLConnection.java
URLConnection.getHeaderFieldLong
public long getHeaderFieldLong(final String name, final long pdefault) { final String value = this.getHeaderField(name); try { return Long.parseLong(value); } catch (final Exception e) { // NOPMD } return pdefault; }
java
public long getHeaderFieldLong(final String name, final long pdefault) { final String value = this.getHeaderField(name); try { return Long.parseLong(value); } catch (final Exception e) { // NOPMD } return pdefault; }
[ "public", "long", "getHeaderFieldLong", "(", "final", "String", "name", ",", "final", "long", "pdefault", ")", "{", "final", "String", "value", "=", "this", ".", "getHeaderField", "(", "name", ")", ";", "try", "{", "return", "Long", ".", "parseLong", "(", ...
Returns the value of the named field parsed as a number. <p> This form of {@code getHeaderField} exists because some connection types (e.g., {@code http-ng} ) have pre-parsed headers. Classes for that connection type can override this method and short-circuit the parsing. </p> @param name the name of the header field. @param pdefault the default value. @return the value of the named field, parsed as a long. The {@code Default} value is returned if the field is missing or malformed. @since 7.0
[ "Returns", "the", "value", "of", "the", "named", "field", "parsed", "as", "a", "number", ".", "<p", ">", "This", "form", "of", "{", "@code", "getHeaderField", "}", "exists", "because", "some", "connection", "types", "(", "e", ".", "g", ".", "{", "@code...
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/java/net/URLConnection.java#L471-L478
samskivert/samskivert
src/main/java/com/samskivert/util/ConfigUtil.java
ConfigUtil.getStream
public static InputStream getStream (String path, ClassLoader loader) { // first try the supplied class loader InputStream in = getResourceAsStream(path, loader); if (in != null) { return in; } // if that didn't work, try the system class loader (but only if it's different from the // class loader we just tried) try { ClassLoader sysloader = ClassLoader.getSystemClassLoader(); if (sysloader != loader) { return getResourceAsStream(path, loader); } } catch (AccessControlException ace) { // can't get the system loader, no problem! } return null; }
java
public static InputStream getStream (String path, ClassLoader loader) { // first try the supplied class loader InputStream in = getResourceAsStream(path, loader); if (in != null) { return in; } // if that didn't work, try the system class loader (but only if it's different from the // class loader we just tried) try { ClassLoader sysloader = ClassLoader.getSystemClassLoader(); if (sysloader != loader) { return getResourceAsStream(path, loader); } } catch (AccessControlException ace) { // can't get the system loader, no problem! } return null; }
[ "public", "static", "InputStream", "getStream", "(", "String", "path", ",", "ClassLoader", "loader", ")", "{", "// first try the supplied class loader", "InputStream", "in", "=", "getResourceAsStream", "(", "path", ",", "loader", ")", ";", "if", "(", "in", "!=", ...
Returns an input stream referencing a file that exists somewhere in the classpath. <p> The supplied classloader is searched first, followed by the system classloader. @param path The path to the file, relative to the root of the classpath directory from which it will be loaded (e.g. <code>com/foo/bar/foo.gif</code>).
[ "Returns", "an", "input", "stream", "referencing", "a", "file", "that", "exists", "somewhere", "in", "the", "classpath", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/ConfigUtil.java#L484-L503
uber/AutoDispose
android/autodispose-android-archcomponents/src/main/java/com/uber/autodispose/android/lifecycle/AndroidLifecycleScopeProvider.java
AndroidLifecycleScopeProvider.from
public static AndroidLifecycleScopeProvider from( Lifecycle lifecycle, Lifecycle.Event untilEvent) { return from(lifecycle, new UntilEventFunction(untilEvent)); }
java
public static AndroidLifecycleScopeProvider from( Lifecycle lifecycle, Lifecycle.Event untilEvent) { return from(lifecycle, new UntilEventFunction(untilEvent)); }
[ "public", "static", "AndroidLifecycleScopeProvider", "from", "(", "Lifecycle", "lifecycle", ",", "Lifecycle", ".", "Event", "untilEvent", ")", "{", "return", "from", "(", "lifecycle", ",", "new", "UntilEventFunction", "(", "untilEvent", ")", ")", ";", "}" ]
Creates a {@link AndroidLifecycleScopeProvider} for Android Lifecycles. @param lifecycle the lifecycle to scope for. @param untilEvent the event until the scope is valid. @return a {@link AndroidLifecycleScopeProvider} against this lifecycle.
[ "Creates", "a", "{", "@link", "AndroidLifecycleScopeProvider", "}", "for", "Android", "Lifecycles", "." ]
train
https://github.com/uber/AutoDispose/blob/1115b0274f7960354289bb3ae7ba75b0c5a47457/android/autodispose-android-archcomponents/src/main/java/com/uber/autodispose/android/lifecycle/AndroidLifecycleScopeProvider.java#L100-L103
auth0/Auth0.Android
auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java
AuthenticationAPIClient.createUser
@SuppressWarnings("WeakerAccess") public DatabaseConnectionRequest<DatabaseUser, AuthenticationException> createUser(@NonNull String email, @NonNull String password, @NonNull String connection) { //noinspection ConstantConditions return createUser(email, password, null, connection); }
java
@SuppressWarnings("WeakerAccess") public DatabaseConnectionRequest<DatabaseUser, AuthenticationException> createUser(@NonNull String email, @NonNull String password, @NonNull String connection) { //noinspection ConstantConditions return createUser(email, password, null, connection); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "DatabaseConnectionRequest", "<", "DatabaseUser", ",", "AuthenticationException", ">", "createUser", "(", "@", "NonNull", "String", "email", ",", "@", "NonNull", "String", "password", ",", "@", "NonNul...
Creates a user in a DB connection using <a href="https://auth0.com/docs/api/authentication#signup">'/dbconnections/signup' endpoint</a> Example usage: <pre> {@code client.createUser("{email}", "{password}", "{database connection name}") .start(new BaseCallback<DatabaseUser>() { {@literal}Override public void onSuccess(DatabaseUser payload) { } {@literal}@Override public void onFailure(AuthenticationException error) { } }); } </pre> @param email of the user and must be non null @param password of the user and must be non null @param connection of the database to create the user on @return a request to start
[ "Creates", "a", "user", "in", "a", "DB", "connection", "using", "<a", "href", "=", "https", ":", "//", "auth0", ".", "com", "/", "docs", "/", "api", "/", "authentication#signup", ">", "/", "dbconnections", "/", "signup", "endpoint<", "/", "a", ">", "Ex...
train
https://github.com/auth0/Auth0.Android/blob/ee37b7f94d989c1fbab2cb1378c87fdcaf7a8156/auth0/src/main/java/com/auth0/android/authentication/AuthenticationAPIClient.java#L558-L562
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/interestrate/products/DigitalFloorlet.java
DigitalFloorlet.getValue
@Override public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException { // This is on the Libor discretization int liborIndex = model.getLiborPeriodIndex(maturity); double paymentDate = model.getLiborPeriod(liborIndex+1); double periodLength = paymentDate - maturity; // Get random variables RandomVariable libor = model.getLIBOR(maturity, maturity, paymentDate); // Set up payoff on path double[] payoff = new double[model.getNumberOfPaths()]; for(int path=0; path<model.getNumberOfPaths(); path++) { double liborOnPath = libor.get(path); if(liborOnPath < strike) { payoff[path] = periodLength; } else { payoff[path] = 0.0; } } // Get random variables RandomVariable numeraire = model.getNumeraire(paymentDate); RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(paymentDate); RandomVariable numeraireAtEvaluationTime = model.getNumeraire(evaluationTime); RandomVariable monteCarloProbabilitiesAtEvaluationTime = model.getMonteCarloWeights(evaluationTime); RandomVariable values = new RandomVariableFromDoubleArray(paymentDate, payoff); values.div(numeraire).mult(monteCarloProbabilities); values.div(numeraireAtEvaluationTime).mult(monteCarloProbabilitiesAtEvaluationTime); // Return values return values; }
java
@Override public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException { // This is on the Libor discretization int liborIndex = model.getLiborPeriodIndex(maturity); double paymentDate = model.getLiborPeriod(liborIndex+1); double periodLength = paymentDate - maturity; // Get random variables RandomVariable libor = model.getLIBOR(maturity, maturity, paymentDate); // Set up payoff on path double[] payoff = new double[model.getNumberOfPaths()]; for(int path=0; path<model.getNumberOfPaths(); path++) { double liborOnPath = libor.get(path); if(liborOnPath < strike) { payoff[path] = periodLength; } else { payoff[path] = 0.0; } } // Get random variables RandomVariable numeraire = model.getNumeraire(paymentDate); RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(paymentDate); RandomVariable numeraireAtEvaluationTime = model.getNumeraire(evaluationTime); RandomVariable monteCarloProbabilitiesAtEvaluationTime = model.getMonteCarloWeights(evaluationTime); RandomVariable values = new RandomVariableFromDoubleArray(paymentDate, payoff); values.div(numeraire).mult(monteCarloProbabilities); values.div(numeraireAtEvaluationTime).mult(monteCarloProbabilitiesAtEvaluationTime); // Return values return values; }
[ "@", "Override", "public", "RandomVariable", "getValue", "(", "double", "evaluationTime", ",", "LIBORModelMonteCarloSimulationModel", "model", ")", "throws", "CalculationException", "{", "// This is on the Libor discretization", "int", "liborIndex", "=", "model", ".", "getL...
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered. @param evaluationTime The time on which this products value should be observed. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
[ "This", "method", "returns", "the", "value", "random", "variable", "of", "the", "product", "within", "the", "specified", "model", "evaluated", "at", "a", "given", "evalutationTime", ".", "Note", ":", "For", "a", "lattice", "this", "is", "often", "the", "valu...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/DigitalFloorlet.java#L43-L81
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cache/CacheUtil.java
CacheUtil.getPrefix
public static String getPrefix(URI uri, ClassLoader classLoader) { if (uri == null && classLoader == null) { return null; } else { StringBuilder sb = new StringBuilder(); if (uri != null) { sb.append(uri.toASCIIString()).append('/'); } if (classLoader != null) { sb.append(classLoader.toString()).append('/'); } return sb.toString(); } }
java
public static String getPrefix(URI uri, ClassLoader classLoader) { if (uri == null && classLoader == null) { return null; } else { StringBuilder sb = new StringBuilder(); if (uri != null) { sb.append(uri.toASCIIString()).append('/'); } if (classLoader != null) { sb.append(classLoader.toString()).append('/'); } return sb.toString(); } }
[ "public", "static", "String", "getPrefix", "(", "URI", "uri", ",", "ClassLoader", "classLoader", ")", "{", "if", "(", "uri", "==", "null", "&&", "classLoader", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "StringBuilder", "sb", "=", ...
Gets the prefix of cache name without Hazelcast's {@link javax.cache.CacheManager} specific prefix {@link com.hazelcast.cache.HazelcastCacheManager#CACHE_MANAGER_PREFIX}. @param uri an implementation specific URI for the Hazelcast's {@link javax.cache.CacheManager} (null means use Hazelcast's {@link javax.cache.spi.CachingProvider#getDefaultURI()}) @param classLoader the {@link ClassLoader} to use for the Hazelcast's {@link javax.cache.CacheManager} (null means use Hazelcast's {@link javax.cache.spi.CachingProvider#getDefaultClassLoader()}) @return the prefix of cache name without Hazelcast's {@link javax.cache.CacheManager} specific prefix {@link com.hazelcast.cache.HazelcastCacheManager#CACHE_MANAGER_PREFIX}
[ "Gets", "the", "prefix", "of", "cache", "name", "without", "Hazelcast", "s", "{", "@link", "javax", ".", "cache", ".", "CacheManager", "}", "specific", "prefix", "{", "@link", "com", ".", "hazelcast", ".", "cache", ".", "HazelcastCacheManager#CACHE_MANAGER_PREFI...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/CacheUtil.java#L44-L57