repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java
AbstractOptionsForSelect.withRowAsyncListeners
public T withRowAsyncListeners(List<Function<Row, Row>> rowAsyncListeners) { """ Add the given list of async listeners on the {@link com.datastax.driver.core.Row} object. Example of usage: <pre class="code"><code class="java"> .withRowAsyncListeners(Arrays.asList(row -> { //Do something with the row object here })) </code></pre> Remark: <strong>You can inspect and read values from the row object</strong> """ getOptions().setRowAsyncListeners(Optional.of(rowAsyncListeners)); return getThis(); }
java
public T withRowAsyncListeners(List<Function<Row, Row>> rowAsyncListeners) { getOptions().setRowAsyncListeners(Optional.of(rowAsyncListeners)); return getThis(); }
[ "public", "T", "withRowAsyncListeners", "(", "List", "<", "Function", "<", "Row", ",", "Row", ">", ">", "rowAsyncListeners", ")", "{", "getOptions", "(", ")", ".", "setRowAsyncListeners", "(", "Optional", ".", "of", "(", "rowAsyncListeners", ")", ")", ";", "return", "getThis", "(", ")", ";", "}" ]
Add the given list of async listeners on the {@link com.datastax.driver.core.Row} object. Example of usage: <pre class="code"><code class="java"> .withRowAsyncListeners(Arrays.asList(row -> { //Do something with the row object here })) </code></pre> Remark: <strong>You can inspect and read values from the row object</strong>
[ "Add", "the", "given", "list", "of", "async", "listeners", "on", "the", "{", "@link", "com", ".", "datastax", ".", "driver", ".", "core", ".", "Row", "}", "object", ".", "Example", "of", "usage", ":", "<pre", "class", "=", "code", ">", "<code", "class", "=", "java", ">" ]
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/dsl/options/AbstractOptionsForSelect.java#L218-L221
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.collectEntries
public static <K,V> Map<?, ?> collectEntries(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<?> transform) { """ Iterates through this Map transforming each entry using the <code>transform</code> closure and returning a map of the transformed entries. <pre class="groovyTestCase"> assert [a:1, b:2].collectEntries { key, value {@code ->} [value, key] } == [1:'a', 2:'b'] assert [a:1, b:2].collectEntries { key, value {@code ->} [(value*10): key.toUpperCase()] } == [10:'A', 20:'B'] </pre> Note: When using the list-style of result, the behavior is '<code>def (key, value) = listResultFromClosure</code>'. While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case; throwing away elements after the second one and using null for the key or value for the case of a shortened list. If your Map doesn't support null keys or values, you might get a runtime error, e.g. NullPointerException or IllegalArgumentException. @param self a Map @param transform the closure used for transforming, which can take one (Map.Entry) or two (key, value) parameters and should return a Map.Entry, a Map or a two-element list containing the resulting key and value @return a Map of the transformed entries @see #collect(Map, Collection, Closure) @since 1.7.9 """ return collectEntries(self, createSimilarMap(self), transform); }
java
public static <K,V> Map<?, ?> collectEntries(Map<K, V> self, @ClosureParams(MapEntryOrKeyValue.class) Closure<?> transform) { return collectEntries(self, createSimilarMap(self), transform); }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "?", ",", "?", ">", "collectEntries", "(", "Map", "<", "K", ",", "V", ">", "self", ",", "@", "ClosureParams", "(", "MapEntryOrKeyValue", ".", "class", ")", "Closure", "<", "?", ">", "transform", ")", "{", "return", "collectEntries", "(", "self", ",", "createSimilarMap", "(", "self", ")", ",", "transform", ")", ";", "}" ]
Iterates through this Map transforming each entry using the <code>transform</code> closure and returning a map of the transformed entries. <pre class="groovyTestCase"> assert [a:1, b:2].collectEntries { key, value {@code ->} [value, key] } == [1:'a', 2:'b'] assert [a:1, b:2].collectEntries { key, value {@code ->} [(value*10): key.toUpperCase()] } == [10:'A', 20:'B'] </pre> Note: When using the list-style of result, the behavior is '<code>def (key, value) = listResultFromClosure</code>'. While we strongly discourage using a list of size other than 2, Groovy's normal semantics apply in this case; throwing away elements after the second one and using null for the key or value for the case of a shortened list. If your Map doesn't support null keys or values, you might get a runtime error, e.g. NullPointerException or IllegalArgumentException. @param self a Map @param transform the closure used for transforming, which can take one (Map.Entry) or two (key, value) parameters and should return a Map.Entry, a Map or a two-element list containing the resulting key and value @return a Map of the transformed entries @see #collect(Map, Collection, Closure) @since 1.7.9
[ "Iterates", "through", "this", "Map", "transforming", "each", "entry", "using", "the", "<code", ">", "transform<", "/", "code", ">", "closure", "and", "returning", "a", "map", "of", "the", "transformed", "entries", ".", "<pre", "class", "=", "groovyTestCase", ">", "assert", "[", "a", ":", "1", "b", ":", "2", "]", ".", "collectEntries", "{", "key", "value", "{", "@code", "-", ">", "}", "[", "value", "key", "]", "}", "==", "[", "1", ":", "a", "2", ":", "b", "]", "assert", "[", "a", ":", "1", "b", ":", "2", "]", ".", "collectEntries", "{", "key", "value", "{", "@code", "-", ">", "}", "[", "(", "value", "*", "10", ")", ":", "key", ".", "toUpperCase", "()", "]", "}", "==", "[", "10", ":", "A", "20", ":", "B", "]", "<", "/", "pre", ">", "Note", ":", "When", "using", "the", "list", "-", "style", "of", "result", "the", "behavior", "is", "<code", ">", "def", "(", "key", "value", ")", "=", "listResultFromClosure<", "/", "code", ">", ".", "While", "we", "strongly", "discourage", "using", "a", "list", "of", "size", "other", "than", "2", "Groovy", "s", "normal", "semantics", "apply", "in", "this", "case", ";", "throwing", "away", "elements", "after", "the", "second", "one", "and", "using", "null", "for", "the", "key", "or", "value", "for", "the", "case", "of", "a", "shortened", "list", ".", "If", "your", "Map", "doesn", "t", "support", "null", "keys", "or", "values", "you", "might", "get", "a", "runtime", "error", "e", ".", "g", ".", "NullPointerException", "or", "IllegalArgumentException", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L3998-L4000
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.binarySearch
public static <T> int binarySearch(final T[] a, final T key, final Comparator<? super T> cmp) { """ {@link Arrays#binarySearch(Object[], Object, Comparator)} @param a @param key @param cmp @return """ return Array.binarySearch(a, key, cmp); }
java
public static <T> int binarySearch(final T[] a, final T key, final Comparator<? super T> cmp) { return Array.binarySearch(a, key, cmp); }
[ "public", "static", "<", "T", ">", "int", "binarySearch", "(", "final", "T", "[", "]", "a", ",", "final", "T", "key", ",", "final", "Comparator", "<", "?", "super", "T", ">", "cmp", ")", "{", "return", "Array", ".", "binarySearch", "(", "a", ",", "key", ",", "cmp", ")", ";", "}" ]
{@link Arrays#binarySearch(Object[], Object, Comparator)} @param a @param key @param cmp @return
[ "{", "@link", "Arrays#binarySearch", "(", "Object", "[]", "Object", "Comparator", ")", "}" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L12281-L12283
cycorp/api-suite
core-api/src/main/java/com/cyc/query/exception/QueryRuntimeException.java
QueryRuntimeException.fromThrowable
public static QueryRuntimeException fromThrowable(String message, Throwable t) { """ Converts a Throwable to a QueryRuntimeException with the specified detail message. If the Throwable is a QueryRuntimeException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new QueryRuntimeException with the detail message. @param t the Throwable to convert @param message the specified detail message @return a QueryRuntimeException """ return (t instanceof QueryRuntimeException && Objects.equals(message, t.getMessage())) ? (QueryRuntimeException) t : new QueryRuntimeException(message, t); }
java
public static QueryRuntimeException fromThrowable(String message, Throwable t) { return (t instanceof QueryRuntimeException && Objects.equals(message, t.getMessage())) ? (QueryRuntimeException) t : new QueryRuntimeException(message, t); }
[ "public", "static", "QueryRuntimeException", "fromThrowable", "(", "String", "message", ",", "Throwable", "t", ")", "{", "return", "(", "t", "instanceof", "QueryRuntimeException", "&&", "Objects", ".", "equals", "(", "message", ",", "t", ".", "getMessage", "(", ")", ")", ")", "?", "(", "QueryRuntimeException", ")", "t", ":", "new", "QueryRuntimeException", "(", "message", ",", "t", ")", ";", "}" ]
Converts a Throwable to a QueryRuntimeException with the specified detail message. If the Throwable is a QueryRuntimeException and if the Throwable's message is identical to the one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a new QueryRuntimeException with the detail message. @param t the Throwable to convert @param message the specified detail message @return a QueryRuntimeException
[ "Converts", "a", "Throwable", "to", "a", "QueryRuntimeException", "with", "the", "specified", "detail", "message", ".", "If", "the", "Throwable", "is", "a", "QueryRuntimeException", "and", "if", "the", "Throwable", "s", "message", "is", "identical", "to", "the", "one", "supplied", "the", "Throwable", "will", "be", "passed", "through", "unmodified", ";", "otherwise", "it", "will", "be", "wrapped", "in", "a", "new", "QueryRuntimeException", "with", "the", "detail", "message", "." ]
train
https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/query/exception/QueryRuntimeException.java#L60-L64
apache/incubator-druid
extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchAggregatorFactory.java
HllSketchAggregatorFactory.getRequiredColumns
@Override public List<AggregatorFactory> getRequiredColumns() { """ This is a convoluted way to return a list of input field names this aggregator needs. Currently the returned factories are only used to obtain a field name by calling getName() method. """ return Collections.singletonList(new HllSketchBuildAggregatorFactory(fieldName, fieldName, lgK, tgtHllType.toString())); }
java
@Override public List<AggregatorFactory> getRequiredColumns() { return Collections.singletonList(new HllSketchBuildAggregatorFactory(fieldName, fieldName, lgK, tgtHllType.toString())); }
[ "@", "Override", "public", "List", "<", "AggregatorFactory", ">", "getRequiredColumns", "(", ")", "{", "return", "Collections", ".", "singletonList", "(", "new", "HllSketchBuildAggregatorFactory", "(", "fieldName", ",", "fieldName", ",", "lgK", ",", "tgtHllType", ".", "toString", "(", ")", ")", ")", ";", "}" ]
This is a convoluted way to return a list of input field names this aggregator needs. Currently the returned factories are only used to obtain a field name by calling getName() method.
[ "This", "is", "a", "convoluted", "way", "to", "return", "a", "list", "of", "input", "field", "names", "this", "aggregator", "needs", ".", "Currently", "the", "returned", "factories", "are", "only", "used", "to", "obtain", "a", "field", "name", "by", "calling", "getName", "()", "method", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchAggregatorFactory.java#L104-L108
opencb/biodata
biodata-formats/src/main/java/org/opencb/biodata/formats/sequence/fastq/FastQ.java
FastQ.transformQualityScoresArray
private void transformQualityScoresArray(int oldEncoding, int newEncoding) { """ Transform the quality scores array if the score types of the encodings are different @param oldEncoding - old quality encoding type @param newEncoding - new quality encoding type """ // If the score types of the encodings are different if (FastQ.SCALE_SCORE[oldEncoding] != FastQ.SCALE_SCORE[newEncoding]) { // Score Map selection Map<Integer, Integer> scoreMap; if (FastQ.SCALE_SCORE[oldEncoding] == FastQ.PHRED_SCORE_TYPE) { scoreMap = FastQ.phredToSolexaMap; } else { scoreMap = FastQ.solexaToPhredMap; } // Transform each quality score in the quality scores array for (int i = 0; i < this.qualityScoresArray.length; i++) { if (qualityScoresArray[i] < 10) { qualityScoresArray[i] = scoreMap.get(qualityScoresArray[i]); } } } }
java
private void transformQualityScoresArray(int oldEncoding, int newEncoding) { // If the score types of the encodings are different if (FastQ.SCALE_SCORE[oldEncoding] != FastQ.SCALE_SCORE[newEncoding]) { // Score Map selection Map<Integer, Integer> scoreMap; if (FastQ.SCALE_SCORE[oldEncoding] == FastQ.PHRED_SCORE_TYPE) { scoreMap = FastQ.phredToSolexaMap; } else { scoreMap = FastQ.solexaToPhredMap; } // Transform each quality score in the quality scores array for (int i = 0; i < this.qualityScoresArray.length; i++) { if (qualityScoresArray[i] < 10) { qualityScoresArray[i] = scoreMap.get(qualityScoresArray[i]); } } } }
[ "private", "void", "transformQualityScoresArray", "(", "int", "oldEncoding", ",", "int", "newEncoding", ")", "{", "// If the score types of the encodings are different", "if", "(", "FastQ", ".", "SCALE_SCORE", "[", "oldEncoding", "]", "!=", "FastQ", ".", "SCALE_SCORE", "[", "newEncoding", "]", ")", "{", "// Score Map selection", "Map", "<", "Integer", ",", "Integer", ">", "scoreMap", ";", "if", "(", "FastQ", ".", "SCALE_SCORE", "[", "oldEncoding", "]", "==", "FastQ", ".", "PHRED_SCORE_TYPE", ")", "{", "scoreMap", "=", "FastQ", ".", "phredToSolexaMap", ";", "}", "else", "{", "scoreMap", "=", "FastQ", ".", "solexaToPhredMap", ";", "}", "// Transform each quality score in the quality scores array", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "qualityScoresArray", ".", "length", ";", "i", "++", ")", "{", "if", "(", "qualityScoresArray", "[", "i", "]", "<", "10", ")", "{", "qualityScoresArray", "[", "i", "]", "=", "scoreMap", ".", "get", "(", "qualityScoresArray", "[", "i", "]", ")", ";", "}", "}", "}", "}" ]
Transform the quality scores array if the score types of the encodings are different @param oldEncoding - old quality encoding type @param newEncoding - new quality encoding type
[ "Transform", "the", "quality", "scores", "array", "if", "the", "score", "types", "of", "the", "encodings", "are", "different" ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-formats/src/main/java/org/opencb/biodata/formats/sequence/fastq/FastQ.java#L305-L322
ironjacamar/ironjacamar
deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java
AbstractResourceAdapterDeployer.hasFailuresLevel
protected boolean hasFailuresLevel(Collection<Failure> failures, int severity) { """ Check for failures at a certain level @param failures failures failures The failures @param severity severity severity The level @return True if a failure is found with the specified severity; otherwise false """ if (failures != null) { for (Failure failure : failures) { if (failure.getSeverity() == severity) { return true; } } } return false; }
java
protected boolean hasFailuresLevel(Collection<Failure> failures, int severity) { if (failures != null) { for (Failure failure : failures) { if (failure.getSeverity() == severity) { return true; } } } return false; }
[ "protected", "boolean", "hasFailuresLevel", "(", "Collection", "<", "Failure", ">", "failures", ",", "int", "severity", ")", "{", "if", "(", "failures", "!=", "null", ")", "{", "for", "(", "Failure", "failure", ":", "failures", ")", "{", "if", "(", "failure", ".", "getSeverity", "(", ")", "==", "severity", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Check for failures at a certain level @param failures failures failures The failures @param severity severity severity The level @return True if a failure is found with the specified severity; otherwise false
[ "Check", "for", "failures", "at", "a", "certain", "level" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java#L1510-L1523
neoremind/navi
navi-mgr-console/src/main/java/com/baidu/beidou/navimgr/common/handler/GlobalExceptionHandler.java
GlobalExceptionHandler.resolveException
@Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object o, Exception e) { """ 全局处理错误 @param request current HTTP request @param response current HTTP response @param handler the executed handler, or <code>null</code> if none chosen at the time of the exception (for example, if multipart resolution failed) @param ex the exception that got thrown during handler execution @return a corresponding ModelAndView to forward to, or <code>null</code> for default processing @see org.springframework.web.servlet.HandlerExceptionResolver#resolveException(javax.servlet.http .HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, java.lang.Exception) """ ModelAndView model = new ModelAndView(new MappingJacksonJsonView()); try { if (e instanceof TypeMismatchException) { LOG.warn("TypeMismatchException occurred. " + e.getMessage()); return buildBizErrors((TypeMismatchException) e, model); } else if (e instanceof BindException) { LOG.warn("BindException occurred. " + e.getMessage()); return buildBizErrors((BindException) e, model); } else if (e instanceof HttpRequestMethodNotSupportedException) { LOG.warn("HttpRequestMethodNotSupportedException occurred. " + e.getMessage()); return buildError(model, GlobalResponseStatusMsg.REQUEST_HTTP_METHOD_ERROR); } else if (e instanceof MissingServletRequestParameterException) { LOG.warn("MissingServletRequestParameterException occurred. " + e.getMessage()); return buildError(model, GlobalResponseStatusMsg.PARAM_MISS_ERROR); } else { LOG.error("System error occurred. " + e.getMessage(), e); return buildError(model, GlobalResponseStatusMsg.SYSTEM_ERROR); } } catch (Exception ex) { // Omit all detailed error message including stack trace to external user LOG.error("Unexpected error occurred! This should never happen! " + ex.getMessage(), ex); model.addObject("status", SYS_ERROR_CODE); model.addObject("msg", SYS_ERROR_MSG); return model; } }
java
@Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object o, Exception e) { ModelAndView model = new ModelAndView(new MappingJacksonJsonView()); try { if (e instanceof TypeMismatchException) { LOG.warn("TypeMismatchException occurred. " + e.getMessage()); return buildBizErrors((TypeMismatchException) e, model); } else if (e instanceof BindException) { LOG.warn("BindException occurred. " + e.getMessage()); return buildBizErrors((BindException) e, model); } else if (e instanceof HttpRequestMethodNotSupportedException) { LOG.warn("HttpRequestMethodNotSupportedException occurred. " + e.getMessage()); return buildError(model, GlobalResponseStatusMsg.REQUEST_HTTP_METHOD_ERROR); } else if (e instanceof MissingServletRequestParameterException) { LOG.warn("MissingServletRequestParameterException occurred. " + e.getMessage()); return buildError(model, GlobalResponseStatusMsg.PARAM_MISS_ERROR); } else { LOG.error("System error occurred. " + e.getMessage(), e); return buildError(model, GlobalResponseStatusMsg.SYSTEM_ERROR); } } catch (Exception ex) { // Omit all detailed error message including stack trace to external user LOG.error("Unexpected error occurred! This should never happen! " + ex.getMessage(), ex); model.addObject("status", SYS_ERROR_CODE); model.addObject("msg", SYS_ERROR_MSG); return model; } }
[ "@", "Override", "public", "ModelAndView", "resolveException", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "Object", "o", ",", "Exception", "e", ")", "{", "ModelAndView", "model", "=", "new", "ModelAndView", "(", "new", "MappingJacksonJsonView", "(", ")", ")", ";", "try", "{", "if", "(", "e", "instanceof", "TypeMismatchException", ")", "{", "LOG", ".", "warn", "(", "\"TypeMismatchException occurred. \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "return", "buildBizErrors", "(", "(", "TypeMismatchException", ")", "e", ",", "model", ")", ";", "}", "else", "if", "(", "e", "instanceof", "BindException", ")", "{", "LOG", ".", "warn", "(", "\"BindException occurred. \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "return", "buildBizErrors", "(", "(", "BindException", ")", "e", ",", "model", ")", ";", "}", "else", "if", "(", "e", "instanceof", "HttpRequestMethodNotSupportedException", ")", "{", "LOG", ".", "warn", "(", "\"HttpRequestMethodNotSupportedException occurred. \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "return", "buildError", "(", "model", ",", "GlobalResponseStatusMsg", ".", "REQUEST_HTTP_METHOD_ERROR", ")", ";", "}", "else", "if", "(", "e", "instanceof", "MissingServletRequestParameterException", ")", "{", "LOG", ".", "warn", "(", "\"MissingServletRequestParameterException occurred. \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "return", "buildError", "(", "model", ",", "GlobalResponseStatusMsg", ".", "PARAM_MISS_ERROR", ")", ";", "}", "else", "{", "LOG", ".", "error", "(", "\"System error occurred. \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "return", "buildError", "(", "model", ",", "GlobalResponseStatusMsg", ".", "SYSTEM_ERROR", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "// Omit all detailed error message including stack trace to external user", "LOG", ".", "error", "(", "\"Unexpected error occurred! This should never happen! \"", "+", "ex", ".", "getMessage", "(", ")", ",", "ex", ")", ";", "model", ".", "addObject", "(", "\"status\"", ",", "SYS_ERROR_CODE", ")", ";", "model", ".", "addObject", "(", "\"msg\"", ",", "SYS_ERROR_MSG", ")", ";", "return", "model", ";", "}", "}" ]
全局处理错误 @param request current HTTP request @param response current HTTP response @param handler the executed handler, or <code>null</code> if none chosen at the time of the exception (for example, if multipart resolution failed) @param ex the exception that got thrown during handler execution @return a corresponding ModelAndView to forward to, or <code>null</code> for default processing @see org.springframework.web.servlet.HandlerExceptionResolver#resolveException(javax.servlet.http .HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, java.lang.Exception)
[ "全局处理错误" ]
train
https://github.com/neoremind/navi/blob/d37e4b46ef07d124be2740ad3d85d87e939acc84/navi-mgr-console/src/main/java/com/baidu/beidou/navimgr/common/handler/GlobalExceptionHandler.java#L72-L100
dihedron/dihedron-commons
src/main/java/org/dihedron/patterns/cache/CacheHelper.java
CacheHelper.putFromByteArray
public static long putFromByteArray(Cache cache, String resource, byte [] data) throws CacheException { """ Stores the given array of bytes under the given resource name. @param cache the cache that stores the resource. @param resource the name of the resource to be stored. @param data the array of bytes containing the resource. @return the number of bytes copied to the cache. @throws CacheException """ if(cache == null) { logger.error("cache reference must not be null"); throw new CacheException("invalid cache"); } ByteArrayInputStream input = null; OutputStream output = null; try { output = cache.put(resource); if(output != null) { input = new ByteArrayInputStream(data); long copied = Streams.copy(input, output); logger.trace("copied {} bytes into cache", copied); return copied; } } catch (IOException e) { logger.error("error copying data from byte array to cache", e); throw new CacheException("error copying data from byte array to cache", e); } finally { Streams.safelyClose(input); Streams.safelyClose(output); } return -1; }
java
public static long putFromByteArray(Cache cache, String resource, byte [] data) throws CacheException { if(cache == null) { logger.error("cache reference must not be null"); throw new CacheException("invalid cache"); } ByteArrayInputStream input = null; OutputStream output = null; try { output = cache.put(resource); if(output != null) { input = new ByteArrayInputStream(data); long copied = Streams.copy(input, output); logger.trace("copied {} bytes into cache", copied); return copied; } } catch (IOException e) { logger.error("error copying data from byte array to cache", e); throw new CacheException("error copying data from byte array to cache", e); } finally { Streams.safelyClose(input); Streams.safelyClose(output); } return -1; }
[ "public", "static", "long", "putFromByteArray", "(", "Cache", "cache", ",", "String", "resource", ",", "byte", "[", "]", "data", ")", "throws", "CacheException", "{", "if", "(", "cache", "==", "null", ")", "{", "logger", ".", "error", "(", "\"cache reference must not be null\"", ")", ";", "throw", "new", "CacheException", "(", "\"invalid cache\"", ")", ";", "}", "ByteArrayInputStream", "input", "=", "null", ";", "OutputStream", "output", "=", "null", ";", "try", "{", "output", "=", "cache", ".", "put", "(", "resource", ")", ";", "if", "(", "output", "!=", "null", ")", "{", "input", "=", "new", "ByteArrayInputStream", "(", "data", ")", ";", "long", "copied", "=", "Streams", ".", "copy", "(", "input", ",", "output", ")", ";", "logger", ".", "trace", "(", "\"copied {} bytes into cache\"", ",", "copied", ")", ";", "return", "copied", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "error", "(", "\"error copying data from byte array to cache\"", ",", "e", ")", ";", "throw", "new", "CacheException", "(", "\"error copying data from byte array to cache\"", ",", "e", ")", ";", "}", "finally", "{", "Streams", ".", "safelyClose", "(", "input", ")", ";", "Streams", ".", "safelyClose", "(", "output", ")", ";", "}", "return", "-", "1", ";", "}" ]
Stores the given array of bytes under the given resource name. @param cache the cache that stores the resource. @param resource the name of the resource to be stored. @param data the array of bytes containing the resource. @return the number of bytes copied to the cache. @throws CacheException
[ "Stores", "the", "given", "array", "of", "bytes", "under", "the", "given", "resource", "name", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/patterns/cache/CacheHelper.java#L83-L106
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.queryConversationEvents
public Observable<ComapiResult<ConversationEventsResponse>> queryConversationEvents(@NonNull final String conversationId, @NonNull final Long from, @NonNull final Integer limit) { """ Query conversation events. @param conversationId ID of a conversation to query events in it. @param from ID of the event to start from. @param limit Limit of events to obtain in this call. @return Observable to get events from a conversation. """ final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueQueryConversationEvents(conversationId, from, limit); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doQueryConversationEvents(token, conversationId, from, limit); } }
java
public Observable<ComapiResult<ConversationEventsResponse>> queryConversationEvents(@NonNull final String conversationId, @NonNull final Long from, @NonNull final Integer limit) { final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueQueryConversationEvents(conversationId, from, limit); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doQueryConversationEvents(token, conversationId, from, limit); } }
[ "public", "Observable", "<", "ComapiResult", "<", "ConversationEventsResponse", ">", ">", "queryConversationEvents", "(", "@", "NonNull", "final", "String", "conversationId", ",", "@", "NonNull", "final", "Long", "from", ",", "@", "NonNull", "final", "Integer", "limit", ")", "{", "final", "String", "token", "=", "getToken", "(", ")", ";", "if", "(", "sessionController", ".", "isCreatingSession", "(", ")", ")", "{", "return", "getTaskQueue", "(", ")", ".", "queueQueryConversationEvents", "(", "conversationId", ",", "from", ",", "limit", ")", ";", "}", "else", "if", "(", "TextUtils", ".", "isEmpty", "(", "token", ")", ")", "{", "return", "Observable", ".", "error", "(", "getSessionStateErrorDescription", "(", ")", ")", ";", "}", "else", "{", "return", "doQueryConversationEvents", "(", "token", ",", "conversationId", ",", "from", ",", "limit", ")", ";", "}", "}" ]
Query conversation events. @param conversationId ID of a conversation to query events in it. @param from ID of the event to start from. @param limit Limit of events to obtain in this call. @return Observable to get events from a conversation.
[ "Query", "conversation", "events", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L836-L847
nakamura5akihito/six-util
src/main/java/jp/go/aist/six/util/search/RelationalBinding.java
RelationalBinding.greaterThanBinding
public static RelationalBinding greaterThanBinding( final String property, final Object value ) { """ Creates a 'GREATER_THAN' binding. @param property the property. @param value the value to which the property should be related. @return a 'GREATER_THAN' binding. """ return (new RelationalBinding( property, Relation.GREATER_THAN, value )); }
java
public static RelationalBinding greaterThanBinding( final String property, final Object value ) { return (new RelationalBinding( property, Relation.GREATER_THAN, value )); }
[ "public", "static", "RelationalBinding", "greaterThanBinding", "(", "final", "String", "property", ",", "final", "Object", "value", ")", "{", "return", "(", "new", "RelationalBinding", "(", "property", ",", "Relation", ".", "GREATER_THAN", ",", "value", ")", ")", ";", "}" ]
Creates a 'GREATER_THAN' binding. @param property the property. @param value the value to which the property should be related. @return a 'GREATER_THAN' binding.
[ "Creates", "a", "GREATER_THAN", "binding", "." ]
train
https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/search/RelationalBinding.java#L130-L136
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java
CacheOnDisk.delTemplateEntry
public void delTemplateEntry(String template, Object entry) { """ Call this method to delete a cache id from a specified template in the disk. @param template - template id. @param entry - cache id. """ if (htod.delTemplateEntry(template, entry) == HTODDynacache.DISK_EXCEPTION) { stopOnError(this.htod.diskCacheException); } }
java
public void delTemplateEntry(String template, Object entry) { if (htod.delTemplateEntry(template, entry) == HTODDynacache.DISK_EXCEPTION) { stopOnError(this.htod.diskCacheException); } }
[ "public", "void", "delTemplateEntry", "(", "String", "template", ",", "Object", "entry", ")", "{", "if", "(", "htod", ".", "delTemplateEntry", "(", "template", ",", "entry", ")", "==", "HTODDynacache", ".", "DISK_EXCEPTION", ")", "{", "stopOnError", "(", "this", ".", "htod", ".", "diskCacheException", ")", ";", "}", "}" ]
Call this method to delete a cache id from a specified template in the disk. @param template - template id. @param entry - cache id.
[ "Call", "this", "method", "to", "delete", "a", "cache", "id", "from", "a", "specified", "template", "in", "the", "disk", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1526-L1530
mapbox/mapbox-plugins-android
plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java
OfflinePlugin.startDownload
public void startDownload(OfflineDownloadOptions options) { """ Start downloading an offline download by providing an options object. <p> You can listen to the actual creation of the download with {@link OfflineDownloadChangeListener}. </p> @param options the offline download builder @since 0.1.0 """ Intent intent = new Intent(context, OfflineDownloadService.class); intent.setAction(OfflineConstants.ACTION_START_DOWNLOAD); intent.putExtra(KEY_BUNDLE, options); context.startService(intent); }
java
public void startDownload(OfflineDownloadOptions options) { Intent intent = new Intent(context, OfflineDownloadService.class); intent.setAction(OfflineConstants.ACTION_START_DOWNLOAD); intent.putExtra(KEY_BUNDLE, options); context.startService(intent); }
[ "public", "void", "startDownload", "(", "OfflineDownloadOptions", "options", ")", "{", "Intent", "intent", "=", "new", "Intent", "(", "context", ",", "OfflineDownloadService", ".", "class", ")", ";", "intent", ".", "setAction", "(", "OfflineConstants", ".", "ACTION_START_DOWNLOAD", ")", ";", "intent", ".", "putExtra", "(", "KEY_BUNDLE", ",", "options", ")", ";", "context", ".", "startService", "(", "intent", ")", ";", "}" ]
Start downloading an offline download by providing an options object. <p> You can listen to the actual creation of the download with {@link OfflineDownloadChangeListener}. </p> @param options the offline download builder @since 0.1.0
[ "Start", "downloading", "an", "offline", "download", "by", "providing", "an", "options", "object", ".", "<p", ">", "You", "can", "listen", "to", "the", "actual", "creation", "of", "the", "download", "with", "{", "@link", "OfflineDownloadChangeListener", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java#L81-L86
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java
PoiUtil.matchCell
public static Cell matchCell(Row row, int colIndex, String searchKey) { """ 匹配单元格 @param row 行 @param colIndex 列索引 @param searchKey 单元格中包含的关键字 @return 单元格,没有找到时返回null """ val cell = row.getCell(colIndex); if (cell == null) return null; val value = getCellStringValue(cell); if (StringUtils.contains(value, searchKey)) return cell; return null; }
java
public static Cell matchCell(Row row, int colIndex, String searchKey) { val cell = row.getCell(colIndex); if (cell == null) return null; val value = getCellStringValue(cell); if (StringUtils.contains(value, searchKey)) return cell; return null; }
[ "public", "static", "Cell", "matchCell", "(", "Row", "row", ",", "int", "colIndex", ",", "String", "searchKey", ")", "{", "val", "cell", "=", "row", ".", "getCell", "(", "colIndex", ")", ";", "if", "(", "cell", "==", "null", ")", "return", "null", ";", "val", "value", "=", "getCellStringValue", "(", "cell", ")", ";", "if", "(", "StringUtils", ".", "contains", "(", "value", ",", "searchKey", ")", ")", "return", "cell", ";", "return", "null", ";", "}" ]
匹配单元格 @param row 行 @param colIndex 列索引 @param searchKey 单元格中包含的关键字 @return 单元格,没有找到时返回null
[ "匹配单元格" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java#L397-L405
alkacon/opencms-core
src/org/opencms/cmis/CmsCmisUtil.java
CmsCmisUtil.addPropertyDateTime
public static void addPropertyDateTime( CmsCmisTypeManager typeManager, PropertiesImpl props, String typeId, Set<String> filter, String id, GregorianCalendar value) { """ Adds a date/time property to a PropertiesImpl.<p> @param typeManager the type manager @param props the properties @param typeId the type id @param filter the property filter string @param id the property id @param value the property value """ if (!checkAddProperty(typeManager, props, typeId, filter, id)) { return; } props.addProperty(new PropertyDateTimeImpl(id, value)); }
java
public static void addPropertyDateTime( CmsCmisTypeManager typeManager, PropertiesImpl props, String typeId, Set<String> filter, String id, GregorianCalendar value) { if (!checkAddProperty(typeManager, props, typeId, filter, id)) { return; } props.addProperty(new PropertyDateTimeImpl(id, value)); }
[ "public", "static", "void", "addPropertyDateTime", "(", "CmsCmisTypeManager", "typeManager", ",", "PropertiesImpl", "props", ",", "String", "typeId", ",", "Set", "<", "String", ">", "filter", ",", "String", "id", ",", "GregorianCalendar", "value", ")", "{", "if", "(", "!", "checkAddProperty", "(", "typeManager", ",", "props", ",", "typeId", ",", "filter", ",", "id", ")", ")", "{", "return", ";", "}", "props", ".", "addProperty", "(", "new", "PropertyDateTimeImpl", "(", "id", ",", "value", ")", ")", ";", "}" ]
Adds a date/time property to a PropertiesImpl.<p> @param typeManager the type manager @param props the properties @param typeId the type id @param filter the property filter string @param id the property id @param value the property value
[ "Adds", "a", "date", "/", "time", "property", "to", "a", "PropertiesImpl", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisUtil.java#L192-L205
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java
ZipUtil.unzip
public static File unzip(String zipFilePath, String outFileDir) throws UtilException { """ 解压,默认UTF-8编码 @param zipFilePath 压缩文件的路径 @param outFileDir 解压到的目录 @return 解压的目录 @throws UtilException IO异常 """ return unzip(zipFilePath, outFileDir, DEFAULT_CHARSET); }
java
public static File unzip(String zipFilePath, String outFileDir) throws UtilException { return unzip(zipFilePath, outFileDir, DEFAULT_CHARSET); }
[ "public", "static", "File", "unzip", "(", "String", "zipFilePath", ",", "String", "outFileDir", ")", "throws", "UtilException", "{", "return", "unzip", "(", "zipFilePath", ",", "outFileDir", ",", "DEFAULT_CHARSET", ")", ";", "}" ]
解压,默认UTF-8编码 @param zipFilePath 压缩文件的路径 @param outFileDir 解压到的目录 @return 解压的目录 @throws UtilException IO异常
[ "解压,默认UTF", "-", "8编码" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L345-L347
windup/windup
rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/scan/ast/ignore/JavaClassIgnoreResolver.java
JavaClassIgnoreResolver.singletonInstance
public static JavaClassIgnoreResolver singletonInstance() { """ Gets the default instance of the {@link JavaClassIgnoreResolver}. This is not thread safe. """ if (defaultInstance == null) { TrieStructureTypeRelation<String,String> relation = new TrieStructureTypeRelation<String,String>() { @Override public String getStringToSearchFromSearchType(String search) { return search; } @Override public String getStringPrefixToSaveSaveType(String save) { /** * At least for now javaclass-ignore does not contain anything except the prefix */ return save; } @Override public boolean checkIfMatchFound(String saved, String searched) { return searched.startsWith(saved); } }; defaultInstance = new JavaClassIgnoreResolver(relation); } return defaultInstance; }
java
public static JavaClassIgnoreResolver singletonInstance() { if (defaultInstance == null) { TrieStructureTypeRelation<String,String> relation = new TrieStructureTypeRelation<String,String>() { @Override public String getStringToSearchFromSearchType(String search) { return search; } @Override public String getStringPrefixToSaveSaveType(String save) { /** * At least for now javaclass-ignore does not contain anything except the prefix */ return save; } @Override public boolean checkIfMatchFound(String saved, String searched) { return searched.startsWith(saved); } }; defaultInstance = new JavaClassIgnoreResolver(relation); } return defaultInstance; }
[ "public", "static", "JavaClassIgnoreResolver", "singletonInstance", "(", ")", "{", "if", "(", "defaultInstance", "==", "null", ")", "{", "TrieStructureTypeRelation", "<", "String", ",", "String", ">", "relation", "=", "new", "TrieStructureTypeRelation", "<", "String", ",", "String", ">", "(", ")", "{", "@", "Override", "public", "String", "getStringToSearchFromSearchType", "(", "String", "search", ")", "{", "return", "search", ";", "}", "@", "Override", "public", "String", "getStringPrefixToSaveSaveType", "(", "String", "save", ")", "{", "/**\n * At least for now javaclass-ignore does not contain anything except the prefix\n */", "return", "save", ";", "}", "@", "Override", "public", "boolean", "checkIfMatchFound", "(", "String", "saved", ",", "String", "searched", ")", "{", "return", "searched", ".", "startsWith", "(", "saved", ")", ";", "}", "}", ";", "defaultInstance", "=", "new", "JavaClassIgnoreResolver", "(", "relation", ")", ";", "}", "return", "defaultInstance", ";", "}" ]
Gets the default instance of the {@link JavaClassIgnoreResolver}. This is not thread safe.
[ "Gets", "the", "default", "instance", "of", "the", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/java/scan/ast/ignore/JavaClassIgnoreResolver.java#L18-L45
nohana/Amalgam
amalgam/src/main/java/com/amalgam/app/FragmentManagerUtils.java
FragmentManagerUtils.supportFindFragmentByTag
@SuppressWarnings("unchecked") // we know that the returning fragment is child of fragment. @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static <F extends android.support.v4.app.Fragment> F supportFindFragmentByTag(android.support.v4.app.FragmentManager manager, String tag) { """ Find a fragment that is under {@link android.support.v4.app.FragmentManager}'s control by the tag string. @param manager the fragment manager. @param tag the fragment tag. @param <F> the concrete fragment class parameter. @return the fragment. """ return (F) manager.findFragmentByTag(tag); }
java
@SuppressWarnings("unchecked") // we know that the returning fragment is child of fragment. @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static <F extends android.support.v4.app.Fragment> F supportFindFragmentByTag(android.support.v4.app.FragmentManager manager, String tag) { return (F) manager.findFragmentByTag(tag); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// we know that the returning fragment is child of fragment.", "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "public", "static", "<", "F", "extends", "android", ".", "support", ".", "v4", ".", "app", ".", "Fragment", ">", "F", "supportFindFragmentByTag", "(", "android", ".", "support", ".", "v4", ".", "app", ".", "FragmentManager", "manager", ",", "String", "tag", ")", "{", "return", "(", "F", ")", "manager", ".", "findFragmentByTag", "(", "tag", ")", ";", "}" ]
Find a fragment that is under {@link android.support.v4.app.FragmentManager}'s control by the tag string. @param manager the fragment manager. @param tag the fragment tag. @param <F> the concrete fragment class parameter. @return the fragment.
[ "Find", "a", "fragment", "that", "is", "under", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/FragmentManagerUtils.java#L61-L65
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setEnterpriseText
public void setEnterpriseText(int index, String value) { """ Set an enterprise text value. @param index text index (1-40) @param value text value """ set(selectField(AssignmentFieldLists.ENTERPRISE_TEXT, index), value); }
java
public void setEnterpriseText(int index, String value) { set(selectField(AssignmentFieldLists.ENTERPRISE_TEXT, index), value); }
[ "public", "void", "setEnterpriseText", "(", "int", "index", ",", "String", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "ENTERPRISE_TEXT", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise text value. @param index text index (1-40) @param value text value
[ "Set", "an", "enterprise", "text", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1804-L1807
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationIterator.java
CollationIterator.handleNextCE32
protected long handleNextCE32() { """ Returns the next code point and its local CE32 value. Returns Collation.FALLBACK_CE32 at the end of the text (c<0) or when c's CE32 value is to be looked up in the base data (fallback). The code point is used for fallbacks, context and implicit weights. It is ignored when the returned CE32 is not special (e.g., FFFD_CE32). Returns the code point in bits 63..32 (signed) and the CE32 in bits 31..0. """ int c = nextCodePoint(); if(c < 0) { return NO_CP_AND_CE32; } return makeCodePointAndCE32Pair(c, data.getCE32(c)); }
java
protected long handleNextCE32() { int c = nextCodePoint(); if(c < 0) { return NO_CP_AND_CE32; } return makeCodePointAndCE32Pair(c, data.getCE32(c)); }
[ "protected", "long", "handleNextCE32", "(", ")", "{", "int", "c", "=", "nextCodePoint", "(", ")", ";", "if", "(", "c", "<", "0", ")", "{", "return", "NO_CP_AND_CE32", ";", "}", "return", "makeCodePointAndCE32Pair", "(", "c", ",", "data", ".", "getCE32", "(", "c", ")", ")", ";", "}" ]
Returns the next code point and its local CE32 value. Returns Collation.FALLBACK_CE32 at the end of the text (c<0) or when c's CE32 value is to be looked up in the base data (fallback). The code point is used for fallbacks, context and implicit weights. It is ignored when the returned CE32 is not special (e.g., FFFD_CE32). Returns the code point in bits 63..32 (signed) and the CE32 in bits 31..0.
[ "Returns", "the", "next", "code", "point", "and", "its", "local", "CE32", "value", ".", "Returns", "Collation", ".", "FALLBACK_CE32", "at", "the", "end", "of", "the", "text", "(", "c<0", ")", "or", "when", "c", "s", "CE32", "value", "is", "to", "be", "looked", "up", "in", "the", "base", "data", "(", "fallback", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationIterator.java#L406-L410
Ashok-Varma/BottomNavigation
bottom-navigation-bar/src/main/java/com/ashokvarma/bottomnavigation/BottomNavigationBar.java
BottomNavigationBar.parseAttrs
private void parseAttrs(Context context, AttributeSet attrs) { """ This method initiates the bottomNavigationBar properties, Tries to get them form XML if not preset sets them to their default values. @param context context of the bottomNavigationBar @param attrs attributes mentioned in the layout XML by user """ if (attrs != null) { TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.BottomNavigationBar, 0, 0); mActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbActiveColor, Utils.fetchContextColor(context, R.attr.colorAccent)); mInActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbInactiveColor, Color.LTGRAY); mBackgroundColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbBackgroundColor, Color.WHITE); mAutoHideEnabled = typedArray.getBoolean(R.styleable.BottomNavigationBar_bnbAutoHideEnabled, true); mElevation = typedArray.getDimension(R.styleable.BottomNavigationBar_bnbElevation, getResources().getDimension(R.dimen.bottom_navigation_elevation)); setAnimationDuration(typedArray.getInt(R.styleable.BottomNavigationBar_bnbAnimationDuration, DEFAULT_ANIMATION_DURATION)); switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbMode, MODE_DEFAULT)) { case MODE_FIXED: mMode = MODE_FIXED; break; case MODE_SHIFTING: mMode = MODE_SHIFTING; break; case MODE_FIXED_NO_TITLE: mMode = MODE_FIXED_NO_TITLE; break; case MODE_SHIFTING_NO_TITLE: mMode = MODE_SHIFTING_NO_TITLE; break; case MODE_DEFAULT: default: mMode = MODE_DEFAULT; break; } switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbBackgroundStyle, BACKGROUND_STYLE_DEFAULT)) { case BACKGROUND_STYLE_STATIC: mBackgroundStyle = BACKGROUND_STYLE_STATIC; break; case BACKGROUND_STYLE_RIPPLE: mBackgroundStyle = BACKGROUND_STYLE_RIPPLE; break; case BACKGROUND_STYLE_DEFAULT: default: mBackgroundStyle = BACKGROUND_STYLE_DEFAULT; break; } typedArray.recycle(); } else { mActiveColor = Utils.fetchContextColor(context, R.attr.colorAccent); mInActiveColor = Color.LTGRAY; mBackgroundColor = Color.WHITE; mElevation = getResources().getDimension(R.dimen.bottom_navigation_elevation); } }
java
private void parseAttrs(Context context, AttributeSet attrs) { if (attrs != null) { TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.BottomNavigationBar, 0, 0); mActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbActiveColor, Utils.fetchContextColor(context, R.attr.colorAccent)); mInActiveColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbInactiveColor, Color.LTGRAY); mBackgroundColor = typedArray.getColor(R.styleable.BottomNavigationBar_bnbBackgroundColor, Color.WHITE); mAutoHideEnabled = typedArray.getBoolean(R.styleable.BottomNavigationBar_bnbAutoHideEnabled, true); mElevation = typedArray.getDimension(R.styleable.BottomNavigationBar_bnbElevation, getResources().getDimension(R.dimen.bottom_navigation_elevation)); setAnimationDuration(typedArray.getInt(R.styleable.BottomNavigationBar_bnbAnimationDuration, DEFAULT_ANIMATION_DURATION)); switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbMode, MODE_DEFAULT)) { case MODE_FIXED: mMode = MODE_FIXED; break; case MODE_SHIFTING: mMode = MODE_SHIFTING; break; case MODE_FIXED_NO_TITLE: mMode = MODE_FIXED_NO_TITLE; break; case MODE_SHIFTING_NO_TITLE: mMode = MODE_SHIFTING_NO_TITLE; break; case MODE_DEFAULT: default: mMode = MODE_DEFAULT; break; } switch (typedArray.getInt(R.styleable.BottomNavigationBar_bnbBackgroundStyle, BACKGROUND_STYLE_DEFAULT)) { case BACKGROUND_STYLE_STATIC: mBackgroundStyle = BACKGROUND_STYLE_STATIC; break; case BACKGROUND_STYLE_RIPPLE: mBackgroundStyle = BACKGROUND_STYLE_RIPPLE; break; case BACKGROUND_STYLE_DEFAULT: default: mBackgroundStyle = BACKGROUND_STYLE_DEFAULT; break; } typedArray.recycle(); } else { mActiveColor = Utils.fetchContextColor(context, R.attr.colorAccent); mInActiveColor = Color.LTGRAY; mBackgroundColor = Color.WHITE; mElevation = getResources().getDimension(R.dimen.bottom_navigation_elevation); } }
[ "private", "void", "parseAttrs", "(", "Context", "context", ",", "AttributeSet", "attrs", ")", "{", "if", "(", "attrs", "!=", "null", ")", "{", "TypedArray", "typedArray", "=", "context", ".", "getTheme", "(", ")", ".", "obtainStyledAttributes", "(", "attrs", ",", "R", ".", "styleable", ".", "BottomNavigationBar", ",", "0", ",", "0", ")", ";", "mActiveColor", "=", "typedArray", ".", "getColor", "(", "R", ".", "styleable", ".", "BottomNavigationBar_bnbActiveColor", ",", "Utils", ".", "fetchContextColor", "(", "context", ",", "R", ".", "attr", ".", "colorAccent", ")", ")", ";", "mInActiveColor", "=", "typedArray", ".", "getColor", "(", "R", ".", "styleable", ".", "BottomNavigationBar_bnbInactiveColor", ",", "Color", ".", "LTGRAY", ")", ";", "mBackgroundColor", "=", "typedArray", ".", "getColor", "(", "R", ".", "styleable", ".", "BottomNavigationBar_bnbBackgroundColor", ",", "Color", ".", "WHITE", ")", ";", "mAutoHideEnabled", "=", "typedArray", ".", "getBoolean", "(", "R", ".", "styleable", ".", "BottomNavigationBar_bnbAutoHideEnabled", ",", "true", ")", ";", "mElevation", "=", "typedArray", ".", "getDimension", "(", "R", ".", "styleable", ".", "BottomNavigationBar_bnbElevation", ",", "getResources", "(", ")", ".", "getDimension", "(", "R", ".", "dimen", ".", "bottom_navigation_elevation", ")", ")", ";", "setAnimationDuration", "(", "typedArray", ".", "getInt", "(", "R", ".", "styleable", ".", "BottomNavigationBar_bnbAnimationDuration", ",", "DEFAULT_ANIMATION_DURATION", ")", ")", ";", "switch", "(", "typedArray", ".", "getInt", "(", "R", ".", "styleable", ".", "BottomNavigationBar_bnbMode", ",", "MODE_DEFAULT", ")", ")", "{", "case", "MODE_FIXED", ":", "mMode", "=", "MODE_FIXED", ";", "break", ";", "case", "MODE_SHIFTING", ":", "mMode", "=", "MODE_SHIFTING", ";", "break", ";", "case", "MODE_FIXED_NO_TITLE", ":", "mMode", "=", "MODE_FIXED_NO_TITLE", ";", "break", ";", "case", "MODE_SHIFTING_NO_TITLE", ":", "mMode", "=", "MODE_SHIFTING_NO_TITLE", ";", "break", ";", "case", "MODE_DEFAULT", ":", "default", ":", "mMode", "=", "MODE_DEFAULT", ";", "break", ";", "}", "switch", "(", "typedArray", ".", "getInt", "(", "R", ".", "styleable", ".", "BottomNavigationBar_bnbBackgroundStyle", ",", "BACKGROUND_STYLE_DEFAULT", ")", ")", "{", "case", "BACKGROUND_STYLE_STATIC", ":", "mBackgroundStyle", "=", "BACKGROUND_STYLE_STATIC", ";", "break", ";", "case", "BACKGROUND_STYLE_RIPPLE", ":", "mBackgroundStyle", "=", "BACKGROUND_STYLE_RIPPLE", ";", "break", ";", "case", "BACKGROUND_STYLE_DEFAULT", ":", "default", ":", "mBackgroundStyle", "=", "BACKGROUND_STYLE_DEFAULT", ";", "break", ";", "}", "typedArray", ".", "recycle", "(", ")", ";", "}", "else", "{", "mActiveColor", "=", "Utils", ".", "fetchContextColor", "(", "context", ",", "R", ".", "attr", ".", "colorAccent", ")", ";", "mInActiveColor", "=", "Color", ".", "LTGRAY", ";", "mBackgroundColor", "=", "Color", ".", "WHITE", ";", "mElevation", "=", "getResources", "(", ")", ".", "getDimension", "(", "R", ".", "dimen", ".", "bottom_navigation_elevation", ")", ";", "}", "}" ]
This method initiates the bottomNavigationBar properties, Tries to get them form XML if not preset sets them to their default values. @param context context of the bottomNavigationBar @param attrs attributes mentioned in the layout XML by user
[ "This", "method", "initiates", "the", "bottomNavigationBar", "properties", "Tries", "to", "get", "them", "form", "XML", "if", "not", "preset", "sets", "them", "to", "their", "default", "values", "." ]
train
https://github.com/Ashok-Varma/BottomNavigation/blob/a5c486a6dfa1ebe7049e2e025e0d967111ecfd0b/bottom-navigation-bar/src/main/java/com/ashokvarma/bottomnavigation/BottomNavigationBar.java#L146-L203
hankcs/HanLP
src/main/java/com/hankcs/hanlp/model/crf/crfpp/Path.java
Path.calcExpectation
public void calcExpectation(double[] expected, double Z, int size) { """ 计算边的期望 @param expected 输出期望 @param Z 规范化因子 @param size 标签个数 """ double c = Math.exp(lnode.alpha + cost + rnode.beta - Z); for (int i = 0; fvector.get(i) != -1; i++) { int idx = fvector.get(i) + lnode.y * size + rnode.y; expected[idx] += c; } }
java
public void calcExpectation(double[] expected, double Z, int size) { double c = Math.exp(lnode.alpha + cost + rnode.beta - Z); for (int i = 0; fvector.get(i) != -1; i++) { int idx = fvector.get(i) + lnode.y * size + rnode.y; expected[idx] += c; } }
[ "public", "void", "calcExpectation", "(", "double", "[", "]", "expected", ",", "double", "Z", ",", "int", "size", ")", "{", "double", "c", "=", "Math", ".", "exp", "(", "lnode", ".", "alpha", "+", "cost", "+", "rnode", ".", "beta", "-", "Z", ")", ";", "for", "(", "int", "i", "=", "0", ";", "fvector", ".", "get", "(", "i", ")", "!=", "-", "1", ";", "i", "++", ")", "{", "int", "idx", "=", "fvector", ".", "get", "(", "i", ")", "+", "lnode", ".", "y", "*", "size", "+", "rnode", ".", "y", ";", "expected", "[", "idx", "]", "+=", "c", ";", "}", "}" ]
计算边的期望 @param expected 输出期望 @param Z 规范化因子 @param size 标签个数
[ "计算边的期望" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/crf/crfpp/Path.java#L36-L44
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java
AvroUtils.getDirectorySchema
public static Schema getDirectorySchema(Path directory, FileSystem fs, boolean latest) throws IOException { """ Get the latest avro schema for a directory @param directory the input dir that contains avro files @param fs the {@link FileSystem} for the given directory. @param latest true to return latest schema, false to return oldest schema @return the latest/oldest schema in the directory @throws IOException """ Schema schema = null; try (Closer closer = Closer.create()) { List<FileStatus> files = getDirectorySchemaHelper(directory, fs); if (files == null || files.size() == 0) { LOG.warn("There is no previous avro file in the directory: " + directory); } else { FileStatus file = latest ? files.get(0) : files.get(files.size() - 1); LOG.debug("Path to get the avro schema: " + file); FsInput fi = new FsInput(file.getPath(), fs.getConf()); GenericDatumReader<GenericRecord> genReader = new GenericDatumReader<>(); schema = closer.register(new DataFileReader<>(fi, genReader)).getSchema(); } } catch (IOException ioe) { throw new IOException("Cannot get the schema for directory " + directory, ioe); } return schema; }
java
public static Schema getDirectorySchema(Path directory, FileSystem fs, boolean latest) throws IOException { Schema schema = null; try (Closer closer = Closer.create()) { List<FileStatus> files = getDirectorySchemaHelper(directory, fs); if (files == null || files.size() == 0) { LOG.warn("There is no previous avro file in the directory: " + directory); } else { FileStatus file = latest ? files.get(0) : files.get(files.size() - 1); LOG.debug("Path to get the avro schema: " + file); FsInput fi = new FsInput(file.getPath(), fs.getConf()); GenericDatumReader<GenericRecord> genReader = new GenericDatumReader<>(); schema = closer.register(new DataFileReader<>(fi, genReader)).getSchema(); } } catch (IOException ioe) { throw new IOException("Cannot get the schema for directory " + directory, ioe); } return schema; }
[ "public", "static", "Schema", "getDirectorySchema", "(", "Path", "directory", ",", "FileSystem", "fs", ",", "boolean", "latest", ")", "throws", "IOException", "{", "Schema", "schema", "=", "null", ";", "try", "(", "Closer", "closer", "=", "Closer", ".", "create", "(", ")", ")", "{", "List", "<", "FileStatus", ">", "files", "=", "getDirectorySchemaHelper", "(", "directory", ",", "fs", ")", ";", "if", "(", "files", "==", "null", "||", "files", ".", "size", "(", ")", "==", "0", ")", "{", "LOG", ".", "warn", "(", "\"There is no previous avro file in the directory: \"", "+", "directory", ")", ";", "}", "else", "{", "FileStatus", "file", "=", "latest", "?", "files", ".", "get", "(", "0", ")", ":", "files", ".", "get", "(", "files", ".", "size", "(", ")", "-", "1", ")", ";", "LOG", ".", "debug", "(", "\"Path to get the avro schema: \"", "+", "file", ")", ";", "FsInput", "fi", "=", "new", "FsInput", "(", "file", ".", "getPath", "(", ")", ",", "fs", ".", "getConf", "(", ")", ")", ";", "GenericDatumReader", "<", "GenericRecord", ">", "genReader", "=", "new", "GenericDatumReader", "<>", "(", ")", ";", "schema", "=", "closer", ".", "register", "(", "new", "DataFileReader", "<>", "(", "fi", ",", "genReader", ")", ")", ".", "getSchema", "(", ")", ";", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "IOException", "(", "\"Cannot get the schema for directory \"", "+", "directory", ",", "ioe", ")", ";", "}", "return", "schema", ";", "}" ]
Get the latest avro schema for a directory @param directory the input dir that contains avro files @param fs the {@link FileSystem} for the given directory. @param latest true to return latest schema, false to return oldest schema @return the latest/oldest schema in the directory @throws IOException
[ "Get", "the", "latest", "avro", "schema", "for", "a", "directory" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/AvroUtils.java#L492-L509
kaazing/gateway
mina.netty/src/main/java/org/kaazing/mina/core/future/DefaultWriteFutureEx.java
DefaultWriteFutureEx.newNotWrittenFuture
public static WriteFutureEx newNotWrittenFuture(IoSession session, Throwable cause) { """ Returns a new {@link DefaultWriteFuture} which is already marked as 'not written'. """ DefaultWriteFutureEx unwrittenFuture = new DefaultWriteFutureEx(session); unwrittenFuture.setException(cause); return unwrittenFuture; }
java
public static WriteFutureEx newNotWrittenFuture(IoSession session, Throwable cause) { DefaultWriteFutureEx unwrittenFuture = new DefaultWriteFutureEx(session); unwrittenFuture.setException(cause); return unwrittenFuture; }
[ "public", "static", "WriteFutureEx", "newNotWrittenFuture", "(", "IoSession", "session", ",", "Throwable", "cause", ")", "{", "DefaultWriteFutureEx", "unwrittenFuture", "=", "new", "DefaultWriteFutureEx", "(", "session", ")", ";", "unwrittenFuture", ".", "setException", "(", "cause", ")", ";", "return", "unwrittenFuture", ";", "}" ]
Returns a new {@link DefaultWriteFuture} which is already marked as 'not written'.
[ "Returns", "a", "new", "{" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/core/future/DefaultWriteFutureEx.java#L38-L42
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java
ParseUtils.readStringAttributeElement
public static String readStringAttributeElement(final XMLExtendedStreamReader reader, final String attributeName) throws XMLStreamException { """ Read an element which contains only a single string attribute. @param reader the reader @param attributeName the attribute name, usually "value" or "name" @return the string value @throws javax.xml.stream.XMLStreamException if an error occurs or if the element does not contain the specified attribute, contains other attributes, or contains child elements. """ requireSingleAttribute(reader, attributeName); final String value = reader.getAttributeValue(0); requireNoContent(reader); return value; }
java
public static String readStringAttributeElement(final XMLExtendedStreamReader reader, final String attributeName) throws XMLStreamException { requireSingleAttribute(reader, attributeName); final String value = reader.getAttributeValue(0); requireNoContent(reader); return value; }
[ "public", "static", "String", "readStringAttributeElement", "(", "final", "XMLExtendedStreamReader", "reader", ",", "final", "String", "attributeName", ")", "throws", "XMLStreamException", "{", "requireSingleAttribute", "(", "reader", ",", "attributeName", ")", ";", "final", "String", "value", "=", "reader", ".", "getAttributeValue", "(", "0", ")", ";", "requireNoContent", "(", "reader", ")", ";", "return", "value", ";", "}" ]
Read an element which contains only a single string attribute. @param reader the reader @param attributeName the attribute name, usually "value" or "name" @return the string value @throws javax.xml.stream.XMLStreamException if an error occurs or if the element does not contain the specified attribute, contains other attributes, or contains child elements.
[ "Read", "an", "element", "which", "contains", "only", "a", "single", "string", "attribute", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/parsing/ParseUtils.java#L401-L407
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformprofile.java
transformprofile.get
public static transformprofile get(nitro_service service, String name) throws Exception { """ Use this API to fetch transformprofile resource of given name . """ transformprofile obj = new transformprofile(); obj.set_name(name); transformprofile response = (transformprofile) obj.get_resource(service); return response; }
java
public static transformprofile get(nitro_service service, String name) throws Exception{ transformprofile obj = new transformprofile(); obj.set_name(name); transformprofile response = (transformprofile) obj.get_resource(service); return response; }
[ "public", "static", "transformprofile", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "transformprofile", "obj", "=", "new", "transformprofile", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "transformprofile", "response", "=", "(", "transformprofile", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch transformprofile resource of given name .
[ "Use", "this", "API", "to", "fetch", "transformprofile", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformprofile.java#L387-L392
jayantk/jklol
src/com/jayantkrish/jklol/util/IntegerArrayIterator.java
IntegerArrayIterator.createFromKeyPrefix
public static IntegerArrayIterator createFromKeyPrefix(int[] dimensionSizes, int[] keyPrefix) { """ Creates an iterator over all assignments to the final {@code dimensionSizes.length - keyPrefix.length} dimensions in {@code dimensionSizes}. @param dimensionSizes @param keyPrefix @return """ int[] sizesForIteration = new int[dimensionSizes.length - keyPrefix.length]; for (int i = keyPrefix.length; i < dimensionSizes.length; i++) { sizesForIteration[i - keyPrefix.length] = dimensionSizes[i]; } return new IntegerArrayIterator(sizesForIteration, keyPrefix); }
java
public static IntegerArrayIterator createFromKeyPrefix(int[] dimensionSizes, int[] keyPrefix) { int[] sizesForIteration = new int[dimensionSizes.length - keyPrefix.length]; for (int i = keyPrefix.length; i < dimensionSizes.length; i++) { sizesForIteration[i - keyPrefix.length] = dimensionSizes[i]; } return new IntegerArrayIterator(sizesForIteration, keyPrefix); }
[ "public", "static", "IntegerArrayIterator", "createFromKeyPrefix", "(", "int", "[", "]", "dimensionSizes", ",", "int", "[", "]", "keyPrefix", ")", "{", "int", "[", "]", "sizesForIteration", "=", "new", "int", "[", "dimensionSizes", ".", "length", "-", "keyPrefix", ".", "length", "]", ";", "for", "(", "int", "i", "=", "keyPrefix", ".", "length", ";", "i", "<", "dimensionSizes", ".", "length", ";", "i", "++", ")", "{", "sizesForIteration", "[", "i", "-", "keyPrefix", ".", "length", "]", "=", "dimensionSizes", "[", "i", "]", ";", "}", "return", "new", "IntegerArrayIterator", "(", "sizesForIteration", ",", "keyPrefix", ")", ";", "}" ]
Creates an iterator over all assignments to the final {@code dimensionSizes.length - keyPrefix.length} dimensions in {@code dimensionSizes}. @param dimensionSizes @param keyPrefix @return
[ "Creates", "an", "iterator", "over", "all", "assignments", "to", "the", "final", "{", "@code", "dimensionSizes", ".", "length", "-", "keyPrefix", ".", "length", "}", "dimensions", "in", "{", "@code", "dimensionSizes", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/util/IntegerArrayIterator.java#L52-L58
line/armeria
core/src/main/java/com/linecorp/armeria/internal/PathMappingUtil.java
PathMappingUtil.ensureAbsolutePath
public static String ensureAbsolutePath(String path, String paramName) { """ Ensures that the specified {@code path} is an absolute pathMapping. @return {@code path} @throws NullPointerException if {@code path} is {@code null} @throws IllegalArgumentException if {@code path} is not an absolute pathMapping """ requireNonNull(path, paramName); if (path.isEmpty() || path.charAt(0) != '/') { throw new IllegalArgumentException(paramName + ": " + path + " (expected: an absolute path)"); } return path; }
java
public static String ensureAbsolutePath(String path, String paramName) { requireNonNull(path, paramName); if (path.isEmpty() || path.charAt(0) != '/') { throw new IllegalArgumentException(paramName + ": " + path + " (expected: an absolute path)"); } return path; }
[ "public", "static", "String", "ensureAbsolutePath", "(", "String", "path", ",", "String", "paramName", ")", "{", "requireNonNull", "(", "path", ",", "paramName", ")", ";", "if", "(", "path", ".", "isEmpty", "(", ")", "||", "path", ".", "charAt", "(", "0", ")", "!=", "'", "'", ")", "{", "throw", "new", "IllegalArgumentException", "(", "paramName", "+", "\": \"", "+", "path", "+", "\" (expected: an absolute path)\"", ")", ";", "}", "return", "path", ";", "}" ]
Ensures that the specified {@code path} is an absolute pathMapping. @return {@code path} @throws NullPointerException if {@code path} is {@code null} @throws IllegalArgumentException if {@code path} is not an absolute pathMapping
[ "Ensures", "that", "the", "specified", "{", "@code", "path", "}", "is", "an", "absolute", "pathMapping", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/PathMappingUtil.java#L62-L68
akarnokd/ixjava
src/main/java/ix/Ix.java
Ix.repeatValue
public static <T> Ix<T> repeatValue(T value, IxBooleanSupplier stopPredicate) { """ Repeats the given value until the given predicate returns true. <p> A count of zero will yield an empty sequence, a count of one will yield a sequence with only one element and so forth. <p> The result's iterator() doesn't support remove(). @param <T> the value type @param value the value to emit @param stopPredicate the predicate called before any emission; returning false keeps repeating the value, returning true terminates the sequence @return the new Ix instance @throws NullPointerException if stopPredicate is null @since 1.0 """ return repeatValue(value, Long.MAX_VALUE, stopPredicate); }
java
public static <T> Ix<T> repeatValue(T value, IxBooleanSupplier stopPredicate) { return repeatValue(value, Long.MAX_VALUE, stopPredicate); }
[ "public", "static", "<", "T", ">", "Ix", "<", "T", ">", "repeatValue", "(", "T", "value", ",", "IxBooleanSupplier", "stopPredicate", ")", "{", "return", "repeatValue", "(", "value", ",", "Long", ".", "MAX_VALUE", ",", "stopPredicate", ")", ";", "}" ]
Repeats the given value until the given predicate returns true. <p> A count of zero will yield an empty sequence, a count of one will yield a sequence with only one element and so forth. <p> The result's iterator() doesn't support remove(). @param <T> the value type @param value the value to emit @param stopPredicate the predicate called before any emission; returning false keeps repeating the value, returning true terminates the sequence @return the new Ix instance @throws NullPointerException if stopPredicate is null @since 1.0
[ "Repeats", "the", "given", "value", "until", "the", "given", "predicate", "returns", "true", ".", "<p", ">", "A", "count", "of", "zero", "will", "yield", "an", "empty", "sequence", "a", "count", "of", "one", "will", "yield", "a", "sequence", "with", "only", "one", "element", "and", "so", "forth", ".", "<p", ">", "The", "result", "s", "iterator", "()", "doesn", "t", "support", "remove", "()", "." ]
train
https://github.com/akarnokd/ixjava/blob/add721bba550c36541faa450e40a975bb65e78d7/src/main/java/ix/Ix.java#L558-L560
Stratio/bdt
src/main/java/com/stratio/qa/specs/LdapSpec.java
LdapSpec.ldapEntryContains
@Then("^the LDAP entry contains the attribute '(.+?)' with the value '(.+?)'$") public void ldapEntryContains(String attributeName, String expectedValue) { """ Checks if the previous LDAP search contained a single Entry with a specific attribute and an expected value @param attributeName The name of the attribute to look for in the LdapEntry @param expectedValue The expected value of the attribute """ if (this.commonspec.getPreviousLdapResults().isPresent()) { Assertions.assertThat(this.commonspec.getPreviousLdapResults().get().getEntry().getAttribute(attributeName).getStringValues()).contains(expectedValue); } else { fail("No previous LDAP results were stored in memory"); } }
java
@Then("^the LDAP entry contains the attribute '(.+?)' with the value '(.+?)'$") public void ldapEntryContains(String attributeName, String expectedValue) { if (this.commonspec.getPreviousLdapResults().isPresent()) { Assertions.assertThat(this.commonspec.getPreviousLdapResults().get().getEntry().getAttribute(attributeName).getStringValues()).contains(expectedValue); } else { fail("No previous LDAP results were stored in memory"); } }
[ "@", "Then", "(", "\"^the LDAP entry contains the attribute '(.+?)' with the value '(.+?)'$\"", ")", "public", "void", "ldapEntryContains", "(", "String", "attributeName", ",", "String", "expectedValue", ")", "{", "if", "(", "this", ".", "commonspec", ".", "getPreviousLdapResults", "(", ")", ".", "isPresent", "(", ")", ")", "{", "Assertions", ".", "assertThat", "(", "this", ".", "commonspec", ".", "getPreviousLdapResults", "(", ")", ".", "get", "(", ")", ".", "getEntry", "(", ")", ".", "getAttribute", "(", "attributeName", ")", ".", "getStringValues", "(", ")", ")", ".", "contains", "(", "expectedValue", ")", ";", "}", "else", "{", "fail", "(", "\"No previous LDAP results were stored in memory\"", ")", ";", "}", "}" ]
Checks if the previous LDAP search contained a single Entry with a specific attribute and an expected value @param attributeName The name of the attribute to look for in the LdapEntry @param expectedValue The expected value of the attribute
[ "Checks", "if", "the", "previous", "LDAP", "search", "contained", "a", "single", "Entry", "with", "a", "specific", "attribute", "and", "an", "expected", "value" ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/LdapSpec.java#L64-L71
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java
Dialogs.showDetailsDialog
public static DetailsDialog showDetailsDialog (Stage stage, String text, String title, String details) { """ Dialog with given title, provided text, and more details available after pressing 'Details' button. """ return showDetailsDialog(stage, text, title, details, false); }
java
public static DetailsDialog showDetailsDialog (Stage stage, String text, String title, String details) { return showDetailsDialog(stage, text, title, details, false); }
[ "public", "static", "DetailsDialog", "showDetailsDialog", "(", "Stage", "stage", ",", "String", "text", ",", "String", "title", ",", "String", "details", ")", "{", "return", "showDetailsDialog", "(", "stage", ",", "text", ",", "title", ",", "details", ",", "false", ")", ";", "}" ]
Dialog with given title, provided text, and more details available after pressing 'Details' button.
[ "Dialog", "with", "given", "title", "provided", "text", "and", "more", "details", "available", "after", "pressing", "Details", "button", "." ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java#L176-L178
zaproxy/zaproxy
src/org/zaproxy/zap/spider/URLCanonicalizer.java
URLCanonicalizer.isDefaultPort
private static boolean isDefaultPort(String scheme, int port) { """ Tells whether or not the given port is the default for the given scheme. <p> <strong>Note:</strong> Only HTTP and HTTPS schemes are taken into account. @param scheme the scheme @param port the port @return {@code true} if given the port is the default port for the given scheme, {@code false} otherwise. """ return HTTP_SCHEME.equalsIgnoreCase(scheme) && port == HTTP_DEFAULT_PORT || HTTPS_SCHEME.equalsIgnoreCase(scheme) && port == HTTPS_DEFAULT_PORT; }
java
private static boolean isDefaultPort(String scheme, int port) { return HTTP_SCHEME.equalsIgnoreCase(scheme) && port == HTTP_DEFAULT_PORT || HTTPS_SCHEME.equalsIgnoreCase(scheme) && port == HTTPS_DEFAULT_PORT; }
[ "private", "static", "boolean", "isDefaultPort", "(", "String", "scheme", ",", "int", "port", ")", "{", "return", "HTTP_SCHEME", ".", "equalsIgnoreCase", "(", "scheme", ")", "&&", "port", "==", "HTTP_DEFAULT_PORT", "||", "HTTPS_SCHEME", ".", "equalsIgnoreCase", "(", "scheme", ")", "&&", "port", "==", "HTTPS_DEFAULT_PORT", ";", "}" ]
Tells whether or not the given port is the default for the given scheme. <p> <strong>Note:</strong> Only HTTP and HTTPS schemes are taken into account. @param scheme the scheme @param port the port @return {@code true} if given the port is the default port for the given scheme, {@code false} otherwise.
[ "Tells", "whether", "or", "not", "the", "given", "port", "is", "the", "default", "for", "the", "given", "scheme", ".", "<p", ">", "<strong", ">", "Note", ":", "<", "/", "strong", ">", "Only", "HTTP", "and", "HTTPS", "schemes", "are", "taken", "into", "account", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/spider/URLCanonicalizer.java#L200-L203
looly/hutool
hutool-http/src/main/java/cn/hutool/http/HttpConnection.java
HttpConnection.create
public static HttpConnection create(String urlStr, Proxy proxy) { """ 创建HttpConnection @param urlStr URL @param proxy 代理,无代理传{@code null} @return HttpConnection """ return create(URLUtil.toUrlForHttp(urlStr), proxy); }
java
public static HttpConnection create(String urlStr, Proxy proxy) { return create(URLUtil.toUrlForHttp(urlStr), proxy); }
[ "public", "static", "HttpConnection", "create", "(", "String", "urlStr", ",", "Proxy", "proxy", ")", "{", "return", "create", "(", "URLUtil", ".", "toUrlForHttp", "(", "urlStr", ")", ",", "proxy", ")", ";", "}" ]
创建HttpConnection @param urlStr URL @param proxy 代理,无代理传{@code null} @return HttpConnection
[ "创建HttpConnection" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpConnection.java#L52-L54
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.createCompositeEntityRole
public UUID createCompositeEntityRole(UUID appId, String versionId, UUID cEntityId, CreateCompositeEntityRoleOptionalParameter createCompositeEntityRoleOptionalParameter) { """ Create an entity role for an entity in the application. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param createCompositeEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the UUID object if successful. """ return createCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, createCompositeEntityRoleOptionalParameter).toBlocking().single().body(); }
java
public UUID createCompositeEntityRole(UUID appId, String versionId, UUID cEntityId, CreateCompositeEntityRoleOptionalParameter createCompositeEntityRoleOptionalParameter) { return createCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, createCompositeEntityRoleOptionalParameter).toBlocking().single().body(); }
[ "public", "UUID", "createCompositeEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ",", "CreateCompositeEntityRoleOptionalParameter", "createCompositeEntityRoleOptionalParameter", ")", "{", "return", "createCompositeEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "cEntityId", ",", "createCompositeEntityRoleOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create an entity role for an entity in the application. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @param createCompositeEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the UUID object if successful.
[ "Create", "an", "entity", "role", "for", "an", "entity", "in", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L8872-L8874
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.v2GetUserMessages
public MessageListResult v2GetUserMessages(String username, int count, String begin_time, String end_time) throws APIConnectionException, APIRequestException { """ Get message list from user's record, messages will store 60 days. @param username Necessary parameter. @param count Necessary parameter. The count of the message list. @param begin_time Optional parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss' @param end_time Optional parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss' @return MessageListResult @throws APIConnectionException connect exception @throws APIRequestException request exception """ return _reportClient.v2GetUserMessages(username, count, begin_time, end_time); }
java
public MessageListResult v2GetUserMessages(String username, int count, String begin_time, String end_time) throws APIConnectionException, APIRequestException { return _reportClient.v2GetUserMessages(username, count, begin_time, end_time); }
[ "public", "MessageListResult", "v2GetUserMessages", "(", "String", "username", ",", "int", "count", ",", "String", "begin_time", ",", "String", "end_time", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_reportClient", ".", "v2GetUserMessages", "(", "username", ",", "count", ",", "begin_time", ",", "end_time", ")", ";", "}" ]
Get message list from user's record, messages will store 60 days. @param username Necessary parameter. @param count Necessary parameter. The count of the message list. @param begin_time Optional parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss' @param end_time Optional parameter. The format must follow by 'yyyy-MM-dd HH:mm:ss' @return MessageListResult @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Get", "message", "list", "from", "user", "s", "record", "messages", "will", "store", "60", "days", "." ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L968-L971
undertow-io/undertow
core/src/main/java/io/undertow/util/FlexBase64.java
FlexBase64.encodeBytes
public static byte[] encodeBytes(byte[] source, int pos, int limit, boolean wrap) { """ Encodes a fixed and complete byte buffer into a Base64 byte array. <pre><code> // Encodes "ell" FlexBase64.encodeString("hello".getBytes("US-ASCII"), 1, 4, false); </code></pre> @param source the byte array to encode from @param pos the position to start encoding at @param limit the position to halt encoding at (exclusive) @param wrap whether or not to wrap at 76 characters with CRLFs @return a new byte array containing the encoded ASCII values """ return Encoder.encodeBytes(source, pos, limit, wrap, false); }
java
public static byte[] encodeBytes(byte[] source, int pos, int limit, boolean wrap) { return Encoder.encodeBytes(source, pos, limit, wrap, false); }
[ "public", "static", "byte", "[", "]", "encodeBytes", "(", "byte", "[", "]", "source", ",", "int", "pos", ",", "int", "limit", ",", "boolean", "wrap", ")", "{", "return", "Encoder", ".", "encodeBytes", "(", "source", ",", "pos", ",", "limit", ",", "wrap", ",", "false", ")", ";", "}" ]
Encodes a fixed and complete byte buffer into a Base64 byte array. <pre><code> // Encodes "ell" FlexBase64.encodeString("hello".getBytes("US-ASCII"), 1, 4, false); </code></pre> @param source the byte array to encode from @param pos the position to start encoding at @param limit the position to halt encoding at (exclusive) @param wrap whether or not to wrap at 76 characters with CRLFs @return a new byte array containing the encoded ASCII values
[ "Encodes", "a", "fixed", "and", "complete", "byte", "buffer", "into", "a", "Base64", "byte", "array", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/util/FlexBase64.java#L271-L273
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/RaidShell.java
RaidShell.findMissingParityFiles
private void findMissingParityFiles(String[] args, int startIndex) { """ Find the files that do not have a corresponding parity file and have replication factor less that 3 args[] contains the root where we need to check """ boolean restoreReplication = false; Path root = null; for (int i = startIndex; i < args.length; i++) { String arg = args[i]; if (arg.equals("-r")) { restoreReplication = true; } else { root = new Path(arg); } } if (root == null) { throw new IllegalArgumentException("Too few arguments"); } try { FileSystem fs = root.getFileSystem(conf); // Make sure default uri is the same as root conf.set(FileSystem.FS_DEFAULT_NAME_KEY, fs.getUri().toString()); MissingParityFiles mParFiles = new MissingParityFiles(conf, restoreReplication); mParFiles.findMissingParityFiles(root, System.out); } catch (IOException ex) { System.err.println("findMissingParityFiles: " + ex); } }
java
private void findMissingParityFiles(String[] args, int startIndex) { boolean restoreReplication = false; Path root = null; for (int i = startIndex; i < args.length; i++) { String arg = args[i]; if (arg.equals("-r")) { restoreReplication = true; } else { root = new Path(arg); } } if (root == null) { throw new IllegalArgumentException("Too few arguments"); } try { FileSystem fs = root.getFileSystem(conf); // Make sure default uri is the same as root conf.set(FileSystem.FS_DEFAULT_NAME_KEY, fs.getUri().toString()); MissingParityFiles mParFiles = new MissingParityFiles(conf, restoreReplication); mParFiles.findMissingParityFiles(root, System.out); } catch (IOException ex) { System.err.println("findMissingParityFiles: " + ex); } }
[ "private", "void", "findMissingParityFiles", "(", "String", "[", "]", "args", ",", "int", "startIndex", ")", "{", "boolean", "restoreReplication", "=", "false", ";", "Path", "root", "=", "null", ";", "for", "(", "int", "i", "=", "startIndex", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "String", "arg", "=", "args", "[", "i", "]", ";", "if", "(", "arg", ".", "equals", "(", "\"-r\"", ")", ")", "{", "restoreReplication", "=", "true", ";", "}", "else", "{", "root", "=", "new", "Path", "(", "arg", ")", ";", "}", "}", "if", "(", "root", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Too few arguments\"", ")", ";", "}", "try", "{", "FileSystem", "fs", "=", "root", ".", "getFileSystem", "(", "conf", ")", ";", "// Make sure default uri is the same as root ", "conf", ".", "set", "(", "FileSystem", ".", "FS_DEFAULT_NAME_KEY", ",", "fs", ".", "getUri", "(", ")", ".", "toString", "(", ")", ")", ";", "MissingParityFiles", "mParFiles", "=", "new", "MissingParityFiles", "(", "conf", ",", "restoreReplication", ")", ";", "mParFiles", ".", "findMissingParityFiles", "(", "root", ",", "System", ".", "out", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "System", ".", "err", ".", "println", "(", "\"findMissingParityFiles: \"", "+", "ex", ")", ";", "}", "}" ]
Find the files that do not have a corresponding parity file and have replication factor less that 3 args[] contains the root where we need to check
[ "Find", "the", "files", "that", "do", "not", "have", "a", "corresponding", "parity", "file", "and", "have", "replication", "factor", "less", "that", "3", "args", "[]", "contains", "the", "root", "where", "we", "need", "to", "check" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidShell.java#L416-L439
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/Module.java
Module.shutdownModule
@SuppressWarnings("unused") public void shutdownModule() throws ModuleShutdownException { """ Frees system resources allocated by this Module. @throws ModuleShutdownException If there is a problem freeing system resources. Note that if there is a problem, it won't end up aborting the shutdown process. Therefore, this method should do everything possible to recover from exceptional situations before throwing an exception. """ logger.info("Shutting down " + getClass().getName()); if (1 == 2) { throw new ModuleShutdownException(null, null); } }
java
@SuppressWarnings("unused") public void shutdownModule() throws ModuleShutdownException { logger.info("Shutting down " + getClass().getName()); if (1 == 2) { throw new ModuleShutdownException(null, null); } }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "void", "shutdownModule", "(", ")", "throws", "ModuleShutdownException", "{", "logger", ".", "info", "(", "\"Shutting down \"", "+", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "if", "(", "1", "==", "2", ")", "{", "throw", "new", "ModuleShutdownException", "(", "null", ",", "null", ")", ";", "}", "}" ]
Frees system resources allocated by this Module. @throws ModuleShutdownException If there is a problem freeing system resources. Note that if there is a problem, it won't end up aborting the shutdown process. Therefore, this method should do everything possible to recover from exceptional situations before throwing an exception.
[ "Frees", "system", "resources", "allocated", "by", "this", "Module", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/Module.java#L133-L139
jenkinsci/jenkins
core/src/main/java/hudson/model/ComputerPinger.java
ComputerPinger.checkIsReachable
public static boolean checkIsReachable(InetAddress ia, int timeout) throws IOException { """ Is this computer reachable via the given address? @param ia The address to check. @param timeout Timeout in seconds. """ for (ComputerPinger pinger : ComputerPinger.all()) { try { if (pinger.isReachable(ia, timeout)) { return true; } } catch (IOException e) { LOGGER.fine("Error checking reachability with " + pinger + ": " + e.getMessage()); } } return false; }
java
public static boolean checkIsReachable(InetAddress ia, int timeout) throws IOException { for (ComputerPinger pinger : ComputerPinger.all()) { try { if (pinger.isReachable(ia, timeout)) { return true; } } catch (IOException e) { LOGGER.fine("Error checking reachability with " + pinger + ": " + e.getMessage()); } } return false; }
[ "public", "static", "boolean", "checkIsReachable", "(", "InetAddress", "ia", ",", "int", "timeout", ")", "throws", "IOException", "{", "for", "(", "ComputerPinger", "pinger", ":", "ComputerPinger", ".", "all", "(", ")", ")", "{", "try", "{", "if", "(", "pinger", ".", "isReachable", "(", "ia", ",", "timeout", ")", ")", "{", "return", "true", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "LOGGER", ".", "fine", "(", "\"Error checking reachability with \"", "+", "pinger", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "return", "false", ";", "}" ]
Is this computer reachable via the given address? @param ia The address to check. @param timeout Timeout in seconds.
[ "Is", "this", "computer", "reachable", "via", "the", "given", "address?" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/ComputerPinger.java#L39-L51
sporniket/core
sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java
XmlStringTools.appendOpeningTag
public static StringBuffer appendOpeningTag(StringBuffer buffer, String tag, Map<String, String> attributes) { """ Add an opening tag with attributes to a StringBuffer. @param buffer StringBuffer to fill @param tag the tag to open @param attributes the attribute map @return the buffer """ StringBuffer _buffer = initStringBufferIfNecessary(buffer); Map<String, String> _attributes = (null != attributes) ? attributes : EMPTY_MAP; return doAppendOpeningTag(_buffer, tag, _attributes); }
java
public static StringBuffer appendOpeningTag(StringBuffer buffer, String tag, Map<String, String> attributes) { StringBuffer _buffer = initStringBufferIfNecessary(buffer); Map<String, String> _attributes = (null != attributes) ? attributes : EMPTY_MAP; return doAppendOpeningTag(_buffer, tag, _attributes); }
[ "public", "static", "StringBuffer", "appendOpeningTag", "(", "StringBuffer", "buffer", ",", "String", "tag", ",", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "StringBuffer", "_buffer", "=", "initStringBufferIfNecessary", "(", "buffer", ")", ";", "Map", "<", "String", ",", "String", ">", "_attributes", "=", "(", "null", "!=", "attributes", ")", "?", "attributes", ":", "EMPTY_MAP", ";", "return", "doAppendOpeningTag", "(", "_buffer", ",", "tag", ",", "_attributes", ")", ";", "}" ]
Add an opening tag with attributes to a StringBuffer. @param buffer StringBuffer to fill @param tag the tag to open @param attributes the attribute map @return the buffer
[ "Add", "an", "opening", "tag", "with", "attributes", "to", "a", "StringBuffer", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L368-L373
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static JPopupMenu leftShift(JPopupMenu self, Component component) { """ Overloads the left shift operator to provide an easy way to add components to a popupMenu.<p> @param self a JPopupMenu @param component a component to be added to the popupMenu. @return same popupMenu, after the value was added to it. @since 1.6.4 """ self.add(component); return self; }
java
public static JPopupMenu leftShift(JPopupMenu self, Component component) { self.add(component); return self; }
[ "public", "static", "JPopupMenu", "leftShift", "(", "JPopupMenu", "self", ",", "Component", "component", ")", "{", "self", ".", "add", "(", "component", ")", ";", "return", "self", ";", "}" ]
Overloads the left shift operator to provide an easy way to add components to a popupMenu.<p> @param self a JPopupMenu @param component a component to be added to the popupMenu. @return same popupMenu, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "components", "to", "a", "popupMenu", ".", "<p", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L910-L913
lessthanoptimal/BoofCV
main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationLinearRotationMulti.java
SelfCalibrationLinearRotationMulti.extractCalibration
void extractCalibration( Homography2D_F64 Hinv , CameraPinhole c ) { """ Extracts calibration for the non-reference frames w = H^-T*w*H^-1 """ CommonOps_DDF3.multTransA(Hinv,W0,tmp); CommonOps_DDF3.mult(tmp,Hinv,Wi); convertW(Wi,c); }
java
void extractCalibration( Homography2D_F64 Hinv , CameraPinhole c ) { CommonOps_DDF3.multTransA(Hinv,W0,tmp); CommonOps_DDF3.mult(tmp,Hinv,Wi); convertW(Wi,c); }
[ "void", "extractCalibration", "(", "Homography2D_F64", "Hinv", ",", "CameraPinhole", "c", ")", "{", "CommonOps_DDF3", ".", "multTransA", "(", "Hinv", ",", "W0", ",", "tmp", ")", ";", "CommonOps_DDF3", ".", "mult", "(", "tmp", ",", "Hinv", ",", "Wi", ")", ";", "convertW", "(", "Wi", ",", "c", ")", ";", "}" ]
Extracts calibration for the non-reference frames w = H^-T*w*H^-1
[ "Extracts", "calibration", "for", "the", "non", "-", "reference", "frames" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/selfcalib/SelfCalibrationLinearRotationMulti.java#L265-L270
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java
Resources.getResourceAsStream
@Pure public static InputStream getResourceAsStream(ClassLoader classLoader, String path) { """ Replies the input stream of a resource. <p>You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames, and may not start the path with a slash. <p>If the {@code classLoader} parameter is <code>null</code>, the class loader replied by {@link ClassLoaderFinder} is used. If this last is <code>null</code>, the class loader of the Resources class is used. @param classLoader is the research scope. If <code>null</code>, the class loader replied by {@link ClassLoaderFinder} is used. @param path is the absolute path of the resource. @return the url of the resource or <code>null</code> if the resource was not found in class paths. """ return currentResourceInstance.getResourceAsStream(classLoader, path); }
java
@Pure public static InputStream getResourceAsStream(ClassLoader classLoader, String path) { return currentResourceInstance.getResourceAsStream(classLoader, path); }
[ "@", "Pure", "public", "static", "InputStream", "getResourceAsStream", "(", "ClassLoader", "classLoader", ",", "String", "path", ")", "{", "return", "currentResourceInstance", ".", "getResourceAsStream", "(", "classLoader", ",", "path", ")", ";", "}" ]
Replies the input stream of a resource. <p>You may use Unix-like syntax to write the resource path, ie. you may use slashes to separate filenames, and may not start the path with a slash. <p>If the {@code classLoader} parameter is <code>null</code>, the class loader replied by {@link ClassLoaderFinder} is used. If this last is <code>null</code>, the class loader of the Resources class is used. @param classLoader is the research scope. If <code>null</code>, the class loader replied by {@link ClassLoaderFinder} is used. @param path is the absolute path of the resource. @return the url of the resource or <code>null</code> if the resource was not found in class paths.
[ "Replies", "the", "input", "stream", "of", "a", "resource", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java#L318-L321
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java
OLAPService.getExpirationDate
public Date getExpirationDate(ApplicationDefinition appDef, String shard) { """ Get the expire-date for the given shard name and OLAP application. Null is returned if the shard does not exist or has no expire-date. @param appDef OLAP application definition. @param shard Shard name. @return Shard's expire-date or null if it doesn't exist or has no expire-date. """ checkServiceState(); return m_olap.getExpirationDate(appDef, shard); }
java
public Date getExpirationDate(ApplicationDefinition appDef, String shard) { checkServiceState(); return m_olap.getExpirationDate(appDef, shard); }
[ "public", "Date", "getExpirationDate", "(", "ApplicationDefinition", "appDef", ",", "String", "shard", ")", "{", "checkServiceState", "(", ")", ";", "return", "m_olap", ".", "getExpirationDate", "(", "appDef", ",", "shard", ")", ";", "}" ]
Get the expire-date for the given shard name and OLAP application. Null is returned if the shard does not exist or has no expire-date. @param appDef OLAP application definition. @param shard Shard name. @return Shard's expire-date or null if it doesn't exist or has no expire-date.
[ "Get", "the", "expire", "-", "date", "for", "the", "given", "shard", "name", "and", "OLAP", "application", ".", "Null", "is", "returned", "if", "the", "shard", "does", "not", "exist", "or", "has", "no", "expire", "-", "date", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java#L360-L363
apiman/apiman
gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/GatewayServlet.java
GatewayServlet.writeResponse
protected void writeResponse(HttpServletResponse response, ApiResponse sresponse) { """ Writes the API response to the HTTP servlet response object. @param response @param sresponse """ response.setStatus(sresponse.getCode()); for (Entry<String, String> entry : sresponse.getHeaders()) { response.addHeader(entry.getKey(), entry.getValue()); } }
java
protected void writeResponse(HttpServletResponse response, ApiResponse sresponse) { response.setStatus(sresponse.getCode()); for (Entry<String, String> entry : sresponse.getHeaders()) { response.addHeader(entry.getKey(), entry.getValue()); } }
[ "protected", "void", "writeResponse", "(", "HttpServletResponse", "response", ",", "ApiResponse", "sresponse", ")", "{", "response", ".", "setStatus", "(", "sresponse", ".", "getCode", "(", ")", ")", ";", "for", "(", "Entry", "<", "String", ",", "String", ">", "entry", ":", "sresponse", ".", "getHeaders", "(", ")", ")", "{", "response", ".", "addHeader", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
Writes the API response to the HTTP servlet response object. @param response @param sresponse
[ "Writes", "the", "API", "response", "to", "the", "HTTP", "servlet", "response", "object", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/platforms/servlet/src/main/java/io/apiman/gateway/platforms/servlet/GatewayServlet.java#L293-L298
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.ip_spam_GET
public ArrayList<String> ip_spam_GET(String ip, OvhSpamStateEnum state) throws IOException { """ Ip spamming REST: GET /ip/{ip}/spam @param state [required] Filter the value of state property (=) @param ip [required] """ String qPath = "/ip/{ip}/spam"; StringBuilder sb = path(qPath, ip); query(sb, "state", state); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<String> ip_spam_GET(String ip, OvhSpamStateEnum state) throws IOException { String qPath = "/ip/{ip}/spam"; StringBuilder sb = path(qPath, ip); query(sb, "state", state); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "String", ">", "ip_spam_GET", "(", "String", "ip", ",", "OvhSpamStateEnum", "state", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/{ip}/spam\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ip", ")", ";", "query", "(", "sb", ",", "\"state\"", ",", "state", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t2", ")", ";", "}" ]
Ip spamming REST: GET /ip/{ip}/spam @param state [required] Filter the value of state property (=) @param ip [required]
[ "Ip", "spamming" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L195-L201
dmerkushov/log-helper
src/main/java/ru/dmerkushov/loghelper/LogHelperDebug.java
LogHelperDebug.printError
public static void printError (String message, Throwable throwable, boolean force) { """ Print a message to <code>System.err</code>, with an every-line prefix: "log-helper ERROR: ", and specifying a full stack trace of a {@link java.lang.Throwable Throwable} @param message @param throwable @param force <code>true</code> if we need to override the debug enabled flag (i.e. the message is REALLY important), <code>false</code> otherwise """ if (isDebugEnabled () || force) { StringBuilder outputBuilder = new StringBuilder (); outputBuilder.append (message).append ("\nThrowable:\n"); outputBuilder.append (DefaultFormatter.getFullThrowableMsg (throwable)); String fullMessage = outputBuilder.toString (); printError (fullMessage, force); } }
java
public static void printError (String message, Throwable throwable, boolean force) { if (isDebugEnabled () || force) { StringBuilder outputBuilder = new StringBuilder (); outputBuilder.append (message).append ("\nThrowable:\n"); outputBuilder.append (DefaultFormatter.getFullThrowableMsg (throwable)); String fullMessage = outputBuilder.toString (); printError (fullMessage, force); } }
[ "public", "static", "void", "printError", "(", "String", "message", ",", "Throwable", "throwable", ",", "boolean", "force", ")", "{", "if", "(", "isDebugEnabled", "(", ")", "||", "force", ")", "{", "StringBuilder", "outputBuilder", "=", "new", "StringBuilder", "(", ")", ";", "outputBuilder", ".", "append", "(", "message", ")", ".", "append", "(", "\"\\nThrowable:\\n\"", ")", ";", "outputBuilder", ".", "append", "(", "DefaultFormatter", ".", "getFullThrowableMsg", "(", "throwable", ")", ")", ";", "String", "fullMessage", "=", "outputBuilder", ".", "toString", "(", ")", ";", "printError", "(", "fullMessage", ",", "force", ")", ";", "}", "}" ]
Print a message to <code>System.err</code>, with an every-line prefix: "log-helper ERROR: ", and specifying a full stack trace of a {@link java.lang.Throwable Throwable} @param message @param throwable @param force <code>true</code> if we need to override the debug enabled flag (i.e. the message is REALLY important), <code>false</code> otherwise
[ "Print", "a", "message", "to", "<code", ">", "System", ".", "err<", "/", "code", ">", "with", "an", "every", "-", "line", "prefix", ":", "log", "-", "helper", "ERROR", ":", "and", "specifying", "a", "full", "stack", "trace", "of", "a", "{" ]
train
https://github.com/dmerkushov/log-helper/blob/3b7d3d30faa7f1437b27cd07c10fa579a995de23/src/main/java/ru/dmerkushov/loghelper/LogHelperDebug.java#L77-L85
jbundle/jbundle
main/screen/src/main/java/org/jbundle/main/user/screen/UserEntryScreen.java
UserEntryScreen.doCommand
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { """ Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success. """ boolean bLogin = false; if (MenuConstants.SUBMIT.equalsIgnoreCase(strCommand)) if (this.getMainRecord().isModified()) bLogin = true; boolean bFlag = super.doCommand(strCommand, sourceSField, iCommandOptions); if (MenuConstants.SUBMIT.equalsIgnoreCase(strCommand)) if (bFlag) if (bLogin) return super.doCommand(MenuConstants.HOME, sourceSField, iCommandOptions); return bFlag; }
java
public boolean doCommand(String strCommand, ScreenField sourceSField, int iCommandOptions) { boolean bLogin = false; if (MenuConstants.SUBMIT.equalsIgnoreCase(strCommand)) if (this.getMainRecord().isModified()) bLogin = true; boolean bFlag = super.doCommand(strCommand, sourceSField, iCommandOptions); if (MenuConstants.SUBMIT.equalsIgnoreCase(strCommand)) if (bFlag) if (bLogin) return super.doCommand(MenuConstants.HOME, sourceSField, iCommandOptions); return bFlag; }
[ "public", "boolean", "doCommand", "(", "String", "strCommand", ",", "ScreenField", "sourceSField", ",", "int", "iCommandOptions", ")", "{", "boolean", "bLogin", "=", "false", ";", "if", "(", "MenuConstants", ".", "SUBMIT", ".", "equalsIgnoreCase", "(", "strCommand", ")", ")", "if", "(", "this", ".", "getMainRecord", "(", ")", ".", "isModified", "(", ")", ")", "bLogin", "=", "true", ";", "boolean", "bFlag", "=", "super", ".", "doCommand", "(", "strCommand", ",", "sourceSField", ",", "iCommandOptions", ")", ";", "if", "(", "MenuConstants", ".", "SUBMIT", ".", "equalsIgnoreCase", "(", "strCommand", ")", ")", "if", "(", "bFlag", ")", "if", "(", "bLogin", ")", "return", "super", ".", "doCommand", "(", "MenuConstants", ".", "HOME", ",", "sourceSField", ",", "iCommandOptions", ")", ";", "return", "bFlag", ";", "}" ]
Process the command. <br />Step 1 - Process the command if possible and return true if processed. <br />Step 2 - If I can't process, pass to all children (with me as the source). <br />Step 3 - If children didn't process, pass to parent (with me as the source). <br />Note: Never pass to a parent or child that matches the source (to avoid an endless loop). @param strCommand The command to process. @param sourceSField The source screen field (to avoid echos). @param iCommandOptions If this command creates a new screen, create in a new window? @return true if success.
[ "Process", "the", "command", ".", "<br", "/", ">", "Step", "1", "-", "Process", "the", "command", "if", "possible", "and", "return", "true", "if", "processed", ".", "<br", "/", ">", "Step", "2", "-", "If", "I", "can", "t", "process", "pass", "to", "all", "children", "(", "with", "me", "as", "the", "source", ")", ".", "<br", "/", ">", "Step", "3", "-", "If", "children", "didn", "t", "process", "pass", "to", "parent", "(", "with", "me", "as", "the", "source", ")", ".", "<br", "/", ">", "Note", ":", "Never", "pass", "to", "a", "parent", "or", "child", "that", "matches", "the", "source", "(", "to", "avoid", "an", "endless", "loop", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/user/screen/UserEntryScreen.java#L169-L181
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
PacketParserUtils.parseError
public static StanzaError.Builder parseError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { """ Parses error sub-packets. @param parser the XML parser. @param outerXmlEnvironment the outer XML environment (optional). @return an error sub-packet. @throws IOException @throws XmlPullParserException @throws SmackParsingException """ final int initialDepth = parser.getDepth(); Map<String, String> descriptiveTexts = null; XmlEnvironment stanzaErrorXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment); List<ExtensionElement> extensions = new ArrayList<>(); StanzaError.Builder builder = StanzaError.getBuilder(); // Parse the error header builder.setType(StanzaError.Type.fromString(parser.getAttributeValue("", "type"))); builder.setErrorGenerator(parser.getAttributeValue("", "by")); outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: String name = parser.getName(); String namespace = parser.getNamespace(); switch (namespace) { case StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE: switch (name) { case Stanza.TEXT: descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts); break; default: builder.setCondition(StanzaError.Condition.fromString(name)); if (!parser.isEmptyElementTag()) { builder.setConditionText(parser.nextText()); } break; } break; default: PacketParserUtils.addExtensionElement(extensions, parser, name, namespace, stanzaErrorXmlEnvironment); } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } } } builder.setExtensions(extensions).setDescriptiveTexts(descriptiveTexts); return builder; }
java
public static StanzaError.Builder parseError(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { final int initialDepth = parser.getDepth(); Map<String, String> descriptiveTexts = null; XmlEnvironment stanzaErrorXmlEnvironment = XmlEnvironment.from(parser, outerXmlEnvironment); List<ExtensionElement> extensions = new ArrayList<>(); StanzaError.Builder builder = StanzaError.getBuilder(); // Parse the error header builder.setType(StanzaError.Type.fromString(parser.getAttributeValue("", "type"))); builder.setErrorGenerator(parser.getAttributeValue("", "by")); outerloop: while (true) { int eventType = parser.next(); switch (eventType) { case XmlPullParser.START_TAG: String name = parser.getName(); String namespace = parser.getNamespace(); switch (namespace) { case StanzaError.ERROR_CONDITION_AND_TEXT_NAMESPACE: switch (name) { case Stanza.TEXT: descriptiveTexts = parseDescriptiveTexts(parser, descriptiveTexts); break; default: builder.setCondition(StanzaError.Condition.fromString(name)); if (!parser.isEmptyElementTag()) { builder.setConditionText(parser.nextText()); } break; } break; default: PacketParserUtils.addExtensionElement(extensions, parser, name, namespace, stanzaErrorXmlEnvironment); } break; case XmlPullParser.END_TAG: if (parser.getDepth() == initialDepth) { break outerloop; } } } builder.setExtensions(extensions).setDescriptiveTexts(descriptiveTexts); return builder; }
[ "public", "static", "StanzaError", ".", "Builder", "parseError", "(", "XmlPullParser", "parser", ",", "XmlEnvironment", "outerXmlEnvironment", ")", "throws", "XmlPullParserException", ",", "IOException", ",", "SmackParsingException", "{", "final", "int", "initialDepth", "=", "parser", ".", "getDepth", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "descriptiveTexts", "=", "null", ";", "XmlEnvironment", "stanzaErrorXmlEnvironment", "=", "XmlEnvironment", ".", "from", "(", "parser", ",", "outerXmlEnvironment", ")", ";", "List", "<", "ExtensionElement", ">", "extensions", "=", "new", "ArrayList", "<>", "(", ")", ";", "StanzaError", ".", "Builder", "builder", "=", "StanzaError", ".", "getBuilder", "(", ")", ";", "// Parse the error header", "builder", ".", "setType", "(", "StanzaError", ".", "Type", ".", "fromString", "(", "parser", ".", "getAttributeValue", "(", "\"\"", ",", "\"type\"", ")", ")", ")", ";", "builder", ".", "setErrorGenerator", "(", "parser", ".", "getAttributeValue", "(", "\"\"", ",", "\"by\"", ")", ")", ";", "outerloop", ":", "while", "(", "true", ")", "{", "int", "eventType", "=", "parser", ".", "next", "(", ")", ";", "switch", "(", "eventType", ")", "{", "case", "XmlPullParser", ".", "START_TAG", ":", "String", "name", "=", "parser", ".", "getName", "(", ")", ";", "String", "namespace", "=", "parser", ".", "getNamespace", "(", ")", ";", "switch", "(", "namespace", ")", "{", "case", "StanzaError", ".", "ERROR_CONDITION_AND_TEXT_NAMESPACE", ":", "switch", "(", "name", ")", "{", "case", "Stanza", ".", "TEXT", ":", "descriptiveTexts", "=", "parseDescriptiveTexts", "(", "parser", ",", "descriptiveTexts", ")", ";", "break", ";", "default", ":", "builder", ".", "setCondition", "(", "StanzaError", ".", "Condition", ".", "fromString", "(", "name", ")", ")", ";", "if", "(", "!", "parser", ".", "isEmptyElementTag", "(", ")", ")", "{", "builder", ".", "setConditionText", "(", "parser", ".", "nextText", "(", ")", ")", ";", "}", "break", ";", "}", "break", ";", "default", ":", "PacketParserUtils", ".", "addExtensionElement", "(", "extensions", ",", "parser", ",", "name", ",", "namespace", ",", "stanzaErrorXmlEnvironment", ")", ";", "}", "break", ";", "case", "XmlPullParser", ".", "END_TAG", ":", "if", "(", "parser", ".", "getDepth", "(", ")", "==", "initialDepth", ")", "{", "break", "outerloop", ";", "}", "}", "}", "builder", ".", "setExtensions", "(", "extensions", ")", ".", "setDescriptiveTexts", "(", "descriptiveTexts", ")", ";", "return", "builder", ";", "}" ]
Parses error sub-packets. @param parser the XML parser. @param outerXmlEnvironment the outer XML environment (optional). @return an error sub-packet. @throws IOException @throws XmlPullParserException @throws SmackParsingException
[ "Parses", "error", "sub", "-", "packets", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java#L879-L922
aws/aws-sdk-java
aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/CreateIdentityProviderRequest.java
CreateIdentityProviderRequest.withProviderDetails
public CreateIdentityProviderRequest withProviderDetails(java.util.Map<String, String> providerDetails) { """ <p> The identity provider details, such as <code>MetadataURL</code> and <code>MetadataFile</code>. </p> @param providerDetails The identity provider details, such as <code>MetadataURL</code> and <code>MetadataFile</code>. @return Returns a reference to this object so that method calls can be chained together. """ setProviderDetails(providerDetails); return this; }
java
public CreateIdentityProviderRequest withProviderDetails(java.util.Map<String, String> providerDetails) { setProviderDetails(providerDetails); return this; }
[ "public", "CreateIdentityProviderRequest", "withProviderDetails", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "providerDetails", ")", "{", "setProviderDetails", "(", "providerDetails", ")", ";", "return", "this", ";", "}" ]
<p> The identity provider details, such as <code>MetadataURL</code> and <code>MetadataFile</code>. </p> @param providerDetails The identity provider details, such as <code>MetadataURL</code> and <code>MetadataFile</code>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "identity", "provider", "details", "such", "as", "<code", ">", "MetadataURL<", "/", "code", ">", "and", "<code", ">", "MetadataFile<", "/", "code", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/CreateIdentityProviderRequest.java#L253-L256
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/DataTracker.java
DataTracker.replaceWithNewInstances
public void replaceWithNewInstances(Collection<SSTableReader> toReplace, Collection<SSTableReader> replaceWith) { """ Replaces existing sstables with new instances, makes sure compaction strategies have the correct instance @param toReplace @param replaceWith """ replaceReaders(toReplace, replaceWith, true); }
java
public void replaceWithNewInstances(Collection<SSTableReader> toReplace, Collection<SSTableReader> replaceWith) { replaceReaders(toReplace, replaceWith, true); }
[ "public", "void", "replaceWithNewInstances", "(", "Collection", "<", "SSTableReader", ">", "toReplace", ",", "Collection", "<", "SSTableReader", ">", "replaceWith", ")", "{", "replaceReaders", "(", "toReplace", ",", "replaceWith", ",", "true", ")", ";", "}" ]
Replaces existing sstables with new instances, makes sure compaction strategies have the correct instance @param toReplace @param replaceWith
[ "Replaces", "existing", "sstables", "with", "new", "instances", "makes", "sure", "compaction", "strategies", "have", "the", "correct", "instance" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/DataTracker.java#L305-L308
Samsung/GearVRf
GVRf/Extensions/3DCursor/IODevices/io_hand_template/src/main/java/com/sample/hand/template/IOBaseComponent.java
IOBaseComponent.setPosition
public void setPosition(float x, float y, float z) { """ Set the position of the {@link IOBaseComponent} @param x the x value of the quaternion @param y the y value of the quaternion @param z the z value of the quaternion """ componentPosition.set(x, y, z); if (sceneObject != null) { sceneObject.getTransform().setPosition(x, y, z); } }
java
public void setPosition(float x, float y, float z) { componentPosition.set(x, y, z); if (sceneObject != null) { sceneObject.getTransform().setPosition(x, y, z); } }
[ "public", "void", "setPosition", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "componentPosition", ".", "set", "(", "x", ",", "y", ",", "z", ")", ";", "if", "(", "sceneObject", "!=", "null", ")", "{", "sceneObject", ".", "getTransform", "(", ")", ".", "setPosition", "(", "x", ",", "y", ",", "z", ")", ";", "}", "}" ]
Set the position of the {@link IOBaseComponent} @param x the x value of the quaternion @param y the y value of the quaternion @param z the z value of the quaternion
[ "Set", "the", "position", "of", "the", "{", "@link", "IOBaseComponent", "}" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/io_hand_template/src/main/java/com/sample/hand/template/IOBaseComponent.java#L97-L102
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/TextGame.java
TextGame.drawRect
public void drawRect(Graphic g, ColorRgba color, int x, int y, int width, int height) { """ Renders text on graphic output, to the specified location using the specified localizable referential. @param g The graphic output. @param color The rectangle color. @param x The horizontal location. @param y The vertical location. @param width The rectangle width. @param height The rectangle height. """ g.setColor(color); g.drawRect(x - this.x, this.y - y - height + this.height, width, height, false); }
java
public void drawRect(Graphic g, ColorRgba color, int x, int y, int width, int height) { g.setColor(color); g.drawRect(x - this.x, this.y - y - height + this.height, width, height, false); }
[ "public", "void", "drawRect", "(", "Graphic", "g", ",", "ColorRgba", "color", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "g", ".", "setColor", "(", "color", ")", ";", "g", ".", "drawRect", "(", "x", "-", "this", ".", "x", ",", "this", ".", "y", "-", "y", "-", "height", "+", "this", ".", "height", ",", "width", ",", "height", ",", "false", ")", ";", "}" ]
Renders text on graphic output, to the specified location using the specified localizable referential. @param g The graphic output. @param color The rectangle color. @param x The horizontal location. @param y The vertical location. @param width The rectangle width. @param height The rectangle height.
[ "Renders", "text", "on", "graphic", "output", "to", "the", "specified", "location", "using", "the", "specified", "localizable", "referential", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/TextGame.java#L100-L104
eirbjo/jetty-console
jetty-console-creator/src/main/java/org/simplericity/jettyconsole/creator/DefaultCreator.java
DefaultCreator.writePathDescriptor
private void writePathDescriptor(File consoleDir, Set<String> paths) { """ Write a txt file with one line for each unpacked class or resource from dependencies. """ try (PrintWriter writer = new PrintWriter(new FileOutputStream(new File(consoleDir, "jettyconsolepaths.txt")))){ for (String path : paths) { writer.println(path); } } catch (FileNotFoundException e) { throw new RuntimeException(e); } }
java
private void writePathDescriptor(File consoleDir, Set<String> paths) { try (PrintWriter writer = new PrintWriter(new FileOutputStream(new File(consoleDir, "jettyconsolepaths.txt")))){ for (String path : paths) { writer.println(path); } } catch (FileNotFoundException e) { throw new RuntimeException(e); } }
[ "private", "void", "writePathDescriptor", "(", "File", "consoleDir", ",", "Set", "<", "String", ">", "paths", ")", "{", "try", "(", "PrintWriter", "writer", "=", "new", "PrintWriter", "(", "new", "FileOutputStream", "(", "new", "File", "(", "consoleDir", ",", "\"jettyconsolepaths.txt\"", ")", ")", ")", ")", "{", "for", "(", "String", "path", ":", "paths", ")", "{", "writer", ".", "println", "(", "path", ")", ";", "}", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Write a txt file with one line for each unpacked class or resource from dependencies.
[ "Write", "a", "txt", "file", "with", "one", "line", "for", "each", "unpacked", "class", "or", "resource", "from", "dependencies", "." ]
train
https://github.com/eirbjo/jetty-console/blob/5bd32ecab12837394dd45fd15c51c3934afcd76b/jetty-console-creator/src/main/java/org/simplericity/jettyconsole/creator/DefaultCreator.java#L104-L113
samskivert/pythagoras
src/main/java/pythagoras/d/RectangularShape.java
RectangularShape.setFrame
public void setFrame (XY loc, IDimension size) { """ Sets the location and size of the framing rectangle of this shape to the supplied values. """ setFrame(loc.x(), loc.y(), size.width(), size.height()); }
java
public void setFrame (XY loc, IDimension size) { setFrame(loc.x(), loc.y(), size.width(), size.height()); }
[ "public", "void", "setFrame", "(", "XY", "loc", ",", "IDimension", "size", ")", "{", "setFrame", "(", "loc", ".", "x", "(", ")", ",", "loc", ".", "y", "(", ")", ",", "size", ".", "width", "(", ")", ",", "size", ".", "height", "(", ")", ")", ";", "}" ]
Sets the location and size of the framing rectangle of this shape to the supplied values.
[ "Sets", "the", "location", "and", "size", "of", "the", "framing", "rectangle", "of", "this", "shape", "to", "the", "supplied", "values", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/RectangularShape.java#L21-L23
line/armeria
core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java
TypeSignature.ofContainer
public static TypeSignature ofContainer(String containerTypeName, TypeSignature... elementTypeSignatures) { """ Creates a new container type with the specified container type name and the type signatures of the elements it contains. @throws IllegalArgumentException if the specified type name is not valid or {@code elementTypeSignatures} is empty. """ requireNonNull(elementTypeSignatures, "elementTypeSignatures"); return ofContainer(containerTypeName, ImmutableList.copyOf(elementTypeSignatures)); }
java
public static TypeSignature ofContainer(String containerTypeName, TypeSignature... elementTypeSignatures) { requireNonNull(elementTypeSignatures, "elementTypeSignatures"); return ofContainer(containerTypeName, ImmutableList.copyOf(elementTypeSignatures)); }
[ "public", "static", "TypeSignature", "ofContainer", "(", "String", "containerTypeName", ",", "TypeSignature", "...", "elementTypeSignatures", ")", "{", "requireNonNull", "(", "elementTypeSignatures", ",", "\"elementTypeSignatures\"", ")", ";", "return", "ofContainer", "(", "containerTypeName", ",", "ImmutableList", ".", "copyOf", "(", "elementTypeSignatures", ")", ")", ";", "}" ]
Creates a new container type with the specified container type name and the type signatures of the elements it contains. @throws IllegalArgumentException if the specified type name is not valid or {@code elementTypeSignatures} is empty.
[ "Creates", "a", "new", "container", "type", "with", "the", "specified", "container", "type", "name", "and", "the", "type", "signatures", "of", "the", "elements", "it", "contains", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/TypeSignature.java#L79-L82
threerings/narya
core/src/main/java/com/threerings/presents/peer/server/PeerManager.java
PeerManager.broadcastStaleCacheData
public void broadcastStaleCacheData (String cache, Streamable data) { """ Called when cached data has changed on the local server and needs to inform our peers. """ _nodeobj.setCacheData(new NodeObject.CacheData(cache, data)); }
java
public void broadcastStaleCacheData (String cache, Streamable data) { _nodeobj.setCacheData(new NodeObject.CacheData(cache, data)); }
[ "public", "void", "broadcastStaleCacheData", "(", "String", "cache", ",", "Streamable", "data", ")", "{", "_nodeobj", ".", "setCacheData", "(", "new", "NodeObject", ".", "CacheData", "(", "cache", ",", "data", ")", ")", ";", "}" ]
Called when cached data has changed on the local server and needs to inform our peers.
[ "Called", "when", "cached", "data", "has", "changed", "on", "the", "local", "server", "and", "needs", "to", "inform", "our", "peers", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L1002-L1005
phax/ph-oton
ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5DeleteFile.java
FineUploader5DeleteFile.setCustomHeaders
@Nonnull public FineUploader5DeleteFile setCustomHeaders (@Nullable final Map <String, String> aCustomHeaders) { """ Any additional headers to attach to all delete file requests. @param aCustomHeaders Custom headers to be set. @return this """ m_aDeleteFileCustomHeaders.setAll (aCustomHeaders); return this; }
java
@Nonnull public FineUploader5DeleteFile setCustomHeaders (@Nullable final Map <String, String> aCustomHeaders) { m_aDeleteFileCustomHeaders.setAll (aCustomHeaders); return this; }
[ "@", "Nonnull", "public", "FineUploader5DeleteFile", "setCustomHeaders", "(", "@", "Nullable", "final", "Map", "<", "String", ",", "String", ">", "aCustomHeaders", ")", "{", "m_aDeleteFileCustomHeaders", ".", "setAll", "(", "aCustomHeaders", ")", ";", "return", "this", ";", "}" ]
Any additional headers to attach to all delete file requests. @param aCustomHeaders Custom headers to be set. @return this
[ "Any", "additional", "headers", "to", "attach", "to", "all", "delete", "file", "requests", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uictrls/src/main/java/com/helger/photon/uictrls/fineupload5/FineUploader5DeleteFile.java#L68-L73
samskivert/samskivert
src/main/java/com/samskivert/util/PropertiesUtil.java
PropertiesUtil.loadAndGet
public static String loadAndGet (File propFile, String key) { """ Loads up the supplied properties file and returns the specified key. Clearly this is an expensive operation and you should load a properties file separately if you plan to retrieve multiple keys from it. This method, however, is convenient for, say, extracting a value from a properties file that contains only one key, like a build timestamp properties file, for example. @return the value of the key in question or null if no such key exists or an error occurred loading the properties file. """ try { return load(propFile).getProperty(key); } catch (IOException ioe) { return null; } }
java
public static String loadAndGet (File propFile, String key) { try { return load(propFile).getProperty(key); } catch (IOException ioe) { return null; } }
[ "public", "static", "String", "loadAndGet", "(", "File", "propFile", ",", "String", "key", ")", "{", "try", "{", "return", "load", "(", "propFile", ")", ".", "getProperty", "(", "key", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "return", "null", ";", "}", "}" ]
Loads up the supplied properties file and returns the specified key. Clearly this is an expensive operation and you should load a properties file separately if you plan to retrieve multiple keys from it. This method, however, is convenient for, say, extracting a value from a properties file that contains only one key, like a build timestamp properties file, for example. @return the value of the key in question or null if no such key exists or an error occurred loading the properties file.
[ "Loads", "up", "the", "supplied", "properties", "file", "and", "returns", "the", "specified", "key", ".", "Clearly", "this", "is", "an", "expensive", "operation", "and", "you", "should", "load", "a", "properties", "file", "separately", "if", "you", "plan", "to", "retrieve", "multiple", "keys", "from", "it", ".", "This", "method", "however", "is", "convenient", "for", "say", "extracting", "a", "value", "from", "a", "properties", "file", "that", "contains", "only", "one", "key", "like", "a", "build", "timestamp", "properties", "file", "for", "example", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/PropertiesUtil.java#L182-L189
aws/aws-sdk-java
aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/StepExecution.java
StepExecution.withInputs
public StepExecution withInputs(java.util.Map<String, String> inputs) { """ <p> Fully-resolved values passed into the step before execution. </p> @param inputs Fully-resolved values passed into the step before execution. @return Returns a reference to this object so that method calls can be chained together. """ setInputs(inputs); return this; }
java
public StepExecution withInputs(java.util.Map<String, String> inputs) { setInputs(inputs); return this; }
[ "public", "StepExecution", "withInputs", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "inputs", ")", "{", "setInputs", "(", "inputs", ")", ";", "return", "this", ";", "}" ]
<p> Fully-resolved values passed into the step before execution. </p> @param inputs Fully-resolved values passed into the step before execution. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Fully", "-", "resolved", "values", "passed", "into", "the", "step", "before", "execution", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/StepExecution.java#L619-L622
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.unexplode
public static void unexplode(File dir, int compressionLevel) { """ Compresses a given directory in its own location. <p> A ZIP file will be first created with a temporary name. After the compressing the directory will be deleted and the ZIP file will be renamed as the original directory. @param dir input directory as well as the target ZIP file. @param compressionLevel compression level @see #pack(File, File) """ try { // Find a new unique name is the same directory File zip = FileUtils.getTempFileFor(dir); // Pack it pack(dir, zip, compressionLevel); // Delete the directory FileUtils.deleteDirectory(dir); // Rename the archive FileUtils.moveFile(zip, dir); } catch (IOException e) { throw ZipExceptionUtil.rethrow(e); } }
java
public static void unexplode(File dir, int compressionLevel) { try { // Find a new unique name is the same directory File zip = FileUtils.getTempFileFor(dir); // Pack it pack(dir, zip, compressionLevel); // Delete the directory FileUtils.deleteDirectory(dir); // Rename the archive FileUtils.moveFile(zip, dir); } catch (IOException e) { throw ZipExceptionUtil.rethrow(e); } }
[ "public", "static", "void", "unexplode", "(", "File", "dir", ",", "int", "compressionLevel", ")", "{", "try", "{", "// Find a new unique name is the same directory", "File", "zip", "=", "FileUtils", ".", "getTempFileFor", "(", "dir", ")", ";", "// Pack it", "pack", "(", "dir", ",", "zip", ",", "compressionLevel", ")", ";", "// Delete the directory", "FileUtils", ".", "deleteDirectory", "(", "dir", ")", ";", "// Rename the archive", "FileUtils", ".", "moveFile", "(", "zip", ",", "dir", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "ZipExceptionUtil", ".", "rethrow", "(", "e", ")", ";", "}", "}" ]
Compresses a given directory in its own location. <p> A ZIP file will be first created with a temporary name. After the compressing the directory will be deleted and the ZIP file will be renamed as the original directory. @param dir input directory as well as the target ZIP file. @param compressionLevel compression level @see #pack(File, File)
[ "Compresses", "a", "given", "directory", "in", "its", "own", "location", ".", "<p", ">", "A", "ZIP", "file", "will", "be", "first", "created", "with", "a", "temporary", "name", ".", "After", "the", "compressing", "the", "directory", "will", "be", "deleted", "and", "the", "ZIP", "file", "will", "be", "renamed", "as", "the", "original", "directory", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1935-L1952
HiddenStage/divide
Client/android-client/src/main/java/com/google/android/gcm/GCMRegistrar.java
GCMRegistrar.register
public static void register(Context context, String... senderIds) { """ Initiate messaging registration for the current application. <p> The result will be returned as an {@link GCMConstants#INTENT_FROM_GCM_REGISTRATION_CALLBACK} intent with either a {@link GCMConstants#EXTRA_REGISTRATION_ID} or {@link GCMConstants#EXTRA_ERROR}. @param context application context. @param senderIds Google Project ID of the accounts authorized to send messages to this application. @throws IllegalStateException if device does not have all GCM dependencies installed. """ GCMRegistrar.resetBackoff(context); internalRegister(context, senderIds); }
java
public static void register(Context context, String... senderIds) { GCMRegistrar.resetBackoff(context); internalRegister(context, senderIds); }
[ "public", "static", "void", "register", "(", "Context", "context", ",", "String", "...", "senderIds", ")", "{", "GCMRegistrar", ".", "resetBackoff", "(", "context", ")", ";", "internalRegister", "(", "context", ",", "senderIds", ")", ";", "}" ]
Initiate messaging registration for the current application. <p> The result will be returned as an {@link GCMConstants#INTENT_FROM_GCM_REGISTRATION_CALLBACK} intent with either a {@link GCMConstants#EXTRA_REGISTRATION_ID} or {@link GCMConstants#EXTRA_ERROR}. @param context application context. @param senderIds Google Project ID of the accounts authorized to send messages to this application. @throws IllegalStateException if device does not have all GCM dependencies installed.
[ "Initiate", "messaging", "registration", "for", "the", "current", "application", ".", "<p", ">", "The", "result", "will", "be", "returned", "as", "an", "{", "@link", "GCMConstants#INTENT_FROM_GCM_REGISTRATION_CALLBACK", "}", "intent", "with", "either", "a", "{", "@link", "GCMConstants#EXTRA_REGISTRATION_ID", "}", "or", "{", "@link", "GCMConstants#EXTRA_ERROR", "}", "." ]
train
https://github.com/HiddenStage/divide/blob/14e36598c50d92b4393e6649915e32b86141c598/Client/android-client/src/main/java/com/google/android/gcm/GCMRegistrar.java#L211-L214
appium/java-client
src/main/java/io/appium/java_client/events/EventFiringObjectFactory.java
EventFiringObjectFactory.getEventFiringObject
public static <T> T getEventFiringObject(T t, WebDriver driver) { """ This method makes an event firing object. @param t an original {@link Object} that is supposed to be listenable @param driver an instance of {@link org.openqa.selenium.WebDriver} @param <T> T @return an {@link Object} that fires events """ return getEventFiringObject(t, driver, Collections.emptyList()); }
java
public static <T> T getEventFiringObject(T t, WebDriver driver) { return getEventFiringObject(t, driver, Collections.emptyList()); }
[ "public", "static", "<", "T", ">", "T", "getEventFiringObject", "(", "T", "t", ",", "WebDriver", "driver", ")", "{", "return", "getEventFiringObject", "(", "t", ",", "driver", ",", "Collections", ".", "emptyList", "(", ")", ")", ";", "}" ]
This method makes an event firing object. @param t an original {@link Object} that is supposed to be listenable @param driver an instance of {@link org.openqa.selenium.WebDriver} @param <T> T @return an {@link Object} that fires events
[ "This", "method", "makes", "an", "event", "firing", "object", "." ]
train
https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/events/EventFiringObjectFactory.java#L54-L56
jblas-project/jblas
src/main/java/org/jblas/util/Permutations.java
Permutations.permutationDoubleMatrixFromPivotIndices
public static DoubleMatrix permutationDoubleMatrixFromPivotIndices(int size, int[] ipiv) { """ Create a permutation matrix from a LAPACK-style 'ipiv' vector. @param ipiv row i was interchanged with row ipiv[i] """ int n = ipiv.length; //System.out.printf("size = %d n = %d\n", size, n); int indices[] = new int[size]; for (int i = 0; i < size; i++) indices[i] = i; //for (int i = 0; i < n; i++) // System.out.printf("ipiv[%d] = %d\n", i, ipiv[i]); for (int i = 0; i < n; i++) { int j = ipiv[i] - 1; int t = indices[i]; indices[i] = indices[j]; indices[j] = t; } DoubleMatrix result = new DoubleMatrix(size, size); for (int i = 0; i < size; i++) result.put(indices[i], i, 1.0); return result; }
java
public static DoubleMatrix permutationDoubleMatrixFromPivotIndices(int size, int[] ipiv) { int n = ipiv.length; //System.out.printf("size = %d n = %d\n", size, n); int indices[] = new int[size]; for (int i = 0; i < size; i++) indices[i] = i; //for (int i = 0; i < n; i++) // System.out.printf("ipiv[%d] = %d\n", i, ipiv[i]); for (int i = 0; i < n; i++) { int j = ipiv[i] - 1; int t = indices[i]; indices[i] = indices[j]; indices[j] = t; } DoubleMatrix result = new DoubleMatrix(size, size); for (int i = 0; i < size; i++) result.put(indices[i], i, 1.0); return result; }
[ "public", "static", "DoubleMatrix", "permutationDoubleMatrixFromPivotIndices", "(", "int", "size", ",", "int", "[", "]", "ipiv", ")", "{", "int", "n", "=", "ipiv", ".", "length", ";", "//System.out.printf(\"size = %d n = %d\\n\", size, n);", "int", "indices", "[", "]", "=", "new", "int", "[", "size", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "indices", "[", "i", "]", "=", "i", ";", "//for (int i = 0; i < n; i++)", "// System.out.printf(\"ipiv[%d] = %d\\n\", i, ipiv[i]);", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "int", "j", "=", "ipiv", "[", "i", "]", "-", "1", ";", "int", "t", "=", "indices", "[", "i", "]", ";", "indices", "[", "i", "]", "=", "indices", "[", "j", "]", ";", "indices", "[", "j", "]", "=", "t", ";", "}", "DoubleMatrix", "result", "=", "new", "DoubleMatrix", "(", "size", ",", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "result", ".", "put", "(", "indices", "[", "i", "]", ",", "i", ",", "1.0", ")", ";", "return", "result", ";", "}" ]
Create a permutation matrix from a LAPACK-style 'ipiv' vector. @param ipiv row i was interchanged with row ipiv[i]
[ "Create", "a", "permutation", "matrix", "from", "a", "LAPACK", "-", "style", "ipiv", "vector", "." ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/Permutations.java#L99-L119
RKumsher/utils
src/main/java/com/github/rkumsher/date/RandomDateUtils.java
RandomDateUtils.randomMonthDayAfter
public static MonthDay randomMonthDayAfter(MonthDay after, boolean includeLeapDay) { """ Returns a random {@link MonthDay} that is after the given {@link MonthDay}. @param after the value that returned {@link MonthDay} must be after @param includeLeapDay whether or not to include leap day @return the random {@link MonthDay} @throws IllegalArgumentException if after is null or if after is last day of year (December 31st) """ checkArgument(after != null, "After must be non-null"); checkArgument(after.isBefore(MonthDay.of(DECEMBER, 31)), "After must be before December 31st"); int year = includeLeapDay ? LEAP_YEAR : LEAP_YEAR - 1; LocalDate start = after.atYear(year).plus(1, DAYS); LocalDate end = Year.of(year + 1).atDay(1); LocalDate localDate = randomLocalDate(start, end); return MonthDay.of(localDate.getMonth(), localDate.getDayOfMonth()); }
java
public static MonthDay randomMonthDayAfter(MonthDay after, boolean includeLeapDay) { checkArgument(after != null, "After must be non-null"); checkArgument(after.isBefore(MonthDay.of(DECEMBER, 31)), "After must be before December 31st"); int year = includeLeapDay ? LEAP_YEAR : LEAP_YEAR - 1; LocalDate start = after.atYear(year).plus(1, DAYS); LocalDate end = Year.of(year + 1).atDay(1); LocalDate localDate = randomLocalDate(start, end); return MonthDay.of(localDate.getMonth(), localDate.getDayOfMonth()); }
[ "public", "static", "MonthDay", "randomMonthDayAfter", "(", "MonthDay", "after", ",", "boolean", "includeLeapDay", ")", "{", "checkArgument", "(", "after", "!=", "null", ",", "\"After must be non-null\"", ")", ";", "checkArgument", "(", "after", ".", "isBefore", "(", "MonthDay", ".", "of", "(", "DECEMBER", ",", "31", ")", ")", ",", "\"After must be before December 31st\"", ")", ";", "int", "year", "=", "includeLeapDay", "?", "LEAP_YEAR", ":", "LEAP_YEAR", "-", "1", ";", "LocalDate", "start", "=", "after", ".", "atYear", "(", "year", ")", ".", "plus", "(", "1", ",", "DAYS", ")", ";", "LocalDate", "end", "=", "Year", ".", "of", "(", "year", "+", "1", ")", ".", "atDay", "(", "1", ")", ";", "LocalDate", "localDate", "=", "randomLocalDate", "(", "start", ",", "end", ")", ";", "return", "MonthDay", ".", "of", "(", "localDate", ".", "getMonth", "(", ")", ",", "localDate", ".", "getDayOfMonth", "(", ")", ")", ";", "}" ]
Returns a random {@link MonthDay} that is after the given {@link MonthDay}. @param after the value that returned {@link MonthDay} must be after @param includeLeapDay whether or not to include leap day @return the random {@link MonthDay} @throws IllegalArgumentException if after is null or if after is last day of year (December 31st)
[ "Returns", "a", "random", "{", "@link", "MonthDay", "}", "that", "is", "after", "the", "given", "{", "@link", "MonthDay", "}", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/date/RandomDateUtils.java#L741-L749
alkacon/opencms-core
src/org/opencms/search/documents/CmsDocumentGeneric.java
CmsDocumentGeneric.extractContent
public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsIndexException { """ Just returns an empty extraction result since the content can't be extracted form a generic resource.<p> @see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, I_CmsSearchIndex) """ if (resource == null) { throw new CmsIndexException(Messages.get().container(Messages.ERR_NO_RAW_CONTENT_1, index.getLocale())); } // just return an empty result set return new CmsExtractionResult(""); }
java
public I_CmsExtractionResult extractContent(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsIndexException { if (resource == null) { throw new CmsIndexException(Messages.get().container(Messages.ERR_NO_RAW_CONTENT_1, index.getLocale())); } // just return an empty result set return new CmsExtractionResult(""); }
[ "public", "I_CmsExtractionResult", "extractContent", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "I_CmsSearchIndex", "index", ")", "throws", "CmsIndexException", "{", "if", "(", "resource", "==", "null", ")", "{", "throw", "new", "CmsIndexException", "(", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_NO_RAW_CONTENT_1", ",", "index", ".", "getLocale", "(", ")", ")", ")", ";", "}", "// just return an empty result set", "return", "new", "CmsExtractionResult", "(", "\"\"", ")", ";", "}" ]
Just returns an empty extraction result since the content can't be extracted form a generic resource.<p> @see org.opencms.search.documents.I_CmsSearchExtractor#extractContent(CmsObject, CmsResource, I_CmsSearchIndex)
[ "Just", "returns", "an", "empty", "extraction", "result", "since", "the", "content", "can", "t", "be", "extracted", "form", "a", "generic", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsDocumentGeneric.java#L65-L73
alkacon/opencms-core
src/org/opencms/i18n/CmsEncoder.java
CmsEncoder.escapeWBlanks
public static String escapeWBlanks(String source, String encoding) { """ Encodes a String in a way similar JavaScript "encodeURIcomponent" function.<p> Multiple blanks are encoded _multiply_ with <code>%20</code>.<p> @param source The text to be encoded @param encoding the encoding type @return The encoded String """ if (CmsStringUtil.isEmpty(source)) { return source; } StringBuffer ret = new StringBuffer(source.length() * 2); // URLEncode the text string // this produces a very similar encoding to JavaSscript encoding, // except the blank which is not encoded into "%20" instead of "+" String enc = encode(source, encoding); for (int z = 0; z < enc.length(); z++) { char c = enc.charAt(z); if (c == '+') { ret.append("%20"); } else { ret.append(c); } } return ret.toString(); }
java
public static String escapeWBlanks(String source, String encoding) { if (CmsStringUtil.isEmpty(source)) { return source; } StringBuffer ret = new StringBuffer(source.length() * 2); // URLEncode the text string // this produces a very similar encoding to JavaSscript encoding, // except the blank which is not encoded into "%20" instead of "+" String enc = encode(source, encoding); for (int z = 0; z < enc.length(); z++) { char c = enc.charAt(z); if (c == '+') { ret.append("%20"); } else { ret.append(c); } } return ret.toString(); }
[ "public", "static", "String", "escapeWBlanks", "(", "String", "source", ",", "String", "encoding", ")", "{", "if", "(", "CmsStringUtil", ".", "isEmpty", "(", "source", ")", ")", "{", "return", "source", ";", "}", "StringBuffer", "ret", "=", "new", "StringBuffer", "(", "source", ".", "length", "(", ")", "*", "2", ")", ";", "// URLEncode the text string", "// this produces a very similar encoding to JavaSscript encoding,", "// except the blank which is not encoded into \"%20\" instead of \"+\"", "String", "enc", "=", "encode", "(", "source", ",", "encoding", ")", ";", "for", "(", "int", "z", "=", "0", ";", "z", "<", "enc", ".", "length", "(", ")", ";", "z", "++", ")", "{", "char", "c", "=", "enc", ".", "charAt", "(", "z", ")", ";", "if", "(", "c", "==", "'", "'", ")", "{", "ret", ".", "append", "(", "\"%20\"", ")", ";", "}", "else", "{", "ret", ".", "append", "(", "c", ")", ";", "}", "}", "return", "ret", ".", "toString", "(", ")", ";", "}" ]
Encodes a String in a way similar JavaScript "encodeURIcomponent" function.<p> Multiple blanks are encoded _multiply_ with <code>%20</code>.<p> @param source The text to be encoded @param encoding the encoding type @return The encoded String
[ "Encodes", "a", "String", "in", "a", "way", "similar", "JavaScript", "encodeURIcomponent", "function", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsEncoder.java#L698-L719
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java
SqlBuilderHelper.generateSQLForStaticQuery
public static void generateSQLForStaticQuery(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { """ <p> Generate log for INSERT operations </p> . @param method the method @param methodBuilder the method builder """ methodBuilder.addComment("generate static SQL for statement"); JQLChecker checker = JQLChecker.getInstance(); // replace the table name, other pieces will be removed String sql = checker.replace(method, method.jql, new JQLReplacerListenerImpl(method) { @Override public String onColumnNameToUpdate(String columnName) { return onColumnName(columnName); } @Override public String onColumnName(String columnName) { SQLProperty tempProperty = method.getEntity().get(columnName); AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, columnName); return tempProperty.columnName; } @Override public String onBindParameter(String bindParameterName, boolean inStatement) { return "?"; } }); methodBuilder.addStatement("String _sql=$S", sql); }
java
public static void generateSQLForStaticQuery(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { methodBuilder.addComment("generate static SQL for statement"); JQLChecker checker = JQLChecker.getInstance(); // replace the table name, other pieces will be removed String sql = checker.replace(method, method.jql, new JQLReplacerListenerImpl(method) { @Override public String onColumnNameToUpdate(String columnName) { return onColumnName(columnName); } @Override public String onColumnName(String columnName) { SQLProperty tempProperty = method.getEntity().get(columnName); AssertKripton.assertTrueOrUnknownPropertyInJQLException(tempProperty != null, method, columnName); return tempProperty.columnName; } @Override public String onBindParameter(String bindParameterName, boolean inStatement) { return "?"; } }); methodBuilder.addStatement("String _sql=$S", sql); }
[ "public", "static", "void", "generateSQLForStaticQuery", "(", "final", "SQLiteModelMethod", "method", ",", "MethodSpec", ".", "Builder", "methodBuilder", ")", "{", "methodBuilder", ".", "addComment", "(", "\"generate static SQL for statement\"", ")", ";", "JQLChecker", "checker", "=", "JQLChecker", ".", "getInstance", "(", ")", ";", "// replace the table name, other pieces will be removed", "String", "sql", "=", "checker", ".", "replace", "(", "method", ",", "method", ".", "jql", ",", "new", "JQLReplacerListenerImpl", "(", "method", ")", "{", "@", "Override", "public", "String", "onColumnNameToUpdate", "(", "String", "columnName", ")", "{", "return", "onColumnName", "(", "columnName", ")", ";", "}", "@", "Override", "public", "String", "onColumnName", "(", "String", "columnName", ")", "{", "SQLProperty", "tempProperty", "=", "method", ".", "getEntity", "(", ")", ".", "get", "(", "columnName", ")", ";", "AssertKripton", ".", "assertTrueOrUnknownPropertyInJQLException", "(", "tempProperty", "!=", "null", ",", "method", ",", "columnName", ")", ";", "return", "tempProperty", ".", "columnName", ";", "}", "@", "Override", "public", "String", "onBindParameter", "(", "String", "bindParameterName", ",", "boolean", "inStatement", ")", "{", "return", "\"?\"", ";", "}", "}", ")", ";", "methodBuilder", ".", "addStatement", "(", "\"String _sql=$S\"", ",", "sql", ")", ";", "}" ]
<p> Generate log for INSERT operations </p> . @param method the method @param methodBuilder the method builder
[ "<p", ">", "Generate", "log", "for", "INSERT", "operations", "<", "/", "p", ">", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java#L715-L743
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/PartitioningStrategyFactory.java
PartitioningStrategyFactory.getPartitioningStrategy
public PartitioningStrategy getPartitioningStrategy(String mapName, PartitioningStrategyConfig config) { """ Obtain a {@link PartitioningStrategy} for the given {@code NodeEngine} and {@code mapName}. This method first attempts locating a {@link PartitioningStrategy} in {code config.getPartitioningStrategy()}. If this is {@code null}, then looks up its internal cache of partitioning strategies; if one has already been created for the given {@code mapName}, it is returned, otherwise it is instantiated, cached and returned. @param mapName Map for which this partitioning strategy is being created @param config the partitioning strategy configuration @return """ PartitioningStrategy strategy = null; if (config != null) { strategy = config.getPartitioningStrategy(); if (strategy == null) { if (cache.containsKey(mapName)) { strategy = cache.get(mapName); } else if (config.getPartitioningStrategyClass() != null) { try { strategy = ClassLoaderUtil.newInstance(configClassLoader, config.getPartitioningStrategyClass()); cache.put(mapName, strategy); } catch (Exception e) { throw ExceptionUtil.rethrow(e); } } } } return strategy; }
java
public PartitioningStrategy getPartitioningStrategy(String mapName, PartitioningStrategyConfig config) { PartitioningStrategy strategy = null; if (config != null) { strategy = config.getPartitioningStrategy(); if (strategy == null) { if (cache.containsKey(mapName)) { strategy = cache.get(mapName); } else if (config.getPartitioningStrategyClass() != null) { try { strategy = ClassLoaderUtil.newInstance(configClassLoader, config.getPartitioningStrategyClass()); cache.put(mapName, strategy); } catch (Exception e) { throw ExceptionUtil.rethrow(e); } } } } return strategy; }
[ "public", "PartitioningStrategy", "getPartitioningStrategy", "(", "String", "mapName", ",", "PartitioningStrategyConfig", "config", ")", "{", "PartitioningStrategy", "strategy", "=", "null", ";", "if", "(", "config", "!=", "null", ")", "{", "strategy", "=", "config", ".", "getPartitioningStrategy", "(", ")", ";", "if", "(", "strategy", "==", "null", ")", "{", "if", "(", "cache", ".", "containsKey", "(", "mapName", ")", ")", "{", "strategy", "=", "cache", ".", "get", "(", "mapName", ")", ";", "}", "else", "if", "(", "config", ".", "getPartitioningStrategyClass", "(", ")", "!=", "null", ")", "{", "try", "{", "strategy", "=", "ClassLoaderUtil", ".", "newInstance", "(", "configClassLoader", ",", "config", ".", "getPartitioningStrategyClass", "(", ")", ")", ";", "cache", ".", "put", "(", "mapName", ",", "strategy", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "ExceptionUtil", ".", "rethrow", "(", "e", ")", ";", "}", "}", "}", "}", "return", "strategy", ";", "}" ]
Obtain a {@link PartitioningStrategy} for the given {@code NodeEngine} and {@code mapName}. This method first attempts locating a {@link PartitioningStrategy} in {code config.getPartitioningStrategy()}. If this is {@code null}, then looks up its internal cache of partitioning strategies; if one has already been created for the given {@code mapName}, it is returned, otherwise it is instantiated, cached and returned. @param mapName Map for which this partitioning strategy is being created @param config the partitioning strategy configuration @return
[ "Obtain", "a", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/PartitioningStrategyFactory.java#L54-L72
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.internalReleaseLeaseOne
boolean internalReleaseLeaseOne(Lease lease, String src, INodeFileUnderConstruction pendingFile, boolean discardLastBlock) throws IOException { """ Move a file that is being written to be immutable. @param src The filename @param lease The lease for the client creating the file @return true if lease recovery has completed, false if the client has to retry """ // if it is safe to discard the last block, then do so if (discardLastBlock && discardDone(pendingFile, src)) { // Have client retry lease recovery. return false; } // Initialize lease recovery for pendingFile. If there are no blocks // associated with this file, then reap lease immediately. Otherwise // renew the lease and trigger lease recovery. if (pendingFile.getTargets() == null || pendingFile.getTargets().length == 0) { if (pendingFile.getBlocks().length == 0) { finalizeINodeFileUnderConstruction(src, pendingFile); NameNode.stateChangeLog.warn("BLOCK*" + " internalReleaseLease: No blocks found, lease removed for " + src); // Tell the client that lease recovery has succeeded. return true; } // setup the Inode.targets for the last block from the blocksMap // Block[] blocks = pendingFile.getBlocks(); Block last = blocks[blocks.length - 1]; DatanodeDescriptor[] targets = new DatanodeDescriptor[blocksMap.numNodes(last)]; Iterator<DatanodeDescriptor> it = blocksMap.nodeIterator(last); for (int i = 0; it != null && it.hasNext(); i++) { targets[i] = it.next(); } pendingFile.setTargets(targets, last.getGenerationStamp()); } // start lease recovery of the last block for this file. pendingFile.assignPrimaryDatanode(); Lease reassignedLease = reassignLease( lease, src, HdfsConstants.NN_RECOVERY_LEASEHOLDER, pendingFile ); getEditLog().logOpenFile(src, pendingFile); leaseManager.renewLease(reassignedLease); return false; // Have the client retry lease recovery. }
java
boolean internalReleaseLeaseOne(Lease lease, String src, INodeFileUnderConstruction pendingFile, boolean discardLastBlock) throws IOException { // if it is safe to discard the last block, then do so if (discardLastBlock && discardDone(pendingFile, src)) { // Have client retry lease recovery. return false; } // Initialize lease recovery for pendingFile. If there are no blocks // associated with this file, then reap lease immediately. Otherwise // renew the lease and trigger lease recovery. if (pendingFile.getTargets() == null || pendingFile.getTargets().length == 0) { if (pendingFile.getBlocks().length == 0) { finalizeINodeFileUnderConstruction(src, pendingFile); NameNode.stateChangeLog.warn("BLOCK*" + " internalReleaseLease: No blocks found, lease removed for " + src); // Tell the client that lease recovery has succeeded. return true; } // setup the Inode.targets for the last block from the blocksMap // Block[] blocks = pendingFile.getBlocks(); Block last = blocks[blocks.length - 1]; DatanodeDescriptor[] targets = new DatanodeDescriptor[blocksMap.numNodes(last)]; Iterator<DatanodeDescriptor> it = blocksMap.nodeIterator(last); for (int i = 0; it != null && it.hasNext(); i++) { targets[i] = it.next(); } pendingFile.setTargets(targets, last.getGenerationStamp()); } // start lease recovery of the last block for this file. pendingFile.assignPrimaryDatanode(); Lease reassignedLease = reassignLease( lease, src, HdfsConstants.NN_RECOVERY_LEASEHOLDER, pendingFile ); getEditLog().logOpenFile(src, pendingFile); leaseManager.renewLease(reassignedLease); return false; // Have the client retry lease recovery. }
[ "boolean", "internalReleaseLeaseOne", "(", "Lease", "lease", ",", "String", "src", ",", "INodeFileUnderConstruction", "pendingFile", ",", "boolean", "discardLastBlock", ")", "throws", "IOException", "{", "// if it is safe to discard the last block, then do so", "if", "(", "discardLastBlock", "&&", "discardDone", "(", "pendingFile", ",", "src", ")", ")", "{", "// Have client retry lease recovery.", "return", "false", ";", "}", "// Initialize lease recovery for pendingFile. If there are no blocks", "// associated with this file, then reap lease immediately. Otherwise", "// renew the lease and trigger lease recovery.", "if", "(", "pendingFile", ".", "getTargets", "(", ")", "==", "null", "||", "pendingFile", ".", "getTargets", "(", ")", ".", "length", "==", "0", ")", "{", "if", "(", "pendingFile", ".", "getBlocks", "(", ")", ".", "length", "==", "0", ")", "{", "finalizeINodeFileUnderConstruction", "(", "src", ",", "pendingFile", ")", ";", "NameNode", ".", "stateChangeLog", ".", "warn", "(", "\"BLOCK*\"", "+", "\" internalReleaseLease: No blocks found, lease removed for \"", "+", "src", ")", ";", "// Tell the client that lease recovery has succeeded.", "return", "true", ";", "}", "// setup the Inode.targets for the last block from the blocksMap", "//", "Block", "[", "]", "blocks", "=", "pendingFile", ".", "getBlocks", "(", ")", ";", "Block", "last", "=", "blocks", "[", "blocks", ".", "length", "-", "1", "]", ";", "DatanodeDescriptor", "[", "]", "targets", "=", "new", "DatanodeDescriptor", "[", "blocksMap", ".", "numNodes", "(", "last", ")", "]", ";", "Iterator", "<", "DatanodeDescriptor", ">", "it", "=", "blocksMap", ".", "nodeIterator", "(", "last", ")", ";", "for", "(", "int", "i", "=", "0", ";", "it", "!=", "null", "&&", "it", ".", "hasNext", "(", ")", ";", "i", "++", ")", "{", "targets", "[", "i", "]", "=", "it", ".", "next", "(", ")", ";", "}", "pendingFile", ".", "setTargets", "(", "targets", ",", "last", ".", "getGenerationStamp", "(", ")", ")", ";", "}", "// start lease recovery of the last block for this file.", "pendingFile", ".", "assignPrimaryDatanode", "(", ")", ";", "Lease", "reassignedLease", "=", "reassignLease", "(", "lease", ",", "src", ",", "HdfsConstants", ".", "NN_RECOVERY_LEASEHOLDER", ",", "pendingFile", ")", ";", "getEditLog", "(", ")", ".", "logOpenFile", "(", "src", ",", "pendingFile", ")", ";", "leaseManager", ".", "renewLease", "(", "reassignedLease", ")", ";", "return", "false", ";", "// Have the client retry lease recovery.", "}" ]
Move a file that is being written to be immutable. @param src The filename @param lease The lease for the client creating the file @return true if lease recovery has completed, false if the client has to retry
[ "Move", "a", "file", "that", "is", "being", "written", "to", "be", "immutable", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L4193-L4233
greatman/craftconomy3
src/main/java/com/greatmancode/craftconomy3/Common.java
Common.alertOldDbVersion
private void alertOldDbVersion(int currentVersion, int newVersion) { """ Alert in the console of a database update. @param currentVersion The current version @param newVersion The database update version """ Common.getInstance().sendConsoleMessage(Level.INFO, "Your database is out of date! (Version " + currentVersion + "). Updating it to Revision " + newVersion + "."); }
java
private void alertOldDbVersion(int currentVersion, int newVersion) { Common.getInstance().sendConsoleMessage(Level.INFO, "Your database is out of date! (Version " + currentVersion + "). Updating it to Revision " + newVersion + "."); }
[ "private", "void", "alertOldDbVersion", "(", "int", "currentVersion", ",", "int", "newVersion", ")", "{", "Common", ".", "getInstance", "(", ")", ".", "sendConsoleMessage", "(", "Level", ".", "INFO", ",", "\"Your database is out of date! (Version \"", "+", "currentVersion", "+", "\"). Updating it to Revision \"", "+", "newVersion", "+", "\".\"", ")", ";", "}" ]
Alert in the console of a database update. @param currentVersion The current version @param newVersion The database update version
[ "Alert", "in", "the", "console", "of", "a", "database", "update", "." ]
train
https://github.com/greatman/craftconomy3/blob/51b1b3de7d039e20c7418d1e70b8c4b02b8cf840/src/main/java/com/greatmancode/craftconomy3/Common.java#L1013-L1015
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/util/Objects.java
Objects.requireNonNullNorEmpty
public static <T extends Collection<?>> T requireNonNullNorEmpty(T collection, String message) { """ Require a collection to be neither null, nor empty. @param collection collection @param message error message @param <T> Collection type @return collection """ if (requireNonNull(collection).isEmpty()) { throw new IllegalArgumentException(message); } return collection; }
java
public static <T extends Collection<?>> T requireNonNullNorEmpty(T collection, String message) { if (requireNonNull(collection).isEmpty()) { throw new IllegalArgumentException(message); } return collection; }
[ "public", "static", "<", "T", "extends", "Collection", "<", "?", ">", ">", "T", "requireNonNullNorEmpty", "(", "T", "collection", ",", "String", "message", ")", "{", "if", "(", "requireNonNull", "(", "collection", ")", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "return", "collection", ";", "}" ]
Require a collection to be neither null, nor empty. @param collection collection @param message error message @param <T> Collection type @return collection
[ "Require", "a", "collection", "to", "be", "neither", "null", "nor", "empty", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/Objects.java#L42-L47
alkacon/opencms-core
src/org/opencms/ade/upload/CmsUploadBean.java
CmsUploadBean.generateResponse
private String generateResponse(Boolean success, String message, String stacktrace) { """ Generates a JSON object and returns its String representation for the response.<p> @param success <code>true</code> if the upload was successful @param message the message to display @param stacktrace the stack trace in case of an error @return the the response String """ JSONObject result = new JSONObject(); try { result.put(I_CmsUploadConstants.KEY_SUCCESS, success); result.put(I_CmsUploadConstants.KEY_MESSAGE, message); result.put(I_CmsUploadConstants.KEY_STACKTRACE, stacktrace); result.put(I_CmsUploadConstants.KEY_REQUEST_SIZE, getRequest().getContentLength()); result.put(I_CmsUploadConstants.KEY_UPLOADED_FILES, new JSONArray(m_resourcesCreated.keySet())); result.put(I_CmsUploadConstants.KEY_UPLOADED_FILE_NAMES, new JSONArray(m_resourcesCreated.values())); if (m_uploadHook != null) { result.put(I_CmsUploadConstants.KEY_UPLOAD_HOOK, m_uploadHook); } } catch (JSONException e) { LOG.error(m_bundle.key(org.opencms.ade.upload.Messages.ERR_UPLOAD_JSON_0), e); } return result.toString(); }
java
private String generateResponse(Boolean success, String message, String stacktrace) { JSONObject result = new JSONObject(); try { result.put(I_CmsUploadConstants.KEY_SUCCESS, success); result.put(I_CmsUploadConstants.KEY_MESSAGE, message); result.put(I_CmsUploadConstants.KEY_STACKTRACE, stacktrace); result.put(I_CmsUploadConstants.KEY_REQUEST_SIZE, getRequest().getContentLength()); result.put(I_CmsUploadConstants.KEY_UPLOADED_FILES, new JSONArray(m_resourcesCreated.keySet())); result.put(I_CmsUploadConstants.KEY_UPLOADED_FILE_NAMES, new JSONArray(m_resourcesCreated.values())); if (m_uploadHook != null) { result.put(I_CmsUploadConstants.KEY_UPLOAD_HOOK, m_uploadHook); } } catch (JSONException e) { LOG.error(m_bundle.key(org.opencms.ade.upload.Messages.ERR_UPLOAD_JSON_0), e); } return result.toString(); }
[ "private", "String", "generateResponse", "(", "Boolean", "success", ",", "String", "message", ",", "String", "stacktrace", ")", "{", "JSONObject", "result", "=", "new", "JSONObject", "(", ")", ";", "try", "{", "result", ".", "put", "(", "I_CmsUploadConstants", ".", "KEY_SUCCESS", ",", "success", ")", ";", "result", ".", "put", "(", "I_CmsUploadConstants", ".", "KEY_MESSAGE", ",", "message", ")", ";", "result", ".", "put", "(", "I_CmsUploadConstants", ".", "KEY_STACKTRACE", ",", "stacktrace", ")", ";", "result", ".", "put", "(", "I_CmsUploadConstants", ".", "KEY_REQUEST_SIZE", ",", "getRequest", "(", ")", ".", "getContentLength", "(", ")", ")", ";", "result", ".", "put", "(", "I_CmsUploadConstants", ".", "KEY_UPLOADED_FILES", ",", "new", "JSONArray", "(", "m_resourcesCreated", ".", "keySet", "(", ")", ")", ")", ";", "result", ".", "put", "(", "I_CmsUploadConstants", ".", "KEY_UPLOADED_FILE_NAMES", ",", "new", "JSONArray", "(", "m_resourcesCreated", ".", "values", "(", ")", ")", ")", ";", "if", "(", "m_uploadHook", "!=", "null", ")", "{", "result", ".", "put", "(", "I_CmsUploadConstants", ".", "KEY_UPLOAD_HOOK", ",", "m_uploadHook", ")", ";", "}", "}", "catch", "(", "JSONException", "e", ")", "{", "LOG", ".", "error", "(", "m_bundle", ".", "key", "(", "org", ".", "opencms", ".", "ade", ".", "upload", ".", "Messages", ".", "ERR_UPLOAD_JSON_0", ")", ",", "e", ")", ";", "}", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Generates a JSON object and returns its String representation for the response.<p> @param success <code>true</code> if the upload was successful @param message the message to display @param stacktrace the stack trace in case of an error @return the the response String
[ "Generates", "a", "JSON", "object", "and", "returns", "its", "String", "representation", "for", "the", "response", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/upload/CmsUploadBean.java#L429-L446
lazy-koala/java-toolkit
fast-toolkit/src/main/java/com/thankjava/toolkit/core/reflect/ReflectUtil.java
ReflectUtil.invokeMethod
public static Object invokeMethod(Object obj, Method method, Object... parameter) { """ 执行指定方法 <p>Function: invokeMethod</p> <p>Description: </p> @param obj @param method @param parameter @author [email protected] @date 2014-12-18 下午1:50:06 @version 1.0 """ try { method.setAccessible(true); return method.invoke(obj, parameter); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return null; }
java
public static Object invokeMethod(Object obj, Method method, Object... parameter) { try { method.setAccessible(true); return method.invoke(obj, parameter); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return null; }
[ "public", "static", "Object", "invokeMethod", "(", "Object", "obj", ",", "Method", "method", ",", "Object", "...", "parameter", ")", "{", "try", "{", "method", ".", "setAccessible", "(", "true", ")", ";", "return", "method", ".", "invoke", "(", "obj", ",", "parameter", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}" ]
执行指定方法 <p>Function: invokeMethod</p> <p>Description: </p> @param obj @param method @param parameter @author [email protected] @date 2014-12-18 下午1:50:06 @version 1.0
[ "执行指定方法", "<p", ">", "Function", ":", "invokeMethod<", "/", "p", ">", "<p", ">", "Description", ":", "<", "/", "p", ">" ]
train
https://github.com/lazy-koala/java-toolkit/blob/f46055fae0cc73049597a3708e515f5c6582d27a/fast-toolkit/src/main/java/com/thankjava/toolkit/core/reflect/ReflectUtil.java#L286-L298
OpenLiberty/open-liberty
dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java
JaxWsDDHelper.getWebserviceDescriptionByEJBLink
static WebserviceDescription getWebserviceDescriptionByEJBLink(String ejbLink, Adaptable containerToAdapt) throws UnableToAdaptException { """ Get the WebserviceDescription by ejb-link. @param ejbLink @param containerToAdapt @return @throws UnableToAdaptException """ return getHighLevelElementByServiceImplBean(ejbLink, containerToAdapt, WebserviceDescription.class, LinkType.EJB); }
java
static WebserviceDescription getWebserviceDescriptionByEJBLink(String ejbLink, Adaptable containerToAdapt) throws UnableToAdaptException { return getHighLevelElementByServiceImplBean(ejbLink, containerToAdapt, WebserviceDescription.class, LinkType.EJB); }
[ "static", "WebserviceDescription", "getWebserviceDescriptionByEJBLink", "(", "String", "ejbLink", ",", "Adaptable", "containerToAdapt", ")", "throws", "UnableToAdaptException", "{", "return", "getHighLevelElementByServiceImplBean", "(", "ejbLink", ",", "containerToAdapt", ",", "WebserviceDescription", ".", "class", ",", "LinkType", ".", "EJB", ")", ";", "}" ]
Get the WebserviceDescription by ejb-link. @param ejbLink @param containerToAdapt @return @throws UnableToAdaptException
[ "Get", "the", "WebserviceDescription", "by", "ejb", "-", "link", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java#L68-L70
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java
EmulatedFields.get
public boolean get(String name, boolean defaultValue) throws IllegalArgumentException { """ Finds and returns the boolean value of a given field named {@code name} in the receiver. If the field has not been assigned any value yet, the default value {@code defaultValue} is returned instead. @param name the name of the field to find. @param defaultValue return value in case the field has not been assigned to yet. @return the value of the given field if it has been assigned, the default value otherwise. @throws IllegalArgumentException if the corresponding field can not be found. """ ObjectSlot slot = findMandatorySlot(name, boolean.class); return slot.defaulted ? defaultValue : ((Boolean) slot.fieldValue).booleanValue(); }
java
public boolean get(String name, boolean defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, boolean.class); return slot.defaulted ? defaultValue : ((Boolean) slot.fieldValue).booleanValue(); }
[ "public", "boolean", "get", "(", "String", "name", ",", "boolean", "defaultValue", ")", "throws", "IllegalArgumentException", "{", "ObjectSlot", "slot", "=", "findMandatorySlot", "(", "name", ",", "boolean", ".", "class", ")", ";", "return", "slot", ".", "defaulted", "?", "defaultValue", ":", "(", "(", "Boolean", ")", "slot", ".", "fieldValue", ")", ".", "booleanValue", "(", ")", ";", "}" ]
Finds and returns the boolean value of a given field named {@code name} in the receiver. If the field has not been assigned any value yet, the default value {@code defaultValue} is returned instead. @param name the name of the field to find. @param defaultValue return value in case the field has not been assigned to yet. @return the value of the given field if it has been assigned, the default value otherwise. @throws IllegalArgumentException if the corresponding field can not be found.
[ "Finds", "and", "returns", "the", "boolean", "value", "of", "a", "given", "field", "named", "{", "@code", "name", "}", "in", "the", "receiver", ".", "If", "the", "field", "has", "not", "been", "assigned", "any", "value", "yet", "the", "default", "value", "{", "@code", "defaultValue", "}", "is", "returned", "instead", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java#L368-L371
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.fundamentalToProjective
public static DMatrixRMaj fundamentalToProjective(DMatrixRMaj F , Point3D_F64 e2, Vector3D_F64 v , double lambda ) { """ <p> Given a fundamental matrix a pair of camera matrices P and P1' are extracted. The camera matrices are 3 by 4 and used to project a 3D homogenous point onto the image plane. These camera matrices will only be known up to a projective transform, thus there are multiple solutions, The canonical camera matrix is defined as: <br> <pre> P=[I|0] and P'= [M|-M*t] = [[e']*F + e'*v^t | lambda*e'] </pre> where e' is the epipole F<sup>T</sup>e' = 0, [e'] is the cross product matrix for the enclosed vector, v is an arbitrary 3-vector and lambda is a non-zero scalar. </p> <p> NOTE: Additional information is needed to upgrade this projective transform into a metric transform. </p> <p> Page 256 in R. Hartley, and A. Zisserman, "Multiple View Geometry in Computer Vision", 2nd Ed, Cambridge 2003 </p> @see #extractEpipoles @see FundamentalToProjective @param F (Input) A fundamental matrix @param e2 (Input) Left epipole of fundamental matrix, F<sup>T</sup>*e2 = 0. @param v (Input) Arbitrary 3-vector. Just pick some value, say (0,0,0). @param lambda (Input) A non zero scalar. Try one. @return The canonical camera (projection) matrix P' (3 by 4) Known up to a projective transform. """ FundamentalToProjective f2p = new FundamentalToProjective(); DMatrixRMaj P = new DMatrixRMaj(3,4); f2p.twoView(F,e2,v,lambda,P); return P; }
java
public static DMatrixRMaj fundamentalToProjective(DMatrixRMaj F , Point3D_F64 e2, Vector3D_F64 v , double lambda ) { FundamentalToProjective f2p = new FundamentalToProjective(); DMatrixRMaj P = new DMatrixRMaj(3,4); f2p.twoView(F,e2,v,lambda,P); return P; }
[ "public", "static", "DMatrixRMaj", "fundamentalToProjective", "(", "DMatrixRMaj", "F", ",", "Point3D_F64", "e2", ",", "Vector3D_F64", "v", ",", "double", "lambda", ")", "{", "FundamentalToProjective", "f2p", "=", "new", "FundamentalToProjective", "(", ")", ";", "DMatrixRMaj", "P", "=", "new", "DMatrixRMaj", "(", "3", ",", "4", ")", ";", "f2p", ".", "twoView", "(", "F", ",", "e2", ",", "v", ",", "lambda", ",", "P", ")", ";", "return", "P", ";", "}" ]
<p> Given a fundamental matrix a pair of camera matrices P and P1' are extracted. The camera matrices are 3 by 4 and used to project a 3D homogenous point onto the image plane. These camera matrices will only be known up to a projective transform, thus there are multiple solutions, The canonical camera matrix is defined as: <br> <pre> P=[I|0] and P'= [M|-M*t] = [[e']*F + e'*v^t | lambda*e'] </pre> where e' is the epipole F<sup>T</sup>e' = 0, [e'] is the cross product matrix for the enclosed vector, v is an arbitrary 3-vector and lambda is a non-zero scalar. </p> <p> NOTE: Additional information is needed to upgrade this projective transform into a metric transform. </p> <p> Page 256 in R. Hartley, and A. Zisserman, "Multiple View Geometry in Computer Vision", 2nd Ed, Cambridge 2003 </p> @see #extractEpipoles @see FundamentalToProjective @param F (Input) A fundamental matrix @param e2 (Input) Left epipole of fundamental matrix, F<sup>T</sup>*e2 = 0. @param v (Input) Arbitrary 3-vector. Just pick some value, say (0,0,0). @param lambda (Input) A non zero scalar. Try one. @return The canonical camera (projection) matrix P' (3 by 4) Known up to a projective transform.
[ "<p", ">", "Given", "a", "fundamental", "matrix", "a", "pair", "of", "camera", "matrices", "P", "and", "P1", "are", "extracted", ".", "The", "camera", "matrices", "are", "3", "by", "4", "and", "used", "to", "project", "a", "3D", "homogenous", "point", "onto", "the", "image", "plane", ".", "These", "camera", "matrices", "will", "only", "be", "known", "up", "to", "a", "projective", "transform", "thus", "there", "are", "multiple", "solutions", "The", "canonical", "camera", "matrix", "is", "defined", "as", ":", "<br", ">", "<pre", ">", "P", "=", "[", "I|0", "]", "and", "P", "=", "[", "M|", "-", "M", "*", "t", "]", "=", "[[", "e", "]", "*", "F", "+", "e", "*", "v^t", "|", "lambda", "*", "e", "]", "<", "/", "pre", ">", "where", "e", "is", "the", "epipole", "F<sup", ">", "T<", "/", "sup", ">", "e", "=", "0", "[", "e", "]", "is", "the", "cross", "product", "matrix", "for", "the", "enclosed", "vector", "v", "is", "an", "arbitrary", "3", "-", "vector", "and", "lambda", "is", "a", "non", "-", "zero", "scalar", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L876-L882
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.matrixFromEuler
public static final Matrix matrixFromEuler(double heading, double attitude, double bank) { """ This conversion uses NASA standard aeroplane conventions as described on page: http://www.euclideanspace.com/maths/geometry/rotations/euler/index.htm Coordinate System: right hand Positive angle: right hand Order of euler angles: heading first, then attitude, then bank. matrix row column ordering: [m00 m01 m02] [m10 m11 m12] [m20 m21 m22] @param heading in radians @param attitude in radians @param bank in radians @return the rotation matrix """ // Assuming the angles are in radians. double ch = Math.cos(heading); double sh = Math.sin(heading); double ca = Math.cos(attitude); double sa = Math.sin(attitude); double cb = Math.cos(bank); double sb = Math.sin(bank); Matrix m = new Matrix(3,3); m.set(0,0, ch * ca); m.set(0,1, sh*sb - ch*sa*cb); m.set(0,2, ch*sa*sb + sh*cb); m.set(1,0, sa); m.set(1,1, ca*cb); m.set(1,2, -ca*sb); m.set(2,0, -sh*ca); m.set(2,1, sh*sa*cb + ch*sb); m.set(2,2, -sh*sa*sb + ch*cb); return m; }
java
public static final Matrix matrixFromEuler(double heading, double attitude, double bank) { // Assuming the angles are in radians. double ch = Math.cos(heading); double sh = Math.sin(heading); double ca = Math.cos(attitude); double sa = Math.sin(attitude); double cb = Math.cos(bank); double sb = Math.sin(bank); Matrix m = new Matrix(3,3); m.set(0,0, ch * ca); m.set(0,1, sh*sb - ch*sa*cb); m.set(0,2, ch*sa*sb + sh*cb); m.set(1,0, sa); m.set(1,1, ca*cb); m.set(1,2, -ca*sb); m.set(2,0, -sh*ca); m.set(2,1, sh*sa*cb + ch*sb); m.set(2,2, -sh*sa*sb + ch*cb); return m; }
[ "public", "static", "final", "Matrix", "matrixFromEuler", "(", "double", "heading", ",", "double", "attitude", ",", "double", "bank", ")", "{", "// Assuming the angles are in radians.", "double", "ch", "=", "Math", ".", "cos", "(", "heading", ")", ";", "double", "sh", "=", "Math", ".", "sin", "(", "heading", ")", ";", "double", "ca", "=", "Math", ".", "cos", "(", "attitude", ")", ";", "double", "sa", "=", "Math", ".", "sin", "(", "attitude", ")", ";", "double", "cb", "=", "Math", ".", "cos", "(", "bank", ")", ";", "double", "sb", "=", "Math", ".", "sin", "(", "bank", ")", ";", "Matrix", "m", "=", "new", "Matrix", "(", "3", ",", "3", ")", ";", "m", ".", "set", "(", "0", ",", "0", ",", "ch", "*", "ca", ")", ";", "m", ".", "set", "(", "0", ",", "1", ",", "sh", "*", "sb", "-", "ch", "*", "sa", "*", "cb", ")", ";", "m", ".", "set", "(", "0", ",", "2", ",", "ch", "*", "sa", "*", "sb", "+", "sh", "*", "cb", ")", ";", "m", ".", "set", "(", "1", ",", "0", ",", "sa", ")", ";", "m", ".", "set", "(", "1", ",", "1", ",", "ca", "*", "cb", ")", ";", "m", ".", "set", "(", "1", ",", "2", ",", "-", "ca", "*", "sb", ")", ";", "m", ".", "set", "(", "2", ",", "0", ",", "-", "sh", "*", "ca", ")", ";", "m", ".", "set", "(", "2", ",", "1", ",", "sh", "*", "sa", "*", "cb", "+", "ch", "*", "sb", ")", ";", "m", ".", "set", "(", "2", ",", "2", ",", "-", "sh", "*", "sa", "*", "sb", "+", "ch", "*", "cb", ")", ";", "return", "m", ";", "}" ]
This conversion uses NASA standard aeroplane conventions as described on page: http://www.euclideanspace.com/maths/geometry/rotations/euler/index.htm Coordinate System: right hand Positive angle: right hand Order of euler angles: heading first, then attitude, then bank. matrix row column ordering: [m00 m01 m02] [m10 m11 m12] [m20 m21 m22] @param heading in radians @param attitude in radians @param bank in radians @return the rotation matrix
[ "This", "conversion", "uses", "NASA", "standard", "aeroplane", "conventions", "as", "described", "on", "page", ":", "http", ":", "//", "www", ".", "euclideanspace", ".", "com", "/", "maths", "/", "geometry", "/", "rotations", "/", "euler", "/", "index", ".", "htm", "Coordinate", "System", ":", "right", "hand", "Positive", "angle", ":", "right", "hand", "Order", "of", "euler", "angles", ":", "heading", "first", "then", "attitude", "then", "bank", ".", "matrix", "row", "column", "ordering", ":", "[", "m00", "m01", "m02", "]", "[", "m10", "m11", "m12", "]", "[", "m20", "m21", "m22", "]" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L1086-L1108
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XString.java
XString.getChars
public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) { """ Copies characters from this string into the destination character array. @param srcBegin index of the first character in the string to copy. @param srcEnd index after the last character in the string to copy. @param dst the destination array. @param dstBegin the start offset in the destination array. @exception IndexOutOfBoundsException If any of the following is true: <ul><li><code>srcBegin</code> is negative. <li><code>srcBegin</code> is greater than <code>srcEnd</code> <li><code>srcEnd</code> is greater than the length of this string <li><code>dstBegin</code> is negative <li><code>dstBegin+(srcEnd-srcBegin)</code> is larger than <code>dst.length</code></ul> @exception NullPointerException if <code>dst</code> is <code>null</code> """ str().getChars(srcBegin, srcEnd, dst, dstBegin); }
java
public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) { str().getChars(srcBegin, srcEnd, dst, dstBegin); }
[ "public", "void", "getChars", "(", "int", "srcBegin", ",", "int", "srcEnd", ",", "char", "dst", "[", "]", ",", "int", "dstBegin", ")", "{", "str", "(", ")", ".", "getChars", "(", "srcBegin", ",", "srcEnd", ",", "dst", ",", "dstBegin", ")", ";", "}" ]
Copies characters from this string into the destination character array. @param srcBegin index of the first character in the string to copy. @param srcEnd index after the last character in the string to copy. @param dst the destination array. @param dstBegin the start offset in the destination array. @exception IndexOutOfBoundsException If any of the following is true: <ul><li><code>srcBegin</code> is negative. <li><code>srcBegin</code> is greater than <code>srcEnd</code> <li><code>srcEnd</code> is greater than the length of this string <li><code>dstBegin</code> is negative <li><code>dstBegin+(srcEnd-srcBegin)</code> is larger than <code>dst.length</code></ul> @exception NullPointerException if <code>dst</code> is <code>null</code>
[ "Copies", "characters", "from", "this", "string", "into", "the", "destination", "character", "array", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XString.java#L277-L280
VoltDB/voltdb
src/frontend/org/voltdb/exportclient/SocketExporterLegacy.java
SocketExporterLegacy.connectToOneServer
static OutputStream connectToOneServer(String server, int port) throws IOException { """ Connect to a single server with retry. Limited exponential backoff. No timeout. This will run until the process is killed if it's not able to connect. @param server hostname:port or just hostname (hostname can be ip). @throws IOException """ try { Socket pushSocket = new Socket(server, port); OutputStream out = pushSocket.getOutputStream(); m_logger.info("Connected to export endpoint node at: " + server + ":" + port); return out; } catch (UnknownHostException e) { m_logger.rateLimitedLog(120, Level.ERROR, e, "Don't know about host: " + server); throw e; } catch (IOException e) { m_logger.rateLimitedLog(120, Level.ERROR, e, "Couldn't get I/O for the connection to: " + server); throw e; } }
java
static OutputStream connectToOneServer(String server, int port) throws IOException { try { Socket pushSocket = new Socket(server, port); OutputStream out = pushSocket.getOutputStream(); m_logger.info("Connected to export endpoint node at: " + server + ":" + port); return out; } catch (UnknownHostException e) { m_logger.rateLimitedLog(120, Level.ERROR, e, "Don't know about host: " + server); throw e; } catch (IOException e) { m_logger.rateLimitedLog(120, Level.ERROR, e, "Couldn't get I/O for the connection to: " + server); throw e; } }
[ "static", "OutputStream", "connectToOneServer", "(", "String", "server", ",", "int", "port", ")", "throws", "IOException", "{", "try", "{", "Socket", "pushSocket", "=", "new", "Socket", "(", "server", ",", "port", ")", ";", "OutputStream", "out", "=", "pushSocket", ".", "getOutputStream", "(", ")", ";", "m_logger", ".", "info", "(", "\"Connected to export endpoint node at: \"", "+", "server", "+", "\":\"", "+", "port", ")", ";", "return", "out", ";", "}", "catch", "(", "UnknownHostException", "e", ")", "{", "m_logger", ".", "rateLimitedLog", "(", "120", ",", "Level", ".", "ERROR", ",", "e", ",", "\"Don't know about host: \"", "+", "server", ")", ";", "throw", "e", ";", "}", "catch", "(", "IOException", "e", ")", "{", "m_logger", ".", "rateLimitedLog", "(", "120", ",", "Level", ".", "ERROR", ",", "e", ",", "\"Couldn't get I/O for the connection to: \"", "+", "server", ")", ";", "throw", "e", ";", "}", "}" ]
Connect to a single server with retry. Limited exponential backoff. No timeout. This will run until the process is killed if it's not able to connect. @param server hostname:port or just hostname (hostname can be ip). @throws IOException
[ "Connect", "to", "a", "single", "server", "with", "retry", ".", "Limited", "exponential", "backoff", ".", "No", "timeout", ".", "This", "will", "run", "until", "the", "process", "is", "killed", "if", "it", "s", "not", "able", "to", "connect", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/exportclient/SocketExporterLegacy.java#L156-L169
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CreditUrl.java
CreditUrl.resendCreditCreatedEmailUrl
public static MozuUrl resendCreditCreatedEmailUrl(String code, String userId) { """ Get Resource Url for ResendCreditCreatedEmail @param code User-defined code that uniqely identifies the channel group. @param userId Unique identifier of the user whose tenant scopes you want to retrieve. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/credits/{code}/Resend-Email?userId={userId}"); formatter.formatUrl("code", code); formatter.formatUrl("userId", userId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl resendCreditCreatedEmailUrl(String code, String userId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/credits/{code}/Resend-Email?userId={userId}"); formatter.formatUrl("code", code); formatter.formatUrl("userId", userId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "resendCreditCreatedEmailUrl", "(", "String", "code", ",", "String", "userId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/customer/credits/{code}/Resend-Email?userId={userId}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"code\"", ",", "code", ")", ";", "formatter", ".", "formatUrl", "(", "\"userId\"", ",", "userId", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for ResendCreditCreatedEmail @param code User-defined code that uniqely identifies the channel group. @param userId Unique identifier of the user whose tenant scopes you want to retrieve. @return String Resource Url
[ "Get", "Resource", "Url", "for", "ResendCreditCreatedEmail" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CreditUrl.java#L84-L90
recommenders/rival
rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java
MultipleRecommendationRunner.runLenskitRecommenders
public static void runLenskitRecommenders(final Set<String> paths, final Properties properties) { """ Runs the Lenskit recommenders. @param paths the input and output paths. @param properties the properties. """ for (AbstractRunner<Long, Long> rec : instantiateLenskitRecommenders(paths, properties)) { RecommendationRunner.run(rec); } }
java
public static void runLenskitRecommenders(final Set<String> paths, final Properties properties) { for (AbstractRunner<Long, Long> rec : instantiateLenskitRecommenders(paths, properties)) { RecommendationRunner.run(rec); } }
[ "public", "static", "void", "runLenskitRecommenders", "(", "final", "Set", "<", "String", ">", "paths", ",", "final", "Properties", "properties", ")", "{", "for", "(", "AbstractRunner", "<", "Long", ",", "Long", ">", "rec", ":", "instantiateLenskitRecommenders", "(", "paths", ",", "properties", ")", ")", "{", "RecommendationRunner", ".", "run", "(", "rec", ")", ";", "}", "}" ]
Runs the Lenskit recommenders. @param paths the input and output paths. @param properties the properties.
[ "Runs", "the", "Lenskit", "recommenders", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-recommend/src/main/java/net/recommenders/rival/recommend/frameworks/MultipleRecommendationRunner.java#L145-L149
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/serialize/SerializationHelper.java
SerializationHelper.getDeserializedObject
@Nonnull public static <T> T getDeserializedObject (@Nonnull final byte [] aData) { """ Convert the passed byte array to an object using deserialization. @param aData The source serialized byte array. Must contain a single object only. May not be <code>null</code>. @return The deserialized object. Never <code>null</code>. @throws IllegalStateException If deserialization failed @param <T> The type of the deserialized object """ ValueEnforcer.notNull (aData, "Data"); // Read new object from byte array try (final ObjectInputStream aOIS = new ObjectInputStream (new NonBlockingByteArrayInputStream (aData))) { return GenericReflection.uncheckedCast (aOIS.readObject ()); } catch (final Exception ex) { throw new IllegalStateException ("Failed to read serializable object", ex); } }
java
@Nonnull public static <T> T getDeserializedObject (@Nonnull final byte [] aData) { ValueEnforcer.notNull (aData, "Data"); // Read new object from byte array try (final ObjectInputStream aOIS = new ObjectInputStream (new NonBlockingByteArrayInputStream (aData))) { return GenericReflection.uncheckedCast (aOIS.readObject ()); } catch (final Exception ex) { throw new IllegalStateException ("Failed to read serializable object", ex); } }
[ "@", "Nonnull", "public", "static", "<", "T", ">", "T", "getDeserializedObject", "(", "@", "Nonnull", "final", "byte", "[", "]", "aData", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aData", ",", "\"Data\"", ")", ";", "// Read new object from byte array", "try", "(", "final", "ObjectInputStream", "aOIS", "=", "new", "ObjectInputStream", "(", "new", "NonBlockingByteArrayInputStream", "(", "aData", ")", ")", ")", "{", "return", "GenericReflection", ".", "uncheckedCast", "(", "aOIS", ".", "readObject", "(", ")", ")", ";", "}", "catch", "(", "final", "Exception", "ex", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Failed to read serializable object\"", ",", "ex", ")", ";", "}", "}" ]
Convert the passed byte array to an object using deserialization. @param aData The source serialized byte array. Must contain a single object only. May not be <code>null</code>. @return The deserialized object. Never <code>null</code>. @throws IllegalStateException If deserialization failed @param <T> The type of the deserialized object
[ "Convert", "the", "passed", "byte", "array", "to", "an", "object", "using", "deserialization", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/serialize/SerializationHelper.java#L96-L110
zaproxy/zaproxy
src/org/zaproxy/zap/extension/api/API.java
API.convertViewActionApiResponse
private static String convertViewActionApiResponse(Format format, String name, ApiResponse res) throws ApiException { """ Converts the given {@code ApiResponse} to {@code String} representation. <p> This is expected to be used just for views and actions. @param format the format to convert to. @param name the name of the view or action. @param res the {@code ApiResponse} to convert. @return the string representation of the {@code ApiResponse}. @throws ApiException if an error occurred while converting the response or if the format was not handled. @see #validateFormatForViewAction(Format) """ switch (format) { case JSON: return res.toJSON().toString(); case JSONP: return getJsonpWrapper(res.toJSON().toString()); case XML: return responseToXml(name, res); case HTML: return responseToHtml(res); default: // Should not happen, format validation should prevent this case... logger.error("Unhandled format: " + format); throw new ApiException(ApiException.Type.INTERNAL_ERROR); } }
java
private static String convertViewActionApiResponse(Format format, String name, ApiResponse res) throws ApiException { switch (format) { case JSON: return res.toJSON().toString(); case JSONP: return getJsonpWrapper(res.toJSON().toString()); case XML: return responseToXml(name, res); case HTML: return responseToHtml(res); default: // Should not happen, format validation should prevent this case... logger.error("Unhandled format: " + format); throw new ApiException(ApiException.Type.INTERNAL_ERROR); } }
[ "private", "static", "String", "convertViewActionApiResponse", "(", "Format", "format", ",", "String", "name", ",", "ApiResponse", "res", ")", "throws", "ApiException", "{", "switch", "(", "format", ")", "{", "case", "JSON", ":", "return", "res", ".", "toJSON", "(", ")", ".", "toString", "(", ")", ";", "case", "JSONP", ":", "return", "getJsonpWrapper", "(", "res", ".", "toJSON", "(", ")", ".", "toString", "(", ")", ")", ";", "case", "XML", ":", "return", "responseToXml", "(", "name", ",", "res", ")", ";", "case", "HTML", ":", "return", "responseToHtml", "(", "res", ")", ";", "default", ":", "// Should not happen, format validation should prevent this case...", "logger", ".", "error", "(", "\"Unhandled format: \"", "+", "format", ")", ";", "throw", "new", "ApiException", "(", "ApiException", ".", "Type", ".", "INTERNAL_ERROR", ")", ";", "}", "}" ]
Converts the given {@code ApiResponse} to {@code String} representation. <p> This is expected to be used just for views and actions. @param format the format to convert to. @param name the name of the view or action. @param res the {@code ApiResponse} to convert. @return the string representation of the {@code ApiResponse}. @throws ApiException if an error occurred while converting the response or if the format was not handled. @see #validateFormatForViewAction(Format)
[ "Converts", "the", "given", "{", "@code", "ApiResponse", "}", "to", "{", "@code", "String", "}", "representation", ".", "<p", ">", "This", "is", "expected", "to", "be", "used", "just", "for", "views", "and", "actions", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/api/API.java#L585-L600
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscalepolicy_binding.java
autoscalepolicy_binding.get
public static autoscalepolicy_binding get(nitro_service service, String name) throws Exception { """ Use this API to fetch autoscalepolicy_binding resource of given name . """ autoscalepolicy_binding obj = new autoscalepolicy_binding(); obj.set_name(name); autoscalepolicy_binding response = (autoscalepolicy_binding) obj.get_resource(service); return response; }
java
public static autoscalepolicy_binding get(nitro_service service, String name) throws Exception{ autoscalepolicy_binding obj = new autoscalepolicy_binding(); obj.set_name(name); autoscalepolicy_binding response = (autoscalepolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "autoscalepolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "autoscalepolicy_binding", "obj", "=", "new", "autoscalepolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "autoscalepolicy_binding", "response", "=", "(", "autoscalepolicy_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch autoscalepolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "autoscalepolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscalepolicy_binding.java#L103-L108
tvesalainen/util
util/src/main/java/org/vesalainen/util/concurrent/CachedScheduledThreadPool.java
CachedScheduledThreadPool.submitAfter
public <V> Future<V> submitAfter(Waiter waiter, Callable<V> callable) { """ submits callable after waiting future to complete @param <V> @param waiter @param callable @return """ return submitAfter(waiter, callable, Long.MAX_VALUE, TimeUnit.MILLISECONDS); }
java
public <V> Future<V> submitAfter(Waiter waiter, Callable<V> callable) { return submitAfter(waiter, callable, Long.MAX_VALUE, TimeUnit.MILLISECONDS); }
[ "public", "<", "V", ">", "Future", "<", "V", ">", "submitAfter", "(", "Waiter", "waiter", ",", "Callable", "<", "V", ">", "callable", ")", "{", "return", "submitAfter", "(", "waiter", ",", "callable", ",", "Long", ".", "MAX_VALUE", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}" ]
submits callable after waiting future to complete @param <V> @param waiter @param callable @return
[ "submits", "callable", "after", "waiting", "future", "to", "complete" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/concurrent/CachedScheduledThreadPool.java#L265-L268
virgo47/javasimon
examples/src/main/java/org/javasimon/examples/MultithreadedStopwatchLoad.java
MultithreadedStopwatchLoad.main
public static void main(String[] args) throws InterruptedException { """ Entry point of the demo application. @param args command line arguments @throws InterruptedException when sleep is interrupted """ ExampleUtils.fillManagerWithSimons(100000); final ExecutorService executorService = Executors.newFixedThreadPool(1000); StopwatchSample[] results = BenchmarkUtils.run(1, 2, new BenchmarkUtils.Task("1") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 1, executorService).execute(); } }, new BenchmarkUtils.Task("2") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 2, executorService).execute(); } }, new BenchmarkUtils.Task("3") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 3, executorService).execute(); } }, new BenchmarkUtils.Task("4") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 4, executorService).execute(); } }, new BenchmarkUtils.Task("5") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 5, executorService).execute(); } }, new BenchmarkUtils.Task("100") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 100, executorService).execute(); } } ); executorService.shutdown(); System.out.println("\nGoogle Chart avg:\n" + GoogleChartImageGenerator.barChart("Multithreaded test", results)); }
java
public static void main(String[] args) throws InterruptedException { ExampleUtils.fillManagerWithSimons(100000); final ExecutorService executorService = Executors.newFixedThreadPool(1000); StopwatchSample[] results = BenchmarkUtils.run(1, 2, new BenchmarkUtils.Task("1") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 1, executorService).execute(); } }, new BenchmarkUtils.Task("2") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 2, executorService).execute(); } }, new BenchmarkUtils.Task("3") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 3, executorService).execute(); } }, new BenchmarkUtils.Task("4") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 4, executorService).execute(); } }, new BenchmarkUtils.Task("5") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 5, executorService).execute(); } }, new BenchmarkUtils.Task("100") { @Override public void perform() throws Exception { new MultithreadedTester(TOTAL_TASK_RUNS, 100, executorService).execute(); } } ); executorService.shutdown(); System.out.println("\nGoogle Chart avg:\n" + GoogleChartImageGenerator.barChart("Multithreaded test", results)); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "InterruptedException", "{", "ExampleUtils", ".", "fillManagerWithSimons", "(", "100000", ")", ";", "final", "ExecutorService", "executorService", "=", "Executors", ".", "newFixedThreadPool", "(", "1000", ")", ";", "StopwatchSample", "[", "]", "results", "=", "BenchmarkUtils", ".", "run", "(", "1", ",", "2", ",", "new", "BenchmarkUtils", ".", "Task", "(", "\"1\"", ")", "{", "@", "Override", "public", "void", "perform", "(", ")", "throws", "Exception", "{", "new", "MultithreadedTester", "(", "TOTAL_TASK_RUNS", ",", "1", ",", "executorService", ")", ".", "execute", "(", ")", ";", "}", "}", ",", "new", "BenchmarkUtils", ".", "Task", "(", "\"2\"", ")", "{", "@", "Override", "public", "void", "perform", "(", ")", "throws", "Exception", "{", "new", "MultithreadedTester", "(", "TOTAL_TASK_RUNS", ",", "2", ",", "executorService", ")", ".", "execute", "(", ")", ";", "}", "}", ",", "new", "BenchmarkUtils", ".", "Task", "(", "\"3\"", ")", "{", "@", "Override", "public", "void", "perform", "(", ")", "throws", "Exception", "{", "new", "MultithreadedTester", "(", "TOTAL_TASK_RUNS", ",", "3", ",", "executorService", ")", ".", "execute", "(", ")", ";", "}", "}", ",", "new", "BenchmarkUtils", ".", "Task", "(", "\"4\"", ")", "{", "@", "Override", "public", "void", "perform", "(", ")", "throws", "Exception", "{", "new", "MultithreadedTester", "(", "TOTAL_TASK_RUNS", ",", "4", ",", "executorService", ")", ".", "execute", "(", ")", ";", "}", "}", ",", "new", "BenchmarkUtils", ".", "Task", "(", "\"5\"", ")", "{", "@", "Override", "public", "void", "perform", "(", ")", "throws", "Exception", "{", "new", "MultithreadedTester", "(", "TOTAL_TASK_RUNS", ",", "5", ",", "executorService", ")", ".", "execute", "(", ")", ";", "}", "}", ",", "new", "BenchmarkUtils", ".", "Task", "(", "\"100\"", ")", "{", "@", "Override", "public", "void", "perform", "(", ")", "throws", "Exception", "{", "new", "MultithreadedTester", "(", "TOTAL_TASK_RUNS", ",", "100", ",", "executorService", ")", ".", "execute", "(", ")", ";", "}", "}", ")", ";", "executorService", ".", "shutdown", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\\nGoogle Chart avg:\\n\"", "+", "GoogleChartImageGenerator", ".", "barChart", "(", "\"Multithreaded test\"", ",", "results", ")", ")", ";", "}" ]
Entry point of the demo application. @param args command line arguments @throws InterruptedException when sleep is interrupted
[ "Entry", "point", "of", "the", "demo", "application", "." ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/examples/src/main/java/org/javasimon/examples/MultithreadedStopwatchLoad.java#L34-L79
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Waiter.java
Waiter.waitForActivity
public boolean waitForActivity(String name, int timeout) { """ Waits for the given {@link Activity}. @param name the name of the {@code Activity} to wait for e.g. {@code "MyActivity"} @param timeout the amount of time in milliseconds to wait @return {@code true} if {@code Activity} appears before the timeout and {@code false} if it does not """ if(isActivityMatching(activityUtils.getCurrentActivity(false, false), name)){ return true; } boolean foundActivity = false; ActivityMonitor activityMonitor = getActivityMonitor(); long currentTime = SystemClock.uptimeMillis(); final long endTime = currentTime + timeout; while(currentTime < endTime){ Activity currentActivity = activityMonitor.waitForActivityWithTimeout(endTime - currentTime); if(isActivityMatching(currentActivity, name)){ foundActivity = true; break; } currentTime = SystemClock.uptimeMillis(); } removeMonitor(activityMonitor); return foundActivity; }
java
public boolean waitForActivity(String name, int timeout){ if(isActivityMatching(activityUtils.getCurrentActivity(false, false), name)){ return true; } boolean foundActivity = false; ActivityMonitor activityMonitor = getActivityMonitor(); long currentTime = SystemClock.uptimeMillis(); final long endTime = currentTime + timeout; while(currentTime < endTime){ Activity currentActivity = activityMonitor.waitForActivityWithTimeout(endTime - currentTime); if(isActivityMatching(currentActivity, name)){ foundActivity = true; break; } currentTime = SystemClock.uptimeMillis(); } removeMonitor(activityMonitor); return foundActivity; }
[ "public", "boolean", "waitForActivity", "(", "String", "name", ",", "int", "timeout", ")", "{", "if", "(", "isActivityMatching", "(", "activityUtils", ".", "getCurrentActivity", "(", "false", ",", "false", ")", ",", "name", ")", ")", "{", "return", "true", ";", "}", "boolean", "foundActivity", "=", "false", ";", "ActivityMonitor", "activityMonitor", "=", "getActivityMonitor", "(", ")", ";", "long", "currentTime", "=", "SystemClock", ".", "uptimeMillis", "(", ")", ";", "final", "long", "endTime", "=", "currentTime", "+", "timeout", ";", "while", "(", "currentTime", "<", "endTime", ")", "{", "Activity", "currentActivity", "=", "activityMonitor", ".", "waitForActivityWithTimeout", "(", "endTime", "-", "currentTime", ")", ";", "if", "(", "isActivityMatching", "(", "currentActivity", ",", "name", ")", ")", "{", "foundActivity", "=", "true", ";", "break", ";", "}", "currentTime", "=", "SystemClock", ".", "uptimeMillis", "(", ")", ";", "}", "removeMonitor", "(", "activityMonitor", ")", ";", "return", "foundActivity", ";", "}" ]
Waits for the given {@link Activity}. @param name the name of the {@code Activity} to wait for e.g. {@code "MyActivity"} @param timeout the amount of time in milliseconds to wait @return {@code true} if {@code Activity} appears before the timeout and {@code false} if it does not
[ "Waits", "for", "the", "given", "{", "@link", "Activity", "}", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Waiter.java#L80-L101
modelmapper/modelmapper
core/src/main/java/org/modelmapper/ModelMapper.java
ModelMapper.addConverter
@SuppressWarnings("unchecked") public <S, D> void addConverter(Converter<S, D> converter, Class<S> sourceType, Class<D> destinationType) { """ Registers the {@code converter} to use when mapping instances of types {@code S} to {@code D}. The {@code converter} will be {@link TypeMap#setConverter(Converter) set} against TypeMap corresponding to the {@code converter}'s type arguments {@code S} and {@code D}. @param <S> source type @param <D> destination type @param converter to register @throws IllegalArgumentException if {@code converter} is null or if type arguments {@code S} and {@code D} are not declared for the {@code converter} @see TypeMap#setConverter(Converter) """ Assert.notNull(converter, "converter"); config.typeMapStore.<S, D>getOrCreate(null, sourceType, destinationType, null, null, converter, engine); }
java
@SuppressWarnings("unchecked") public <S, D> void addConverter(Converter<S, D> converter, Class<S> sourceType, Class<D> destinationType) { Assert.notNull(converter, "converter"); config.typeMapStore.<S, D>getOrCreate(null, sourceType, destinationType, null, null, converter, engine); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "S", ",", "D", ">", "void", "addConverter", "(", "Converter", "<", "S", ",", "D", ">", "converter", ",", "Class", "<", "S", ">", "sourceType", ",", "Class", "<", "D", ">", "destinationType", ")", "{", "Assert", ".", "notNull", "(", "converter", ",", "\"converter\"", ")", ";", "config", ".", "typeMapStore", ".", "<", "S", ",", "D", ">", "getOrCreate", "(", "null", ",", "sourceType", ",", "destinationType", ",", "null", ",", "null", ",", "converter", ",", "engine", ")", ";", "}" ]
Registers the {@code converter} to use when mapping instances of types {@code S} to {@code D}. The {@code converter} will be {@link TypeMap#setConverter(Converter) set} against TypeMap corresponding to the {@code converter}'s type arguments {@code S} and {@code D}. @param <S> source type @param <D> destination type @param converter to register @throws IllegalArgumentException if {@code converter} is null or if type arguments {@code S} and {@code D} are not declared for the {@code converter} @see TypeMap#setConverter(Converter)
[ "Registers", "the", "{", "@code", "converter", "}", "to", "use", "when", "mapping", "instances", "of", "types", "{", "@code", "S", "}", "to", "{", "@code", "D", "}", ".", "The", "{", "@code", "converter", "}", "will", "be", "{", "@link", "TypeMap#setConverter", "(", "Converter", ")", "set", "}", "against", "TypeMap", "corresponding", "to", "the", "{", "@code", "converter", "}", "s", "type", "arguments", "{", "@code", "S", "}", "and", "{", "@code", "D", "}", "." ]
train
https://github.com/modelmapper/modelmapper/blob/491d165ded9dc9aba7ce8b56984249e1a1363204/core/src/main/java/org/modelmapper/ModelMapper.java#L91-L96
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingMemoryCache.java
CountingMemoryCache.maybeAddToExclusives
private synchronized boolean maybeAddToExclusives(Entry<K, V> entry) { """ Adds the entry to the exclusively owned queue if it is viable for eviction. """ if (!entry.isOrphan && entry.clientCount == 0) { mExclusiveEntries.put(entry.key, entry); return true; } return false; }
java
private synchronized boolean maybeAddToExclusives(Entry<K, V> entry) { if (!entry.isOrphan && entry.clientCount == 0) { mExclusiveEntries.put(entry.key, entry); return true; } return false; }
[ "private", "synchronized", "boolean", "maybeAddToExclusives", "(", "Entry", "<", "K", ",", "V", ">", "entry", ")", "{", "if", "(", "!", "entry", ".", "isOrphan", "&&", "entry", ".", "clientCount", "==", "0", ")", "{", "mExclusiveEntries", ".", "put", "(", "entry", ".", "key", ",", "entry", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Adds the entry to the exclusively owned queue if it is viable for eviction.
[ "Adds", "the", "entry", "to", "the", "exclusively", "owned", "queue", "if", "it", "is", "viable", "for", "eviction", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/cache/CountingMemoryCache.java#L256-L262
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.isSubtypes
public boolean isSubtypes(List<Type> ts, List<Type> ss) { """ Are corresponding elements of ts subtypes of ss? If lists are of different length, return false. """ while (ts.tail != null && ss.tail != null /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ && isSubtype(ts.head, ss.head)) { ts = ts.tail; ss = ss.tail; } return ts.tail == null && ss.tail == null; /*inlined: ts.isEmpty() && ss.isEmpty();*/ }
java
public boolean isSubtypes(List<Type> ts, List<Type> ss) { while (ts.tail != null && ss.tail != null /*inlined: ts.nonEmpty() && ss.nonEmpty()*/ && isSubtype(ts.head, ss.head)) { ts = ts.tail; ss = ss.tail; } return ts.tail == null && ss.tail == null; /*inlined: ts.isEmpty() && ss.isEmpty();*/ }
[ "public", "boolean", "isSubtypes", "(", "List", "<", "Type", ">", "ts", ",", "List", "<", "Type", ">", "ss", ")", "{", "while", "(", "ts", ".", "tail", "!=", "null", "&&", "ss", ".", "tail", "!=", "null", "/*inlined: ts.nonEmpty() && ss.nonEmpty()*/", "&&", "isSubtype", "(", "ts", ".", "head", ",", "ss", ".", "head", ")", ")", "{", "ts", "=", "ts", ".", "tail", ";", "ss", "=", "ss", ".", "tail", ";", "}", "return", "ts", ".", "tail", "==", "null", "&&", "ss", ".", "tail", "==", "null", ";", "/*inlined: ts.isEmpty() && ss.isEmpty();*/", "}" ]
Are corresponding elements of ts subtypes of ss? If lists are of different length, return false.
[ "Are", "corresponding", "elements", "of", "ts", "subtypes", "of", "ss?", "If", "lists", "are", "of", "different", "length", "return", "false", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L926-L935
lightblueseas/swing-components
src/main/java/de/alpharogroup/layout/InfomationDialog.java
InfomationDialog.showInfoDialog
public static String showInfoDialog(final Frame owner, final String message) { """ Statische Methode um ein Dialogfenster mit der angegebener Nachricht zu erzeugen. @param owner the owner @param message the message @return das ergebnis """ InfomationDialog mdialog; String ok = "OK"; mdialog = new InfomationDialog(owner, "Information message", message, ok); @SuppressWarnings("unlikely-arg-type") final int index = mdialog.getVButtons().indexOf(ok); final Button button = mdialog.getVButtons().get(index); button.addActionListener(mdialog); mdialog.setVisible(true); return mdialog.getResult(); }
java
public static String showInfoDialog(final Frame owner, final String message) { InfomationDialog mdialog; String ok = "OK"; mdialog = new InfomationDialog(owner, "Information message", message, ok); @SuppressWarnings("unlikely-arg-type") final int index = mdialog.getVButtons().indexOf(ok); final Button button = mdialog.getVButtons().get(index); button.addActionListener(mdialog); mdialog.setVisible(true); return mdialog.getResult(); }
[ "public", "static", "String", "showInfoDialog", "(", "final", "Frame", "owner", ",", "final", "String", "message", ")", "{", "InfomationDialog", "mdialog", ";", "String", "ok", "=", "\"OK\"", ";", "mdialog", "=", "new", "InfomationDialog", "(", "owner", ",", "\"Information message\"", ",", "message", ",", "ok", ")", ";", "@", "SuppressWarnings", "(", "\"unlikely-arg-type\"", ")", "final", "int", "index", "=", "mdialog", ".", "getVButtons", "(", ")", ".", "indexOf", "(", "ok", ")", ";", "final", "Button", "button", "=", "mdialog", ".", "getVButtons", "(", ")", ".", "get", "(", "index", ")", ";", "button", ".", "addActionListener", "(", "mdialog", ")", ";", "mdialog", ".", "setVisible", "(", "true", ")", ";", "return", "mdialog", ".", "getResult", "(", ")", ";", "}" ]
Statische Methode um ein Dialogfenster mit der angegebener Nachricht zu erzeugen. @param owner the owner @param message the message @return das ergebnis
[ "Statische", "Methode", "um", "ein", "Dialogfenster", "mit", "der", "angegebener", "Nachricht", "zu", "erzeugen", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/layout/InfomationDialog.java#L63-L74
HadoopGenomics/Hadoop-BAM
src/main/java/org/seqdoop/hadoop_bam/VCFInputFormat.java
VCFInputFormat.getSplits
@Override public List<InputSplit> getSplits(JobContext job) throws IOException { """ Defers to {@link BCFSplitGuesser} as appropriate for each individual path. VCF paths do not require special handling, so their splits are left unchanged. """ if (this.conf == null) this.conf = job.getConfiguration(); final List<InputSplit> origSplits = super.getSplits(job); // We have to partition the splits by input format and hand the BCF ones // over to getBCFSplits(). final List<FileSplit> bcfOrigSplits = new ArrayList<FileSplit>(origSplits.size()); final List<InputSplit> newSplits = new ArrayList<InputSplit>(origSplits.size()); for (final InputSplit iSplit : origSplits) { final FileSplit split = (FileSplit)iSplit; if (VCFFormat.BCF.equals(getFormat(split.getPath()))) bcfOrigSplits.add(split); else newSplits.add(split); } fixBCFSplits(bcfOrigSplits, newSplits); return filterByInterval(newSplits, conf); }
java
@Override public List<InputSplit> getSplits(JobContext job) throws IOException { if (this.conf == null) this.conf = job.getConfiguration(); final List<InputSplit> origSplits = super.getSplits(job); // We have to partition the splits by input format and hand the BCF ones // over to getBCFSplits(). final List<FileSplit> bcfOrigSplits = new ArrayList<FileSplit>(origSplits.size()); final List<InputSplit> newSplits = new ArrayList<InputSplit>(origSplits.size()); for (final InputSplit iSplit : origSplits) { final FileSplit split = (FileSplit)iSplit; if (VCFFormat.BCF.equals(getFormat(split.getPath()))) bcfOrigSplits.add(split); else newSplits.add(split); } fixBCFSplits(bcfOrigSplits, newSplits); return filterByInterval(newSplits, conf); }
[ "@", "Override", "public", "List", "<", "InputSplit", ">", "getSplits", "(", "JobContext", "job", ")", "throws", "IOException", "{", "if", "(", "this", ".", "conf", "==", "null", ")", "this", ".", "conf", "=", "job", ".", "getConfiguration", "(", ")", ";", "final", "List", "<", "InputSplit", ">", "origSplits", "=", "super", ".", "getSplits", "(", "job", ")", ";", "// We have to partition the splits by input format and hand the BCF ones", "// over to getBCFSplits().", "final", "List", "<", "FileSplit", ">", "bcfOrigSplits", "=", "new", "ArrayList", "<", "FileSplit", ">", "(", "origSplits", ".", "size", "(", ")", ")", ";", "final", "List", "<", "InputSplit", ">", "newSplits", "=", "new", "ArrayList", "<", "InputSplit", ">", "(", "origSplits", ".", "size", "(", ")", ")", ";", "for", "(", "final", "InputSplit", "iSplit", ":", "origSplits", ")", "{", "final", "FileSplit", "split", "=", "(", "FileSplit", ")", "iSplit", ";", "if", "(", "VCFFormat", ".", "BCF", ".", "equals", "(", "getFormat", "(", "split", ".", "getPath", "(", ")", ")", ")", ")", "bcfOrigSplits", ".", "add", "(", "split", ")", ";", "else", "newSplits", ".", "add", "(", "split", ")", ";", "}", "fixBCFSplits", "(", "bcfOrigSplits", ",", "newSplits", ")", ";", "return", "filterByInterval", "(", "newSplits", ",", "conf", ")", ";", "}" ]
Defers to {@link BCFSplitGuesser} as appropriate for each individual path. VCF paths do not require special handling, so their splits are left unchanged.
[ "Defers", "to", "{" ]
train
https://github.com/HadoopGenomics/Hadoop-BAM/blob/9f974cf635a8d72f69604021cc3d5f3469d38d2f/src/main/java/org/seqdoop/hadoop_bam/VCFInputFormat.java#L272-L298
lukas-krecan/JsonUnit
json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java
JsonUnitResultMatchers.isObject
public ResultMatcher isObject() { """ Fails if the selected JSON is not an Object or is not present. """ return new AbstractResultMatcher(path, configuration) { public void doMatch(Object actual) { isPresent(actual); Node node = getNode(actual); if (node.getNodeType() != OBJECT) { failOnType(node, "an object"); } } }; }
java
public ResultMatcher isObject() { return new AbstractResultMatcher(path, configuration) { public void doMatch(Object actual) { isPresent(actual); Node node = getNode(actual); if (node.getNodeType() != OBJECT) { failOnType(node, "an object"); } } }; }
[ "public", "ResultMatcher", "isObject", "(", ")", "{", "return", "new", "AbstractResultMatcher", "(", "path", ",", "configuration", ")", "{", "public", "void", "doMatch", "(", "Object", "actual", ")", "{", "isPresent", "(", "actual", ")", ";", "Node", "node", "=", "getNode", "(", "actual", ")", ";", "if", "(", "node", ".", "getNodeType", "(", ")", "!=", "OBJECT", ")", "{", "failOnType", "(", "node", ",", "\"an object\"", ")", ";", "}", "}", "}", ";", "}" ]
Fails if the selected JSON is not an Object or is not present.
[ "Fails", "if", "the", "selected", "JSON", "is", "not", "an", "Object", "or", "is", "not", "present", "." ]
train
https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java#L183-L193
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/util/ConstructorUtils.java
ConstructorUtils.getInstance
public static <T> T getInstance(String className, Class<T> ofType) throws IllegalStateException { """ Creates and returns a new instance of class with name className, loading the class and using the default constructor. @param <T> @param className @param ofType @return a new instance of class loaded from className. @throws IllegalStateException if className could not be loaded or if that class does not have a default constructor or if the loaded class is not of the supplied type (ofType). """ return getInstance(className, ofType, new Class<?>[]{}, new Object[]{}); }
java
public static <T> T getInstance(String className, Class<T> ofType) throws IllegalStateException { return getInstance(className, ofType, new Class<?>[]{}, new Object[]{}); }
[ "public", "static", "<", "T", ">", "T", "getInstance", "(", "String", "className", ",", "Class", "<", "T", ">", "ofType", ")", "throws", "IllegalStateException", "{", "return", "getInstance", "(", "className", ",", "ofType", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "}", ",", "new", "Object", "[", "]", "{", "}", ")", ";", "}" ]
Creates and returns a new instance of class with name className, loading the class and using the default constructor. @param <T> @param className @param ofType @return a new instance of class loaded from className. @throws IllegalStateException if className could not be loaded or if that class does not have a default constructor or if the loaded class is not of the supplied type (ofType).
[ "Creates", "and", "returns", "a", "new", "instance", "of", "class", "with", "name", "className", "loading", "the", "class", "and", "using", "the", "default", "constructor", "." ]
train
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/ConstructorUtils.java#L115-L117
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java
ArrowButtonPainter.paintForegroundDisabled
private void paintForegroundDisabled(Graphics2D g, int width, int height) { """ Paint the arrow in disabled state. @param g the Graphics2D context to paint with. @param width the width. @param height the height. """ Shape s = decodeArrowPath(width, height); g.setPaint(disabledColor); g.fill(s); }
java
private void paintForegroundDisabled(Graphics2D g, int width, int height) { Shape s = decodeArrowPath(width, height); g.setPaint(disabledColor); g.fill(s); }
[ "private", "void", "paintForegroundDisabled", "(", "Graphics2D", "g", ",", "int", "width", ",", "int", "height", ")", "{", "Shape", "s", "=", "decodeArrowPath", "(", "width", ",", "height", ")", ";", "g", ".", "setPaint", "(", "disabledColor", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "}" ]
Paint the arrow in disabled state. @param g the Graphics2D context to paint with. @param width the width. @param height the height.
[ "Paint", "the", "arrow", "in", "disabled", "state", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ArrowButtonPainter.java#L94-L100
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/MoveOnChangeHandler.java
MoveOnChangeHandler.fieldChanged
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { """ The Field has Changed. Move the source field to the destination field. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay). """ int iErrorCode = this.moveIt(bDisplayOption, iMoveMode); if (iErrorCode != DBConstants.NORMAL_RETURN) if (this.getOwner() != m_fldSource) if (this.getOwner() != m_fldDest) iErrorCode = DBConstants.NORMAL_RETURN; // If the source and dest are unrelated this this, don't return an error (and revert this field) if (iErrorCode == DBConstants.NORMAL_RETURN) iErrorCode = super.fieldChanged(bDisplayOption, iMoveMode); return iErrorCode; }
java
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { int iErrorCode = this.moveIt(bDisplayOption, iMoveMode); if (iErrorCode != DBConstants.NORMAL_RETURN) if (this.getOwner() != m_fldSource) if (this.getOwner() != m_fldDest) iErrorCode = DBConstants.NORMAL_RETURN; // If the source and dest are unrelated this this, don't return an error (and revert this field) if (iErrorCode == DBConstants.NORMAL_RETURN) iErrorCode = super.fieldChanged(bDisplayOption, iMoveMode); return iErrorCode; }
[ "public", "int", "fieldChanged", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "int", "iErrorCode", "=", "this", ".", "moveIt", "(", "bDisplayOption", ",", "iMoveMode", ")", ";", "if", "(", "iErrorCode", "!=", "DBConstants", ".", "NORMAL_RETURN", ")", "if", "(", "this", ".", "getOwner", "(", ")", "!=", "m_fldSource", ")", "if", "(", "this", ".", "getOwner", "(", ")", "!=", "m_fldDest", ")", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "// If the source and dest are unrelated this this, don't return an error (and revert this field)", "if", "(", "iErrorCode", "==", "DBConstants", ".", "NORMAL_RETURN", ")", "iErrorCode", "=", "super", ".", "fieldChanged", "(", "bDisplayOption", ",", "iMoveMode", ")", ";", "return", "iErrorCode", ";", "}" ]
The Field has Changed. Move the source field to the destination field. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "The", "Field", "has", "Changed", ".", "Move", "the", "source", "field", "to", "the", "destination", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/MoveOnChangeHandler.java#L160-L170
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java
RestClientUtil.addMapDocument
public String addMapDocument(String indexName , Map bean) throws ElasticSearchException { """ 创建或者更新索引文档 For Elasticsearch 7 and 7+ @param indexName @param bean @return @throws ElasticSearchException """ return addMapDocument( indexName, _doc, bean); }
java
public String addMapDocument(String indexName , Map bean) throws ElasticSearchException{ return addMapDocument( indexName, _doc, bean); }
[ "public", "String", "addMapDocument", "(", "String", "indexName", ",", "Map", "bean", ")", "throws", "ElasticSearchException", "{", "return", "addMapDocument", "(", "indexName", ",", "_doc", ",", "bean", ")", ";", "}" ]
创建或者更新索引文档 For Elasticsearch 7 and 7+ @param indexName @param bean @return @throws ElasticSearchException
[ "创建或者更新索引文档", "For", "Elasticsearch", "7", "and", "7", "+" ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L4438-L4440
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.gridToWorld
public static Point2D gridToWorld( GridGeometry2D gridGeometry, int x, int y ) throws InvalidGridGeometryException, TransformException { """ Utility to tranform row/col to easting/westing. @param gridGeometry @param x @param y @return the world easting and northing. @throws InvalidGridGeometryException @throws TransformException """ final Point2D worldPosition = new Point2D.Double(x, y); gridGeometry.getGridToCRS2D().transform(worldPosition, worldPosition); return worldPosition; }
java
public static Point2D gridToWorld( GridGeometry2D gridGeometry, int x, int y ) throws InvalidGridGeometryException, TransformException { final Point2D worldPosition = new Point2D.Double(x, y); gridGeometry.getGridToCRS2D().transform(worldPosition, worldPosition); return worldPosition; }
[ "public", "static", "Point2D", "gridToWorld", "(", "GridGeometry2D", "gridGeometry", ",", "int", "x", ",", "int", "y", ")", "throws", "InvalidGridGeometryException", ",", "TransformException", "{", "final", "Point2D", "worldPosition", "=", "new", "Point2D", ".", "Double", "(", "x", ",", "y", ")", ";", "gridGeometry", ".", "getGridToCRS2D", "(", ")", ".", "transform", "(", "worldPosition", ",", "worldPosition", ")", ";", "return", "worldPosition", ";", "}" ]
Utility to tranform row/col to easting/westing. @param gridGeometry @param x @param y @return the world easting and northing. @throws InvalidGridGeometryException @throws TransformException
[ "Utility", "to", "tranform", "row", "/", "col", "to", "easting", "/", "westing", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1242-L1247
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetsInner.java
AssetsInner.listStreamingLocators
public ListStreamingLocatorsResponseInner listStreamingLocators(String resourceGroupName, String accountName, String assetName) { """ List Streaming Locators. Lists Streaming Locators which are associated with this asset. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ListStreamingLocatorsResponseInner object if successful. """ return listStreamingLocatorsWithServiceResponseAsync(resourceGroupName, accountName, assetName).toBlocking().single().body(); }
java
public ListStreamingLocatorsResponseInner listStreamingLocators(String resourceGroupName, String accountName, String assetName) { return listStreamingLocatorsWithServiceResponseAsync(resourceGroupName, accountName, assetName).toBlocking().single().body(); }
[ "public", "ListStreamingLocatorsResponseInner", "listStreamingLocators", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "assetName", ")", "{", "return", "listStreamingLocatorsWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "assetName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
List Streaming Locators. Lists Streaming Locators which are associated with this asset. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ListStreamingLocatorsResponseInner object if successful.
[ "List", "Streaming", "Locators", ".", "Lists", "Streaming", "Locators", "which", "are", "associated", "with", "this", "asset", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetsInner.java#L992-L994