repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/CLARA.java
CLARA.assignRemainingToNearestCluster
static double assignRemainingToNearestCluster(ArrayDBIDs means, DBIDs ids, DBIDs rids, WritableIntegerDataStore assignment, DistanceQuery<?> distQ) { rids = DBIDUtil.ensureSet(rids); // Ensure we have fast contains double distsum = 0.; DBIDArrayIter miter = means.iter(); for(DBIDIter iditer = distQ.getRelation().iterDBIDs(); iditer.valid(); iditer.advance()) { if(rids.contains(iditer)) { continue; } double mindist = Double.POSITIVE_INFINITY; int minIndex = 0; miter.seek(0); // Reuse iterator. for(int i = 0; miter.valid(); miter.advance(), i++) { double dist = distQ.distance(iditer, miter); if(dist < mindist) { minIndex = i; mindist = dist; } } distsum += mindist; assignment.put(iditer, minIndex); } return distsum; }
java
static double assignRemainingToNearestCluster(ArrayDBIDs means, DBIDs ids, DBIDs rids, WritableIntegerDataStore assignment, DistanceQuery<?> distQ) { rids = DBIDUtil.ensureSet(rids); // Ensure we have fast contains double distsum = 0.; DBIDArrayIter miter = means.iter(); for(DBIDIter iditer = distQ.getRelation().iterDBIDs(); iditer.valid(); iditer.advance()) { if(rids.contains(iditer)) { continue; } double mindist = Double.POSITIVE_INFINITY; int minIndex = 0; miter.seek(0); // Reuse iterator. for(int i = 0; miter.valid(); miter.advance(), i++) { double dist = distQ.distance(iditer, miter); if(dist < mindist) { minIndex = i; mindist = dist; } } distsum += mindist; assignment.put(iditer, minIndex); } return distsum; }
[ "static", "double", "assignRemainingToNearestCluster", "(", "ArrayDBIDs", "means", ",", "DBIDs", "ids", ",", "DBIDs", "rids", ",", "WritableIntegerDataStore", "assignment", ",", "DistanceQuery", "<", "?", ">", "distQ", ")", "{", "rids", "=", "DBIDUtil", ".", "en...
Returns a list of clusters. The k<sup>th</sup> cluster contains the ids of those FeatureVectors, that are nearest to the k<sup>th</sup> mean. @param means Object centroids @param ids Object ids @param rids Sample that was already assigned @param assignment cluster assignment @param distQ distance query @return Sum of distances.
[ "Returns", "a", "list", "of", "clusters", ".", "The", "k<sup", ">", "th<", "/", "sup", ">", "cluster", "contains", "the", "ids", "of", "those", "FeatureVectors", "that", "are", "nearest", "to", "the", "k<sup", ">", "th<", "/", "sup", ">", "mean", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/kmeans/CLARA.java#L235-L257
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.publishToCacheWriter
private <T> void publishToCacheWriter(Consumer<T> action, Supplier<T> data) { if (!configuration.isWriteThrough()) { return; } try { action.accept(data.get()); } catch (CacheWriterException e) { throw e; } catch (RuntimeException e) { throw new CacheWriterException("Exception in CacheWriter", e); } }
java
private <T> void publishToCacheWriter(Consumer<T> action, Supplier<T> data) { if (!configuration.isWriteThrough()) { return; } try { action.accept(data.get()); } catch (CacheWriterException e) { throw e; } catch (RuntimeException e) { throw new CacheWriterException("Exception in CacheWriter", e); } }
[ "private", "<", "T", ">", "void", "publishToCacheWriter", "(", "Consumer", "<", "T", ">", "action", ",", "Supplier", "<", "T", ">", "data", ")", "{", "if", "(", "!", "configuration", ".", "isWriteThrough", "(", ")", ")", "{", "return", ";", "}", "try...
Performs the action with the cache writer if write-through is enabled.
[ "Performs", "the", "action", "with", "the", "cache", "writer", "if", "write", "-", "through", "is", "enabled", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L994-L1005
google/closure-compiler
src/com/google/javascript/jscomp/JsIterables.java
JsIterables.getElementType
static final JSType getElementType(JSType iterableOrIterator, JSTypeRegistry typeRegistry) { TemplateTypeMap templateTypeMap = iterableOrIterator // Remember that `string` will box to a `Iterable`. .autobox() .getTemplateTypeMap(); if (templateTypeMap.hasTemplateKey(typeRegistry.getIterableTemplate())) { // `Iterable<SomeElementType>` or `Generator<SomeElementType>` return templateTypeMap.getResolvedTemplateType(typeRegistry.getIterableTemplate()); } else if (templateTypeMap.hasTemplateKey(typeRegistry.getIteratorTemplate())) { // `Iterator<SomeElementType>` return templateTypeMap.getResolvedTemplateType(typeRegistry.getIteratorTemplate()); } else if (templateTypeMap.hasTemplateKey(typeRegistry.getAsyncIterableTemplate())) { // `AsyncIterable<SomeElementType>` or `AsyncGenerator<SomeElementType>` return templateTypeMap.getResolvedTemplateType(typeRegistry.getAsyncIterableTemplate()); } else if (templateTypeMap.hasTemplateKey(typeRegistry.getAsyncIteratorTemplate())) { // `AsyncIterator<SomeElementType>` return templateTypeMap.getResolvedTemplateType(typeRegistry.getAsyncIteratorTemplate()); } return typeRegistry.getNativeType(UNKNOWN_TYPE); }
java
static final JSType getElementType(JSType iterableOrIterator, JSTypeRegistry typeRegistry) { TemplateTypeMap templateTypeMap = iterableOrIterator // Remember that `string` will box to a `Iterable`. .autobox() .getTemplateTypeMap(); if (templateTypeMap.hasTemplateKey(typeRegistry.getIterableTemplate())) { // `Iterable<SomeElementType>` or `Generator<SomeElementType>` return templateTypeMap.getResolvedTemplateType(typeRegistry.getIterableTemplate()); } else if (templateTypeMap.hasTemplateKey(typeRegistry.getIteratorTemplate())) { // `Iterator<SomeElementType>` return templateTypeMap.getResolvedTemplateType(typeRegistry.getIteratorTemplate()); } else if (templateTypeMap.hasTemplateKey(typeRegistry.getAsyncIterableTemplate())) { // `AsyncIterable<SomeElementType>` or `AsyncGenerator<SomeElementType>` return templateTypeMap.getResolvedTemplateType(typeRegistry.getAsyncIterableTemplate()); } else if (templateTypeMap.hasTemplateKey(typeRegistry.getAsyncIteratorTemplate())) { // `AsyncIterator<SomeElementType>` return templateTypeMap.getResolvedTemplateType(typeRegistry.getAsyncIteratorTemplate()); } return typeRegistry.getNativeType(UNKNOWN_TYPE); }
[ "static", "final", "JSType", "getElementType", "(", "JSType", "iterableOrIterator", ",", "JSTypeRegistry", "typeRegistry", ")", "{", "TemplateTypeMap", "templateTypeMap", "=", "iterableOrIterator", "// Remember that `string` will box to a `Iterable`.", ".", "autobox", "(", ")...
Returns the given `Iterable`s element type. <p>If the given type is not an `Iterator`, `Iterable`, `AsyncIterator`, or `AsyncIterable`, returns the unknown type.
[ "Returns", "the", "given", "Iterable", "s", "element", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/JsIterables.java#L43-L64
alkacon/opencms-core
src/org/opencms/file/collectors/A_CmsResourceCollector.java
A_CmsResourceCollector.shrinkToFit
protected List<CmsResource> shrinkToFit(List<CmsResource> result, int maxSize, int explicitNumResults) { return shrinkToFit(result, explicitNumResults > 0 ? explicitNumResults : maxSize); }
java
protected List<CmsResource> shrinkToFit(List<CmsResource> result, int maxSize, int explicitNumResults) { return shrinkToFit(result, explicitNumResults > 0 ? explicitNumResults : maxSize); }
[ "protected", "List", "<", "CmsResource", ">", "shrinkToFit", "(", "List", "<", "CmsResource", ">", "result", ",", "int", "maxSize", ",", "int", "explicitNumResults", ")", "{", "return", "shrinkToFit", "(", "result", ",", "explicitNumResults", ">", "0", "?", ...
Shrinks a List to fit a maximum size.<p> @param result a List @param maxSize the maximum size of the List @param explicitNumResults the value of the numResults parameter given to the getResults method (this overrides maxSize if it is positive) @return the reduced list
[ "Shrinks", "a", "List", "to", "fit", "a", "maximum", "size", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/collectors/A_CmsResourceCollector.java#L430-L433
wellner/jcarafe
jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java
ObjectArrayList.addAllOfFromTo
public void addAllOfFromTo(ObjectArrayList other, int from, int to) { beforeInsertAllOfFromTo(size, other, from, to); }
java
public void addAllOfFromTo(ObjectArrayList other, int from, int to) { beforeInsertAllOfFromTo(size, other, from, to); }
[ "public", "void", "addAllOfFromTo", "(", "ObjectArrayList", "other", ",", "int", "from", ",", "int", "to", ")", "{", "beforeInsertAllOfFromTo", "(", "size", ",", "other", ",", "from", ",", "to", ")", ";", "}" ]
Appends the part of the specified list between <code>from</code> (inclusive) and <code>to</code> (inclusive) to the receiver. @param other the list to be added to the receiver. @param from the index of the first element to be appended (inclusive). @param to the index of the last element to be appended (inclusive). @exception IndexOutOfBoundsException index is out of range (<tt>other.size()&gt;0 && (from&lt;0 || from&gt;to || to&gt;=other.size())</tt>).
[ "Appends", "the", "part", "of", "the", "specified", "list", "between", "<code", ">", "from<", "/", "code", ">", "(", "inclusive", ")", "and", "<code", ">", "to<", "/", "code", ">", "(", "inclusive", ")", "to", "the", "receiver", "." ]
train
https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/ObjectArrayList.java#L73-L75
jmeetsma/Iglu-Common
src/main/java/org/ijsberg/iglu/mvc/IndentedConfigReaderMapping.java
IndentedConfigReaderMapping.reportError
private static void reportError(List messages, String fileName, int lineNr, String line, String errorMessage) { messages.add(new Date() + " ERROR in \"" + fileName + "\" at line " + lineNr + ':'); messages.add(errorMessage); }
java
private static void reportError(List messages, String fileName, int lineNr, String line, String errorMessage) { messages.add(new Date() + " ERROR in \"" + fileName + "\" at line " + lineNr + ':'); messages.add(errorMessage); }
[ "private", "static", "void", "reportError", "(", "List", "messages", ",", "String", "fileName", ",", "int", "lineNr", ",", "String", "line", ",", "String", "errorMessage", ")", "{", "messages", ".", "add", "(", "new", "Date", "(", ")", "+", "\" ERROR in \\...
Adds a message to the list. @param fileName @param lineNr @param line @param errorMessage
[ "Adds", "a", "message", "to", "the", "list", "." ]
train
https://github.com/jmeetsma/Iglu-Common/blob/0fb0885775b576209ff1b5a0f67e3c25a99a6420/src/main/java/org/ijsberg/iglu/mvc/IndentedConfigReaderMapping.java#L148-L151
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLFunctionalDataPropertyAxiomImpl_CustomFieldSerializer.java
OWLFunctionalDataPropertyAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLFunctionalDataPropertyAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLFunctionalDataPropertyAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLFunctionalDataPropertyAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ...
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLFunctionalDataPropertyAxiomImpl_CustomFieldSerializer.java#L75-L78
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/QueryParserBase.java
QueryParserBase.appendDefaultOperator
protected void appendDefaultOperator(SolrQuery solrQuery, @Nullable Operator defaultOperator) { if (defaultOperator != null && !Query.Operator.NONE.equals(defaultOperator)) { solrQuery.set("q.op", defaultOperator.asQueryStringRepresentation()); } }
java
protected void appendDefaultOperator(SolrQuery solrQuery, @Nullable Operator defaultOperator) { if (defaultOperator != null && !Query.Operator.NONE.equals(defaultOperator)) { solrQuery.set("q.op", defaultOperator.asQueryStringRepresentation()); } }
[ "protected", "void", "appendDefaultOperator", "(", "SolrQuery", "solrQuery", ",", "@", "Nullable", "Operator", "defaultOperator", ")", "{", "if", "(", "defaultOperator", "!=", "null", "&&", "!", "Query", ".", "Operator", ".", "NONE", ".", "equals", "(", "defau...
Set {@code q.op} parameter for {@link SolrQuery} @param solrQuery @param defaultOperator
[ "Set", "{", "@code", "q", ".", "op", "}", "parameter", "for", "{", "@link", "SolrQuery", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/QueryParserBase.java#L463-L467
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.mixin
public static void mixin(MetaClass self, Class categoryClass) { mixin(self, Collections.singletonList(categoryClass)); }
java
public static void mixin(MetaClass self, Class categoryClass) { mixin(self, Collections.singletonList(categoryClass)); }
[ "public", "static", "void", "mixin", "(", "MetaClass", "self", ",", "Class", "categoryClass", ")", "{", "mixin", "(", "self", ",", "Collections", ".", "singletonList", "(", "categoryClass", ")", ")", ";", "}" ]
Extend class globally with category methods. @param self any Class @param categoryClass a category class to use @since 1.6.0
[ "Extend", "class", "globally", "with", "category", "methods", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L611-L613
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.updateIntentWithServiceResponseAsync
public Observable<ServiceResponse<OperationStatus>> updateIntentWithServiceResponseAsync(UUID appId, String versionId, UUID intentId, UpdateIntentOptionalParameter updateIntentOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (intentId == null) { throw new IllegalArgumentException("Parameter intentId is required and cannot be null."); } final String name = updateIntentOptionalParameter != null ? updateIntentOptionalParameter.name() : null; return updateIntentWithServiceResponseAsync(appId, versionId, intentId, name); }
java
public Observable<ServiceResponse<OperationStatus>> updateIntentWithServiceResponseAsync(UUID appId, String versionId, UUID intentId, UpdateIntentOptionalParameter updateIntentOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (intentId == null) { throw new IllegalArgumentException("Parameter intentId is required and cannot be null."); } final String name = updateIntentOptionalParameter != null ? updateIntentOptionalParameter.name() : null; return updateIntentWithServiceResponseAsync(appId, versionId, intentId, name); }
[ "public", "Observable", "<", "ServiceResponse", "<", "OperationStatus", ">", ">", "updateIntentWithServiceResponseAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "intentId", ",", "UpdateIntentOptionalParameter", "updateIntentOptionalParameter", ")", ...
Updates the name of an intent classifier. @param appId The application ID. @param versionId The version ID. @param intentId The intent classifier ID. @param updateIntentOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Updates", "the", "name", "of", "an", "intent", "classifier", "." ]
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#L2959-L2975
asterisk-java/asterisk-java
src/main/java/org/asteriskjava/manager/action/UpdateConfigAction.java
UpdateConfigAction.addCommand
public void addCommand(String action, String cat, String var, String value, String match) { // for convienence of reference, shorter! final String stringCounter = String.format("%06d", this.actionCounter); if (action != null) { actions.put("Action-" + stringCounter, action); } if (cat != null) { actions.put("Cat-" + stringCounter, cat); } if (var != null) { actions.put("Var-" + stringCounter, var); } if (value != null) { actions.put("Value-" + stringCounter, value); } if (match != null) { actions.put("Match-" + stringCounter, match); } this.actionCounter++; }
java
public void addCommand(String action, String cat, String var, String value, String match) { // for convienence of reference, shorter! final String stringCounter = String.format("%06d", this.actionCounter); if (action != null) { actions.put("Action-" + stringCounter, action); } if (cat != null) { actions.put("Cat-" + stringCounter, cat); } if (var != null) { actions.put("Var-" + stringCounter, var); } if (value != null) { actions.put("Value-" + stringCounter, value); } if (match != null) { actions.put("Match-" + stringCounter, match); } this.actionCounter++; }
[ "public", "void", "addCommand", "(", "String", "action", ",", "String", "cat", ",", "String", "var", ",", "String", "value", ",", "String", "match", ")", "{", "// for convienence of reference, shorter!", "final", "String", "stringCounter", "=", "String", ".", "f...
Adds a command to update a config file while sparing you the details of the Manager's required syntax. If you want to omit one of the command's sections, provide a null value to this method. The command index will be incremented even if you supply a null for all parameters, though the map will be unaffected. @param action Action to Take (NewCat,RenameCat,DelCat,Update,Delete,Append), see static fields @param cat Category to operate on @param var Variable to work on @param value Value to work on @param match Extra match required to match line
[ "Adds", "a", "command", "to", "update", "a", "config", "file", "while", "sparing", "you", "the", "details", "of", "the", "Manager", "s", "required", "syntax", ".", "If", "you", "want", "to", "omit", "one", "of", "the", "command", "s", "sections", "provid...
train
https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/manager/action/UpdateConfigAction.java#L107-L138
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/chrono/PaxDate.java
PaxDate.plusMonths
@Override PaxDate plusMonths(long monthsToAdd) { if (monthsToAdd == 0) { return this; } long calcMonths = Math.addExact(getProlepticMonth(), monthsToAdd); // "Regularize" the month count, as if years were all 13 months long. long monthsRegularized = calcMonths - getLeapMonthsBefore(calcMonths); int newYear = YEAR.checkValidIntValue(Math.floorDiv(monthsRegularized, MONTHS_IN_YEAR)); int newMonth = Math.toIntExact(calcMonths - ((long) newYear * MONTHS_IN_YEAR + getLeapYearsBefore(newYear)) + 1); return resolvePreviousValid(newYear, newMonth, getDayOfMonth()); }
java
@Override PaxDate plusMonths(long monthsToAdd) { if (monthsToAdd == 0) { return this; } long calcMonths = Math.addExact(getProlepticMonth(), monthsToAdd); // "Regularize" the month count, as if years were all 13 months long. long monthsRegularized = calcMonths - getLeapMonthsBefore(calcMonths); int newYear = YEAR.checkValidIntValue(Math.floorDiv(monthsRegularized, MONTHS_IN_YEAR)); int newMonth = Math.toIntExact(calcMonths - ((long) newYear * MONTHS_IN_YEAR + getLeapYearsBefore(newYear)) + 1); return resolvePreviousValid(newYear, newMonth, getDayOfMonth()); }
[ "@", "Override", "PaxDate", "plusMonths", "(", "long", "monthsToAdd", ")", "{", "if", "(", "monthsToAdd", "==", "0", ")", "{", "return", "this", ";", "}", "long", "calcMonths", "=", "Math", ".", "addExact", "(", "getProlepticMonth", "(", ")", ",", "month...
Returns a copy of this {@code PaxDate} with the specified period in months added. <p> This method adds the specified amount to the months field in three steps: <ol> <li>Add the input months to the month-of-year field</li> <li>Check if the resulting date would be invalid</li> <li>Adjust the day-of-month to the last valid day if necessary</li> </ol> <p> For example, 2006-12-13 plus one month would result in the invalid date 2006-13-13. Instead of returning an invalid result, the last valid day of the month, 2006-13-07, is selected instead. <p> This instance is immutable and unaffected by this method call. @param monthsToAdd the months to add, may be negative @return a {@code PaxDate} based on this date with the months added, not null @throws DateTimeException if the result exceeds the supported date range
[ "Returns", "a", "copy", "of", "this", "{", "@code", "PaxDate", "}", "with", "the", "specified", "period", "in", "months", "added", ".", "<p", ">", "This", "method", "adds", "the", "specified", "amount", "to", "the", "months", "field", "in", "three", "ste...
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/PaxDate.java#L598-L609
finmath/finmath-lib
src/main/java6/net/finmath/montecarlo/interestrate/products/Bond.java
Bond.getValue
@Override public RandomVariableInterface getValue(double evaluationTime, LIBORModelMonteCarloSimulationInterface model) throws CalculationException { // Get random variables RandomVariableInterface numeraire = model.getNumeraire(maturity); RandomVariableInterface monteCarloProbabilities = model.getMonteCarloWeights(maturity); // Calculate numeraire relative value RandomVariableInterface values = model.getRandomVariableForConstant(1.0); values = values.div(numeraire).mult(monteCarloProbabilities); // Convert back to values RandomVariableInterface numeraireAtEvaluationTime = model.getNumeraire(evaluationTime); RandomVariableInterface monteCarloProbabilitiesAtEvaluationTime = model.getMonteCarloWeights(evaluationTime); values = values.mult(numeraireAtEvaluationTime).div(monteCarloProbabilitiesAtEvaluationTime); // Return values return values; }
java
@Override public RandomVariableInterface getValue(double evaluationTime, LIBORModelMonteCarloSimulationInterface model) throws CalculationException { // Get random variables RandomVariableInterface numeraire = model.getNumeraire(maturity); RandomVariableInterface monteCarloProbabilities = model.getMonteCarloWeights(maturity); // Calculate numeraire relative value RandomVariableInterface values = model.getRandomVariableForConstant(1.0); values = values.div(numeraire).mult(monteCarloProbabilities); // Convert back to values RandomVariableInterface numeraireAtEvaluationTime = model.getNumeraire(evaluationTime); RandomVariableInterface monteCarloProbabilitiesAtEvaluationTime = model.getMonteCarloWeights(evaluationTime); values = values.mult(numeraireAtEvaluationTime).div(monteCarloProbabilitiesAtEvaluationTime); // Return values return values; }
[ "@", "Override", "public", "RandomVariableInterface", "getValue", "(", "double", "evaluationTime", ",", "LIBORModelMonteCarloSimulationInterface", "model", ")", "throws", "CalculationException", "{", "// Get random variables", "RandomVariableInterface", "numeraire", "=", "model...
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/java6/net/finmath/montecarlo/interestrate/products/Bond.java#L39-L57
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneRegion.java
ZoneRegion.ofId
static ZoneRegion ofId(String zoneId, boolean checkAvailable) { Objects.requireNonNull(zoneId, "zoneId"); checkName(zoneId); ZoneRules rules = null; try { // always attempt load for better behavior after deserialization rules = ZoneRulesProvider.getRules(zoneId, true); } catch (ZoneRulesException ex) { if (checkAvailable) { throw ex; } } return new ZoneRegion(zoneId, rules); }
java
static ZoneRegion ofId(String zoneId, boolean checkAvailable) { Objects.requireNonNull(zoneId, "zoneId"); checkName(zoneId); ZoneRules rules = null; try { // always attempt load for better behavior after deserialization rules = ZoneRulesProvider.getRules(zoneId, true); } catch (ZoneRulesException ex) { if (checkAvailable) { throw ex; } } return new ZoneRegion(zoneId, rules); }
[ "static", "ZoneRegion", "ofId", "(", "String", "zoneId", ",", "boolean", "checkAvailable", ")", "{", "Objects", ".", "requireNonNull", "(", "zoneId", ",", "\"zoneId\"", ")", ";", "checkName", "(", "zoneId", ")", ";", "ZoneRules", "rules", "=", "null", ";", ...
Obtains an instance of {@code ZoneId} from an identifier. @param zoneId the time-zone ID, not null @param checkAvailable whether to check if the zone ID is available @return the zone ID, not null @throws DateTimeException if the ID format is invalid @throws ZoneRulesException if checking availability and the ID cannot be found
[ "Obtains", "an", "instance", "of", "{", "@code", "ZoneId", "}", "from", "an", "identifier", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneRegion.java#L114-L127
weld/core
impl/src/main/java/org/jboss/weld/util/Preconditions.java
Preconditions.checkArgumentNotNull
public static void checkArgumentNotNull(Object reference, String argumentName) { if (reference == null) { throw ValidatorLogger.LOG.argumentNull(argumentName); } }
java
public static void checkArgumentNotNull(Object reference, String argumentName) { if (reference == null) { throw ValidatorLogger.LOG.argumentNull(argumentName); } }
[ "public", "static", "void", "checkArgumentNotNull", "(", "Object", "reference", ",", "String", "argumentName", ")", "{", "if", "(", "reference", "==", "null", ")", "{", "throw", "ValidatorLogger", ".", "LOG", ".", "argumentNull", "(", "argumentName", ")", ";",...
Throws {@link IllegalArgumentException} with an appropriate message if the reference is null. @param reference the reference to be checked @param argumentName name of the argument that is being checked. The name used in the error message.
[ "Throws", "{", "@link", "IllegalArgumentException", "}", "with", "an", "appropriate", "message", "if", "the", "reference", "is", "null", "." ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/Preconditions.java#L38-L42
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MessageListenerSetter.java
MessageListenerSetter.setMessageListener
public void setMessageListener(MessageConsumer consumer, MessageListener listener) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setMessageListener", new Object[]{consumer, listener}); if (!(consumer instanceof JmsMsgConsumerImpl)) { // This "shouldn't happen" (tm) because the calling code switches on the class of the consumer. throw (JMSException) JmsErrorUtils.newThrowable( JMSException.class, "WRONG_CONSUMER_TYPE_CWSIA0088", new Object[] { consumer.getClass().getName() }, null, "MessageListenerSetter.setMessageListener#1", this, tc); } JmsMsgConsumerImpl c = (JmsMsgConsumerImpl) consumer; boolean checkManaged = false; c._setMessageListener(listener, checkManaged); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setMessageListener"); }
java
public void setMessageListener(MessageConsumer consumer, MessageListener listener) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setMessageListener", new Object[]{consumer, listener}); if (!(consumer instanceof JmsMsgConsumerImpl)) { // This "shouldn't happen" (tm) because the calling code switches on the class of the consumer. throw (JMSException) JmsErrorUtils.newThrowable( JMSException.class, "WRONG_CONSUMER_TYPE_CWSIA0088", new Object[] { consumer.getClass().getName() }, null, "MessageListenerSetter.setMessageListener#1", this, tc); } JmsMsgConsumerImpl c = (JmsMsgConsumerImpl) consumer; boolean checkManaged = false; c._setMessageListener(listener, checkManaged); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setMessageListener"); }
[ "public", "void", "setMessageListener", "(", "MessageConsumer", "consumer", ",", "MessageListener", "listener", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")",...
Assign a messageListener to the message consumer. @see com.ibm.wsspi.jms.JmsMessageListenerSupport.MessageListenerSetter#setMessageListener(javax.jms.MessageConsumer, javax.jms.MessageListener)
[ "Assign", "a", "messageListener", "to", "the", "message", "consumer", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/MessageListenerSetter.java#L36-L57
square/javapoet
src/main/java/com/squareup/javapoet/CodeWriter.java
CodeWriter.emitModifiers
public void emitModifiers(Set<Modifier> modifiers, Set<Modifier> implicitModifiers) throws IOException { if (modifiers.isEmpty()) return; for (Modifier modifier : EnumSet.copyOf(modifiers)) { if (implicitModifiers.contains(modifier)) continue; emitAndIndent(modifier.name().toLowerCase(Locale.US)); emitAndIndent(" "); } }
java
public void emitModifiers(Set<Modifier> modifiers, Set<Modifier> implicitModifiers) throws IOException { if (modifiers.isEmpty()) return; for (Modifier modifier : EnumSet.copyOf(modifiers)) { if (implicitModifiers.contains(modifier)) continue; emitAndIndent(modifier.name().toLowerCase(Locale.US)); emitAndIndent(" "); } }
[ "public", "void", "emitModifiers", "(", "Set", "<", "Modifier", ">", "modifiers", ",", "Set", "<", "Modifier", ">", "implicitModifiers", ")", "throws", "IOException", "{", "if", "(", "modifiers", ".", "isEmpty", "(", ")", ")", "return", ";", "for", "(", ...
Emits {@code modifiers} in the standard order. Modifiers in {@code implicitModifiers} will not be emitted.
[ "Emits", "{" ]
train
https://github.com/square/javapoet/blob/0f93da9a3d9a1da8d29fc993409fcf83d40452bc/src/main/java/com/squareup/javapoet/CodeWriter.java#L170-L178
primefaces-extensions/core
src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java
RequestParameterBuilder.encodeJson
public String encodeJson(Object value, String type) throws UnsupportedEncodingException { jsonConverter.setType(type); String jsonValue; if (value == null) { jsonValue = "null"; } else { jsonValue = jsonConverter.getAsString(null, null, value); } return URLEncoder.encode(jsonValue, encoding); }
java
public String encodeJson(Object value, String type) throws UnsupportedEncodingException { jsonConverter.setType(type); String jsonValue; if (value == null) { jsonValue = "null"; } else { jsonValue = jsonConverter.getAsString(null, null, value); } return URLEncoder.encode(jsonValue, encoding); }
[ "public", "String", "encodeJson", "(", "Object", "value", ",", "String", "type", ")", "throws", "UnsupportedEncodingException", "{", "jsonConverter", ".", "setType", "(", "type", ")", ";", "String", "jsonValue", ";", "if", "(", "value", "==", "null", ")", "{...
Convertes give value to JSON and encodes the converted value with a proper encoding. Data type is sometimes required, especially for Java generic types, because type information is erased at runtime and the conversion to JSON will not work properly. @param value value to be converted and encoded @param type data type of the value object. Any primitive type, array, non generic or generic type is supported. Data type is sometimes required to convert a value to a JSON representation. All data types should be fully qualified. Examples: "boolean" "int" "long[]" "java.lang.String" "java.util.Date" "java.util.Collection<java.lang.Integer>" "java.util.Map<java.lang.String, com.durr.FooPair<java.lang.Integer, java.util.Date>>" "com.durr.FooNonGenericClass" "com.durr.FooGenericClass<java.lang.String, java.lang.Integer>" "com.durr.FooGenericClass<int[], com.durr.FooGenericClass<com.durr.FooNonGenericClass, java.lang.Boolean>>". @return String converted and encoded value @throws UnsupportedEncodingException DOCUMENT_ME
[ "Convertes", "give", "value", "to", "JSON", "and", "encodes", "the", "converted", "value", "with", "a", "proper", "encoding", ".", "Data", "type", "is", "sometimes", "required", "especially", "for", "Java", "generic", "types", "because", "type", "information", ...
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/RequestParameterBuilder.java#L202-L214
JoeKerouac/utils
src/main/java/com/joe/utils/common/StringUtils.java
StringUtils.replaceBefor
public static String replaceBefor(String str, int end, String rp) { return replace(str, 0, end, rp); }
java
public static String replaceBefor(String str, int end, String rp) { return replace(str, 0, end, rp); }
[ "public", "static", "String", "replaceBefor", "(", "String", "str", ",", "int", "end", ",", "String", "rp", ")", "{", "return", "replace", "(", "str", ",", "0", ",", "end", ",", "rp", ")", ";", "}" ]
替换指定结束位置之前的所有字符 @param str 字符串 @param end 要替换的结束位置(包含该位置) @param rp 替换字符串 @return 替换后的字符串,例如对123456替换3,*,结果为*56
[ "替换指定结束位置之前的所有字符" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/StringUtils.java#L81-L83
aalmiray/Json-lib
src/main/java/net/sf/json/JSONObject.java
JSONObject.optLong
public long optLong( String key, long defaultValue ) { verifyIsNull(); try{ return getLong( key ); }catch( Exception e ){ return defaultValue; } }
java
public long optLong( String key, long defaultValue ) { verifyIsNull(); try{ return getLong( key ); }catch( Exception e ){ return defaultValue; } }
[ "public", "long", "optLong", "(", "String", "key", ",", "long", "defaultValue", ")", "{", "verifyIsNull", "(", ")", ";", "try", "{", "return", "getLong", "(", "key", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "defaultValue", ";"...
Get an optional long value associated with a key, or the default if there is no such key or if the value is not a number. If the value is a string, an attempt will be made to evaluate it as a number. @param key A key string. @param defaultValue The default. @return An object which is the value.
[ "Get", "an", "optional", "long", "value", "associated", "with", "a", "key", "or", "the", "default", "if", "there", "is", "no", "such", "key", "or", "if", "the", "value", "is", "not", "a", "number", ".", "If", "the", "value", "is", "a", "string", "an"...
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L2259-L2266
jankotek/mapdb
src/main/java/org/mapdb/io/DataIO.java
DataIO.packLong
static public void packLong(OutputStream out, long value) throws IOException { //$DELAY$ int shift = 63-Long.numberOfLeadingZeros(value); shift -= shift%7; // round down to nearest multiple of 7 while(shift!=0){ out.write((int) ((value>>>shift) & 0x7F)); //$DELAY$ shift-=7; } out.write((int) ((value & 0x7F)|0x80)); }
java
static public void packLong(OutputStream out, long value) throws IOException { //$DELAY$ int shift = 63-Long.numberOfLeadingZeros(value); shift -= shift%7; // round down to nearest multiple of 7 while(shift!=0){ out.write((int) ((value>>>shift) & 0x7F)); //$DELAY$ shift-=7; } out.write((int) ((value & 0x7F)|0x80)); }
[ "static", "public", "void", "packLong", "(", "OutputStream", "out", ",", "long", "value", ")", "throws", "IOException", "{", "//$DELAY$", "int", "shift", "=", "63", "-", "Long", ".", "numberOfLeadingZeros", "(", "value", ")", ";", "shift", "-=", "shift", "...
Pack long into output. It will occupy 1-10 bytes depending on value (lower values occupy smaller space) @param out OutputStream to put value into @param value to be serialized, must be non-negative @throws java.io.IOException in case of IO error
[ "Pack", "long", "into", "output", ".", "It", "will", "occupy", "1", "-", "10", "bytes", "depending", "on", "value", "(", "lower", "values", "occupy", "smaller", "space", ")" ]
train
https://github.com/jankotek/mapdb/blob/dfd873b2b9cc4e299228839c100adf93a98f1903/src/main/java/org/mapdb/io/DataIO.java#L133-L143
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java
StorageAccountsInner.addAsync
public Observable<Void> addAsync(String resourceGroupName, String accountName, String storageAccountName, AddStorageAccountParameters parameters) { return addWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> addAsync(String resourceGroupName, String accountName, String storageAccountName, AddStorageAccountParameters parameters) { return addWithServiceResponseAsync(resourceGroupName, accountName, storageAccountName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "addAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "storageAccountName", ",", "AddStorageAccountParameters", "parameters", ")", "{", "return", "addWithServiceResponseAsync", "(", "resour...
Updates the specified Data Lake Analytics account to add an Azure Storage account. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @param storageAccountName The name of the Azure Storage account to add @param parameters The parameters containing the access key and optional suffix for the Azure Storage Account. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Updates", "the", "specified", "Data", "Lake", "Analytics", "account", "to", "add", "an", "Azure", "Storage", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java#L429-L436
Indoqa/indoqa-boot
src/main/java/com/indoqa/boot/resources/error/RestResourceErrorMapper.java
RestResourceErrorMapper.registerException
public void registerException(Class<? extends Exception> exceptionType, Function<Exception, RestResourceErrorInfo> errorProvider) { Pair<Class<? extends Exception>, Function<Exception, RestResourceErrorInfo>> currentMapping = Pair.of(exceptionType, errorProvider ); Pair<Class<? extends Exception>, Function<Exception, RestResourceErrorInfo>> matchingMapping = null; for (SortedSet<Pair<Class<? extends Exception>, Function<Exception, RestResourceErrorInfo>>> eachBucket : this.mappings) { // find out if the currentMapping exception belongs to the bucket for (Pair<Class<? extends Exception>, Function<Exception, RestResourceErrorInfo>> eachMapping : eachBucket) { Class<? extends Exception> mappingType = eachMapping.getKey(); boolean haveSpecificSuperExceptionType = haveSpecificSuperExceptionType(mappingType, currentMapping.getKey()); if (exceptionType.isAssignableFrom(mappingType) || mappingType.isAssignableFrom(exceptionType) || haveSpecificSuperExceptionType) { matchingMapping = currentMapping; break; } } if (matchingMapping != null) { eachBucket.add(matchingMapping); break; } } // if there was no matching bucket, create a new one if (matchingMapping == null) { // use a set that is sorted by the class hierarchy (more specific exceptions come first) SortedSet<Pair<Class<? extends Exception>, Function<Exception, RestResourceErrorInfo>>> newBucket = new TreeSet<>( EXCEPTION_COMPARATOR); newBucket.add(currentMapping); this.mappings.add(newBucket); } }
java
public void registerException(Class<? extends Exception> exceptionType, Function<Exception, RestResourceErrorInfo> errorProvider) { Pair<Class<? extends Exception>, Function<Exception, RestResourceErrorInfo>> currentMapping = Pair.of(exceptionType, errorProvider ); Pair<Class<? extends Exception>, Function<Exception, RestResourceErrorInfo>> matchingMapping = null; for (SortedSet<Pair<Class<? extends Exception>, Function<Exception, RestResourceErrorInfo>>> eachBucket : this.mappings) { // find out if the currentMapping exception belongs to the bucket for (Pair<Class<? extends Exception>, Function<Exception, RestResourceErrorInfo>> eachMapping : eachBucket) { Class<? extends Exception> mappingType = eachMapping.getKey(); boolean haveSpecificSuperExceptionType = haveSpecificSuperExceptionType(mappingType, currentMapping.getKey()); if (exceptionType.isAssignableFrom(mappingType) || mappingType.isAssignableFrom(exceptionType) || haveSpecificSuperExceptionType) { matchingMapping = currentMapping; break; } } if (matchingMapping != null) { eachBucket.add(matchingMapping); break; } } // if there was no matching bucket, create a new one if (matchingMapping == null) { // use a set that is sorted by the class hierarchy (more specific exceptions come first) SortedSet<Pair<Class<? extends Exception>, Function<Exception, RestResourceErrorInfo>>> newBucket = new TreeSet<>( EXCEPTION_COMPARATOR); newBucket.add(currentMapping); this.mappings.add(newBucket); } }
[ "public", "void", "registerException", "(", "Class", "<", "?", "extends", "Exception", ">", "exceptionType", ",", "Function", "<", "Exception", ",", "RestResourceErrorInfo", ">", "errorProvider", ")", "{", "Pair", "<", "Class", "<", "?", "extends", "Exception", ...
Map from an exception type to a {@link RestResourceErrorInfo}. The list is sorted in the way that more specific exceptions will match first. @param exceptionType The exception to be checked. @param errorProvider The function that should be applied with an exception.
[ "Map", "from", "an", "exception", "type", "to", "a", "{", "@link", "RestResourceErrorInfo", "}", ".", "The", "list", "is", "sorted", "in", "the", "way", "that", "more", "specific", "exceptions", "will", "match", "first", "." ]
train
https://github.com/Indoqa/indoqa-boot/blob/a4c6a6517308f5fc6f1eb4e4f5b9994122c268e6/src/main/java/com/indoqa/boot/resources/error/RestResourceErrorMapper.java#L73-L106
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/BeanPath.java
BeanPath.createSet
@SuppressWarnings("unchecked") protected <A, E extends SimpleExpression<? super A>> SetPath<A, E> createSet(String property, Class<? super A> type, Class<? super E> queryType, PathInits inits) { return add(new SetPath<A, E>(type, (Class) queryType, forProperty(property), inits)); }
java
@SuppressWarnings("unchecked") protected <A, E extends SimpleExpression<? super A>> SetPath<A, E> createSet(String property, Class<? super A> type, Class<? super E> queryType, PathInits inits) { return add(new SetPath<A, E>(type, (Class) queryType, forProperty(property), inits)); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "<", "A", ",", "E", "extends", "SimpleExpression", "<", "?", "super", "A", ">", ">", "SetPath", "<", "A", ",", "E", ">", "createSet", "(", "String", "property", ",", "Class", "<", "?", "s...
Create a new Set typed path @param <A> @param property property name @param type property type @return property path
[ "Create", "a", "new", "Set", "typed", "path" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/BeanPath.java#L259-L262
vnesek/nmote-xr
src/main/java/com/nmote/xr/EndpointBuilder.java
EndpointBuilder.get
@SuppressWarnings("unchecked") public T get() { T result; if (uri != null) { if (classLoader == null) { classLoader = clazz.getClassLoader(); } Endpoint clientEndpoint = new HTTPClientEndpoint(uri); if (logger != null) { clientEndpoint = new LoggerEndpoint(clientEndpoint, logger); } result = new FacadeEndpoint<T>(clientEndpoint, // classLoader, clazz, typeConverter, // additionalInterfaces.toArray(new Class<?>[additionalInterfaces.size()])) // .newProxy(); } else { ObjectEndpoint endpoint = new ObjectEndpoint(); endpoint.faultMapper(faultMapper); endpoint.typeConverter(typeConverter); endpoint.export(server, clazz); for (Class<?> i : additionalInterfaces) { endpoint.export(server, i); } result = (T) new HTTPServerEndpoint(endpoint); } return result; }
java
@SuppressWarnings("unchecked") public T get() { T result; if (uri != null) { if (classLoader == null) { classLoader = clazz.getClassLoader(); } Endpoint clientEndpoint = new HTTPClientEndpoint(uri); if (logger != null) { clientEndpoint = new LoggerEndpoint(clientEndpoint, logger); } result = new FacadeEndpoint<T>(clientEndpoint, // classLoader, clazz, typeConverter, // additionalInterfaces.toArray(new Class<?>[additionalInterfaces.size()])) // .newProxy(); } else { ObjectEndpoint endpoint = new ObjectEndpoint(); endpoint.faultMapper(faultMapper); endpoint.typeConverter(typeConverter); endpoint.export(server, clazz); for (Class<?> i : additionalInterfaces) { endpoint.export(server, i); } result = (T) new HTTPServerEndpoint(endpoint); } return result; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "T", "get", "(", ")", "{", "T", "result", ";", "if", "(", "uri", "!=", "null", ")", "{", "if", "(", "classLoader", "==", "null", ")", "{", "classLoader", "=", "clazz", ".", "getClassLoader",...
Returns either a client proxy or {@link HTTPServerEndpoint} instance. @return building result
[ "Returns", "either", "a", "client", "proxy", "or", "{", "@link", "HTTPServerEndpoint", "}", "instance", "." ]
train
https://github.com/vnesek/nmote-xr/blob/6c584142a38a9dbc6401c75614d8d207f64f658d/src/main/java/com/nmote/xr/EndpointBuilder.java#L181-L211
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/Text.java
Text.writeStringOpt
public static void writeStringOpt(DataOutput out, String str) throws IOException{ if (str == null) { WritableUtils.writeVInt(out, NULL_STRING_LENGTH); return; } final int len = str.length(); TempArrays ta = UTF8.getArrays(len); byte[] rawBytes = ta.byteArray; char[] charArray = ta.charArray; str.getChars(0, len, charArray, 0); boolean ascii = true; for (int i = 0; i < len; i++) { if (charArray[i] > UTF8.MAX_ASCII_CODE) { ascii = false; break; } rawBytes[i] = (byte) charArray[i]; } if(ascii) { WritableUtils.writeVInt(out, len); out.write(rawBytes, 0, len); } else { writeString(out, str); } }
java
public static void writeStringOpt(DataOutput out, String str) throws IOException{ if (str == null) { WritableUtils.writeVInt(out, NULL_STRING_LENGTH); return; } final int len = str.length(); TempArrays ta = UTF8.getArrays(len); byte[] rawBytes = ta.byteArray; char[] charArray = ta.charArray; str.getChars(0, len, charArray, 0); boolean ascii = true; for (int i = 0; i < len; i++) { if (charArray[i] > UTF8.MAX_ASCII_CODE) { ascii = false; break; } rawBytes[i] = (byte) charArray[i]; } if(ascii) { WritableUtils.writeVInt(out, len); out.write(rawBytes, 0, len); } else { writeString(out, str); } }
[ "public", "static", "void", "writeStringOpt", "(", "DataOutput", "out", ",", "String", "str", ")", "throws", "IOException", "{", "if", "(", "str", "==", "null", ")", "{", "WritableUtils", ".", "writeVInt", "(", "out", ",", "NULL_STRING_LENGTH", ")", ";", "...
Writes the string to the output, if possible the encoding part is optimized.
[ "Writes", "the", "string", "to", "the", "output", "if", "possible", "the", "encoding", "part", "is", "optimized", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/Text.java#L448-L474
Comcast/jrugged
jrugged-spring/src/main/java/org/fishwife/jrugged/spring/jmx/WebMBeanServerAdapter.java
WebMBeanServerAdapter.createWebMBeanAdapter
public WebMBeanAdapter createWebMBeanAdapter(String mBeanName, String encoding) throws JMException, UnsupportedEncodingException { return new WebMBeanAdapter(mBeanServer, mBeanName, encoding); }
java
public WebMBeanAdapter createWebMBeanAdapter(String mBeanName, String encoding) throws JMException, UnsupportedEncodingException { return new WebMBeanAdapter(mBeanServer, mBeanName, encoding); }
[ "public", "WebMBeanAdapter", "createWebMBeanAdapter", "(", "String", "mBeanName", ",", "String", "encoding", ")", "throws", "JMException", ",", "UnsupportedEncodingException", "{", "return", "new", "WebMBeanAdapter", "(", "mBeanServer", ",", "mBeanName", ",", "encoding"...
Create a WebMBeanAdaptor for a specified MBean name. @param mBeanName the MBean name (can be URL-encoded). @param encoding the string encoding to be used (i.e. UTF-8) @return the created WebMBeanAdaptor. @throws JMException Java Management Exception @throws UnsupportedEncodingException if the encoding is not supported.
[ "Create", "a", "WebMBeanAdaptor", "for", "a", "specified", "MBean", "name", "." ]
train
https://github.com/Comcast/jrugged/blob/b6a5147c68ee733faf5616d49800abcbba67afe9/jrugged-spring/src/main/java/org/fishwife/jrugged/spring/jmx/WebMBeanServerAdapter.java#L71-L74
encircled/Joiner
joiner-core/src/main/java/cz/encircled/joiner/core/Joiner.java
Joiner.applyPredicates
private <T, R> void applyPredicates(JoinerQuery<T, R> request, JPAQuery query, Set<Path<?>> usedAliases, List<JoinDescription> joins) { if (request.getWhere() != null) { Predicate where = predicateAliasResolver.resolvePredicate(request.getWhere(), joins, usedAliases); checkAliasesArePresent(where, usedAliases); query.where(where); } if (request.getGroupBy() != null) { Map<AnnotatedElement, List<JoinDescription>> grouped = joins.stream() .collect(Collectors.groupingBy(j -> j.getOriginalAlias().getAnnotatedElement())); Path<?> grouping = predicateAliasResolver.resolvePath(request.getGroupBy(), grouped, usedAliases); checkAliasesArePresent(grouping, usedAliases); query.groupBy(grouping); } if (request.getHaving() != null) { Predicate having = predicateAliasResolver.resolvePredicate(request.getHaving(), joins, usedAliases); checkAliasesArePresent(having, usedAliases); query.having(having); } }
java
private <T, R> void applyPredicates(JoinerQuery<T, R> request, JPAQuery query, Set<Path<?>> usedAliases, List<JoinDescription> joins) { if (request.getWhere() != null) { Predicate where = predicateAliasResolver.resolvePredicate(request.getWhere(), joins, usedAliases); checkAliasesArePresent(where, usedAliases); query.where(where); } if (request.getGroupBy() != null) { Map<AnnotatedElement, List<JoinDescription>> grouped = joins.stream() .collect(Collectors.groupingBy(j -> j.getOriginalAlias().getAnnotatedElement())); Path<?> grouping = predicateAliasResolver.resolvePath(request.getGroupBy(), grouped, usedAliases); checkAliasesArePresent(grouping, usedAliases); query.groupBy(grouping); } if (request.getHaving() != null) { Predicate having = predicateAliasResolver.resolvePredicate(request.getHaving(), joins, usedAliases); checkAliasesArePresent(having, usedAliases); query.having(having); } }
[ "private", "<", "T", ",", "R", ">", "void", "applyPredicates", "(", "JoinerQuery", "<", "T", ",", "R", ">", "request", ",", "JPAQuery", "query", ",", "Set", "<", "Path", "<", "?", ">", ">", "usedAliases", ",", "List", "<", "JoinDescription", ">", "jo...
Apply "where", "groupBy" and "having" @param request @param query @param usedAliases @param joins @param <T> @param <R>
[ "Apply", "where", "groupBy", "and", "having" ]
train
https://github.com/encircled/Joiner/blob/7b9117db05d8b89feeeb9ef7ce944256330d405c/joiner-core/src/main/java/cz/encircled/joiner/core/Joiner.java#L164-L182
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/ops/executioner/CudaGridExecutioner.java
CudaGridExecutioner.isMatchingZXY
protected boolean isMatchingZXY(Op opA, Op opB) { if (opA.z() == opB.x() || opA.z() == opB.y()) return true; return false; }
java
protected boolean isMatchingZXY(Op opA, Op opB) { if (opA.z() == opB.x() || opA.z() == opB.y()) return true; return false; }
[ "protected", "boolean", "isMatchingZXY", "(", "Op", "opA", ",", "Op", "opB", ")", "{", "if", "(", "opA", ".", "z", "(", ")", "==", "opB", ".", "x", "(", ")", "||", "opA", ".", "z", "(", ")", "==", "opB", ".", "y", "(", ")", ")", "return", "...
This method is additional check, basically it qualifies possibility of InvertedPredicate MetaOp @param opA @param opB @return
[ "This", "method", "is", "additional", "check", "basically", "it", "qualifies", "possibility", "of", "InvertedPredicate", "MetaOp" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/ops/executioner/CudaGridExecutioner.java#L487-L492
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/processor/map/CreateMapProcessor.java
CreateMapProcessor.saveSvgFile
public static void saveSvgFile(final SVGGraphics2D graphics2d, final File path) throws IOException { try (FileOutputStream fs = new FileOutputStream(path); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fs, StandardCharsets.UTF_8); Writer osw = new BufferedWriter(outputStreamWriter) ) { graphics2d.stream(osw, true); } }
java
public static void saveSvgFile(final SVGGraphics2D graphics2d, final File path) throws IOException { try (FileOutputStream fs = new FileOutputStream(path); OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fs, StandardCharsets.UTF_8); Writer osw = new BufferedWriter(outputStreamWriter) ) { graphics2d.stream(osw, true); } }
[ "public", "static", "void", "saveSvgFile", "(", "final", "SVGGraphics2D", "graphics2d", ",", "final", "File", "path", ")", "throws", "IOException", "{", "try", "(", "FileOutputStream", "fs", "=", "new", "FileOutputStream", "(", "path", ")", ";", "OutputStreamWri...
Save a SVG graphic to the given path. @param graphics2d The SVG graphic to save. @param path The file.
[ "Save", "a", "SVG", "graphic", "to", "the", "given", "path", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/map/CreateMapProcessor.java#L211-L218
killbill/killbill
util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java
InternalCallContextFactory.createInternalTenantContext
public InternalTenantContext createInternalTenantContext(final UUID objectId, final ObjectType objectType, final TenantContext context) { // The callcontext may come from a user API - for security, check we're not doing cross-tenants operations //final Long tenantRecordIdFromObject = retrieveTenantRecordIdFromObject(objectId, objectType); //final Long tenantRecordIdFromContext = getTenantRecordIdSafe(callcontext); //Preconditions.checkState(tenantRecordIdFromContext.equals(tenantRecordIdFromObject), // "tenant of the pointed object (%s) and the callcontext (%s) don't match!", tenantRecordIdFromObject, tenantRecordIdFromContext); final Long tenantRecordId = getTenantRecordIdSafe(context); final Long accountRecordId = getAccountRecordIdSafe(objectId, objectType, context); return createInternalTenantContext(tenantRecordId, accountRecordId); }
java
public InternalTenantContext createInternalTenantContext(final UUID objectId, final ObjectType objectType, final TenantContext context) { // The callcontext may come from a user API - for security, check we're not doing cross-tenants operations //final Long tenantRecordIdFromObject = retrieveTenantRecordIdFromObject(objectId, objectType); //final Long tenantRecordIdFromContext = getTenantRecordIdSafe(callcontext); //Preconditions.checkState(tenantRecordIdFromContext.equals(tenantRecordIdFromObject), // "tenant of the pointed object (%s) and the callcontext (%s) don't match!", tenantRecordIdFromObject, tenantRecordIdFromContext); final Long tenantRecordId = getTenantRecordIdSafe(context); final Long accountRecordId = getAccountRecordIdSafe(objectId, objectType, context); return createInternalTenantContext(tenantRecordId, accountRecordId); }
[ "public", "InternalTenantContext", "createInternalTenantContext", "(", "final", "UUID", "objectId", ",", "final", "ObjectType", "objectType", ",", "final", "TenantContext", "context", ")", "{", "// The callcontext may come from a user API - for security, check we're not doing cross...
Crate an internal tenant callcontext from a tenant callcontext, and retrieving the account_record_id from another table @param objectId the id of the row in the table pointed by object type where to look for account_record_id @param objectType the object type pointed by this objectId @param context original tenant callcontext @return internal tenant callcontext from callcontext, with a non null account_record_id (if found)
[ "Crate", "an", "internal", "tenant", "callcontext", "from", "a", "tenant", "callcontext", "and", "retrieving", "the", "account_record_id", "from", "another", "table" ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/util/src/main/java/org/killbill/billing/util/callcontext/InternalCallContextFactory.java#L138-L147
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ClassUtils.java
ClassUtils.buildApplicationObject
public static <T> T buildApplicationObject(Class<T> interfaceClass, Collection<String> classNamesIterator, T defaultObject, FacesConfigurator config) { return buildApplicationObject(interfaceClass, null, null, classNamesIterator, defaultObject, config); }
java
public static <T> T buildApplicationObject(Class<T> interfaceClass, Collection<String> classNamesIterator, T defaultObject, FacesConfigurator config) { return buildApplicationObject(interfaceClass, null, null, classNamesIterator, defaultObject, config); }
[ "public", "static", "<", "T", ">", "T", "buildApplicationObject", "(", "Class", "<", "T", ">", "interfaceClass", ",", "Collection", "<", "String", ">", "classNamesIterator", ",", "T", "defaultObject", ",", "FacesConfigurator", "config", ")", "{", "return", "bu...
Creates ApplicationObjects like NavigationHandler or StateManager and creates the right wrapping chain of the ApplicationObjects known as the decorator pattern. @param <T> @param interfaceClass The class from which the implementation has to inherit from. @param classNamesIterator All the class names of the actual ApplicationObject implementations from the faces-config.xml. @param defaultObject The default implementation for the given ApplicationObject. @Param FacesConfig The object which will be used for InjectAndPostConstruct. Added for CDI 1.2 support @return
[ "Creates", "ApplicationObjects", "like", "NavigationHandler", "or", "StateManager", "and", "creates", "the", "right", "wrapping", "chain", "of", "the", "ApplicationObjects", "known", "as", "the", "decorator", "pattern", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/ClassUtils.java#L557-L561
LearnLib/automatalib
util/src/main/java/net/automatalib/util/automata/transducers/MealyFilter.java
MealyFilter.retainTransitionsWithOutput
public static <I, O> CompactMealy<I, O> retainTransitionsWithOutput(MealyMachine<?, I, ?, O> in, Alphabet<I> inputs, Collection<? super O> outputs) { return filterByOutput(in, inputs, outputs::contains); }
java
public static <I, O> CompactMealy<I, O> retainTransitionsWithOutput(MealyMachine<?, I, ?, O> in, Alphabet<I> inputs, Collection<? super O> outputs) { return filterByOutput(in, inputs, outputs::contains); }
[ "public", "static", "<", "I", ",", "O", ">", "CompactMealy", "<", "I", ",", "O", ">", "retainTransitionsWithOutput", "(", "MealyMachine", "<", "?", ",", "I", ",", "?", ",", "O", ">", "in", ",", "Alphabet", "<", "I", ">", "inputs", ",", "Collection", ...
Returns a Mealy machine with all transitions removed that have an output not among the specified values. The resulting Mealy machine will not contain any unreachable states. @param in the input Mealy machine @param inputs the input alphabet @param outputs the outputs to retain @return a Mealy machine with all transitions retained that have one of the specified outputs.
[ "Returns", "a", "Mealy", "machine", "with", "all", "transitions", "removed", "that", "have", "an", "output", "not", "among", "the", "specified", "values", ".", "The", "resulting", "Mealy", "machine", "will", "not", "contain", "any", "unreachable", "states", "....
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/automata/transducers/MealyFilter.java#L138-L142
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java
ServiceBuilder.withCacheFactory
public ServiceBuilder withCacheFactory(Function<ComponentSetup, CacheFactory> cacheFactoryCreator) { Preconditions.checkNotNull(cacheFactoryCreator, "cacheFactoryCreator"); this.cacheFactoryCreator = cacheFactoryCreator; return this; }
java
public ServiceBuilder withCacheFactory(Function<ComponentSetup, CacheFactory> cacheFactoryCreator) { Preconditions.checkNotNull(cacheFactoryCreator, "cacheFactoryCreator"); this.cacheFactoryCreator = cacheFactoryCreator; return this; }
[ "public", "ServiceBuilder", "withCacheFactory", "(", "Function", "<", "ComponentSetup", ",", "CacheFactory", ">", "cacheFactoryCreator", ")", "{", "Preconditions", ".", "checkNotNull", "(", "cacheFactoryCreator", ",", "\"cacheFactoryCreator\"", ")", ";", "this", ".", ...
Attaches the given CacheFactory creator to this ServiceBuilder. The given Function will only not be invoked right away; it will be called when needed. @param cacheFactoryCreator The Function to attach. @return This ServiceBuilder.
[ "Attaches", "the", "given", "CacheFactory", "creator", "to", "this", "ServiceBuilder", ".", "The", "given", "Function", "will", "only", "not", "be", "invoked", "right", "away", ";", "it", "will", "be", "called", "when", "needed", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/store/ServiceBuilder.java#L209-L213
devnied/EMV-NFC-Paycard-Enrollment
library/src/main/java/com/github/devnied/emvnfccard/parser/impl/GeldKarteParser.java
GeldKarteParser.readEF_BLOG
protected void readEF_BLOG(final Application pApplication) throws CommunicationException{ List<EmvTransactionRecord> list = new ArrayList<EmvTransactionRecord>(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); // Read each records for (int i = 1; i < 16 ; i++) { byte[] data = template.get().getProvider().transceive(new CommandApdu(CommandEnum.READ_RECORD, i, 0xEC, 0).toBytes()); // Check response if (ResponseUtils.isSucceed(data)) { if (data.length < 35){ continue; } EmvTransactionRecord record = new EmvTransactionRecord(); record.setCurrency(CurrencyEnum.EUR); record.setTransactionType(getType(data[0])); record.setAmount(Float.parseFloat(BytesUtils.bytesToStringNoSpace(Arrays.copyOfRange(data, 21, 24))) / 100L); try { record.setDate(dateFormat.parse(String.format("%02x.%02x.%02x%02x", data[32], data[31], data[29], data[30]))); record.setTime(timeFormat.parse(String.format("%02x:%02x:%02x", data[33], data[34], data[35]))); } catch (ParseException e) { LOGGER.error(e.getMessage(), e); } list.add(record); } else { break; } } pApplication.setListTransactions(list); }
java
protected void readEF_BLOG(final Application pApplication) throws CommunicationException{ List<EmvTransactionRecord> list = new ArrayList<EmvTransactionRecord>(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy"); SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); // Read each records for (int i = 1; i < 16 ; i++) { byte[] data = template.get().getProvider().transceive(new CommandApdu(CommandEnum.READ_RECORD, i, 0xEC, 0).toBytes()); // Check response if (ResponseUtils.isSucceed(data)) { if (data.length < 35){ continue; } EmvTransactionRecord record = new EmvTransactionRecord(); record.setCurrency(CurrencyEnum.EUR); record.setTransactionType(getType(data[0])); record.setAmount(Float.parseFloat(BytesUtils.bytesToStringNoSpace(Arrays.copyOfRange(data, 21, 24))) / 100L); try { record.setDate(dateFormat.parse(String.format("%02x.%02x.%02x%02x", data[32], data[31], data[29], data[30]))); record.setTime(timeFormat.parse(String.format("%02x:%02x:%02x", data[33], data[34], data[35]))); } catch (ParseException e) { LOGGER.error(e.getMessage(), e); } list.add(record); } else { break; } } pApplication.setListTransactions(list); }
[ "protected", "void", "readEF_BLOG", "(", "final", "Application", "pApplication", ")", "throws", "CommunicationException", "{", "List", "<", "EmvTransactionRecord", ">", "list", "=", "new", "ArrayList", "<", "EmvTransactionRecord", ">", "(", ")", ";", "SimpleDateForm...
Read EF_BLOG @param pApplication emv application @throws CommunicationException communication error
[ "Read", "EF_BLOG" ]
train
https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/impl/GeldKarteParser.java#L126-L155
haifengl/smile
math/src/main/java/smile/math/special/Gamma.java
Gamma.regularizedIncompleteGamma
public static double regularizedIncompleteGamma(double s, double x) { if (s < 0.0) { throw new IllegalArgumentException("Invalid s: " + s); } if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } double igf = 0.0; if (x < s + 1.0) { // Series representation igf = regularizedIncompleteGammaSeries(s, x); } else { // Continued fraction representation igf = regularizedIncompleteGammaFraction(s, x); } return igf; }
java
public static double regularizedIncompleteGamma(double s, double x) { if (s < 0.0) { throw new IllegalArgumentException("Invalid s: " + s); } if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } double igf = 0.0; if (x < s + 1.0) { // Series representation igf = regularizedIncompleteGammaSeries(s, x); } else { // Continued fraction representation igf = regularizedIncompleteGammaFraction(s, x); } return igf; }
[ "public", "static", "double", "regularizedIncompleteGamma", "(", "double", "s", ",", "double", "x", ")", "{", "if", "(", "s", "<", "0.0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid s: \"", "+", "s", ")", ";", "}", "if", "(", "x...
Regularized Incomplete Gamma Function P(s,x) = <i><big>&#8747;</big><sub><small>0</small></sub><sup><small>x</small></sup> e<sup>-t</sup> t<sup>(s-1)</sup> dt</i>
[ "Regularized", "Incomplete", "Gamma", "Function", "P", "(", "s", "x", ")", "=", "<i", ">", "<big", ">", "&#8747", ";", "<", "/", "big", ">", "<sub", ">", "<small", ">", "0<", "/", "small", ">", "<", "/", "sub", ">", "<sup", ">", "<small", ">", ...
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/special/Gamma.java#L122-L142
alipay/sofa-rpc
extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperRegistry.java
ZookeeperRegistry.subscribeOverride
protected void subscribeOverride(final ConsumerConfig config, ConfigListener listener) { try { if (overrideObserver == null) { // 初始化 overrideObserver = new ZookeeperOverrideObserver(); } overrideObserver.addConfigListener(config, listener); final String overridePath = buildOverridePath(rootPath, config); final AbstractInterfaceConfig registerConfig = getRegisterConfig(config); // 监听配置节点下 子节点增加、子节点删除、子节点Data修改事件 PathChildrenCache pathChildrenCache = new PathChildrenCache(zkClient, overridePath, true); pathChildrenCache.getListenable().addListener(new PathChildrenCacheListener() { @Override public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception { if (LOGGER.isDebugEnabled(config.getAppName())) { LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]"); } switch (event.getType()) { case CHILD_ADDED: //新增IP级配置 overrideObserver.addConfig(config, overridePath, event.getData()); break; case CHILD_REMOVED: //删除IP级配置 overrideObserver.removeConfig(config, overridePath, event.getData(), registerConfig); break; case CHILD_UPDATED:// 更新IP级配置 overrideObserver.updateConfig(config, overridePath, event.getData()); break; default: break; } } }); pathChildrenCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE); INTERFACE_OVERRIDE_CACHE.put(overridePath, pathChildrenCache); overrideObserver.updateConfigAll(config, overridePath, pathChildrenCache.getCurrentData()); } catch (Exception e) { throw new SofaRpcRuntimeException("Failed to subscribe provider config from zookeeperRegistry!", e); } }
java
protected void subscribeOverride(final ConsumerConfig config, ConfigListener listener) { try { if (overrideObserver == null) { // 初始化 overrideObserver = new ZookeeperOverrideObserver(); } overrideObserver.addConfigListener(config, listener); final String overridePath = buildOverridePath(rootPath, config); final AbstractInterfaceConfig registerConfig = getRegisterConfig(config); // 监听配置节点下 子节点增加、子节点删除、子节点Data修改事件 PathChildrenCache pathChildrenCache = new PathChildrenCache(zkClient, overridePath, true); pathChildrenCache.getListenable().addListener(new PathChildrenCacheListener() { @Override public void childEvent(CuratorFramework client1, PathChildrenCacheEvent event) throws Exception { if (LOGGER.isDebugEnabled(config.getAppName())) { LOGGER.debug("Receive zookeeper event: " + "type=[" + event.getType() + "]"); } switch (event.getType()) { case CHILD_ADDED: //新增IP级配置 overrideObserver.addConfig(config, overridePath, event.getData()); break; case CHILD_REMOVED: //删除IP级配置 overrideObserver.removeConfig(config, overridePath, event.getData(), registerConfig); break; case CHILD_UPDATED:// 更新IP级配置 overrideObserver.updateConfig(config, overridePath, event.getData()); break; default: break; } } }); pathChildrenCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE); INTERFACE_OVERRIDE_CACHE.put(overridePath, pathChildrenCache); overrideObserver.updateConfigAll(config, overridePath, pathChildrenCache.getCurrentData()); } catch (Exception e) { throw new SofaRpcRuntimeException("Failed to subscribe provider config from zookeeperRegistry!", e); } }
[ "protected", "void", "subscribeOverride", "(", "final", "ConsumerConfig", "config", ",", "ConfigListener", "listener", ")", "{", "try", "{", "if", "(", "overrideObserver", "==", "null", ")", "{", "// 初始化", "overrideObserver", "=", "new", "ZookeeperOverrideObserver",...
订阅IP级配置(服务发布暂时不支持动态配置,暂时支持订阅ConsumerConfig参数设置) @param config consumer config @param listener config listener
[ "订阅IP级配置(服务发布暂时不支持动态配置", "暂时支持订阅ConsumerConfig参数设置)" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/registry-zk/src/main/java/com/alipay/sofa/rpc/registry/zk/ZookeeperRegistry.java#L453-L490
LearnLib/automatalib
util/src/main/java/net/automatalib/util/partitionrefinement/PaigeTarjanExtractors.java
PaigeTarjanExtractors.toDeterministic
public static <S1, S2, I, T1, T2, SP, TP, A extends MutableDeterministic<S2, I, T2, SP, TP>> A toDeterministic( PaigeTarjan pt, AutomatonCreator<A, I> creator, Alphabet<I> inputs, DeterministicAutomaton<S1, I, T1> original, StateIDs<S1> origIds, Function<? super S1, ? extends SP> spExtractor, Function<? super T1, ? extends TP> tpExtractor, boolean pruneUnreachable) { final Function<? super S1, ? extends SP> safeSpExtractor = FunctionsUtil.safeDefault(spExtractor); final Function<? super T1, ? extends TP> safeTpExtractor = FunctionsUtil.safeDefault(tpExtractor); if (pruneUnreachable) { return toDeterministicPruned(pt, creator, inputs, original, origIds, safeSpExtractor, safeTpExtractor); } return toDeterministicUnpruned(pt, creator, inputs, original, origIds, safeSpExtractor, safeTpExtractor); }
java
public static <S1, S2, I, T1, T2, SP, TP, A extends MutableDeterministic<S2, I, T2, SP, TP>> A toDeterministic( PaigeTarjan pt, AutomatonCreator<A, I> creator, Alphabet<I> inputs, DeterministicAutomaton<S1, I, T1> original, StateIDs<S1> origIds, Function<? super S1, ? extends SP> spExtractor, Function<? super T1, ? extends TP> tpExtractor, boolean pruneUnreachable) { final Function<? super S1, ? extends SP> safeSpExtractor = FunctionsUtil.safeDefault(spExtractor); final Function<? super T1, ? extends TP> safeTpExtractor = FunctionsUtil.safeDefault(tpExtractor); if (pruneUnreachable) { return toDeterministicPruned(pt, creator, inputs, original, origIds, safeSpExtractor, safeTpExtractor); } return toDeterministicUnpruned(pt, creator, inputs, original, origIds, safeSpExtractor, safeTpExtractor); }
[ "public", "static", "<", "S1", ",", "S2", ",", "I", ",", "T1", ",", "T2", ",", "SP", ",", "TP", ",", "A", "extends", "MutableDeterministic", "<", "S2", ",", "I", ",", "T2", ",", "SP", ",", "TP", ">", ">", "A", "toDeterministic", "(", "PaigeTarjan...
Translates the results of a coarsest stable partition computation into a deterministic automaton. <p> This method is designed to match the following methods from {@link PaigeTarjanInitializers}: <ul> <li> {@link PaigeTarjanInitializers#initDeterministic(PaigeTarjan, net.automatalib.automata.simple.SimpleDeterministicAutomaton,Alphabet, Function, Object)} </li> <li> {@link PaigeTarjanInitializers#initDeterministic(PaigeTarjan,DeterministicAutomaton, Alphabet, java.util.function.Predicate, boolean)} </li> </ul> <p> Both the {@code spExtractor} and the {@code tpExtractor} can be {@code null}, in which case they are replaced by a function always returning {@code null}. @param pt the partition refinement data structure, after computing the coarsest stable partition @param creator an {@link AutomatonCreator} for creating the resulting automaton @param inputs the input alphabet to use @param original the original automaton on which the partition was computed @param origIds the {@link StateIDs} that translate the {@code int}s from the {@link PaigeTarjan} to states of {@code original} (e.g., obtained as the result from {@link PaigeTarjanInitializers#initDeterministic(PaigeTarjan, DeterministicAutomaton, Alphabet, java.util.function.Predicate, boolean)} @param spExtractor the state property extractor, or {@code null} @param tpExtractor the transition property extractor, or {@code null} @param pruneUnreachable {@code true} if unreachable states should be pruned during construction, {@code false} otherwise @return an automaton created using the specified creator, over the specified input alphabet, and reflecting the partition data of the specified {@link PaigeTarjan} object
[ "Translates", "the", "results", "of", "a", "coarsest", "stable", "partition", "computation", "into", "a", "deterministic", "automaton", ".", "<p", ">", "This", "method", "is", "designed", "to", "match", "the", "following", "methods", "from", "{", "@link", "Pai...
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/partitionrefinement/PaigeTarjanExtractors.java#L85-L102
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/imageprocessing/ExampleConvolution.java
ExampleConvolution.normalize2D
private static void normalize2D(GrayU8 gray) { // Create a Gaussian kernel with radius of 3 Kernel2D_S32 kernel = FactoryKernelGaussian.gaussian2D(GrayU8.class, -1, 3); // Note that there is a more efficient way to compute this convolution since it is a separable kernel // just use BlurImageOps instead. // Since it's normalized it can be saved inside an 8bit image GrayU8 output = new GrayU8(gray.width,gray.height); GConvolveImageOps.convolveNormalized(kernel, gray, output); panel.addImage(VisualizeImageData.standard(output, null), "2D Normalized Kernel"); }
java
private static void normalize2D(GrayU8 gray) { // Create a Gaussian kernel with radius of 3 Kernel2D_S32 kernel = FactoryKernelGaussian.gaussian2D(GrayU8.class, -1, 3); // Note that there is a more efficient way to compute this convolution since it is a separable kernel // just use BlurImageOps instead. // Since it's normalized it can be saved inside an 8bit image GrayU8 output = new GrayU8(gray.width,gray.height); GConvolveImageOps.convolveNormalized(kernel, gray, output); panel.addImage(VisualizeImageData.standard(output, null), "2D Normalized Kernel"); }
[ "private", "static", "void", "normalize2D", "(", "GrayU8", "gray", ")", "{", "// Create a Gaussian kernel with radius of 3", "Kernel2D_S32", "kernel", "=", "FactoryKernelGaussian", ".", "gaussian2D", "(", "GrayU8", ".", "class", ",", "-", "1", ",", "3", ")", ";", ...
Convolves a 2D normalized kernel. This kernel is divided by its sum after computation.
[ "Convolves", "a", "2D", "normalized", "kernel", ".", "This", "kernel", "is", "divided", "by", "its", "sum", "after", "computation", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/imageprocessing/ExampleConvolution.java#L101-L112
facebook/fresco
imagepipeline/src/main/java/com/facebook/imagepipeline/platform/DefaultDecoder.java
DefaultDecoder.decodeStaticImageFromStream
protected CloseableReference<Bitmap> decodeStaticImageFromStream( InputStream inputStream, BitmapFactory.Options options, @Nullable Rect regionToDecode) { return decodeFromStream(inputStream, options, regionToDecode, null); }
java
protected CloseableReference<Bitmap> decodeStaticImageFromStream( InputStream inputStream, BitmapFactory.Options options, @Nullable Rect regionToDecode) { return decodeFromStream(inputStream, options, regionToDecode, null); }
[ "protected", "CloseableReference", "<", "Bitmap", ">", "decodeStaticImageFromStream", "(", "InputStream", "inputStream", ",", "BitmapFactory", ".", "Options", "options", ",", "@", "Nullable", "Rect", "regionToDecode", ")", "{", "return", "decodeFromStream", "(", "inpu...
This method is needed because of dependency issues. @param inputStream the InputStream @param options the {@link android.graphics.BitmapFactory.Options} used to decode the stream @param regionToDecode optional image region to decode or null to decode the whole image @return the bitmap
[ "This", "method", "is", "needed", "because", "of", "dependency", "issues", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/platform/DefaultDecoder.java#L173-L176
alkacon/opencms-core
src/org/opencms/util/CmsStringUtil.java
CmsStringUtil.isEqual
public static boolean isEqual(Object value1, Object value2) { if (value1 == null) { return (value2 == null); } return value1.equals(value2); }
java
public static boolean isEqual(Object value1, Object value2) { if (value1 == null) { return (value2 == null); } return value1.equals(value2); }
[ "public", "static", "boolean", "isEqual", "(", "Object", "value1", ",", "Object", "value2", ")", "{", "if", "(", "value1", "==", "null", ")", "{", "return", "(", "value2", "==", "null", ")", ";", "}", "return", "value1", ".", "equals", "(", "value2", ...
Returns <code>true</code> if the provided Objects are either both <code>null</code> or equal according to {@link Object#equals(Object)}.<p> @param value1 the first object to compare @param value2 the second object to compare @return <code>true</code> if the provided Objects are either both <code>null</code> or equal according to {@link Object#equals(Object)}
[ "Returns", "<code", ">", "true<", "/", "code", ">", "if", "the", "provided", "Objects", "are", "either", "both", "<code", ">", "null<", "/", "code", ">", "or", "equal", "according", "to", "{", "@link", "Object#equals", "(", "Object", ")", "}", ".", "<p...
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L1049-L1055
Waikato/moa
moa/src/main/java/moa/gui/experimentertab/Stream.java
Stream.readBuffer
public void readBuffer(List<String> algPath, List<String> algNames, List<Measure> measures) { BufferedReader buffer = null; for (int i = 0; i < algPath.size(); i++) { try { buffer = new BufferedReader(new FileReader(algPath.get(i))); } catch (FileNotFoundException ex) { Logger.getLogger(Stream.class.getName()).log(Level.SEVERE, null, ex); } Algorithm algorithm = new Algorithm(algNames.get(i), measures, buffer,algPath.get(i)); this.algorithm.add(algorithm); } }
java
public void readBuffer(List<String> algPath, List<String> algNames, List<Measure> measures) { BufferedReader buffer = null; for (int i = 0; i < algPath.size(); i++) { try { buffer = new BufferedReader(new FileReader(algPath.get(i))); } catch (FileNotFoundException ex) { Logger.getLogger(Stream.class.getName()).log(Level.SEVERE, null, ex); } Algorithm algorithm = new Algorithm(algNames.get(i), measures, buffer,algPath.get(i)); this.algorithm.add(algorithm); } }
[ "public", "void", "readBuffer", "(", "List", "<", "String", ">", "algPath", ",", "List", "<", "String", ">", "algNames", ",", "List", "<", "Measure", ">", "measures", ")", "{", "BufferedReader", "buffer", "=", "null", ";", "for", "(", "int", "i", "=", ...
Read each algorithm file. @param algPath @param algNames @param measures
[ "Read", "each", "algorithm", "file", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/experimentertab/Stream.java#L65-L77
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java
TaskSlotTable.isAllocated
public boolean isAllocated(int index, JobID jobId, AllocationID allocationId) { TaskSlot taskSlot = taskSlots.get(index); return taskSlot.isAllocated(jobId, allocationId); }
java
public boolean isAllocated(int index, JobID jobId, AllocationID allocationId) { TaskSlot taskSlot = taskSlots.get(index); return taskSlot.isAllocated(jobId, allocationId); }
[ "public", "boolean", "isAllocated", "(", "int", "index", ",", "JobID", "jobId", ",", "AllocationID", "allocationId", ")", "{", "TaskSlot", "taskSlot", "=", "taskSlots", ".", "get", "(", "index", ")", ";", "return", "taskSlot", ".", "isAllocated", "(", "jobId...
Check whether the slot for the given index is allocated for the given job and allocation id. @param index of the task slot @param jobId for which the task slot should be allocated @param allocationId which should match the task slot's allocation id @return True if the given task slot is allocated for the given job and allocation id
[ "Check", "whether", "the", "slot", "for", "the", "given", "index", "is", "allocated", "for", "the", "given", "job", "and", "allocation", "id", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L375-L379
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/query/parsing/impl/Neo4jPropertyHelper.java
Neo4jPropertyHelper.getPropertyIdentifier
public PropertyIdentifier getPropertyIdentifier(String entityType, List<String> propertyPath, int requiredDepth) { // we analyze the property path to find all the associations/embedded which are in the way and create proper // aliases for them String entityAlias = aliasResolver.findAliasForType( entityType ); String propertyEntityType = entityType; String propertyAlias = entityAlias; String propertyName; List<String> currentPropertyPath = new ArrayList<>(); List<String> lastAssociationPath = Collections.emptyList(); OgmEntityPersister currentPersister = getPersister( entityType ); boolean isLastElementAssociation = false; int depth = 1; for ( String property : propertyPath ) { currentPropertyPath.add( property ); Type currentPropertyType = getPropertyType( entityType, currentPropertyPath ); // determine if the current property path is still part of requiredPropertyMatch boolean optionalMatch = depth > requiredDepth; if ( currentPropertyType.isAssociationType() ) { AssociationType associationPropertyType = (AssociationType) currentPropertyType; Joinable associatedJoinable = associationPropertyType.getAssociatedJoinable( getSessionFactory() ); if ( associatedJoinable.isCollection() && !( (OgmCollectionPersister) associatedJoinable ).getType().isEntityType() ) { // we have a collection of embedded propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch ); } else { propertyEntityType = associationPropertyType.getAssociatedEntityName( getSessionFactory() ); currentPersister = getPersister( propertyEntityType ); String targetNodeType = currentPersister.getEntityKeyMetadata().getTable(); propertyAlias = aliasResolver.createAliasForAssociation( entityAlias, currentPropertyPath, targetNodeType, optionalMatch ); lastAssociationPath = new ArrayList<>( currentPropertyPath ); isLastElementAssociation = true; } } else if ( currentPropertyType.isComponentType() && !isIdProperty( currentPersister, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) ) ) { // we are in the embedded case and the embedded is not the id of the entity (the id is stored as normal // properties) propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch ); } else { isLastElementAssociation = false; } depth++; } if ( isLastElementAssociation ) { // even the last element is an association, we need to find a suitable identifier property propertyName = getSessionFactory().getMetamodel().entityPersister( propertyEntityType ).getIdentifierPropertyName(); } else { // the last element is a property so we can build the test with this property propertyName = getColumnName( propertyEntityType, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) ); } return new PropertyIdentifier( propertyAlias, propertyName ); }
java
public PropertyIdentifier getPropertyIdentifier(String entityType, List<String> propertyPath, int requiredDepth) { // we analyze the property path to find all the associations/embedded which are in the way and create proper // aliases for them String entityAlias = aliasResolver.findAliasForType( entityType ); String propertyEntityType = entityType; String propertyAlias = entityAlias; String propertyName; List<String> currentPropertyPath = new ArrayList<>(); List<String> lastAssociationPath = Collections.emptyList(); OgmEntityPersister currentPersister = getPersister( entityType ); boolean isLastElementAssociation = false; int depth = 1; for ( String property : propertyPath ) { currentPropertyPath.add( property ); Type currentPropertyType = getPropertyType( entityType, currentPropertyPath ); // determine if the current property path is still part of requiredPropertyMatch boolean optionalMatch = depth > requiredDepth; if ( currentPropertyType.isAssociationType() ) { AssociationType associationPropertyType = (AssociationType) currentPropertyType; Joinable associatedJoinable = associationPropertyType.getAssociatedJoinable( getSessionFactory() ); if ( associatedJoinable.isCollection() && !( (OgmCollectionPersister) associatedJoinable ).getType().isEntityType() ) { // we have a collection of embedded propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch ); } else { propertyEntityType = associationPropertyType.getAssociatedEntityName( getSessionFactory() ); currentPersister = getPersister( propertyEntityType ); String targetNodeType = currentPersister.getEntityKeyMetadata().getTable(); propertyAlias = aliasResolver.createAliasForAssociation( entityAlias, currentPropertyPath, targetNodeType, optionalMatch ); lastAssociationPath = new ArrayList<>( currentPropertyPath ); isLastElementAssociation = true; } } else if ( currentPropertyType.isComponentType() && !isIdProperty( currentPersister, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) ) ) { // we are in the embedded case and the embedded is not the id of the entity (the id is stored as normal // properties) propertyAlias = aliasResolver.createAliasForEmbedded( entityAlias, currentPropertyPath, optionalMatch ); } else { isLastElementAssociation = false; } depth++; } if ( isLastElementAssociation ) { // even the last element is an association, we need to find a suitable identifier property propertyName = getSessionFactory().getMetamodel().entityPersister( propertyEntityType ).getIdentifierPropertyName(); } else { // the last element is a property so we can build the test with this property propertyName = getColumnName( propertyEntityType, propertyPath.subList( lastAssociationPath.size(), propertyPath.size() ) ); } return new PropertyIdentifier( propertyAlias, propertyName ); }
[ "public", "PropertyIdentifier", "getPropertyIdentifier", "(", "String", "entityType", ",", "List", "<", "String", ">", "propertyPath", ",", "int", "requiredDepth", ")", "{", "// we analyze the property path to find all the associations/embedded which are in the way and create prope...
Returns the {@link PropertyIdentifier} for the given property path. In passing, it creates all the necessary aliases for embedded/associations. @param entityType the type of the entity @param propertyPath the path to the property without aliases @param requiredDepth it defines until where the aliases will be considered as required aliases (see {@link Neo4jAliasResolver} for more information) @return the {@link PropertyIdentifier}
[ "Returns", "the", "{", "@link", "PropertyIdentifier", "}", "for", "the", "given", "property", "path", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/query/parsing/impl/Neo4jPropertyHelper.java#L71-L131
UrielCh/ovh-java-sdk
ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java
ApiOvhHorizonView.serviceName_domainTrust_domainTrustId_GET
public OvhDomainTrust serviceName_domainTrust_domainTrustId_GET(String serviceName, Long domainTrustId) throws IOException { String qPath = "/horizonView/{serviceName}/domainTrust/{domainTrustId}"; StringBuilder sb = path(qPath, serviceName, domainTrustId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDomainTrust.class); }
java
public OvhDomainTrust serviceName_domainTrust_domainTrustId_GET(String serviceName, Long domainTrustId) throws IOException { String qPath = "/horizonView/{serviceName}/domainTrust/{domainTrustId}"; StringBuilder sb = path(qPath, serviceName, domainTrustId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDomainTrust.class); }
[ "public", "OvhDomainTrust", "serviceName_domainTrust_domainTrustId_GET", "(", "String", "serviceName", ",", "Long", "domainTrustId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/horizonView/{serviceName}/domainTrust/{domainTrustId}\"", ";", "StringBuilder", "s...
Get this object properties REST: GET /horizonView/{serviceName}/domainTrust/{domainTrustId} @param serviceName [required] Domain of the service @param domainTrustId [required] Domain trust id
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java#L351-L356
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java
PageInBrowserStats.getDomLastLoadTime
public long getDomLastLoadTime(final String intervalName, final TimeUnit unit) { return unit.transformMillis(domLastLoadTime.getValueAsLong(intervalName)); }
java
public long getDomLastLoadTime(final String intervalName, final TimeUnit unit) { return unit.transformMillis(domLastLoadTime.getValueAsLong(intervalName)); }
[ "public", "long", "getDomLastLoadTime", "(", "final", "String", "intervalName", ",", "final", "TimeUnit", "unit", ")", "{", "return", "unit", ".", "transformMillis", "(", "domLastLoadTime", ".", "getValueAsLong", "(", "intervalName", ")", ")", ";", "}" ]
Returns DOM last load time for given interval and {@link TimeUnit}. @param intervalName name of the interval @param unit {@link TimeUnit} @return DOM last load time
[ "Returns", "DOM", "last", "load", "time", "for", "given", "interval", "and", "{", "@link", "TimeUnit", "}", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java#L153-L155
LearnLib/learnlib
algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/model/ObservationTree.java
ObservationTree.addState
public void addState(final S newState, final Word<I> accessSequence, final O output) { final Word<I> prefix = accessSequence.prefix(accessSequence.length() - 1); final I sym = accessSequence.lastSymbol(); final FastMealyState<O> pred = this.observationTree.getSuccessor(this.observationTree.getInitialState(), prefix); final FastMealyState<O> target; if (pred.getTransitionObject(alphabet.getSymbolIndex(sym)) == null) { target = this.observationTree.addState(); this.observationTree.addTransition(pred, sym, target, output); } else { target = this.observationTree.getSuccessor(pred, sym); } this.nodeToObservationMap.put(newState, target); }
java
public void addState(final S newState, final Word<I> accessSequence, final O output) { final Word<I> prefix = accessSequence.prefix(accessSequence.length() - 1); final I sym = accessSequence.lastSymbol(); final FastMealyState<O> pred = this.observationTree.getSuccessor(this.observationTree.getInitialState(), prefix); final FastMealyState<O> target; if (pred.getTransitionObject(alphabet.getSymbolIndex(sym)) == null) { target = this.observationTree.addState(); this.observationTree.addTransition(pred, sym, target, output); } else { target = this.observationTree.getSuccessor(pred, sym); } this.nodeToObservationMap.put(newState, target); }
[ "public", "void", "addState", "(", "final", "S", "newState", ",", "final", "Word", "<", "I", ">", "accessSequence", ",", "final", "O", "output", ")", "{", "final", "Word", "<", "I", ">", "prefix", "=", "accessSequence", ".", "prefix", "(", "accessSequenc...
Registers a new hypothesis state at the observation tree. It is expected to register states in the order of their discovery, meaning whenever a new state is added, information about all prefixes of its access sequence are already stored. Therefore providing only the output of the last symbol of its access sequence is sufficient. @param newState the hypothesis state in question @param accessSequence the access sequence of the hypothesis state in the system under learning @param output the output of the last symbol of the access sequence.
[ "Registers", "a", "new", "hypothesis", "state", "at", "the", "observation", "tree", ".", "It", "is", "expected", "to", "register", "states", "in", "the", "order", "of", "their", "discovery", "meaning", "whenever", "a", "new", "state", "is", "added", "informa...
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/adt/src/main/java/de/learnlib/algorithms/adt/model/ObservationTree.java#L181-L197
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/GuardedBySymbolResolver.java
GuardedBySymbolResolver.resolveType
private Symbol resolveType(String name, SearchSuperTypes searchSuperTypes) { Symbol type = null; if (searchSuperTypes == SearchSuperTypes.YES) { type = getSuperType(enclosingClass, name); } if (enclosingClass.getSimpleName().contentEquals(name)) { type = enclosingClass; } if (type == null) { type = getLexicallyEnclosing(enclosingClass, name); } if (type == null) { type = attribIdent(name); } checkGuardedBy( !(type instanceof Symbol.PackageSymbol), "All we could find for '%s' was a package symbol.", name); return type; }
java
private Symbol resolveType(String name, SearchSuperTypes searchSuperTypes) { Symbol type = null; if (searchSuperTypes == SearchSuperTypes.YES) { type = getSuperType(enclosingClass, name); } if (enclosingClass.getSimpleName().contentEquals(name)) { type = enclosingClass; } if (type == null) { type = getLexicallyEnclosing(enclosingClass, name); } if (type == null) { type = attribIdent(name); } checkGuardedBy( !(type instanceof Symbol.PackageSymbol), "All we could find for '%s' was a package symbol.", name); return type; }
[ "private", "Symbol", "resolveType", "(", "String", "name", ",", "SearchSuperTypes", "searchSuperTypes", ")", "{", "Symbol", "type", "=", "null", ";", "if", "(", "searchSuperTypes", "==", "SearchSuperTypes", ".", "YES", ")", "{", "type", "=", "getSuperType", "(...
Resolves a simple name as a type. Considers super classes, lexically enclosing classes, and then arbitrary types available in the current environment.
[ "Resolves", "a", "simple", "name", "as", "a", "type", ".", "Considers", "super", "classes", "lexically", "enclosing", "classes", "and", "then", "arbitrary", "types", "available", "in", "the", "current", "environment", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/threadsafety/GuardedBySymbolResolver.java#L197-L216
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java
TiledMap.getTileProperty
public String getTileProperty(int tileID, String propertyName, String def) { if (tileID == 0) { return def; } TileSet set = findTileSet(tileID); Properties props = set.getProperties(tileID); if (props == null) { return def; } return props.getProperty(propertyName, def); }
java
public String getTileProperty(int tileID, String propertyName, String def) { if (tileID == 0) { return def; } TileSet set = findTileSet(tileID); Properties props = set.getProperties(tileID); if (props == null) { return def; } return props.getProperty(propertyName, def); }
[ "public", "String", "getTileProperty", "(", "int", "tileID", ",", "String", "propertyName", ",", "String", "def", ")", "{", "if", "(", "tileID", "==", "0", ")", "{", "return", "def", ";", "}", "TileSet", "set", "=", "findTileSet", "(", "tileID", ")", "...
Get a propety given to a particular tile. Note that this method will not perform well and should not be used as part of the default code path in the game loop. @param tileID The global ID of the tile to retrieve @param propertyName The name of the property to retireve @param def The default value to return @return The value assigned to the property on the tile (or the default value if none is supplied)
[ "Get", "a", "propety", "given", "to", "a", "particular", "tile", ".", "Note", "that", "this", "method", "will", "not", "perform", "well", "and", "should", "not", "be", "used", "as", "part", "of", "the", "default", "code", "path", "in", "the", "game", "...
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/tiled/TiledMap.java#L335-L347
alkacon/opencms-core
src/org/opencms/importexport/CmsExportHelper.java
CmsExportHelper.writeFile2Zip
protected void writeFile2Zip(CmsFile file, String name) throws IOException { ZipEntry entry = new ZipEntry(name); // save the time of the last modification in the zip entry.setTime(file.getDateLastModified()); m_exportZipStream.putNextEntry(entry); m_exportZipStream.write(file.getContents()); m_exportZipStream.closeEntry(); }
java
protected void writeFile2Zip(CmsFile file, String name) throws IOException { ZipEntry entry = new ZipEntry(name); // save the time of the last modification in the zip entry.setTime(file.getDateLastModified()); m_exportZipStream.putNextEntry(entry); m_exportZipStream.write(file.getContents()); m_exportZipStream.closeEntry(); }
[ "protected", "void", "writeFile2Zip", "(", "CmsFile", "file", ",", "String", "name", ")", "throws", "IOException", "{", "ZipEntry", "entry", "=", "new", "ZipEntry", "(", "name", ")", ";", "// save the time of the last modification in the zip", "entry", ".", "setTime...
Writes a single OpenCms VFS file to the ZIP export.<p> @param file the OpenCms VFS file to write @param name the name of the file in the export @throws IOException in case of file access issues
[ "Writes", "a", "single", "OpenCms", "VFS", "file", "to", "the", "ZIP", "export", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsExportHelper.java#L235-L243
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java
JsonUtil.putEnumList
public static void putEnumList(Writer writer, List<? extends Enum<?>> values) throws IOException { if (values == null) { writer.write("null"); } else { startArray(writer); for (int i = 0; i < values.size(); i++) { put(writer, values.get(i)); if (i != values.size() - 1) { addSeparator(writer); } } endArray(writer); } }
java
public static void putEnumList(Writer writer, List<? extends Enum<?>> values) throws IOException { if (values == null) { writer.write("null"); } else { startArray(writer); for (int i = 0; i < values.size(); i++) { put(writer, values.get(i)); if (i != values.size() - 1) { addSeparator(writer); } } endArray(writer); } }
[ "public", "static", "void", "putEnumList", "(", "Writer", "writer", ",", "List", "<", "?", "extends", "Enum", "<", "?", ">", ">", "values", ")", "throws", "IOException", "{", "if", "(", "values", "==", "null", ")", "{", "writer", ".", "write", "(", "...
Writes the given value with the given writer. @param writer @param values @throws IOException @author vvakame
[ "Writes", "the", "given", "value", "with", "the", "given", "writer", "." ]
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java#L602-L617
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java
SpecializedOps_DDRM.copyChangeRow
public static DMatrixRMaj copyChangeRow(int order[] , DMatrixRMaj src , DMatrixRMaj dst ) { if( dst == null ) { dst = new DMatrixRMaj(src.numRows,src.numCols); } else if( src.numRows != dst.numRows || src.numCols != dst.numCols ) { throw new IllegalArgumentException("src and dst must have the same dimensions."); } for( int i = 0; i < src.numRows; i++ ) { int indexDst = i*src.numCols; int indexSrc = order[i]*src.numCols; System.arraycopy(src.data,indexSrc,dst.data,indexDst,src.numCols); } return dst; }
java
public static DMatrixRMaj copyChangeRow(int order[] , DMatrixRMaj src , DMatrixRMaj dst ) { if( dst == null ) { dst = new DMatrixRMaj(src.numRows,src.numCols); } else if( src.numRows != dst.numRows || src.numCols != dst.numCols ) { throw new IllegalArgumentException("src and dst must have the same dimensions."); } for( int i = 0; i < src.numRows; i++ ) { int indexDst = i*src.numCols; int indexSrc = order[i]*src.numCols; System.arraycopy(src.data,indexSrc,dst.data,indexDst,src.numCols); } return dst; }
[ "public", "static", "DMatrixRMaj", "copyChangeRow", "(", "int", "order", "[", "]", ",", "DMatrixRMaj", "src", ",", "DMatrixRMaj", "dst", ")", "{", "if", "(", "dst", "==", "null", ")", "{", "dst", "=", "new", "DMatrixRMaj", "(", "src", ".", "numRows", "...
Creates a copy of a matrix but swaps the rows as specified by the order array. @param order Specifies which row in the dest corresponds to a row in the src. Not modified. @param src The original matrix. Not modified. @param dst A Matrix that is a row swapped copy of src. Modified.
[ "Creates", "a", "copy", "of", "a", "matrix", "but", "swaps", "the", "rows", "as", "specified", "by", "the", "order", "array", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java#L97-L113
git-commit-id/maven-git-commit-id-plugin
src/main/java/pl/project13/maven/git/build/BuildServerDataProvider.java
BuildServerDataProvider.getBuildServerProvider
public static BuildServerDataProvider getBuildServerProvider(@Nonnull Map<String, String> env, @Nonnull LoggerBridge log) { if (BambooBuildServerData.isActiveServer(env)) { return new BambooBuildServerData(log, env); } if (GitlabBuildServerData.isActiveServer(env)) { return new GitlabBuildServerData(log, env); } if (HudsonJenkinsBuildServerData.isActiveServer(env)) { return new HudsonJenkinsBuildServerData(log, env); } if (TeamCityBuildServerData.isActiveServer(env)) { return new TeamCityBuildServerData(log, env); } if (TravisBuildServerData.isActiveServer(env)) { return new TravisBuildServerData(log, env); } return new UnknownBuildServerData(log, env); }
java
public static BuildServerDataProvider getBuildServerProvider(@Nonnull Map<String, String> env, @Nonnull LoggerBridge log) { if (BambooBuildServerData.isActiveServer(env)) { return new BambooBuildServerData(log, env); } if (GitlabBuildServerData.isActiveServer(env)) { return new GitlabBuildServerData(log, env); } if (HudsonJenkinsBuildServerData.isActiveServer(env)) { return new HudsonJenkinsBuildServerData(log, env); } if (TeamCityBuildServerData.isActiveServer(env)) { return new TeamCityBuildServerData(log, env); } if (TravisBuildServerData.isActiveServer(env)) { return new TravisBuildServerData(log, env); } return new UnknownBuildServerData(log, env); }
[ "public", "static", "BuildServerDataProvider", "getBuildServerProvider", "(", "@", "Nonnull", "Map", "<", "String", ",", "String", ">", "env", ",", "@", "Nonnull", "LoggerBridge", "log", ")", "{", "if", "(", "BambooBuildServerData", ".", "isActiveServer", "(", "...
Get the {@link BuildServerDataProvider} implementation for the running environment @param env environment variables which get used to identify the environment @param log logging provider which will be used to log events @return the corresponding {@link BuildServerDataProvider} for your environment or {@link UnknownBuildServerData}
[ "Get", "the", "{", "@link", "BuildServerDataProvider", "}", "implementation", "for", "the", "running", "environment" ]
train
https://github.com/git-commit-id/maven-git-commit-id-plugin/blob/a276551fb043d1b7fc4c890603f6ea0c79dc729a/src/main/java/pl/project13/maven/git/build/BuildServerDataProvider.java#L75-L92
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_account_accountName_filter_name_rule_id_GET
public OvhRule domain_account_accountName_filter_name_rule_id_GET(String domain, String accountName, String name, Long id) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}/rule/{id}"; StringBuilder sb = path(qPath, domain, accountName, name, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRule.class); }
java
public OvhRule domain_account_accountName_filter_name_rule_id_GET(String domain, String accountName, String name, Long id) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}/rule/{id}"; StringBuilder sb = path(qPath, domain, accountName, name, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRule.class); }
[ "public", "OvhRule", "domain_account_accountName_filter_name_rule_id_GET", "(", "String", "domain", ",", "String", "accountName", ",", "String", "name", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/account/{accoun...
Get this object properties REST: GET /email/domain/{domain}/account/{accountName}/filter/{name}/rule/{id} @param domain [required] Name of your domain name @param accountName [required] Name of account @param name [required] Filter name @param id [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L723-L728
line/armeria
core/src/main/java/com/linecorp/armeria/server/cors/CorsServiceBuilder.java
CorsServiceBuilder.preflightResponseHeader
public CorsServiceBuilder preflightResponseHeader(CharSequence name, Supplier<?> valueSupplier) { firstPolicyBuilder.preflightResponseHeader(name, valueSupplier); return this; }
java
public CorsServiceBuilder preflightResponseHeader(CharSequence name, Supplier<?> valueSupplier) { firstPolicyBuilder.preflightResponseHeader(name, valueSupplier); return this; }
[ "public", "CorsServiceBuilder", "preflightResponseHeader", "(", "CharSequence", "name", ",", "Supplier", "<", "?", ">", "valueSupplier", ")", "{", "firstPolicyBuilder", ".", "preflightResponseHeader", "(", "name", ",", "valueSupplier", ")", ";", "return", "this", ";...
Returns HTTP response headers that should be added to a CORS preflight response. <p>An intermediary like a load balancer might require that a CORS preflight request have certain headers set. This enables such headers to be added. <p>Some values must be dynamically created when the HTTP response is created, for example the 'Date' response header. This can be accomplished by using a {@link Supplier} which will have its 'call' method invoked when the HTTP response is created. @param name the name of the HTTP header. @param valueSupplier a {@link Supplier} which will be invoked at HTTP response creation. @return {@link CorsServiceBuilder} to support method chaining.
[ "Returns", "HTTP", "response", "headers", "that", "should", "be", "added", "to", "a", "CORS", "preflight", "response", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/cors/CorsServiceBuilder.java#L335-L338
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LRImporter.java
LRImporter.getObtainRequestPath
private String getObtainRequestPath(String requestID, Boolean byResourceID, Boolean byDocID, Boolean idsOnly, String resumptionToken) { String path = obtainPath; if (resumptionToken != null) { path += "?" + resumptionTokenParam + "=" + resumptionToken; return path; } if (requestID != null) { path += "?" + requestIDParam + "=" + requestID; } else { // error return null; } if (byResourceID) { path += "&" + byResourceIDParam + "=" + booleanTrueString; } else { path += "&" + byResourceIDParam + "=" + booleanFalseString; } if (byDocID) { path += "&" + byDocIDParam + "=" + booleanTrueString; } else { path += "&" + byDocIDParam + "=" + booleanFalseString; } if (idsOnly) { path += "&" + idsOnlyParam + "=" + booleanTrueString; } else { path += "&" + idsOnlyParam + "=" + booleanFalseString; } return path; }
java
private String getObtainRequestPath(String requestID, Boolean byResourceID, Boolean byDocID, Boolean idsOnly, String resumptionToken) { String path = obtainPath; if (resumptionToken != null) { path += "?" + resumptionTokenParam + "=" + resumptionToken; return path; } if (requestID != null) { path += "?" + requestIDParam + "=" + requestID; } else { // error return null; } if (byResourceID) { path += "&" + byResourceIDParam + "=" + booleanTrueString; } else { path += "&" + byResourceIDParam + "=" + booleanFalseString; } if (byDocID) { path += "&" + byDocIDParam + "=" + booleanTrueString; } else { path += "&" + byDocIDParam + "=" + booleanFalseString; } if (idsOnly) { path += "&" + idsOnlyParam + "=" + booleanTrueString; } else { path += "&" + idsOnlyParam + "=" + booleanFalseString; } return path; }
[ "private", "String", "getObtainRequestPath", "(", "String", "requestID", ",", "Boolean", "byResourceID", ",", "Boolean", "byDocID", ",", "Boolean", "idsOnly", ",", "String", "resumptionToken", ")", "{", "String", "path", "=", "obtainPath", ";", "if", "(", "resum...
Obtain the path used for an obtain request @param requestID the "request_ID" parameter for the request @param byResourceID the "by_resource_ID" parameter for the request @param byDocID the "by_doc_ID" parameter for the request @param idsOnly the "ids_only" parameter for the request @param resumptionToken the "resumption_token" parameter for the request @return the string of the path for an obtain request
[ "Obtain", "the", "path", "used", "for", "an", "obtain", "request" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRImporter.java#L118-L166
kaazing/gateway
service/amqp/src/main/java/org/kaazing/gateway/service/amqp/amqp091/AmqpTable.java
AmqpTable.addLongString
public AmqpTable addLongString(String key, String value) { this.add(key, value, AmqpType.LONGSTRING); return this; }
java
public AmqpTable addLongString(String key, String value) { this.add(key, value, AmqpType.LONGSTRING); return this; }
[ "public", "AmqpTable", "addLongString", "(", "String", "key", ",", "String", "value", ")", "{", "this", ".", "add", "(", "key", ",", "value", ",", "AmqpType", ".", "LONGSTRING", ")", ";", "return", "this", ";", "}" ]
Adds a long string entry to the AmqpTable. @param key name of an entry @param value long string value of an entry @return AmqpTable object that holds the table of entries
[ "Adds", "a", "long", "string", "entry", "to", "the", "AmqpTable", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/service/amqp/src/main/java/org/kaazing/gateway/service/amqp/amqp091/AmqpTable.java#L142-L145
threerings/narya
core/src/main/java/com/threerings/admin/client/PulldownFieldEditor.java
PulldownFieldEditor.addChoice
public void addChoice (Object choice) { String name = (choice == null) ? "null" : choice.toString(); addChoice(new Choice(name, choice)); }
java
public void addChoice (Object choice) { String name = (choice == null) ? "null" : choice.toString(); addChoice(new Choice(name, choice)); }
[ "public", "void", "addChoice", "(", "Object", "choice", ")", "{", "String", "name", "=", "(", "choice", "==", "null", ")", "?", "\"null\"", ":", "choice", ".", "toString", "(", ")", ";", "addChoice", "(", "new", "Choice", "(", "name", ",", "choice", ...
Add the specified object as a choice. The name will be the toString() of the object.
[ "Add", "the", "specified", "object", "as", "a", "choice", ".", "The", "name", "will", "be", "the", "toString", "()", "of", "the", "object", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/admin/client/PulldownFieldEditor.java#L92-L96
zandero/cmd
src/main/java/com/zandero/cmd/CommandBuilder.java
CommandBuilder.setHelp
public void setHelp(String appVersion, String usageExample) { helpAppVersion = StringUtils.trimToNull(appVersion); helpAppExample = StringUtils.trimToNull(usageExample); }
java
public void setHelp(String appVersion, String usageExample) { helpAppVersion = StringUtils.trimToNull(appVersion); helpAppExample = StringUtils.trimToNull(usageExample); }
[ "public", "void", "setHelp", "(", "String", "appVersion", ",", "String", "usageExample", ")", "{", "helpAppVersion", "=", "StringUtils", ".", "trimToNull", "(", "appVersion", ")", ";", "helpAppExample", "=", "StringUtils", ".", "trimToNull", "(", "usageExample", ...
Sets app version and example to be show in help screen @param appVersion application name and version @param usageExample example or additional data
[ "Sets", "app", "version", "and", "example", "to", "be", "show", "in", "help", "screen" ]
train
https://github.com/zandero/cmd/blob/cf0c3b0afdd413f9f52243164bdf28e1db3e523f/src/main/java/com/zandero/cmd/CommandBuilder.java#L185-L189
Virtlink/commons-configuration2-jackson
src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java
JacksonConfiguration.addChildNode
private void addChildNode(final Builder builder, final String name, final Object value) { assert !(value instanceof List); final Builder childBuilder = new Builder(); // Set the name of the child node. childBuilder.name(name); // Set the value of the child node. final ImmutableNode childNode = toNode(childBuilder, value); // Add the node to the children of the node being built. builder.addChild(childNode); }
java
private void addChildNode(final Builder builder, final String name, final Object value) { assert !(value instanceof List); final Builder childBuilder = new Builder(); // Set the name of the child node. childBuilder.name(name); // Set the value of the child node. final ImmutableNode childNode = toNode(childBuilder, value); // Add the node to the children of the node being built. builder.addChild(childNode); }
[ "private", "void", "addChildNode", "(", "final", "Builder", "builder", ",", "final", "String", "name", ",", "final", "Object", "value", ")", "{", "assert", "!", "(", "value", "instanceof", "List", ")", ";", "final", "Builder", "childBuilder", "=", "new", "...
Adds a child node to the specified builder. @param builder The builder to add the node to. @param name The name of the node. @param value The value of the node.
[ "Adds", "a", "child", "node", "to", "the", "specified", "builder", "." ]
train
https://github.com/Virtlink/commons-configuration2-jackson/blob/40474ab3c641fbbb4ccd9c97d4f7075c1644ef69/src/main/java/com/virtlink/commons/configuration2/jackson/JacksonConfiguration.java#L185-L195
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/sasl/ShuffleSecretManager.java
ShuffleSecretManager.registerApp
public void registerApp(String appId, ByteBuffer shuffleSecret) { registerApp(appId, JavaUtils.bytesToString(shuffleSecret)); }
java
public void registerApp(String appId, ByteBuffer shuffleSecret) { registerApp(appId, JavaUtils.bytesToString(shuffleSecret)); }
[ "public", "void", "registerApp", "(", "String", "appId", ",", "ByteBuffer", "shuffleSecret", ")", "{", "registerApp", "(", "appId", ",", "JavaUtils", ".", "bytesToString", "(", "shuffleSecret", ")", ")", ";", "}" ]
Register an application with its secret specified as a byte buffer.
[ "Register", "an", "application", "with", "its", "secret", "specified", "as", "a", "byte", "buffer", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/sasl/ShuffleSecretManager.java#L60-L62
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/Util.java
Util.flipBitmapRangeAndCardinalityChange
@Deprecated public static int flipBitmapRangeAndCardinalityChange(long[] bitmap, int start, int end) { int cardbefore = cardinalityInBitmapWordRange(bitmap, start, end); flipBitmapRange(bitmap, start,end); int cardafter = cardinalityInBitmapWordRange(bitmap, start, end); return cardafter - cardbefore; }
java
@Deprecated public static int flipBitmapRangeAndCardinalityChange(long[] bitmap, int start, int end) { int cardbefore = cardinalityInBitmapWordRange(bitmap, start, end); flipBitmapRange(bitmap, start,end); int cardafter = cardinalityInBitmapWordRange(bitmap, start, end); return cardafter - cardbefore; }
[ "@", "Deprecated", "public", "static", "int", "flipBitmapRangeAndCardinalityChange", "(", "long", "[", "]", "bitmap", ",", "int", "start", ",", "int", "end", ")", "{", "int", "cardbefore", "=", "cardinalityInBitmapWordRange", "(", "bitmap", ",", "start", ",", ...
flip bits at start, start+1,..., end-1 and report the cardinality change @param bitmap array of words to be modified @param start first index to be modified (inclusive) @param end last index to be modified (exclusive) @return cardinality change
[ "flip", "bits", "at", "start", "start", "+", "1", "...", "end", "-", "1", "and", "report", "the", "cardinality", "change" ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L545-L551
phax/ph-css
ph-css/src/main/java/com/helger/css/tools/MediaQueryTools.java
MediaQueryTools.getWrappedInMediaQuery
@Nullable public static CascadingStyleSheet getWrappedInMediaQuery (@Nonnull final CascadingStyleSheet aCSS, @Nonnull final CSSMediaQuery aMediaQuery, final boolean bAllowNestedMediaQueries) { return getWrappedInMediaQuery (aCSS, new CommonsArrayList <> (aMediaQuery), bAllowNestedMediaQueries); }
java
@Nullable public static CascadingStyleSheet getWrappedInMediaQuery (@Nonnull final CascadingStyleSheet aCSS, @Nonnull final CSSMediaQuery aMediaQuery, final boolean bAllowNestedMediaQueries) { return getWrappedInMediaQuery (aCSS, new CommonsArrayList <> (aMediaQuery), bAllowNestedMediaQueries); }
[ "@", "Nullable", "public", "static", "CascadingStyleSheet", "getWrappedInMediaQuery", "(", "@", "Nonnull", "final", "CascadingStyleSheet", "aCSS", ",", "@", "Nonnull", "final", "CSSMediaQuery", "aMediaQuery", ",", "final", "boolean", "bAllowNestedMediaQueries", ")", "{"...
Get the CSS wrapped in the specified media query. Note: all existing rule objects are reused, so modifying them also modifies the original CSS! @param aCSS The CSS to be wrapped. May not be <code>null</code>. @param aMediaQuery The media query to use. @param bAllowNestedMediaQueries if <code>true</code> nested media queries are allowed, <code>false</code> if they are prohibited. @return <code>null</code> if out CSS cannot be wrapped, the newly created {@link CascadingStyleSheet} object otherwise.
[ "Get", "the", "CSS", "wrapped", "in", "the", "specified", "media", "query", ".", "Note", ":", "all", "existing", "rule", "objects", "are", "reused", "so", "modifying", "them", "also", "modifies", "the", "original", "CSS!" ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/tools/MediaQueryTools.java#L118-L124
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChangesHolder.java
ChangesHolder.writeField
private static void writeField(ObjectOutput out, Fieldable field) throws IOException { // Name out.writeUTF(field.name()); // Flags writeFlags(out, field); if (field.getBoost() != 1.0f) { // Boost out.writeFloat(field.getBoost()); } // Value writeValue(out, field); }
java
private static void writeField(ObjectOutput out, Fieldable field) throws IOException { // Name out.writeUTF(field.name()); // Flags writeFlags(out, field); if (field.getBoost() != 1.0f) { // Boost out.writeFloat(field.getBoost()); } // Value writeValue(out, field); }
[ "private", "static", "void", "writeField", "(", "ObjectOutput", "out", ",", "Fieldable", "field", ")", "throws", "IOException", "{", "// Name", "out", ".", "writeUTF", "(", "field", ".", "name", "(", ")", ")", ";", "// Flags", "writeFlags", "(", "out", ","...
Serialize the Field into the given {@link ObjectOutput} @param out the stream in which we serialize the Field @param field the Field instance to serialize @throws IOException if the Field could not be serialized
[ "Serialize", "the", "Field", "into", "the", "given", "{" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/ChangesHolder.java#L301-L314
hal/core
gui/src/main/java/org/jboss/as/console/rebind/ProductConfigGenerator.java
ProductConfigGenerator.generateClass
private void generateClass(TreeLogger logger, GeneratorContext context) throws Throwable { // get print writer that receives the source code PrintWriter printWriter = context.tryCreate(logger, packageName, className); // print writer if null, source code has ALREADY been generated, return if (printWriter == null) { return; } // init composer, set class properties, create source writer ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className); // Imports composerFactory.addImport("org.jboss.as.console.client.Console"); composerFactory.addImport("org.jboss.as.console.client.ProductConfig"); composerFactory.addImport("java.util.*"); // Interfaces composerFactory.addImplementedInterface("org.jboss.as.console.client.ProductConfig"); // SourceWriter SourceWriter sourceWriter = composerFactory.createSourceWriter(context, printWriter); // ctor generateConstructor(sourceWriter); // Methods generateMethods(logger, sourceWriter, context); // close generated class sourceWriter.outdent(); sourceWriter.println("}"); // commit generated class context.commit(logger, printWriter); }
java
private void generateClass(TreeLogger logger, GeneratorContext context) throws Throwable { // get print writer that receives the source code PrintWriter printWriter = context.tryCreate(logger, packageName, className); // print writer if null, source code has ALREADY been generated, return if (printWriter == null) { return; } // init composer, set class properties, create source writer ClassSourceFileComposerFactory composerFactory = new ClassSourceFileComposerFactory(packageName, className); // Imports composerFactory.addImport("org.jboss.as.console.client.Console"); composerFactory.addImport("org.jboss.as.console.client.ProductConfig"); composerFactory.addImport("java.util.*"); // Interfaces composerFactory.addImplementedInterface("org.jboss.as.console.client.ProductConfig"); // SourceWriter SourceWriter sourceWriter = composerFactory.createSourceWriter(context, printWriter); // ctor generateConstructor(sourceWriter); // Methods generateMethods(logger, sourceWriter, context); // close generated class sourceWriter.outdent(); sourceWriter.println("}"); // commit generated class context.commit(logger, printWriter); }
[ "private", "void", "generateClass", "(", "TreeLogger", "logger", ",", "GeneratorContext", "context", ")", "throws", "Throwable", "{", "// get print writer that receives the source code", "PrintWriter", "printWriter", "=", "context", ".", "tryCreate", "(", "logger", ",", ...
Generate source code for new class. Class extends <code>HashMap</code>. @param logger Logger object @param context Generator context
[ "Generate", "source", "code", "for", "new", "class", ".", "Class", "extends", "<code", ">", "HashMap<", "/", "code", ">", "." ]
train
https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/rebind/ProductConfigGenerator.java#L85-L121
hellosign/hellosign-java-sdk
src/main/java/com/hellosign/sdk/http/Authentication.java
Authentication.setAccessToken
public void setAccessToken(String accessToken, String tokenType) throws HelloSignException { if (accessToken == null) { throw new HelloSignException("Access Token cannot be null"); } if (tokenType == null) { throw new HelloSignException("Token Type cannot be null"); } this.accessToken = new String(accessToken); this.accessTokenType = new String(tokenType); }
java
public void setAccessToken(String accessToken, String tokenType) throws HelloSignException { if (accessToken == null) { throw new HelloSignException("Access Token cannot be null"); } if (tokenType == null) { throw new HelloSignException("Token Type cannot be null"); } this.accessToken = new String(accessToken); this.accessTokenType = new String(tokenType); }
[ "public", "void", "setAccessToken", "(", "String", "accessToken", ",", "String", "tokenType", ")", "throws", "HelloSignException", "{", "if", "(", "accessToken", "==", "null", ")", "{", "throw", "new", "HelloSignException", "(", "\"Access Token cannot be null\"", ")...
Sets the access token for the HelloSign client authentication. @param accessToken String @param tokenType String @throws HelloSignException if either the accessToken or tokenType are null
[ "Sets", "the", "access", "token", "for", "the", "HelloSign", "client", "authentication", "." ]
train
https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/http/Authentication.java#L125-L134
nextreports/nextreports-server
src/ro/nextreports/server/api/client/jdbc/Driver.java
Driver.parseURL
public static Properties parseURL(String url, Properties info) { if ((url == null) || !url.toLowerCase().startsWith(driverPrefix)) { return null; // throws exception ?! } Properties props = new Properties(info); // take local copy of existing properties Enumeration<?> en = info.propertyNames(); while (en.hasMoreElements()) { String key = (String) en.nextElement(); String value = info.getProperty(key); if (value != null) { props.setProperty(key.toUpperCase(), value); } } String tmp = url.substring(driverPrefix.length()); String[] tokens = tmp.split(";"); if (tokens.length != 2) { return null; // datasource missing } try { new URL(tokens[0]); } catch (MalformedURLException e) { return null; // url invalid } props.setProperty(SERVER_URL, tokens[0]); props.setProperty(DATASOURCE_PATH, tokens[1]); return props; }
java
public static Properties parseURL(String url, Properties info) { if ((url == null) || !url.toLowerCase().startsWith(driverPrefix)) { return null; // throws exception ?! } Properties props = new Properties(info); // take local copy of existing properties Enumeration<?> en = info.propertyNames(); while (en.hasMoreElements()) { String key = (String) en.nextElement(); String value = info.getProperty(key); if (value != null) { props.setProperty(key.toUpperCase(), value); } } String tmp = url.substring(driverPrefix.length()); String[] tokens = tmp.split(";"); if (tokens.length != 2) { return null; // datasource missing } try { new URL(tokens[0]); } catch (MalformedURLException e) { return null; // url invalid } props.setProperty(SERVER_URL, tokens[0]); props.setProperty(DATASOURCE_PATH, tokens[1]); return props; }
[ "public", "static", "Properties", "parseURL", "(", "String", "url", ",", "Properties", "info", ")", "{", "if", "(", "(", "url", "==", "null", ")", "||", "!", "url", ".", "toLowerCase", "(", ")", ".", "startsWith", "(", "driverPrefix", ")", ")", "{", ...
Parse the driver URL and extract the properties. @param url the URL to parse @param info any existing properties already loaded in a <code>Properties</code> object @return the URL properties as a <code>Properties</code> object
[ "Parse", "the", "driver", "URL", "and", "extract", "the", "properties", "." ]
train
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/api/client/jdbc/Driver.java#L133-L167
threerings/nenya
core/src/main/java/com/threerings/media/image/ImageUtil.java
ImageUtil.createCompatibleImage
public static BufferedImage createCompatibleImage (BufferedImage source, int width, int height) { WritableRaster raster = source.getRaster().createCompatibleWritableRaster(width, height); return new BufferedImage(source.getColorModel(), raster, false, null); }
java
public static BufferedImage createCompatibleImage (BufferedImage source, int width, int height) { WritableRaster raster = source.getRaster().createCompatibleWritableRaster(width, height); return new BufferedImage(source.getColorModel(), raster, false, null); }
[ "public", "static", "BufferedImage", "createCompatibleImage", "(", "BufferedImage", "source", ",", "int", "width", ",", "int", "height", ")", "{", "WritableRaster", "raster", "=", "source", ".", "getRaster", "(", ")", ".", "createCompatibleWritableRaster", "(", "w...
Creates a new buffered image with the same sample model and color model as the source image but with the new width and height.
[ "Creates", "a", "new", "buffered", "image", "with", "the", "same", "sample", "model", "and", "color", "model", "as", "the", "source", "image", "but", "with", "the", "new", "width", "and", "height", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/ImageUtil.java#L62-L66
lastaflute/lastaflute
src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java
TypicalLoginAssist.buildRememberMeCookieValue
protected String buildRememberMeCookieValue(USER_ENTITY userEntity, USER_BEAN userBean, int expireDays) { final String autoLoginKey = createRememberMeKey(userEntity, userBean); final String delimiter = getRememberMeDelimiter(); final HandyDate currentHandyDate = timeManager.currentHandyDate(); final HandyDate expireDate = currentHandyDate.addDay(expireDays); // access token's expire return autoLoginKey + delimiter + formatForRememberMeExpireDate(expireDate); }
java
protected String buildRememberMeCookieValue(USER_ENTITY userEntity, USER_BEAN userBean, int expireDays) { final String autoLoginKey = createRememberMeKey(userEntity, userBean); final String delimiter = getRememberMeDelimiter(); final HandyDate currentHandyDate = timeManager.currentHandyDate(); final HandyDate expireDate = currentHandyDate.addDay(expireDays); // access token's expire return autoLoginKey + delimiter + formatForRememberMeExpireDate(expireDate); }
[ "protected", "String", "buildRememberMeCookieValue", "(", "USER_ENTITY", "userEntity", ",", "USER_BEAN", "userBean", ",", "int", "expireDays", ")", "{", "final", "String", "autoLoginKey", "=", "createRememberMeKey", "(", "userEntity", ",", "userBean", ")", ";", "fin...
Build the value for remember-me saved in cookie. <br> You can change access token's structure by override. #change_access_token @param userEntity The selected entity of login user. (NotNull) @param userBean The user bean saved in session. (NotNull) @param expireDays The count of expired days from current times. (NotNull) @return The string value for remember-me. (NotNull)
[ "Build", "the", "value", "for", "remember", "-", "me", "saved", "in", "cookie", ".", "<br", ">", "You", "can", "change", "access", "token", "s", "structure", "by", "override", ".", "#change_access_token" ]
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java#L451-L457
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/MessageFormat.java
MessageFormat.setFormat
public void setFormat(int formatElementIndex, Format newFormat) { if (formatElementIndex > maxOffset) { throw new ArrayIndexOutOfBoundsException(maxOffset, formatElementIndex); } formats[formatElementIndex] = newFormat; }
java
public void setFormat(int formatElementIndex, Format newFormat) { if (formatElementIndex > maxOffset) { throw new ArrayIndexOutOfBoundsException(maxOffset, formatElementIndex); } formats[formatElementIndex] = newFormat; }
[ "public", "void", "setFormat", "(", "int", "formatElementIndex", ",", "Format", "newFormat", ")", "{", "if", "(", "formatElementIndex", ">", "maxOffset", ")", "{", "throw", "new", "ArrayIndexOutOfBoundsException", "(", "maxOffset", ",", "formatElementIndex", ")", ...
Sets the format to use for the format element with the given format element index within the previously set pattern string. The format element index is the zero-based number of the format element counting from the start of the pattern string. <p> Since the order of format elements in a pattern string often changes during localization, it is generally better to use the {@link #setFormatByArgumentIndex setFormatByArgumentIndex} method, which accesses format elements based on the argument index they specify. @param formatElementIndex the index of a format element within the pattern @param newFormat the format to use for the specified format element @exception ArrayIndexOutOfBoundsException if {@code formatElementIndex} is equal to or larger than the number of format elements in the pattern string
[ "Sets", "the", "format", "to", "use", "for", "the", "format", "element", "with", "the", "given", "format", "element", "index", "within", "the", "previously", "set", "pattern", "string", ".", "The", "format", "element", "index", "is", "the", "zero", "-", "b...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/MessageFormat.java#L692-L697
wildfly/wildfly-build-tools
provisioning/src/main/java/org/wildfly/build/util/ZipFileSubsystemInputStreamSources.java
ZipFileSubsystemInputStreamSources.addSubsystemFileSourceFromZipFile
public boolean addSubsystemFileSourceFromZipFile(String subsystem, File file) throws IOException { try (ZipFile zip = new ZipFile(file)) { String entryName = "subsystem-templates/"+subsystem; ZipEntry entry = zip.getEntry(entryName); if (entry != null) { addSubsystemFileSource(subsystem, file, entry); return true; } } return false; }
java
public boolean addSubsystemFileSourceFromZipFile(String subsystem, File file) throws IOException { try (ZipFile zip = new ZipFile(file)) { String entryName = "subsystem-templates/"+subsystem; ZipEntry entry = zip.getEntry(entryName); if (entry != null) { addSubsystemFileSource(subsystem, file, entry); return true; } } return false; }
[ "public", "boolean", "addSubsystemFileSourceFromZipFile", "(", "String", "subsystem", ",", "File", "file", ")", "throws", "IOException", "{", "try", "(", "ZipFile", "zip", "=", "new", "ZipFile", "(", "file", ")", ")", "{", "String", "entryName", "=", "\"subsys...
Adds the file source for the specified subsystem, from the specified zip file. @param subsystem @param file @return true if such subsystem file source was found and added; false otherwise @throws IOException
[ "Adds", "the", "file", "source", "for", "the", "specified", "subsystem", "from", "the", "specified", "zip", "file", "." ]
train
https://github.com/wildfly/wildfly-build-tools/blob/520a5f2e58e6a24097d63fd65c51a8fc29847a61/provisioning/src/main/java/org/wildfly/build/util/ZipFileSubsystemInputStreamSources.java#L91-L101
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java
ServiceDiscoveryManager.discoverInfo
public DiscoverInfo discoverInfo(Jid entityID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { if (entityID == null) return discoverInfo(null, null); synchronized (discoInfoLookupShortcutMechanisms) { for (DiscoInfoLookupShortcutMechanism discoInfoLookupShortcutMechanism : discoInfoLookupShortcutMechanisms) { DiscoverInfo info = discoInfoLookupShortcutMechanism.getDiscoverInfoByUser(this, entityID); if (info != null) { // We were able to retrieve the information from Entity Caps and // avoided a disco request, hurray! return info; } } } // Last resort: Standard discovery. return discoverInfo(entityID, null); }
java
public DiscoverInfo discoverInfo(Jid entityID) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { if (entityID == null) return discoverInfo(null, null); synchronized (discoInfoLookupShortcutMechanisms) { for (DiscoInfoLookupShortcutMechanism discoInfoLookupShortcutMechanism : discoInfoLookupShortcutMechanisms) { DiscoverInfo info = discoInfoLookupShortcutMechanism.getDiscoverInfoByUser(this, entityID); if (info != null) { // We were able to retrieve the information from Entity Caps and // avoided a disco request, hurray! return info; } } } // Last resort: Standard discovery. return discoverInfo(entityID, null); }
[ "public", "DiscoverInfo", "discoverInfo", "(", "Jid", "entityID", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "if", "(", "entityID", "==", "null", ")", "return", "discoverInfo", "(", ...
Returns the discovered information of a given XMPP entity addressed by its JID. Use null as entityID to query the server @param entityID the address of the XMPP entity or null. @return the discovered information. @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Returns", "the", "discovered", "information", "of", "a", "given", "XMPP", "entity", "addressed", "by", "its", "JID", ".", "Use", "null", "as", "entityID", "to", "query", "the", "server" ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java#L489-L506
JM-Lab/utils-java8
src/main/java/kr/jm/utils/stats/collector/WordNumberCollectorBundle.java
WordNumberCollectorBundle.addNumber
public WordNumberCollectorBundle addNumber(String key, Number number) { numberCollector.add(key, number); return this; }
java
public WordNumberCollectorBundle addNumber(String key, Number number) { numberCollector.add(key, number); return this; }
[ "public", "WordNumberCollectorBundle", "addNumber", "(", "String", "key", ",", "Number", "number", ")", "{", "numberCollector", ".", "add", "(", "key", ",", "number", ")", ";", "return", "this", ";", "}" ]
Add number word number collector bundle. @param key the key @param number the number @return the word number collector bundle
[ "Add", "number", "word", "number", "collector", "bundle", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/stats/collector/WordNumberCollectorBundle.java#L79-L82
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/Util.java
Util.toLog2
public static int toLog2(final int value, final String argName) { checkIfPowerOf2(value, argName); return Integer.numberOfTrailingZeros(value); }
java
public static int toLog2(final int value, final String argName) { checkIfPowerOf2(value, argName); return Integer.numberOfTrailingZeros(value); }
[ "public", "static", "int", "toLog2", "(", "final", "int", "value", ",", "final", "String", "argName", ")", "{", "checkIfPowerOf2", "(", "value", ",", "argName", ")", ";", "return", "Integer", ".", "numberOfTrailingZeros", "(", "value", ")", ";", "}" ]
Checks the given value if it is a power of 2. If not, it throws an exception. Otherwise, returns the log-base2 of the given value. @param value must be a power of 2 and greater than zero. @param argName the argument name used in the exception if thrown. @return the log-base2 of the given value
[ "Checks", "the", "given", "value", "if", "it", "is", "a", "power", "of", "2", ".", "If", "not", "it", "throws", "an", "exception", ".", "Otherwise", "returns", "the", "log", "-", "base2", "of", "the", "given", "value", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L381-L384
m-m-m/util
cli/src/main/java/net/sf/mmm/util/cli/base/AbstractCliParser.java
AbstractCliParser.parseParameterUndefinedOption
private void parseParameterUndefinedOption(String parameter, CliParserState parserState, CliParameterConsumer parameterConsumer) { if (END_OPTIONS.equals(parameter)) { parserState.setOptionsComplete(); return; } CliStyleHandling handling = this.cliState.getCliStyle().optionMixedShortForm(); Matcher matcher = PATTERN_MIXED_SHORT_OPTIONS.matcher(parameter); if (matcher.matches()) { // "-vlp" --> "-v", "-l", "-p" RuntimeException mixedOptions = null; if (handling != CliStyleHandling.OK) { // TODO: declare proper exception for this purpose... mixedOptions = new NlsIllegalArgumentException("Mixed options (" + parameter + ") should be avoided."); } handling.handle(getLogger(), mixedOptions); String multiOptions = matcher.group(1); for (int i = 0; i < multiOptions.length(); i++) { String subArgument = PREFIX_SHORT_OPTION + multiOptions.charAt(i); parseParameter(subArgument, parserState, CliParameterConsumer.EMPTY_INSTANCE); } } else if (parameter.startsWith(PREFIX_SHORT_OPTION)) { throw new CliOptionUndefinedException(parameter); } else { // so it seems the options are completed and this is a regular argument parserState.setOptionsComplete(); parseParameter(parameter, parserState, parameterConsumer); } }
java
private void parseParameterUndefinedOption(String parameter, CliParserState parserState, CliParameterConsumer parameterConsumer) { if (END_OPTIONS.equals(parameter)) { parserState.setOptionsComplete(); return; } CliStyleHandling handling = this.cliState.getCliStyle().optionMixedShortForm(); Matcher matcher = PATTERN_MIXED_SHORT_OPTIONS.matcher(parameter); if (matcher.matches()) { // "-vlp" --> "-v", "-l", "-p" RuntimeException mixedOptions = null; if (handling != CliStyleHandling.OK) { // TODO: declare proper exception for this purpose... mixedOptions = new NlsIllegalArgumentException("Mixed options (" + parameter + ") should be avoided."); } handling.handle(getLogger(), mixedOptions); String multiOptions = matcher.group(1); for (int i = 0; i < multiOptions.length(); i++) { String subArgument = PREFIX_SHORT_OPTION + multiOptions.charAt(i); parseParameter(subArgument, parserState, CliParameterConsumer.EMPTY_INSTANCE); } } else if (parameter.startsWith(PREFIX_SHORT_OPTION)) { throw new CliOptionUndefinedException(parameter); } else { // so it seems the options are completed and this is a regular argument parserState.setOptionsComplete(); parseParameter(parameter, parserState, parameterConsumer); } }
[ "private", "void", "parseParameterUndefinedOption", "(", "String", "parameter", ",", "CliParserState", "parserState", ",", "CliParameterConsumer", "parameterConsumer", ")", "{", "if", "(", "END_OPTIONS", ".", "equals", "(", "parameter", ")", ")", "{", "parserState", ...
Parses the given commandline {@code parameter} that is no defined {@link CliOption}. @param parameter is the commandline argument. @param parserState is the current {@link CliParserState}. @param parameterConsumer is the {@link CliParameterConsumer}.
[ "Parses", "the", "given", "commandline", "{", "@code", "parameter", "}", "that", "is", "no", "defined", "{", "@link", "CliOption", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/AbstractCliParser.java#L320-L350
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/misc/TransposeAlgs_DDRM.java
TransposeAlgs_DDRM.standard
public static void standard(DMatrix1Row A, DMatrix1Row A_tran) { int index = 0; for( int i = 0; i < A_tran.numRows; i++ ) { int index2 = i; int end = index + A_tran.numCols; while( index < end ) { A_tran.data[index++ ] = A.data[ index2 ]; index2 += A.numCols; } } }
java
public static void standard(DMatrix1Row A, DMatrix1Row A_tran) { int index = 0; for( int i = 0; i < A_tran.numRows; i++ ) { int index2 = i; int end = index + A_tran.numCols; while( index < end ) { A_tran.data[index++ ] = A.data[ index2 ]; index2 += A.numCols; } } }
[ "public", "static", "void", "standard", "(", "DMatrix1Row", "A", ",", "DMatrix1Row", "A_tran", ")", "{", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "A_tran", ".", "numRows", ";", "i", "++", ")", "{", "int", "i...
A straight forward transpose. Good for small non-square matrices. @param A Original matrix. Not modified. @param A_tran Transposed matrix. Modified.
[ "A", "straight", "forward", "transpose", ".", "Good", "for", "small", "non", "-", "square", "matrices", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/misc/TransposeAlgs_DDRM.java#L103-L115
AltBeacon/android-beacon-library
lib/src/main/java/org/altbeacon/beacon/service/ScanJob.java
ScanJob.startScanning
private boolean startScanning() { BeaconManager beaconManager = BeaconManager.getInstanceForApplication(getApplicationContext()); beaconManager.setScannerInSameProcess(true); if (beaconManager.isMainProcess()) { LogManager.i(TAG, "scanJob version %s is starting up on the main process", BuildConfig.VERSION_NAME); } else { LogManager.i(TAG, "beaconScanJob library version %s is starting up on a separate process", BuildConfig.VERSION_NAME); ProcessUtils processUtils = new ProcessUtils(ScanJob.this); LogManager.i(TAG, "beaconScanJob PID is "+processUtils.getPid()+" with process name "+processUtils.getProcessName()); } ModelSpecificDistanceCalculator defaultDistanceCalculator = new ModelSpecificDistanceCalculator(ScanJob.this, BeaconManager.getDistanceModelUpdateUrl()); Beacon.setDistanceCalculator(defaultDistanceCalculator); return restartScanning(); }
java
private boolean startScanning() { BeaconManager beaconManager = BeaconManager.getInstanceForApplication(getApplicationContext()); beaconManager.setScannerInSameProcess(true); if (beaconManager.isMainProcess()) { LogManager.i(TAG, "scanJob version %s is starting up on the main process", BuildConfig.VERSION_NAME); } else { LogManager.i(TAG, "beaconScanJob library version %s is starting up on a separate process", BuildConfig.VERSION_NAME); ProcessUtils processUtils = new ProcessUtils(ScanJob.this); LogManager.i(TAG, "beaconScanJob PID is "+processUtils.getPid()+" with process name "+processUtils.getProcessName()); } ModelSpecificDistanceCalculator defaultDistanceCalculator = new ModelSpecificDistanceCalculator(ScanJob.this, BeaconManager.getDistanceModelUpdateUrl()); Beacon.setDistanceCalculator(defaultDistanceCalculator); return restartScanning(); }
[ "private", "boolean", "startScanning", "(", ")", "{", "BeaconManager", "beaconManager", "=", "BeaconManager", ".", "getInstanceForApplication", "(", "getApplicationContext", "(", ")", ")", ";", "beaconManager", ".", "setScannerInSameProcess", "(", "true", ")", ";", ...
Returns true of scanning actually was started, false if it did not need to be
[ "Returns", "true", "of", "scanning", "actually", "was", "started", "false", "if", "it", "did", "not", "need", "to", "be" ]
train
https://github.com/AltBeacon/android-beacon-library/blob/f7f3a323ea7415d53e7bd695ff6a01f1501d5dc3/lib/src/main/java/org/altbeacon/beacon/service/ScanJob.java#L238-L252
apache/flink
flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtil.java
TypeSerializerSerializationUtil.writeSerializer
public static <T> void writeSerializer(DataOutputView out, TypeSerializer<T> serializer) throws IOException { new TypeSerializerSerializationUtil.TypeSerializerSerializationProxy<>(serializer).write(out); }
java
public static <T> void writeSerializer(DataOutputView out, TypeSerializer<T> serializer) throws IOException { new TypeSerializerSerializationUtil.TypeSerializerSerializationProxy<>(serializer).write(out); }
[ "public", "static", "<", "T", ">", "void", "writeSerializer", "(", "DataOutputView", "out", ",", "TypeSerializer", "<", "T", ">", "serializer", ")", "throws", "IOException", "{", "new", "TypeSerializerSerializationUtil", ".", "TypeSerializerSerializationProxy", "<>", ...
Writes a {@link TypeSerializer} to the provided data output view. <p>It is written with a format that can be later read again using {@link #tryReadSerializer(DataInputView, ClassLoader, boolean)}. @param out the data output view. @param serializer the serializer to write. @param <T> Data type of the serializer. @throws IOException
[ "Writes", "a", "{", "@link", "TypeSerializer", "}", "to", "the", "provided", "data", "output", "view", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/common/typeutils/TypeSerializerSerializationUtil.java#L68-L70
omadahealth/TypefaceView
lib/src/main/java/com/github/omadahealth/typefaceview/TypefaceTextView.java
TypefaceTextView.setCustomTypeface
@BindingAdapter("bind:tv_typeface") public static void setCustomTypeface(TypefaceTextView textView, String type) { textView.mCurrentTypeface = TypefaceType.getTypeface(type != null ? type : ""); Typeface typeface = getFont(textView.getContext(), textView.mCurrentTypeface.getAssetFileName()); textView.setTypeface(typeface); }
java
@BindingAdapter("bind:tv_typeface") public static void setCustomTypeface(TypefaceTextView textView, String type) { textView.mCurrentTypeface = TypefaceType.getTypeface(type != null ? type : ""); Typeface typeface = getFont(textView.getContext(), textView.mCurrentTypeface.getAssetFileName()); textView.setTypeface(typeface); }
[ "@", "BindingAdapter", "(", "\"bind:tv_typeface\"", ")", "public", "static", "void", "setCustomTypeface", "(", "TypefaceTextView", "textView", ",", "String", "type", ")", "{", "textView", ".", "mCurrentTypeface", "=", "TypefaceType", ".", "getTypeface", "(", "type",...
Data-binding method for custom attribute bind:tv_typeface to be set @param textView The instance of the object to set value on @param type The string name of the typeface, same as in xml
[ "Data", "-", "binding", "method", "for", "custom", "attribute", "bind", ":", "tv_typeface", "to", "be", "set" ]
train
https://github.com/omadahealth/TypefaceView/blob/9a36a67b0fb26584c3e20a24f8f0bafad6a0badd/lib/src/main/java/com/github/omadahealth/typefaceview/TypefaceTextView.java#L79-L84
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java
CommerceOrderItemPersistenceImpl.findByCPInstanceId
@Override public List<CommerceOrderItem> findByCPInstanceId(long CPInstanceId, int start, int end) { return findByCPInstanceId(CPInstanceId, start, end, null); }
java
@Override public List<CommerceOrderItem> findByCPInstanceId(long CPInstanceId, int start, int end) { return findByCPInstanceId(CPInstanceId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceOrderItem", ">", "findByCPInstanceId", "(", "long", "CPInstanceId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCPInstanceId", "(", "CPInstanceId", ",", "start", ",", "end", ",", "null", ...
Returns a range of all the commerce order items where CPInstanceId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceOrderItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPInstanceId the cp instance ID @param start the lower bound of the range of commerce order items @param end the upper bound of the range of commerce order items (not inclusive) @return the range of matching commerce order items
[ "Returns", "a", "range", "of", "all", "the", "commerce", "order", "items", "where", "CPInstanceId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java#L1173-L1177
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java
FindingReplacing.setBetns
public NegateMultiPos<S, Integer, Integer> setBetns(int leftIndex, int rightIndex) { return new NegateMultiPos<S, Integer, Integer>(leftIndex, rightIndex) { @Override protected S result() { return delegateQueue('I', left, right, pos, position, null, plusminus, filltgt); } }; }
java
public NegateMultiPos<S, Integer, Integer> setBetns(int leftIndex, int rightIndex) { return new NegateMultiPos<S, Integer, Integer>(leftIndex, rightIndex) { @Override protected S result() { return delegateQueue('I', left, right, pos, position, null, plusminus, filltgt); } }; }
[ "public", "NegateMultiPos", "<", "S", ",", "Integer", ",", "Integer", ">", "setBetns", "(", "int", "leftIndex", ",", "int", "rightIndex", ")", "{", "return", "new", "NegateMultiPos", "<", "S", ",", "Integer", ",", "Integer", ">", "(", "leftIndex", ",", "...
Sets the substring in given left index and right index as the delegate string <p><b>The look result same as {@link StrMatcher#finder()}'s behavior</b> @see StrMatcher#finder() @param leftIndex @param rightIndex @return
[ "Sets", "the", "substring", "in", "given", "left", "index", "and", "right", "index", "as", "the", "delegate", "string", "<p", ">", "<b", ">", "The", "look", "result", "same", "as", "{", "@link", "StrMatcher#finder", "()", "}", "s", "behavior<", "/", "b",...
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java#L327-L334
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/process/WordShapeClassifier.java
WordShapeClassifier.wordShapeChris4
private static String wordShapeChris4(String s, boolean omitIfInBoundary, Collection<String> knownLCWords) { int len = s.length(); if (len <= BOUNDARY_SIZE * 2) { return wordShapeChris4Short(s, len, knownLCWords); } else { return wordShapeChris4Long(s, omitIfInBoundary, len, knownLCWords); } }
java
private static String wordShapeChris4(String s, boolean omitIfInBoundary, Collection<String> knownLCWords) { int len = s.length(); if (len <= BOUNDARY_SIZE * 2) { return wordShapeChris4Short(s, len, knownLCWords); } else { return wordShapeChris4Long(s, omitIfInBoundary, len, knownLCWords); } }
[ "private", "static", "String", "wordShapeChris4", "(", "String", "s", ",", "boolean", "omitIfInBoundary", ",", "Collection", "<", "String", ">", "knownLCWords", ")", "{", "int", "len", "=", "s", ".", "length", "(", ")", ";", "if", "(", "len", "<=", "BOUN...
This one picks up on Dan2 ideas, but seeks to make less distinctions mid sequence by sorting for long words, but to maintain extra distinctions for short words, by always recording the class of the first and last two characters of the word. Compared to chris2 on which it is based, it uses more Unicode classes, and so collapses things like punctuation more, and might work better with real unicode. @param s The String to find the word shape of @param omitIfInBoundary If true, character classes present in the first or last two (i.e., BOUNDARY_SIZE) letters of the word are not also registered as classes that appear in the middle of the word. @param knownLCWords If non-null and non-empty, tag with a "k" suffix words that are in this list when lowercased (representing that the word is "known" as a lowercase word). @return A word shape for the word.
[ "This", "one", "picks", "up", "on", "Dan2", "ideas", "but", "seeks", "to", "make", "less", "distinctions", "mid", "sequence", "by", "sorting", "for", "long", "words", "but", "to", "maintain", "extra", "distinctions", "for", "short", "words", "by", "always", ...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/process/WordShapeClassifier.java#L555-L562
pawelprazak/java-extended
guava/src/main/java/com/bluecatcode/common/security/KeyProvider.java
KeyProvider.getKey
public Key getKey(String alias, String password) { try { return keyStore.getKey(alias, password.toCharArray()); } catch (GeneralSecurityException e) { throw new IllegalStateException(e); } }
java
public Key getKey(String alias, String password) { try { return keyStore.getKey(alias, password.toCharArray()); } catch (GeneralSecurityException e) { throw new IllegalStateException(e); } }
[ "public", "Key", "getKey", "(", "String", "alias", ",", "String", "password", ")", "{", "try", "{", "return", "keyStore", ".", "getKey", "(", "alias", ",", "password", ".", "toCharArray", "(", ")", ")", ";", "}", "catch", "(", "GeneralSecurityException", ...
Gets a key from the key store @param alias key alias @param password key password @return the key
[ "Gets", "a", "key", "from", "the", "key", "store" ]
train
https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/security/KeyProvider.java#L41-L47
DDTH/ddth-queue
ddth-queue-core/src/main/java/com/github/ddth/queue/utils/MongoUtils.java
MongoUtils.collectionExists
public static boolean collectionExists(MongoDatabase db, String collectionName) { return db.listCollections().filter(Filters.eq("name", collectionName)).first() != null; }
java
public static boolean collectionExists(MongoDatabase db, String collectionName) { return db.listCollections().filter(Filters.eq("name", collectionName)).first() != null; }
[ "public", "static", "boolean", "collectionExists", "(", "MongoDatabase", "db", ",", "String", "collectionName", ")", "{", "return", "db", ".", "listCollections", "(", ")", ".", "filter", "(", "Filters", ".", "eq", "(", "\"name\"", ",", "collectionName", ")", ...
Check if a collection exists. @param db @param collectionName @return
[ "Check", "if", "a", "collection", "exists", "." ]
train
https://github.com/DDTH/ddth-queue/blob/b20776850d23111d3d71fc8ed6023c590bc3621f/ddth-queue-core/src/main/java/com/github/ddth/queue/utils/MongoUtils.java#L35-L37
feroult/yawp
yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java
ResourceFinder.mapAllClasses
public Map<String, Class> mapAllClasses(String uri) throws IOException, ClassNotFoundException { Map<String, Class> classes = new HashMap<>(); Map<String, String> map = mapAllStrings(uri); for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); String string = (String) entry.getKey(); String className = (String) entry.getValue(); Class clazz = classLoader.loadClass(className); classes.put(string, clazz); } return classes; }
java
public Map<String, Class> mapAllClasses(String uri) throws IOException, ClassNotFoundException { Map<String, Class> classes = new HashMap<>(); Map<String, String> map = mapAllStrings(uri); for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); String string = (String) entry.getKey(); String className = (String) entry.getValue(); Class clazz = classLoader.loadClass(className); classes.put(string, clazz); } return classes; }
[ "public", "Map", "<", "String", ",", "Class", ">", "mapAllClasses", "(", "String", "uri", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "Map", "<", "String", ",", "Class", ">", "classes", "=", "new", "HashMap", "<>", "(", ")", ";", "M...
Executes mapAllStrings assuming the value of each entry in the map is the name of a class that should be loaded. <p/> Any class that cannot be loaded will be cause an exception to be thrown. <p/> Example classpath: <p/> META-INF/xmlparsers/xerces META-INF/xmlparsers/crimson <p/> ResourceFinder finder = new ResourceFinder("META-INF/"); Map map = finder.mapAvailableStrings("xmlparsers"); map.contains("xerces"); // true map.contains("crimson"); // true Class xercesClass = map.get("xerces"); Class crimsonClass = map.get("crimson"); @param uri @return @throws IOException @throws ClassNotFoundException
[ "Executes", "mapAllStrings", "assuming", "the", "value", "of", "each", "entry", "in", "the", "map", "is", "the", "name", "of", "a", "class", "that", "should", "be", "loaded", ".", "<p", "/", ">", "Any", "class", "that", "cannot", "be", "loaded", "will", ...
train
https://github.com/feroult/yawp/blob/b90deb905edd3fdb3009a5525e310cd17ead7f3d/yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java#L381-L392
looly/hutool
hutool-db/src/main/java/cn/hutool/db/meta/Column.java
Column.init
public void init(String tableName, ResultSet columnMetaRs) throws SQLException { this.tableName = tableName; this.name = columnMetaRs.getString("COLUMN_NAME"); this.type = columnMetaRs.getInt("DATA_TYPE"); this.size = columnMetaRs.getInt("COLUMN_SIZE"); this.isNullable = columnMetaRs.getBoolean("NULLABLE"); this.comment = columnMetaRs.getString("REMARKS"); }
java
public void init(String tableName, ResultSet columnMetaRs) throws SQLException { this.tableName = tableName; this.name = columnMetaRs.getString("COLUMN_NAME"); this.type = columnMetaRs.getInt("DATA_TYPE"); this.size = columnMetaRs.getInt("COLUMN_SIZE"); this.isNullable = columnMetaRs.getBoolean("NULLABLE"); this.comment = columnMetaRs.getString("REMARKS"); }
[ "public", "void", "init", "(", "String", "tableName", ",", "ResultSet", "columnMetaRs", ")", "throws", "SQLException", "{", "this", ".", "tableName", "=", "tableName", ";", "this", ".", "name", "=", "columnMetaRs", ".", "getString", "(", "\"COLUMN_NAME\"", ")"...
初始化 @param tableName 表名 @param columnMetaRs 列的meta ResultSet @throws SQLException SQL执行异常
[ "初始化" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/meta/Column.java#L73-L81
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/imageprocess/AipImageProcess.java
AipImageProcess.dehaze
public JSONObject dehaze(byte[] image, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); String base64Content = Base64Util.encode(image); request.addBody("image", base64Content); if (options != null) { request.addBody(options); } request.setUri(ImageProcessConsts.DEHAZE); postOperation(request); return requestServer(request); }
java
public JSONObject dehaze(byte[] image, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); String base64Content = Base64Util.encode(image); request.addBody("image", base64Content); if (options != null) { request.addBody(options); } request.setUri(ImageProcessConsts.DEHAZE); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "dehaze", "(", "byte", "[", "]", "image", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "String"...
图像去雾接口 对浓雾天气下拍摄,导致细节无法辨认的图像进行去雾处理,还原更清晰真实的图像。 @param image - 二进制图像数据 @param options - 可选参数对象,key: value都为string类型 options - options列表: @return JSONObject
[ "图像去雾接口", "对浓雾天气下拍摄,导致细节无法辨认的图像进行去雾处理,还原更清晰真实的图像。" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/imageprocess/AipImageProcess.java#L83-L95
wnameless/rubycollect4j
src/main/java/net/sf/rubycollect4j/RubyObject.java
RubyObject.send
public static <E> E send(Object o, String methodName, Character arg) { return send(o, methodName, (Object) arg); }
java
public static <E> E send(Object o, String methodName, Character arg) { return send(o, methodName, (Object) arg); }
[ "public", "static", "<", "E", ">", "E", "send", "(", "Object", "o", ",", "String", "methodName", ",", "Character", "arg", ")", "{", "return", "send", "(", "o", ",", "methodName", ",", "(", "Object", ")", "arg", ")", ";", "}" ]
Executes a method of any Object by Java reflection. @param o an Object @param methodName name of the method @param arg a Character @return the result of the method called
[ "Executes", "a", "method", "of", "any", "Object", "by", "Java", "reflection", "." ]
train
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyObject.java#L363-L365
voldemort/voldemort
contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/HadoopStoreBuilder.java
HadoopStoreBuilder.writeMetadataFile
private void writeMetadataFile(Path directoryPath, FileSystem outputFs, String metadataFileName, ReadOnlyStorageMetadata metadata) throws IOException { Path metadataPath = new Path(directoryPath, metadataFileName); FSDataOutputStream metadataStream = outputFs.create(metadataPath); outputFs.setPermission(metadataPath, new FsPermission(HADOOP_FILE_PERMISSION)); metadataStream.write(metadata.toJsonString().getBytes()); metadataStream.flush(); metadataStream.close(); }
java
private void writeMetadataFile(Path directoryPath, FileSystem outputFs, String metadataFileName, ReadOnlyStorageMetadata metadata) throws IOException { Path metadataPath = new Path(directoryPath, metadataFileName); FSDataOutputStream metadataStream = outputFs.create(metadataPath); outputFs.setPermission(metadataPath, new FsPermission(HADOOP_FILE_PERMISSION)); metadataStream.write(metadata.toJsonString().getBytes()); metadataStream.flush(); metadataStream.close(); }
[ "private", "void", "writeMetadataFile", "(", "Path", "directoryPath", ",", "FileSystem", "outputFs", ",", "String", "metadataFileName", ",", "ReadOnlyStorageMetadata", "metadata", ")", "throws", "IOException", "{", "Path", "metadataPath", "=", "new", "Path", "(", "d...
Persists a *.metadata file to a specific directory in HDFS. @param directoryPath where to write the metadata file. @param outputFs {@link org.apache.hadoop.fs.FileSystem} where to write the file @param metadataFileName name of the file (including extension) @param metadata {@link voldemort.store.readonly.ReadOnlyStorageMetadata} to persist on HDFS @throws IOException if the FileSystem operations fail
[ "Persists", "a", "*", ".", "metadata", "file", "to", "a", "specific", "directory", "in", "HDFS", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/HadoopStoreBuilder.java#L435-L445
JodaOrg/joda-time
src/main/java/org/joda/time/base/BasePeriod.java
BasePeriod.setFieldInto
protected void setFieldInto(int[] values, DurationFieldType field, int value) { int index = indexOf(field); if (index == -1) { if (value != 0 || field == null) { throw new IllegalArgumentException( "Period does not support field '" + field + "'"); } } else { values[index] = value; } }
java
protected void setFieldInto(int[] values, DurationFieldType field, int value) { int index = indexOf(field); if (index == -1) { if (value != 0 || field == null) { throw new IllegalArgumentException( "Period does not support field '" + field + "'"); } } else { values[index] = value; } }
[ "protected", "void", "setFieldInto", "(", "int", "[", "]", "values", ",", "DurationFieldType", "field", ",", "int", "value", ")", "{", "int", "index", "=", "indexOf", "(", "field", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "if", "(", ...
Sets the value of a field in this period. @param values the array of values to update @param field the field to set @param value the value to set @throws IllegalArgumentException if field is null or not supported.
[ "Sets", "the", "value", "of", "a", "field", "in", "this", "period", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/base/BasePeriod.java#L485-L495
virgo47/javasimon
examples/src/main/java/org/javasimon/examples/jmx/MonitoredApplication.java
MonitoredApplication.doInsert
protected final void doInsert(Connection c) throws SQLException { PreparedStatement stmt = null; try { stmt = c.prepareStatement("insert into foo values (?, ?) "); stmt.setInt(1, rand.nextInt(99999)); stmt.setString(2, "This is a text"); stmt.executeUpdate(); } finally { if (stmt != null) { stmt.close(); } } }
java
protected final void doInsert(Connection c) throws SQLException { PreparedStatement stmt = null; try { stmt = c.prepareStatement("insert into foo values (?, ?) "); stmt.setInt(1, rand.nextInt(99999)); stmt.setString(2, "This is a text"); stmt.executeUpdate(); } finally { if (stmt != null) { stmt.close(); } } }
[ "protected", "final", "void", "doInsert", "(", "Connection", "c", ")", "throws", "SQLException", "{", "PreparedStatement", "stmt", "=", "null", ";", "try", "{", "stmt", "=", "c", ".", "prepareStatement", "(", "\"insert into foo values (?, ?) \"", ")", ";", "stm...
Executes prepared insert into table <i>foo</i>. @param c connection to DB @throws SQLException if something goes wrong
[ "Executes", "prepared", "insert", "into", "table", "<i", ">", "foo<", "/", "i", ">", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/examples/src/main/java/org/javasimon/examples/jmx/MonitoredApplication.java#L58-L70
susom/database
src/main/java/com/github/susom/database/DatabaseProvider.java
DatabaseProvider.fromPool
@CheckReturnValue public static Builder fromPool(Pool pool) { return new BuilderImpl(pool.poolShutdown, () -> { try { return pool.dataSource.getConnection(); } catch (Exception e) { throw new DatabaseException("Unable to obtain a connection from the DataSource", e); } }, new OptionsDefault(pool.flavor)); }
java
@CheckReturnValue public static Builder fromPool(Pool pool) { return new BuilderImpl(pool.poolShutdown, () -> { try { return pool.dataSource.getConnection(); } catch (Exception e) { throw new DatabaseException("Unable to obtain a connection from the DataSource", e); } }, new OptionsDefault(pool.flavor)); }
[ "@", "CheckReturnValue", "public", "static", "Builder", "fromPool", "(", "Pool", "pool", ")", "{", "return", "new", "BuilderImpl", "(", "pool", ".", "poolShutdown", ",", "(", ")", "->", "{", "try", "{", "return", "pool", ".", "dataSource", ".", "getConnect...
Use an externally configured DataSource, Flavor, and optionally a shutdown hook. The shutdown hook may be null if you don't want calls to Builder.close() to attempt any shutdown. The DataSource and Flavor are mandatory.
[ "Use", "an", "externally", "configured", "DataSource", "Flavor", "and", "optionally", "a", "shutdown", "hook", ".", "The", "shutdown", "hook", "may", "be", "null", "if", "you", "don", "t", "want", "calls", "to", "Builder", ".", "close", "()", "to", "attemp...
train
https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/DatabaseProvider.java#L108-L117
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java
JBBPDslBuilder.Float
public JBBPDslBuilder Float(final String name) { final Item item = new Item(BinType.FLOAT, name, this.byteOrder); this.addItem(item); return this; }
java
public JBBPDslBuilder Float(final String name) { final Item item = new Item(BinType.FLOAT, name, this.byteOrder); this.addItem(item); return this; }
[ "public", "JBBPDslBuilder", "Float", "(", "final", "String", "name", ")", "{", "final", "Item", "item", "=", "new", "Item", "(", "BinType", ".", "FLOAT", ",", "name", ",", "this", ".", "byteOrder", ")", ";", "this", ".", "addItem", "(", "item", ")", ...
Add named float field @param name name of the field, can be null for anonymous @return the builder instance, must not be null
[ "Add", "named", "float", "field" ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1223-L1227
mockito/mockito
src/main/java/org/mockito/internal/stubbing/InvocationContainerImpl.java
InvocationContainerImpl.addAnswer
public StubbedInvocationMatcher addAnswer(Answer answer, boolean isConsecutive, Strictness stubbingStrictness) { Invocation invocation = invocationForStubbing.getInvocation(); mockingProgress().stubbingCompleted(); if (answer instanceof ValidableAnswer) { ((ValidableAnswer) answer).validateFor(invocation); } synchronized (stubbed) { if (isConsecutive) { stubbed.getFirst().addAnswer(answer); } else { Strictness effectiveStrictness = stubbingStrictness != null ? stubbingStrictness : this.mockStrictness; stubbed.addFirst(new StubbedInvocationMatcher(answer, invocationForStubbing, effectiveStrictness)); } return stubbed.getFirst(); } }
java
public StubbedInvocationMatcher addAnswer(Answer answer, boolean isConsecutive, Strictness stubbingStrictness) { Invocation invocation = invocationForStubbing.getInvocation(); mockingProgress().stubbingCompleted(); if (answer instanceof ValidableAnswer) { ((ValidableAnswer) answer).validateFor(invocation); } synchronized (stubbed) { if (isConsecutive) { stubbed.getFirst().addAnswer(answer); } else { Strictness effectiveStrictness = stubbingStrictness != null ? stubbingStrictness : this.mockStrictness; stubbed.addFirst(new StubbedInvocationMatcher(answer, invocationForStubbing, effectiveStrictness)); } return stubbed.getFirst(); } }
[ "public", "StubbedInvocationMatcher", "addAnswer", "(", "Answer", "answer", ",", "boolean", "isConsecutive", ",", "Strictness", "stubbingStrictness", ")", "{", "Invocation", "invocation", "=", "invocationForStubbing", ".", "getInvocation", "(", ")", ";", "mockingProgres...
Adds new stubbed answer and returns the invocation matcher the answer was added to.
[ "Adds", "new", "stubbed", "answer", "and", "returns", "the", "invocation", "matcher", "the", "answer", "was", "added", "to", "." ]
train
https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/stubbing/InvocationContainerImpl.java#L66-L82
molgenis/molgenis
molgenis-navigator/src/main/java/org/molgenis/navigator/copy/service/RelationTransformer.java
RelationTransformer.transformExtends
static void transformExtends(EntityType entityType, Map<String, EntityType> newEntityTypes) { if (newEntityTypes.isEmpty()) { return; } EntityType entityTypeExtends = entityType.getExtends(); if (entityTypeExtends != null) { String extendsId = entityTypeExtends.getId(); if (newEntityTypes.containsKey(extendsId)) { entityType.setExtends(newEntityTypes.get(extendsId)); } } }
java
static void transformExtends(EntityType entityType, Map<String, EntityType> newEntityTypes) { if (newEntityTypes.isEmpty()) { return; } EntityType entityTypeExtends = entityType.getExtends(); if (entityTypeExtends != null) { String extendsId = entityTypeExtends.getId(); if (newEntityTypes.containsKey(extendsId)) { entityType.setExtends(newEntityTypes.get(extendsId)); } } }
[ "static", "void", "transformExtends", "(", "EntityType", "entityType", ",", "Map", "<", "String", ",", "EntityType", ">", "newEntityTypes", ")", "{", "if", "(", "newEntityTypes", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "EntityType", "entityTy...
Changes the parent of an {@link EntityType} to let it inherit from another, new EntityType. Does nothing if the Map does not contain the ID of the current parent EntityType. @param entityType the EntityType to update @param newEntityTypes a Map of (old) EntityType IDs and new EntityTypes
[ "Changes", "the", "parent", "of", "an", "{", "@link", "EntityType", "}", "to", "let", "it", "inherit", "from", "another", "new", "EntityType", ".", "Does", "nothing", "if", "the", "Map", "does", "not", "contain", "the", "ID", "of", "the", "current", "par...
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-navigator/src/main/java/org/molgenis/navigator/copy/service/RelationTransformer.java#L50-L62
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java
RemoteLockMapImpl.getReaders
public Collection getReaders(Object obj) { Collection result = null; try { Identity oid = new Identity(obj, getBroker()); byte selector = (byte) 'r'; byte[] requestBarr = buildRequestArray(oid, selector); HttpURLConnection conn = getHttpUrlConnection(); //post request BufferedOutputStream out = new BufferedOutputStream(conn.getOutputStream()); out.write(requestBarr,0,requestBarr.length); out.flush(); // read result from InputStream in = conn.getInputStream(); ObjectInputStream ois = new ObjectInputStream(in); result = (Collection) ois.readObject(); // cleanup ois.close(); out.close(); conn.disconnect(); } catch (Throwable t) { throw new PersistenceBrokerException(t); } return result; }
java
public Collection getReaders(Object obj) { Collection result = null; try { Identity oid = new Identity(obj, getBroker()); byte selector = (byte) 'r'; byte[] requestBarr = buildRequestArray(oid, selector); HttpURLConnection conn = getHttpUrlConnection(); //post request BufferedOutputStream out = new BufferedOutputStream(conn.getOutputStream()); out.write(requestBarr,0,requestBarr.length); out.flush(); // read result from InputStream in = conn.getInputStream(); ObjectInputStream ois = new ObjectInputStream(in); result = (Collection) ois.readObject(); // cleanup ois.close(); out.close(); conn.disconnect(); } catch (Throwable t) { throw new PersistenceBrokerException(t); } return result; }
[ "public", "Collection", "getReaders", "(", "Object", "obj", ")", "{", "Collection", "result", "=", "null", ";", "try", "{", "Identity", "oid", "=", "new", "Identity", "(", "obj", ",", "getBroker", "(", ")", ")", ";", "byte", "selector", "=", "(", "byte...
returns a collection of Reader LockEntries for object obj. If now LockEntries could be found an empty Vector is returned.
[ "returns", "a", "collection", "of", "Reader", "LockEntries", "for", "object", "obj", ".", "If", "now", "LockEntries", "could", "be", "found", "an", "empty", "Vector", "is", "returned", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/locking/RemoteLockMapImpl.java#L146-L177
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipAssert.java
SipAssert.assertHeaderContains
public static void assertHeaderContains(SipMessage sipMessage, String header, String value) { assertHeaderContains(null, sipMessage, header, value); // value is case // sensitive? }
java
public static void assertHeaderContains(SipMessage sipMessage, String header, String value) { assertHeaderContains(null, sipMessage, header, value); // value is case // sensitive? }
[ "public", "static", "void", "assertHeaderContains", "(", "SipMessage", "sipMessage", ",", "String", "header", ",", "String", "value", ")", "{", "assertHeaderContains", "(", "null", ",", "sipMessage", ",", "header", ",", "value", ")", ";", "// value is case\r", "...
Asserts that the given SIP message contains at least one occurrence of the specified header and that at least one occurrence of this header contains the given value. The assertion fails if no occurrence of the header contains the value or if the header is not present in the mesage. @param sipMessage the SIP message. @param header the string identifying the header as specified in RFC-3261. @param value the string value within the header to look for. An exact string match is done against the entire contents of the header. The assertion will pass if any part of the header matches the value given.
[ "Asserts", "that", "the", "given", "SIP", "message", "contains", "at", "least", "one", "occurrence", "of", "the", "specified", "header", "and", "that", "at", "least", "one", "occurrence", "of", "this", "header", "contains", "the", "given", "value", ".", "The...
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L162-L165
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java
StandardDirectoryAgentServer.handleUDPAttrRqst
protected void handleUDPAttrRqst(AttrRqst attrRqst, InetSocketAddress localAddress, InetSocketAddress remoteAddress) { // Match scopes, RFC 2608, 11.1 if (!scopes.weakMatch(attrRqst.getScopes())) { udpAttrRply.perform(localAddress, remoteAddress, attrRqst, SLPError.SCOPE_NOT_SUPPORTED); return; } Attributes attributes = matchAttributes(attrRqst); if (logger.isLoggable(Level.FINE)) logger.fine("DirectoryAgent " + this + " returning attributes for service " + attrRqst.getURL() + ": " + attributes.asString()); udpAttrRply.perform(localAddress, remoteAddress, attrRqst, attributes); }
java
protected void handleUDPAttrRqst(AttrRqst attrRqst, InetSocketAddress localAddress, InetSocketAddress remoteAddress) { // Match scopes, RFC 2608, 11.1 if (!scopes.weakMatch(attrRqst.getScopes())) { udpAttrRply.perform(localAddress, remoteAddress, attrRqst, SLPError.SCOPE_NOT_SUPPORTED); return; } Attributes attributes = matchAttributes(attrRqst); if (logger.isLoggable(Level.FINE)) logger.fine("DirectoryAgent " + this + " returning attributes for service " + attrRqst.getURL() + ": " + attributes.asString()); udpAttrRply.perform(localAddress, remoteAddress, attrRqst, attributes); }
[ "protected", "void", "handleUDPAttrRqst", "(", "AttrRqst", "attrRqst", ",", "InetSocketAddress", "localAddress", ",", "InetSocketAddress", "remoteAddress", ")", "{", "// Match scopes, RFC 2608, 11.1", "if", "(", "!", "scopes", ".", "weakMatch", "(", "attrRqst", ".", "...
Handles unicast UDP AttrRqst message arrived to this directory agent. <br /> This directory agent will reply with a list of attributes of matching services. @param attrRqst the AttrRqst message to handle @param localAddress the socket address the message arrived to @param remoteAddress the socket address the message was sent from
[ "Handles", "unicast", "UDP", "AttrRqst", "message", "arrived", "to", "this", "directory", "agent", ".", "<br", "/", ">", "This", "directory", "agent", "will", "reply", "with", "a", "list", "of", "attributes", "of", "matching", "services", "." ]
train
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/da/StandardDirectoryAgentServer.java#L618-L632
Netflix/conductor
grpc-client/src/main/java/com/netflix/conductor/client/grpc/TaskClient.java
TaskClient.pollTask
public Task pollTask(String taskType, String workerId, String domain) { Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); Preconditions.checkArgument(StringUtils.isNotBlank(domain), "Domain cannot be blank"); Preconditions.checkArgument(StringUtils.isNotBlank(workerId), "Worker id cannot be blank"); TaskServicePb.PollResponse response = stub.poll( TaskServicePb.PollRequest.newBuilder() .setTaskType(taskType) .setWorkerId(workerId) .setDomain(domain) .build() ); return protoMapper.fromProto(response.getTask()); }
java
public Task pollTask(String taskType, String workerId, String domain) { Preconditions.checkArgument(StringUtils.isNotBlank(taskType), "Task type cannot be blank"); Preconditions.checkArgument(StringUtils.isNotBlank(domain), "Domain cannot be blank"); Preconditions.checkArgument(StringUtils.isNotBlank(workerId), "Worker id cannot be blank"); TaskServicePb.PollResponse response = stub.poll( TaskServicePb.PollRequest.newBuilder() .setTaskType(taskType) .setWorkerId(workerId) .setDomain(domain) .build() ); return protoMapper.fromProto(response.getTask()); }
[ "public", "Task", "pollTask", "(", "String", "taskType", ",", "String", "workerId", ",", "String", "domain", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "taskType", ")", ",", "\"Task type cannot be blank\"", ")", ...
Perform a poll for a task of a specific task type. @param taskType The taskType to poll for @param domain The domain of the task type @param workerId Name of the client worker. Used for logging. @return Task waiting to be executed.
[ "Perform", "a", "poll", "for", "a", "task", "of", "a", "specific", "task", "type", "." ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/grpc-client/src/main/java/com/netflix/conductor/client/grpc/TaskClient.java#L35-L48
SimonVT/android-menudrawer
menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java
MenuDrawer.setMenuView
public void setMenuView(View view) { setMenuView(view, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); }
java
public void setMenuView(View view) { setMenuView(view, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); }
[ "public", "void", "setMenuView", "(", "View", "view", ")", "{", "setMenuView", "(", "view", ",", "new", "LayoutParams", "(", "LayoutParams", ".", "MATCH_PARENT", ",", "LayoutParams", ".", "MATCH_PARENT", ")", ")", ";", "}" ]
Set the menu view to an explicit view. @param view The menu view.
[ "Set", "the", "menu", "view", "to", "an", "explicit", "view", "." ]
train
https://github.com/SimonVT/android-menudrawer/blob/59e8d18e109c77d911b8b63232d66d5f0551cf6a/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java#L1421-L1423