repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/modules/utils/BinaryFast.java
BinaryFast.generateBackgroundEdgeFromForegroundEdge
public void generateBackgroundEdgeFromForegroundEdge() { backgroundEdgePixels.clear(); Point p, p2; Iterator<Point> it = foregroundEdgePixels.iterator(); while( it.hasNext() ) { p = new Point(it.next()); for( int j = -1; j < 2; ++j ) { for( int i = -1; i < 2; ++i ) { if ((p.x + i >= 0) && (p.x + i < width) && (p.y + j >= 0) && (p.y + j < height)) { p2 = new Point(p.x + i, p.y + j); if (pixels[p2.x][p2.y] == BACKGROUND) { backgroundEdgePixels.add(p2); } } } } } }
java
public void generateBackgroundEdgeFromForegroundEdge() { backgroundEdgePixels.clear(); Point p, p2; Iterator<Point> it = foregroundEdgePixels.iterator(); while( it.hasNext() ) { p = new Point(it.next()); for( int j = -1; j < 2; ++j ) { for( int i = -1; i < 2; ++i ) { if ((p.x + i >= 0) && (p.x + i < width) && (p.y + j >= 0) && (p.y + j < height)) { p2 = new Point(p.x + i, p.y + j); if (pixels[p2.x][p2.y] == BACKGROUND) { backgroundEdgePixels.add(p2); } } } } } }
[ "public", "void", "generateBackgroundEdgeFromForegroundEdge", "(", ")", "{", "backgroundEdgePixels", ".", "clear", "(", ")", ";", "Point", "p", ",", "p2", ";", "Iterator", "<", "Point", ">", "it", "=", "foregroundEdgePixels", ".", "iterator", "(", ")", ";", ...
Generates the background edge hash set from the foreground edge hash set and the 2D array of pixels.
[ "Generates", "the", "background", "edge", "hash", "set", "from", "the", "foreground", "edge", "hash", "set", "and", "the", "2D", "array", "of", "pixels", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/utils/BinaryFast.java#L207-L224
OpenTSDB/opentsdb
src/tsd/HttpJsonSerializer.java
HttpJsonSerializer.parseQueryV1
public TSQuery parseQueryV1() { final String json = query.getContent(); if (json == null || json.isEmpty()) { throw new BadRequestException(HttpResponseStatus.BAD_REQUEST, "Missing message content", "Supply valid JSON formatted data in the body of your request"); } try { TSQuery data_query = JSON.parseToObject(json, TSQuery.class); // Filter out duplicate queries Set<TSSubQuery> query_set = new LinkedHashSet<TSSubQuery>(data_query.getQueries()); data_query.getQueries().clear(); data_query.getQueries().addAll(query_set); return data_query; } catch (IllegalArgumentException iae) { throw new BadRequestException("Unable to parse the given JSON", iae); } }
java
public TSQuery parseQueryV1() { final String json = query.getContent(); if (json == null || json.isEmpty()) { throw new BadRequestException(HttpResponseStatus.BAD_REQUEST, "Missing message content", "Supply valid JSON formatted data in the body of your request"); } try { TSQuery data_query = JSON.parseToObject(json, TSQuery.class); // Filter out duplicate queries Set<TSSubQuery> query_set = new LinkedHashSet<TSSubQuery>(data_query.getQueries()); data_query.getQueries().clear(); data_query.getQueries().addAll(query_set); return data_query; } catch (IllegalArgumentException iae) { throw new BadRequestException("Unable to parse the given JSON", iae); } }
[ "public", "TSQuery", "parseQueryV1", "(", ")", "{", "final", "String", "json", "=", "query", ".", "getContent", "(", ")", ";", "if", "(", "json", "==", "null", "||", "json", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "BadRequestException", "("...
Parses a timeseries data query @return A TSQuery with data ready to validate @throws JSONException if parsing failed @throws BadRequestException if the content was missing or parsing failed
[ "Parses", "a", "timeseries", "data", "query" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpJsonSerializer.java#L264-L281
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/BufferedByteOutputStream.java
BufferedByteOutputStream.wrapOutputStream
public static DataOutputStream wrapOutputStream(OutputStream os, int bufferSize, int writeBufferSize) { // wrapping BufferedByteOutputStream in BufferedOutputStream decreases // pressure on BBOS internal locks, and we read from the BBOS in // bigger chunks return new DataOutputStream(new BufferedOutputStream( new BufferedByteOutputStream(os, bufferSize, writeBufferSize))); }
java
public static DataOutputStream wrapOutputStream(OutputStream os, int bufferSize, int writeBufferSize) { // wrapping BufferedByteOutputStream in BufferedOutputStream decreases // pressure on BBOS internal locks, and we read from the BBOS in // bigger chunks return new DataOutputStream(new BufferedOutputStream( new BufferedByteOutputStream(os, bufferSize, writeBufferSize))); }
[ "public", "static", "DataOutputStream", "wrapOutputStream", "(", "OutputStream", "os", ",", "int", "bufferSize", ",", "int", "writeBufferSize", ")", "{", "// wrapping BufferedByteOutputStream in BufferedOutputStream decreases", "// pressure on BBOS internal locks, and we read from th...
Wrap given output stream with BufferedByteInputOutput. This is the only way to instantiate the buffered output stream. @param os underlying output stream @param bufferSize size of the in memory buffer @param writeBufferSize size of the buffer used for writing to is
[ "Wrap", "given", "output", "stream", "with", "BufferedByteInputOutput", ".", "This", "is", "the", "only", "way", "to", "instantiate", "the", "buffered", "output", "stream", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/BufferedByteOutputStream.java#L59-L66
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/labeled/checkbox/img/LabeledImageCheckboxPanel.java
LabeledImageCheckboxPanel.newImage
protected Image newImage(final String id, final IModel<LabeledImageCheckboxModelBean> model) { return ComponentFactory.newImage(id, model.getObject().getImageResource()); }
java
protected Image newImage(final String id, final IModel<LabeledImageCheckboxModelBean> model) { return ComponentFactory.newImage(id, model.getObject().getImageResource()); }
[ "protected", "Image", "newImage", "(", "final", "String", "id", ",", "final", "IModel", "<", "LabeledImageCheckboxModelBean", ">", "model", ")", "{", "return", "ComponentFactory", ".", "newImage", "(", "id", ",", "model", ".", "getObject", "(", ")", ".", "ge...
Factory method for create a new {@link Image}. This method is invoked in the constructor from this class and can be overridden so users can provide their own version of a new {@link Image}. @param id the id @param model the model that contains the IResource object @return the new {@link Image}.
[ "Factory", "method", "for", "create", "a", "new", "{", "@link", "Image", "}", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "this", "class", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own", ...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/labeled/checkbox/img/LabeledImageCheckboxPanel.java#L91-L94
EsotericSoftware/kryonet
src/com/esotericsoftware/kryonet/util/ObjectIntMap.java
ObjectIntMap.getAndIncrement
public int getAndIncrement (K key, int defaultValue, int increment) { int hashCode = key.hashCode(); int index = hashCode & mask; if (!key.equals(keyTable[index])) { index = hash2(hashCode); if (!key.equals(keyTable[index])) { index = hash3(hashCode); if (!key.equals(keyTable[index])) return getAndIncrementStash(key, defaultValue, increment); } } int value = valueTable[index]; valueTable[index] = value + increment; return value; }
java
public int getAndIncrement (K key, int defaultValue, int increment) { int hashCode = key.hashCode(); int index = hashCode & mask; if (!key.equals(keyTable[index])) { index = hash2(hashCode); if (!key.equals(keyTable[index])) { index = hash3(hashCode); if (!key.equals(keyTable[index])) return getAndIncrementStash(key, defaultValue, increment); } } int value = valueTable[index]; valueTable[index] = value + increment; return value; }
[ "public", "int", "getAndIncrement", "(", "K", "key", ",", "int", "defaultValue", ",", "int", "increment", ")", "{", "int", "hashCode", "=", "key", ".", "hashCode", "(", ")", ";", "int", "index", "=", "hashCode", "&", "mask", ";", "if", "(", "!", "key...
Returns the key's current value and increments the stored value. If the key is not in the map, defaultValue + increment is put into the map.
[ "Returns", "the", "key", "s", "current", "value", "and", "increments", "the", "stored", "value", ".", "If", "the", "key", "is", "not", "in", "the", "map", "defaultValue", "+", "increment", "is", "put", "into", "the", "map", "." ]
train
https://github.com/EsotericSoftware/kryonet/blob/2ed19b4743667664d15e3778447e579855ba3a65/src/com/esotericsoftware/kryonet/util/ObjectIntMap.java#L294-L307
TNG/property-loader
src/main/java/com/tngtech/propertyloader/Obfuscator.java
Obfuscator.decryptInternal
private String decryptInternal(SecretKeySpec key, byte[] encryptedBytes) { try { Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM + ENCRYPTION_ALGORITHM_MODIFIER); cipher.init(Cipher.DECRYPT_MODE, key); byte[] decryptedBytes = cipher.doFinal(encryptedBytes); return new String(decryptedBytes, ENCODING); } catch (GeneralSecurityException e) { throw new RuntimeException("Exception during decryptInternal: " + e, e); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Exception during encryptInternal: " + e, e); } }
java
private String decryptInternal(SecretKeySpec key, byte[] encryptedBytes) { try { Cipher cipher = Cipher.getInstance(ENCRYPTION_ALGORITHM + ENCRYPTION_ALGORITHM_MODIFIER); cipher.init(Cipher.DECRYPT_MODE, key); byte[] decryptedBytes = cipher.doFinal(encryptedBytes); return new String(decryptedBytes, ENCODING); } catch (GeneralSecurityException e) { throw new RuntimeException("Exception during decryptInternal: " + e, e); } catch (UnsupportedEncodingException e) { throw new RuntimeException("Exception during encryptInternal: " + e, e); } }
[ "private", "String", "decryptInternal", "(", "SecretKeySpec", "key", ",", "byte", "[", "]", "encryptedBytes", ")", "{", "try", "{", "Cipher", "cipher", "=", "Cipher", ".", "getInstance", "(", "ENCRYPTION_ALGORITHM", "+", "ENCRYPTION_ALGORITHM_MODIFIER", ")", ";", ...
Internal decryption method. @param key - the SecretKeySpec used to decrypt @param encryptedBytes - the byte[] to decrypt @return the decrypted plaintext String.
[ "Internal", "decryption", "method", "." ]
train
https://github.com/TNG/property-loader/blob/0fbc8a091795aaf2bdaf7c0d494a32772bff0e1f/src/main/java/com/tngtech/propertyloader/Obfuscator.java#L83-L94
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/BeanPath.java
BeanPath.createMap
@SuppressWarnings("unchecked") protected <K, V, E extends SimpleExpression<? super V>> MapPath<K, V, E> createMap(String property, Class<? super K> key, Class<? super V> value, Class<? super E> queryType) { return add(new MapPath<K, V, E>(key, value, (Class) queryType, forProperty(property))); }
java
@SuppressWarnings("unchecked") protected <K, V, E extends SimpleExpression<? super V>> MapPath<K, V, E> createMap(String property, Class<? super K> key, Class<? super V> value, Class<? super E> queryType) { return add(new MapPath<K, V, E>(key, value, (Class) queryType, forProperty(property))); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "<", "K", ",", "V", ",", "E", "extends", "SimpleExpression", "<", "?", "super", "V", ">", ">", "MapPath", "<", "K", ",", "V", ",", "E", ">", "createMap", "(", "String", "property", ",", ...
Create a new Map typed path @param <K> @param <V> @param <E> @param property property name @param key key type @param value value type @param queryType expression type @return property path
[ "Create", "a", "new", "Map", "typed", "path" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/BeanPath.java#L233-L236
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/util/ElementUtil.java
ElementUtil.isNonnull
public static boolean isNonnull(Element element, boolean parametersNonnullByDefault) { return hasNonnullAnnotation(element) || isConstructor(element) // Java constructors are always non-null. || (isParameter(element) && parametersNonnullByDefault && !((VariableElement) element).asType().getKind().isPrimitive()); }
java
public static boolean isNonnull(Element element, boolean parametersNonnullByDefault) { return hasNonnullAnnotation(element) || isConstructor(element) // Java constructors are always non-null. || (isParameter(element) && parametersNonnullByDefault && !((VariableElement) element).asType().getKind().isPrimitive()); }
[ "public", "static", "boolean", "isNonnull", "(", "Element", "element", ",", "boolean", "parametersNonnullByDefault", ")", "{", "return", "hasNonnullAnnotation", "(", "element", ")", "||", "isConstructor", "(", "element", ")", "// Java constructors are always non-null.", ...
Returns whether an element is marked as always being non-null. Field, method, and parameter elements can be defined as non-null with a Nonnull annotation. Method parameters can also be defined as non-null by annotating the owning package or type element with the ParametersNonnullByDefault annotation.
[ "Returns", "whether", "an", "element", "is", "marked", "as", "always", "being", "non", "-", "null", ".", "Field", "method", "and", "parameter", "elements", "can", "be", "defined", "as", "non", "-", "null", "with", "a", "Nonnull", "annotation", ".", "Method...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/ElementUtil.java#L809-L815
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/transcoder/TranscoderUtils.java
TranscoderUtils.byteBufToGenericObject
public static Object byteBufToGenericObject(ByteBuf input, ObjectMapper mapper) throws IOException { //skip leading whitespaces int toSkip = input.forEachByte(new WhitespaceSkipper()); if (toSkip > 0) { input.skipBytes(toSkip); } //peek into the buffer for quick detection of objects and arrays input.markReaderIndex(); byte first = input.readByte(); input.resetReaderIndex(); switch (first) { case '{': return byteBufToClass(input, JsonObject.class, mapper); case '[': return byteBufToClass(input, JsonArray.class, mapper); } //we couldn't fast detect the type, we'll have to unmarshall to object and make sure maps and lists //are converted to JsonObject/JsonArray. Object value = byteBufToClass(input, Object.class, mapper); if (value instanceof Map) { LOGGER.warn( "A JSON object could not be fast detected (first byte '{}')", user((char) first) ); return JsonObject.from((Map<String, ?>) value); } else if (value instanceof List) { LOGGER.warn( "A JSON array could not be fast detected (first byte '{}')", user((char) first) ); return JsonArray.from((List<?>) value); } else { return value; } }
java
public static Object byteBufToGenericObject(ByteBuf input, ObjectMapper mapper) throws IOException { //skip leading whitespaces int toSkip = input.forEachByte(new WhitespaceSkipper()); if (toSkip > 0) { input.skipBytes(toSkip); } //peek into the buffer for quick detection of objects and arrays input.markReaderIndex(); byte first = input.readByte(); input.resetReaderIndex(); switch (first) { case '{': return byteBufToClass(input, JsonObject.class, mapper); case '[': return byteBufToClass(input, JsonArray.class, mapper); } //we couldn't fast detect the type, we'll have to unmarshall to object and make sure maps and lists //are converted to JsonObject/JsonArray. Object value = byteBufToClass(input, Object.class, mapper); if (value instanceof Map) { LOGGER.warn( "A JSON object could not be fast detected (first byte '{}')", user((char) first) ); return JsonObject.from((Map<String, ?>) value); } else if (value instanceof List) { LOGGER.warn( "A JSON array could not be fast detected (first byte '{}')", user((char) first) ); return JsonArray.from((List<?>) value); } else { return value; } }
[ "public", "static", "Object", "byteBufToGenericObject", "(", "ByteBuf", "input", ",", "ObjectMapper", "mapper", ")", "throws", "IOException", "{", "//skip leading whitespaces", "int", "toSkip", "=", "input", ".", "forEachByte", "(", "new", "WhitespaceSkipper", "(", ...
Converts a {@link ByteBuf} representing a valid JSON entity to a generic {@link Object}, <b>without releasing the buffer</b>. The entity can either be a JSON object, array or scalar value, potentially with leading whitespace (which gets ignored). JSON objects are converted to a {@link JsonObject} and JSON arrays to a {@link JsonArray}. Detection of JSON objects and arrays is attempted in order not to incur an additional conversion step (JSON to Map to JsonObject for example), but if a Map or List is produced, it will be transformed to {@link JsonObject} or {@link JsonArray} (with a warning logged). @param input the buffer to convert. It won't be released. @return a Object decoded from the buffer @throws IOException if the decoding fails.
[ "Converts", "a", "{", "@link", "ByteBuf", "}", "representing", "a", "valid", "JSON", "entity", "to", "a", "generic", "{", "@link", "Object", "}", "<b", ">", "without", "releasing", "the", "buffer<", "/", "b", ">", ".", "The", "entity", "can", "either", ...
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/transcoder/TranscoderUtils.java#L362-L398
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketClient.java
BackendBucketClient.insertBackendBucket
@BetaApi public final Operation insertBackendBucket(String project, BackendBucket backendBucketResource) { InsertBackendBucketHttpRequest request = InsertBackendBucketHttpRequest.newBuilder() .setProject(project) .setBackendBucketResource(backendBucketResource) .build(); return insertBackendBucket(request); }
java
@BetaApi public final Operation insertBackendBucket(String project, BackendBucket backendBucketResource) { InsertBackendBucketHttpRequest request = InsertBackendBucketHttpRequest.newBuilder() .setProject(project) .setBackendBucketResource(backendBucketResource) .build(); return insertBackendBucket(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertBackendBucket", "(", "String", "project", ",", "BackendBucket", "backendBucketResource", ")", "{", "InsertBackendBucketHttpRequest", "request", "=", "InsertBackendBucketHttpRequest", ".", "newBuilder", "(", ")", ".", ...
Creates a BackendBucket resource in the specified project using the data included in the request. <p>Sample code: <pre><code> try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) { ProjectName project = ProjectName.of("[PROJECT]"); BackendBucket backendBucketResource = BackendBucket.newBuilder().build(); Operation response = backendBucketClient.insertBackendBucket(project.toString(), backendBucketResource); } </code></pre> @param project Project ID for this request. @param backendBucketResource A BackendBucket resource. This resource defines a Cloud Storage bucket. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "BackendBucket", "resource", "in", "the", "specified", "project", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/BackendBucketClient.java#L640-L649
dickschoeller/gedbrowser
gedbrowserng/src/main/java/org/schoellerfamily/gedbrowser/api/crud/PersonCrud.java
PersonCrud.createOne
@Override public ApiPerson createOne(final String db, final ApiPerson person) { logger.info("Entering create person in db: " + db); return create(readRoot(db), person, (i, id) -> new ApiPerson(i, id)); }
java
@Override public ApiPerson createOne(final String db, final ApiPerson person) { logger.info("Entering create person in db: " + db); return create(readRoot(db), person, (i, id) -> new ApiPerson(i, id)); }
[ "@", "Override", "public", "ApiPerson", "createOne", "(", "final", "String", "db", ",", "final", "ApiPerson", "person", ")", "{", "logger", ".", "info", "(", "\"Entering create person in db: \"", "+", "db", ")", ";", "return", "create", "(", "readRoot", "(", ...
Create a new person from the passed object. @param db the name of the db to access @param person the data for the person @return the person as created
[ "Create", "a", "new", "person", "from", "the", "passed", "object", "." ]
train
https://github.com/dickschoeller/gedbrowser/blob/e3e10b1ff3a34ebde9b7edcbfafcd5fe6fb3b3e1/gedbrowserng/src/main/java/org/schoellerfamily/gedbrowser/api/crud/PersonCrud.java#L61-L65
bThink-BGU/BPjs
src/main/java/il/ac/bgu/cs/bp/bpjs/analysis/DfsTraversalNode.java
DfsTraversalNode.getNextNode
public DfsTraversalNode getNextNode(BEvent e, ExecutorService exSvc) throws BPjsRuntimeException { try { return new DfsTraversalNode(bp, BProgramSyncSnapshotCloner.clone(systemState).triggerEvent(e, exSvc, Collections.emptySet()), e); } catch ( InterruptedException ie ) { throw new BPjsRuntimeException("Thread interrupted during event invocaiton", ie); } }
java
public DfsTraversalNode getNextNode(BEvent e, ExecutorService exSvc) throws BPjsRuntimeException { try { return new DfsTraversalNode(bp, BProgramSyncSnapshotCloner.clone(systemState).triggerEvent(e, exSvc, Collections.emptySet()), e); } catch ( InterruptedException ie ) { throw new BPjsRuntimeException("Thread interrupted during event invocaiton", ie); } }
[ "public", "DfsTraversalNode", "getNextNode", "(", "BEvent", "e", ",", "ExecutorService", "exSvc", ")", "throws", "BPjsRuntimeException", "{", "try", "{", "return", "new", "DfsTraversalNode", "(", "bp", ",", "BProgramSyncSnapshotCloner", ".", "clone", "(", "systemSta...
Get a Node object for each possible state of the system after triggering the given event. @param e the selected event @param exSvc The executor service that will run the threads @return State of the BProgram after event {@code e} was selected while the program was at {@code this} node's state. @throws BPjsRuntimeException In case there's an error running the JavaScript code.
[ "Get", "a", "Node", "object", "for", "each", "possible", "state", "of", "the", "system", "after", "triggering", "the", "given", "event", "." ]
train
https://github.com/bThink-BGU/BPjs/blob/2d388365a27ad79ded108eaf98a35a7ef292ae1f/src/main/java/il/ac/bgu/cs/bp/bpjs/analysis/DfsTraversalNode.java#L88-L94
alamkanak/Android-Week-View
library/src/main/java/com/alamkanak/weekview/WeekView.java
WeekView.isEventsCollide
private boolean isEventsCollide(WeekViewEvent event1, WeekViewEvent event2) { long start1 = event1.getStartTime().getTimeInMillis(); long end1 = event1.getEndTime().getTimeInMillis(); long start2 = event2.getStartTime().getTimeInMillis(); long end2 = event2.getEndTime().getTimeInMillis(); return !((start1 >= end2) || (end1 <= start2)); }
java
private boolean isEventsCollide(WeekViewEvent event1, WeekViewEvent event2) { long start1 = event1.getStartTime().getTimeInMillis(); long end1 = event1.getEndTime().getTimeInMillis(); long start2 = event2.getStartTime().getTimeInMillis(); long end2 = event2.getEndTime().getTimeInMillis(); return !((start1 >= end2) || (end1 <= start2)); }
[ "private", "boolean", "isEventsCollide", "(", "WeekViewEvent", "event1", ",", "WeekViewEvent", "event2", ")", "{", "long", "start1", "=", "event1", ".", "getStartTime", "(", ")", ".", "getTimeInMillis", "(", ")", ";", "long", "end1", "=", "event1", ".", "get...
Checks if two events overlap. @param event1 The first event. @param event2 The second event. @return true if the events overlap.
[ "Checks", "if", "two", "events", "overlap", "." ]
train
https://github.com/alamkanak/Android-Week-View/blob/dc3f97d65d44785d1a761b52b58527c86c4eee1b/library/src/main/java/com/alamkanak/weekview/WeekView.java#L1194-L1200
lessthanoptimal/ddogleg
src/org/ddogleg/optimization/math/HessianSchurComplement_DDRM.java
HessianSchurComplement_DDRM.computeHessian
@Override public void computeHessian(DMatrixRMaj jacLeft , DMatrixRMaj jacRight) { A.reshape(jacLeft.numCols,jacLeft.numCols); B.reshape(jacLeft.numCols,jacRight.numCols); D.reshape(jacRight.numCols,jacRight.numCols); // take advantage of the inner product's symmetry when possible to reduce // the number of calculations MatrixMultProduct_DDRM.inner_reorder_lower(jacLeft,A); CommonOps_DDRM.symmLowerToFull(A); CommonOps_DDRM.multTransA(jacLeft,jacRight,B); MatrixMultProduct_DDRM.inner_reorder_lower(jacRight,D); CommonOps_DDRM.symmLowerToFull(D); }
java
@Override public void computeHessian(DMatrixRMaj jacLeft , DMatrixRMaj jacRight) { A.reshape(jacLeft.numCols,jacLeft.numCols); B.reshape(jacLeft.numCols,jacRight.numCols); D.reshape(jacRight.numCols,jacRight.numCols); // take advantage of the inner product's symmetry when possible to reduce // the number of calculations MatrixMultProduct_DDRM.inner_reorder_lower(jacLeft,A); CommonOps_DDRM.symmLowerToFull(A); CommonOps_DDRM.multTransA(jacLeft,jacRight,B); MatrixMultProduct_DDRM.inner_reorder_lower(jacRight,D); CommonOps_DDRM.symmLowerToFull(D); }
[ "@", "Override", "public", "void", "computeHessian", "(", "DMatrixRMaj", "jacLeft", ",", "DMatrixRMaj", "jacRight", ")", "{", "A", ".", "reshape", "(", "jacLeft", ".", "numCols", ",", "jacLeft", ".", "numCols", ")", ";", "B", ".", "reshape", "(", "jacLeft"...
Compuets the Hessian in block form @param jacLeft (Input) Left side of Jacobian @param jacRight (Input) Right side of Jacobian
[ "Compuets", "the", "Hessian", "in", "block", "form" ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/math/HessianSchurComplement_DDRM.java#L54-L67
massimozappino/tagmycode-java-plugin-framework
src/main/java/com/tagmycode/plugin/gui/TextPrompt.java
TextPrompt.changeAlpha
public void changeAlpha(int alpha) { alpha = alpha > 255 ? 255 : alpha < 0 ? 0 : alpha; Color foreground = getForeground(); int red = foreground.getRed(); int green = foreground.getGreen(); int blue = foreground.getBlue(); Color withAlpha = new Color(red, green, blue, alpha); super.setForeground(withAlpha); }
java
public void changeAlpha(int alpha) { alpha = alpha > 255 ? 255 : alpha < 0 ? 0 : alpha; Color foreground = getForeground(); int red = foreground.getRed(); int green = foreground.getGreen(); int blue = foreground.getBlue(); Color withAlpha = new Color(red, green, blue, alpha); super.setForeground(withAlpha); }
[ "public", "void", "changeAlpha", "(", "int", "alpha", ")", "{", "alpha", "=", "alpha", ">", "255", "?", "255", ":", "alpha", "<", "0", "?", "0", ":", "alpha", ";", "Color", "foreground", "=", "getForeground", "(", ")", ";", "int", "red", "=", "fore...
Convenience method to applyChanges the alpha value of the current foreground Color to the specifice value. @param alpha value in the range of 0 - 255.
[ "Convenience", "method", "to", "applyChanges", "the", "alpha", "value", "of", "the", "current", "foreground", "Color", "to", "the", "specifice", "value", "." ]
train
https://github.com/massimozappino/tagmycode-java-plugin-framework/blob/06637e32bf737e3e0d318859c718815edac9d0f0/src/main/java/com/tagmycode/plugin/gui/TextPrompt.java#L68-L78
thinkaurelius/titan
titan-core/src/main/java/com/thinkaurelius/titan/util/stats/ObjectAccumulator.java
ObjectAccumulator.incBy
public double incBy(K o, double inc) { Counter c = countMap.get(o); if (c == null) { c = new Counter(); countMap.put(o, c); } c.count += inc; return c.count; }
java
public double incBy(K o, double inc) { Counter c = countMap.get(o); if (c == null) { c = new Counter(); countMap.put(o, c); } c.count += inc; return c.count; }
[ "public", "double", "incBy", "(", "K", "o", ",", "double", "inc", ")", "{", "Counter", "c", "=", "countMap", ".", "get", "(", "o", ")", ";", "if", "(", "c", "==", "null", ")", "{", "c", "=", "new", "Counter", "(", ")", ";", "countMap", ".", "...
Increases the count of object o by inc and returns the new count value @param o @param inc @return
[ "Increases", "the", "count", "of", "object", "o", "by", "inc", "and", "returns", "the", "new", "count", "value" ]
train
https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/util/stats/ObjectAccumulator.java#L36-L44
roboconf/roboconf-platform
core/roboconf-target-iaas-occi/src/main/java/net/roboconf/target/occi/internal/OcciVMUtils.java
OcciVMUtils.deleteVM
public static boolean deleteVM(String hostIpPort, String id) throws TargetException { if(id.startsWith("urn:uuid:")) id = id.substring(9); String ret = null; URL url = null; try { CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL)); url = new URL("http://" + hostIpPort + "/" + id); } catch (MalformedURLException e) { throw new TargetException(e); } HttpURLConnection httpURLConnection = null; DataInputStream in = null; try { httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setRequestMethod("DELETE"); httpURLConnection.setRequestProperty("Content-Type", "text/occi"); httpURLConnection.setRequestProperty("Accept", "*/*"); in = new DataInputStream(httpURLConnection.getInputStream()); ByteArrayOutputStream out = new ByteArrayOutputStream(); Utils.copyStreamSafely(in, out); ret = out.toString( "UTF-8" ); } catch (IOException e) { throw new TargetException(e); } finally { Utils.closeQuietly(in); if (httpURLConnection != null) { httpURLConnection.disconnect(); } } return ("OK".equalsIgnoreCase(ret)); }
java
public static boolean deleteVM(String hostIpPort, String id) throws TargetException { if(id.startsWith("urn:uuid:")) id = id.substring(9); String ret = null; URL url = null; try { CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL)); url = new URL("http://" + hostIpPort + "/" + id); } catch (MalformedURLException e) { throw new TargetException(e); } HttpURLConnection httpURLConnection = null; DataInputStream in = null; try { httpURLConnection = (HttpURLConnection) url.openConnection(); httpURLConnection.setRequestMethod("DELETE"); httpURLConnection.setRequestProperty("Content-Type", "text/occi"); httpURLConnection.setRequestProperty("Accept", "*/*"); in = new DataInputStream(httpURLConnection.getInputStream()); ByteArrayOutputStream out = new ByteArrayOutputStream(); Utils.copyStreamSafely(in, out); ret = out.toString( "UTF-8" ); } catch (IOException e) { throw new TargetException(e); } finally { Utils.closeQuietly(in); if (httpURLConnection != null) { httpURLConnection.disconnect(); } } return ("OK".equalsIgnoreCase(ret)); }
[ "public", "static", "boolean", "deleteVM", "(", "String", "hostIpPort", ",", "String", "id", ")", "throws", "TargetException", "{", "if", "(", "id", ".", "startsWith", "(", "\"urn:uuid:\"", ")", ")", "id", "=", "id", ".", "substring", "(", "9", ")", ";",...
Deletes a VM (OCCI / VMWare). @param hostIpPort IP and port of OCCI server (eg. "172.16.225.91:8080") @param id Unique VM ID @return true if deletion OK, false otherwise
[ "Deletes", "a", "VM", "(", "OCCI", "/", "VMWare", ")", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-occi/src/main/java/net/roboconf/target/occi/internal/OcciVMUtils.java#L533-L569
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.newDriverInstance
public Object newDriverInstance(CmsParameterConfiguration configuration, String driverName, String driverPoolUrl) throws CmsException { Class<?>[] initParamClasses = {CmsParameterConfiguration.class, String.class, CmsDriverManager.class}; Object[] initParams = {configuration, driverPoolUrl, this}; Class<?> driverClass = null; Object driver = null; try { // try to get the class driverClass = Class.forName(driverName); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_START_1, driverName)); } // try to create a instance driver = driverClass.newInstance(); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_INITIALIZING_1, driverName)); } // invoke the init-method of this access class driver.getClass().getMethod("init", initParamClasses).invoke(driver, initParams); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_INIT_FINISHED_1, driverPoolUrl)); } } catch (Exception exc) { CmsMessageContainer message = Messages.get().container(Messages.ERR_INIT_DRIVER_MANAGER_1); if (LOG.isFatalEnabled()) { LOG.fatal(message.key(), exc); } throw new CmsDbException(message, exc); } return driver; }
java
public Object newDriverInstance(CmsParameterConfiguration configuration, String driverName, String driverPoolUrl) throws CmsException { Class<?>[] initParamClasses = {CmsParameterConfiguration.class, String.class, CmsDriverManager.class}; Object[] initParams = {configuration, driverPoolUrl, this}; Class<?> driverClass = null; Object driver = null; try { // try to get the class driverClass = Class.forName(driverName); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_START_1, driverName)); } // try to create a instance driver = driverClass.newInstance(); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_INITIALIZING_1, driverName)); } // invoke the init-method of this access class driver.getClass().getMethod("init", initParamClasses).invoke(driver, initParams); if (CmsLog.INIT.isInfoEnabled()) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_DRIVER_INIT_FINISHED_1, driverPoolUrl)); } } catch (Exception exc) { CmsMessageContainer message = Messages.get().container(Messages.ERR_INIT_DRIVER_MANAGER_1); if (LOG.isFatalEnabled()) { LOG.fatal(message.key(), exc); } throw new CmsDbException(message, exc); } return driver; }
[ "public", "Object", "newDriverInstance", "(", "CmsParameterConfiguration", "configuration", ",", "String", "driverName", ",", "String", "driverPoolUrl", ")", "throws", "CmsException", "{", "Class", "<", "?", ">", "[", "]", "initParamClasses", "=", "{", "CmsParameter...
Method to create a new instance of a driver.<p> @param configuration the configurations from the propertyfile @param driverName the class name of the driver @param driverPoolUrl the pool url for the driver @return an initialized instance of the driver @throws CmsException if something goes wrong
[ "Method", "to", "create", "a", "new", "instance", "of", "a", "driver", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L5970-L6009
cdk/cdk
base/core/src/main/java/org/openscience/cdk/graph/PathTools.java
PathTools.breadthFirstSearch
public static void breadthFirstSearch(IAtomContainer atomContainer, List<IAtom> sphere, IAtomContainer molecule) { // logger.debug("Staring partitioning with this ac: " + ac); breadthFirstSearch(atomContainer, sphere, molecule, -1); }
java
public static void breadthFirstSearch(IAtomContainer atomContainer, List<IAtom> sphere, IAtomContainer molecule) { // logger.debug("Staring partitioning with this ac: " + ac); breadthFirstSearch(atomContainer, sphere, molecule, -1); }
[ "public", "static", "void", "breadthFirstSearch", "(", "IAtomContainer", "atomContainer", ",", "List", "<", "IAtom", ">", "sphere", ",", "IAtomContainer", "molecule", ")", "{", "// logger.debug(\"Staring partitioning with this ac: \" + ac);", "breadthFirstSearch", "(", "ato...
Performs a breadthFirstSearch in an AtomContainer starting with a particular sphere, which usually consists of one start atom. While searching the graph, the method marks each visited atom. It then puts all the atoms connected to the atoms in the given sphere into a new vector which forms the sphere to search for the next recursive method call. All atoms that have been visited are put into a molecule container. This breadthFirstSearch does thus find the connected graph for a given start atom. @param atomContainer The AtomContainer to be searched @param sphere A sphere of atoms to start the search with @param molecule A molecule into which all the atoms and bonds are stored that are found during search
[ "Performs", "a", "breadthFirstSearch", "in", "an", "AtomContainer", "starting", "with", "a", "particular", "sphere", "which", "usually", "consists", "of", "one", "start", "atom", ".", "While", "searching", "the", "graph", "the", "method", "marks", "each", "visit...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/graph/PathTools.java#L203-L206
landawn/AbacusUtil
src/com/landawn/abacus/util/CSVUtil.java
CSVUtil.loadCSV
@SuppressWarnings("rawtypes") public static <E extends Exception> DataSet loadCSV(final InputStream csvInputStream, final long offset, final long count, final Try.Predicate<String[], E> filter, final List<? extends Type> columnTypeList) throws E { final Reader csvReader = new InputStreamReader(csvInputStream); return loadCSV(csvReader, offset, count, filter, columnTypeList); }
java
@SuppressWarnings("rawtypes") public static <E extends Exception> DataSet loadCSV(final InputStream csvInputStream, final long offset, final long count, final Try.Predicate<String[], E> filter, final List<? extends Type> columnTypeList) throws E { final Reader csvReader = new InputStreamReader(csvInputStream); return loadCSV(csvReader, offset, count, filter, columnTypeList); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "<", "E", "extends", "Exception", ">", "DataSet", "loadCSV", "(", "final", "InputStream", "csvInputStream", ",", "final", "long", "offset", ",", "final", "long", "count", ",", "final", "Try...
Load the data from CSV. @param csvInputStream @param offset @param count @param filter @param columnTypeList set the column type to null to skip the column in CSV. @return
[ "Load", "the", "data", "from", "CSV", ".", "@param", "csvInputStream", "@param", "offset", "@param", "count", "@param", "filter", "@param", "columnTypeList", "set", "the", "column", "type", "to", "null", "to", "skip", "the", "column", "in", "CSV", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/CSVUtil.java#L595-L601
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java
ConnectionMonitorsInner.createOrUpdate
public ConnectionMonitorResultInner createOrUpdate(String resourceGroupName, String networkWatcherName, String connectionMonitorName, ConnectionMonitorInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters).toBlocking().last().body(); }
java
public ConnectionMonitorResultInner createOrUpdate(String resourceGroupName, String networkWatcherName, String connectionMonitorName, ConnectionMonitorInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, networkWatcherName, connectionMonitorName, parameters).toBlocking().last().body(); }
[ "public", "ConnectionMonitorResultInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "String", "connectionMonitorName", ",", "ConnectionMonitorInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", ...
Create or update a connection monitor. @param resourceGroupName The name of the resource group containing Network Watcher. @param networkWatcherName The name of the Network Watcher resource. @param connectionMonitorName The name of the connection monitor. @param parameters Parameters that define the operation to create a connection monitor. @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 ConnectionMonitorResultInner object if successful.
[ "Create", "or", "update", "a", "connection", "monitor", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ConnectionMonitorsInner.java#L122-L124
negusoft/holoaccent
HoloAccent/src/com/negusoft/holoaccent/AccentResources.java
AccentResources.getTintendResourceStream
private InputStream getTintendResourceStream(int id, TypedValue value, int color) { Bitmap bitmap = getBitmapFromResource(id, value); bitmap = BitmapUtils.applyColor(bitmap, color); return getStreamFromBitmap(bitmap); }
java
private InputStream getTintendResourceStream(int id, TypedValue value, int color) { Bitmap bitmap = getBitmapFromResource(id, value); bitmap = BitmapUtils.applyColor(bitmap, color); return getStreamFromBitmap(bitmap); }
[ "private", "InputStream", "getTintendResourceStream", "(", "int", "id", ",", "TypedValue", "value", ",", "int", "color", ")", "{", "Bitmap", "bitmap", "=", "getBitmapFromResource", "(", "id", ",", "value", ")", ";", "bitmap", "=", "BitmapUtils", ".", "applyCol...
Get a reference to a resource that is equivalent to the one requested, but with the accent color applied to it.
[ "Get", "a", "reference", "to", "a", "resource", "that", "is", "equivalent", "to", "the", "one", "requested", "but", "with", "the", "accent", "color", "applied", "to", "it", "." ]
train
https://github.com/negusoft/holoaccent/blob/7121a02dde94834e770cb81174d0bdc596323324/HoloAccent/src/com/negusoft/holoaccent/AccentResources.java#L366-L370
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.drawImage
public void drawImage (final PDInlineImage inlineImage, final float x, final float y, final float width, final float height) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: drawImage is not allowed within a text block."); } saveGraphicsState (); transform (new Matrix (width, 0, 0, height, x, y)); // create the image dictionary final StringBuilder sb = new StringBuilder (); sb.append ("BI"); sb.append ("\n /W "); sb.append (inlineImage.getWidth ()); sb.append ("\n /H "); sb.append (inlineImage.getHeight ()); sb.append ("\n /CS "); sb.append ("/"); sb.append (inlineImage.getColorSpace ().getName ()); if (inlineImage.getDecode () != null && inlineImage.getDecode ().size () > 0) { sb.append ("\n /D "); sb.append ("["); for (final COSBase base : inlineImage.getDecode ()) { sb.append (((COSNumber) base).intValue ()); sb.append (" "); } sb.append ("]"); } if (inlineImage.isStencil ()) { sb.append ("\n /IM true"); } sb.append ("\n /BPC "); sb.append (inlineImage.getBitsPerComponent ()); // image dictionary write (sb.toString ()); writeLine (); // binary data writeOperator ((byte) 'I', (byte) 'D'); writeBytes (inlineImage.getData ()); writeLine (); writeOperator ((byte) 'E', (byte) 'I'); restoreGraphicsState (); }
java
public void drawImage (final PDInlineImage inlineImage, final float x, final float y, final float width, final float height) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: drawImage is not allowed within a text block."); } saveGraphicsState (); transform (new Matrix (width, 0, 0, height, x, y)); // create the image dictionary final StringBuilder sb = new StringBuilder (); sb.append ("BI"); sb.append ("\n /W "); sb.append (inlineImage.getWidth ()); sb.append ("\n /H "); sb.append (inlineImage.getHeight ()); sb.append ("\n /CS "); sb.append ("/"); sb.append (inlineImage.getColorSpace ().getName ()); if (inlineImage.getDecode () != null && inlineImage.getDecode ().size () > 0) { sb.append ("\n /D "); sb.append ("["); for (final COSBase base : inlineImage.getDecode ()) { sb.append (((COSNumber) base).intValue ()); sb.append (" "); } sb.append ("]"); } if (inlineImage.isStencil ()) { sb.append ("\n /IM true"); } sb.append ("\n /BPC "); sb.append (inlineImage.getBitsPerComponent ()); // image dictionary write (sb.toString ()); writeLine (); // binary data writeOperator ((byte) 'I', (byte) 'D'); writeBytes (inlineImage.getData ()); writeLine (); writeOperator ((byte) 'E', (byte) 'I'); restoreGraphicsState (); }
[ "public", "void", "drawImage", "(", "final", "PDInlineImage", "inlineImage", ",", "final", "float", "x", ",", "final", "float", "y", ",", "final", "float", "width", ",", "final", "float", "height", ")", "throws", "IOException", "{", "if", "(", "inTextMode", ...
Draw an inline image at the x,y coordinates and a certain width and height. @param inlineImage The inline image to draw. @param x The x-coordinate to draw the inline image. @param y The y-coordinate to draw the inline image. @param width The width of the inline image to draw. @param height The height of the inline image to draw. @throws IOException If there is an error writing to the stream. @throws IllegalStateException If the method was called within a text block.
[ "Draw", "an", "inline", "image", "at", "the", "x", "y", "coordinates", "and", "a", "certain", "width", "and", "height", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L568-L627
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/security/support/AbstractSecurityController.java
AbstractSecurityController.setVisibilityOnControlledObject
private void setVisibilityOnControlledObject(Object controlledObject, boolean authorized) { try { Method method = controlledObject.getClass().getMethod( "setVisible", new Class[] { boolean.class } ); method.invoke( controlledObject, new Object[] { new Boolean( authorized ) } ); } catch( NoSuchMethodException ignored ) { System.out.println( "NO setVisible method on object: " + controlledObject ); // No method to call, so nothing to do } catch( IllegalAccessException ignored ) { logger.error( "Could not call setVisible", ignored ); } catch( InvocationTargetException ignored ) { logger.error( "Could not call setVisible", ignored ); } }
java
private void setVisibilityOnControlledObject(Object controlledObject, boolean authorized) { try { Method method = controlledObject.getClass().getMethod( "setVisible", new Class[] { boolean.class } ); method.invoke( controlledObject, new Object[] { new Boolean( authorized ) } ); } catch( NoSuchMethodException ignored ) { System.out.println( "NO setVisible method on object: " + controlledObject ); // No method to call, so nothing to do } catch( IllegalAccessException ignored ) { logger.error( "Could not call setVisible", ignored ); } catch( InvocationTargetException ignored ) { logger.error( "Could not call setVisible", ignored ); } }
[ "private", "void", "setVisibilityOnControlledObject", "(", "Object", "controlledObject", ",", "boolean", "authorized", ")", "{", "try", "{", "Method", "method", "=", "controlledObject", ".", "getClass", "(", ")", ".", "getMethod", "(", "\"setVisible\"", ",", "new"...
Set the visible property on a controlled action according to the provided authorization.
[ "Set", "the", "visible", "property", "on", "a", "controlled", "action", "according", "to", "the", "provided", "authorization", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/security/support/AbstractSecurityController.java#L218-L230
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/wi/wisite_binding.java
wisite_binding.get
public static wisite_binding get(nitro_service service, String sitepath) throws Exception{ wisite_binding obj = new wisite_binding(); obj.set_sitepath(sitepath); wisite_binding response = (wisite_binding) obj.get_resource(service); return response; }
java
public static wisite_binding get(nitro_service service, String sitepath) throws Exception{ wisite_binding obj = new wisite_binding(); obj.set_sitepath(sitepath); wisite_binding response = (wisite_binding) obj.get_resource(service); return response; }
[ "public", "static", "wisite_binding", "get", "(", "nitro_service", "service", ",", "String", "sitepath", ")", "throws", "Exception", "{", "wisite_binding", "obj", "=", "new", "wisite_binding", "(", ")", ";", "obj", ".", "set_sitepath", "(", "sitepath", ")", ";...
Use this API to fetch wisite_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "wisite_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/wi/wisite_binding.java#L125-L130
carewebframework/carewebframework-core
org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpHistory.java
HelpHistory.sameTopic
private boolean sameTopic(HelpTopic topic1, HelpTopic topic2) { return topic1 == topic2 || (topic1 != null && topic2 != null && topic1.equals(topic2)); }
java
private boolean sameTopic(HelpTopic topic1, HelpTopic topic2) { return topic1 == topic2 || (topic1 != null && topic2 != null && topic1.equals(topic2)); }
[ "private", "boolean", "sameTopic", "(", "HelpTopic", "topic1", ",", "HelpTopic", "topic2", ")", "{", "return", "topic1", "==", "topic2", "||", "(", "topic1", "!=", "null", "&&", "topic2", "!=", "null", "&&", "topic1", ".", "equals", "(", "topic2", ")", "...
Because the HelpTopic class does not implement its own equals method, have to implement equality test here. Two topics are considered equal if the are the same instance or if their targets are equal. @param topic1 First topic to compare. @param topic2 Second topic to compare. @return True if topics are equal.
[ "Because", "the", "HelpTopic", "class", "does", "not", "implement", "its", "own", "equals", "method", "have", "to", "implement", "equality", "test", "here", ".", "Two", "topics", "are", "considered", "equal", "if", "the", "are", "the", "same", "instance", "o...
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpHistory.java#L116-L118
alibaba/jstorm
example/sequence-split-merge/src/main/java/org/apache/storm/starter/trident/TridentMinMaxOfVehiclesTopology.java
TridentMinMaxOfVehiclesTopology.buildVehiclesTopology
public static StormTopology buildVehiclesTopology() { Fields driverField = new Fields(Driver.FIELD_NAME); Fields vehicleField = new Fields(Vehicle.FIELD_NAME); Fields allFields = new Fields(Vehicle.FIELD_NAME, Driver.FIELD_NAME); FixedBatchSpout spout = new FixedBatchSpout(allFields, 10, Vehicle.generateVehicles(20)); spout.setCycle(true); TridentTopology topology = new TridentTopology(); Stream vehiclesStream = topology.newStream("spout1", spout).each(allFields, new Debug("##### vehicles")); Stream slowVehiclesStream = vehiclesStream.min(new SpeedComparator()).each(vehicleField, new Debug("#### slowest vehicle")); Stream slowDriversStream = slowVehiclesStream.project(driverField).each(driverField, new Debug("##### slowest driver")); vehiclesStream.max(new SpeedComparator()).each(vehicleField, new Debug("#### fastest vehicle")) .project(driverField).each(driverField, new Debug("##### fastest driver")); vehiclesStream.minBy(Vehicle.FIELD_NAME, new EfficiencyComparator()).each(vehicleField, new Debug("#### least efficient vehicle")); vehiclesStream.maxBy(Vehicle.FIELD_NAME, new EfficiencyComparator()).each(vehicleField, new Debug("#### most efficient vehicle")); return topology.build(); }
java
public static StormTopology buildVehiclesTopology() { Fields driverField = new Fields(Driver.FIELD_NAME); Fields vehicleField = new Fields(Vehicle.FIELD_NAME); Fields allFields = new Fields(Vehicle.FIELD_NAME, Driver.FIELD_NAME); FixedBatchSpout spout = new FixedBatchSpout(allFields, 10, Vehicle.generateVehicles(20)); spout.setCycle(true); TridentTopology topology = new TridentTopology(); Stream vehiclesStream = topology.newStream("spout1", spout).each(allFields, new Debug("##### vehicles")); Stream slowVehiclesStream = vehiclesStream.min(new SpeedComparator()).each(vehicleField, new Debug("#### slowest vehicle")); Stream slowDriversStream = slowVehiclesStream.project(driverField).each(driverField, new Debug("##### slowest driver")); vehiclesStream.max(new SpeedComparator()).each(vehicleField, new Debug("#### fastest vehicle")) .project(driverField).each(driverField, new Debug("##### fastest driver")); vehiclesStream.minBy(Vehicle.FIELD_NAME, new EfficiencyComparator()).each(vehicleField, new Debug("#### least efficient vehicle")); vehiclesStream.maxBy(Vehicle.FIELD_NAME, new EfficiencyComparator()).each(vehicleField, new Debug("#### most efficient vehicle")); return topology.build(); }
[ "public", "static", "StormTopology", "buildVehiclesTopology", "(", ")", "{", "Fields", "driverField", "=", "new", "Fields", "(", "Driver", ".", "FIELD_NAME", ")", ";", "Fields", "vehicleField", "=", "new", "Fields", "(", "Vehicle", ".", "FIELD_NAME", ")", ";",...
Creates a topology which demonstrates min/max operations on tuples of stream which contain vehicle and driver fields with values {@link TridentMinMaxOfVehiclesTopology.Vehicle} and {@link TridentMinMaxOfVehiclesTopology.Driver} respectively.
[ "Creates", "a", "topology", "which", "demonstrates", "min", "/", "max", "operations", "on", "tuples", "of", "stream", "which", "contain", "vehicle", "and", "driver", "fields", "with", "values", "{" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/example/sequence-split-merge/src/main/java/org/apache/storm/starter/trident/TridentMinMaxOfVehiclesTopology.java#L57-L84
atomix/atomix
primitive/src/main/java/io/atomix/primitive/proxy/impl/LogProxySession.java
LogProxySession.getOrCreateSession
private Session getOrCreateSession(SessionId sessionId) { Session session = sessions.get(sessionId); if (session == null) { session = new LocalSession(sessionId, name(), type(), null, service.serializer()); sessions.put(session.sessionId(), session); service.register(session); } return session; }
java
private Session getOrCreateSession(SessionId sessionId) { Session session = sessions.get(sessionId); if (session == null) { session = new LocalSession(sessionId, name(), type(), null, service.serializer()); sessions.put(session.sessionId(), session); service.register(session); } return session; }
[ "private", "Session", "getOrCreateSession", "(", "SessionId", "sessionId", ")", "{", "Session", "session", "=", "sessions", ".", "get", "(", "sessionId", ")", ";", "if", "(", "session", "==", "null", ")", "{", "session", "=", "new", "LocalSession", "(", "s...
Gets or creates a session. @param sessionId the session identifier @return the session
[ "Gets", "or", "creates", "a", "session", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/primitive/src/main/java/io/atomix/primitive/proxy/impl/LogProxySession.java#L170-L178
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java
Widget.setRotation
public void setRotation(float w, float x, float y, float z) { getTransform().setRotation(w, x, y, z); if (mTransformCache.setRotation(w, x, y, z)) { onTransformChanged(); } }
java
public void setRotation(float w, float x, float y, float z) { getTransform().setRotation(w, x, y, z); if (mTransformCache.setRotation(w, x, y, z)) { onTransformChanged(); } }
[ "public", "void", "setRotation", "(", "float", "w", ",", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "getTransform", "(", ")", ".", "setRotation", "(", "w", ",", "x", ",", "y", ",", "z", ")", ";", "if", "(", "mTransformCache", "...
Set rotation, as a quaternion. Sets the widget's current rotation in quaternion terms. Overrides any previous rotations using {@link #rotate(float, float, float, float) rotate()}, {@link #rotateByAxis(float, float, float, float) rotateByAxis()} , or {@link #rotateByAxisWithPivot(float, float, float, float, float, float, float) rotateByAxisWithPivot()} . @param w 'W' component of the quaternion. @param x 'X' component of the quaternion. @param y 'Y' component of the quaternion. @param z 'Z' component of the quaternion.
[ "Set", "rotation", "as", "a", "quaternion", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/Widget.java#L1393-L1398
cdapio/tigon
tigon-yarn/src/main/java/co/cask/tigon/lang/ClassLoaders.java
ClassLoaders.getClassLoader
public static ClassLoader getClassLoader(TypeToken<?> type) { Set<ClassLoader> classLoaders = Sets.newIdentityHashSet(); // Breath first traversal into the Type. Queue<TypeToken<?>> queue = Lists.newLinkedList(); queue.add(type); while (!queue.isEmpty()) { type = queue.remove(); ClassLoader classLoader = type.getRawType().getClassLoader(); if (classLoader != null) { classLoaders.add(classLoader); } if (type.getType() instanceof ParameterizedType) { for (Type typeArg : ((ParameterizedType) type.getType()).getActualTypeArguments()) { queue.add(TypeToken.of(typeArg)); } } } // Determine the parent classloader ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); ClassLoader parent = (contextClassLoader == null) ? ClassLoader.getSystemClassLoader() : contextClassLoader; if (classLoaders.isEmpty()) { return parent; } return new CombineClassLoader(parent, classLoaders); }
java
public static ClassLoader getClassLoader(TypeToken<?> type) { Set<ClassLoader> classLoaders = Sets.newIdentityHashSet(); // Breath first traversal into the Type. Queue<TypeToken<?>> queue = Lists.newLinkedList(); queue.add(type); while (!queue.isEmpty()) { type = queue.remove(); ClassLoader classLoader = type.getRawType().getClassLoader(); if (classLoader != null) { classLoaders.add(classLoader); } if (type.getType() instanceof ParameterizedType) { for (Type typeArg : ((ParameterizedType) type.getType()).getActualTypeArguments()) { queue.add(TypeToken.of(typeArg)); } } } // Determine the parent classloader ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); ClassLoader parent = (contextClassLoader == null) ? ClassLoader.getSystemClassLoader() : contextClassLoader; if (classLoaders.isEmpty()) { return parent; } return new CombineClassLoader(parent, classLoaders); }
[ "public", "static", "ClassLoader", "getClassLoader", "(", "TypeToken", "<", "?", ">", "type", ")", "{", "Set", "<", "ClassLoader", ">", "classLoaders", "=", "Sets", ".", "newIdentityHashSet", "(", ")", ";", "// Breath first traversal into the Type.", "Queue", "<",...
Returns the ClassLoader of the given type. If the given type is a {@link java.lang.reflect.ParameterizedType}, it returns a {@link CombineClassLoader} of all types. The context ClassLoader or System ClassLoader would be used as the parent of the CombineClassLoader. @return A new CombineClassLoader. If no ClassLoader is found from the type, it returns the current thread context ClassLoader if it's not null, otherwise, return system ClassLoader.
[ "Returns", "the", "ClassLoader", "of", "the", "given", "type", ".", "If", "the", "given", "type", "is", "a", "{", "@link", "java", ".", "lang", ".", "reflect", ".", "ParameterizedType", "}", "it", "returns", "a", "{", "@link", "CombineClassLoader", "}", ...
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-yarn/src/main/java/co/cask/tigon/lang/ClassLoaders.java#L101-L129
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.setEnum
public <T extends Enum<T>> void setEnum(String name, T value) { set(name, value.toString()); }
java
public <T extends Enum<T>> void setEnum(String name, T value) { set(name, value.toString()); }
[ "public", "<", "T", "extends", "Enum", "<", "T", ">", ">", "void", "setEnum", "(", "String", "name", ",", "T", "value", ")", "{", "set", "(", "name", ",", "value", ".", "toString", "(", ")", ")", ";", "}" ]
Set the value of the <code>name</code> property to the given type. This is equivalent to <code>set(&lt;name&gt;, value.toString())</code>. @param name property name @param value new value
[ "Set", "the", "value", "of", "the", "<code", ">", "name<", "/", "code", ">", "property", "to", "the", "given", "type", ".", "This", "is", "equivalent", "to", "<code", ">", "set", "(", "&lt", ";", "name&gt", ";", "value", ".", "toString", "()", ")", ...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L1572-L1574
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/layout/UIManager.java
UIManager.createRenderer
private static Renderer createRenderer(final String rendererName) { if (rendererName.endsWith(".vm")) { // This is a velocity template, so use a VelocityLayout return new VelocityRenderer(rendererName); } try { Class<?> managerClass = Class.forName(rendererName); Object manager = managerClass.newInstance(); if (!(manager instanceof Renderer)) { throw new SystemException(rendererName + " is not a Renderer"); } return (Renderer) manager; } catch (ClassNotFoundException e) { // Legal - there might not a manager implementation in a given theme return null; } catch (InstantiationException e) { throw new SystemException("Failed to instantiate " + rendererName, e); } catch (IllegalAccessException e) { throw new SystemException("Failed to access " + rendererName, e); } }
java
private static Renderer createRenderer(final String rendererName) { if (rendererName.endsWith(".vm")) { // This is a velocity template, so use a VelocityLayout return new VelocityRenderer(rendererName); } try { Class<?> managerClass = Class.forName(rendererName); Object manager = managerClass.newInstance(); if (!(manager instanceof Renderer)) { throw new SystemException(rendererName + " is not a Renderer"); } return (Renderer) manager; } catch (ClassNotFoundException e) { // Legal - there might not a manager implementation in a given theme return null; } catch (InstantiationException e) { throw new SystemException("Failed to instantiate " + rendererName, e); } catch (IllegalAccessException e) { throw new SystemException("Failed to access " + rendererName, e); } }
[ "private", "static", "Renderer", "createRenderer", "(", "final", "String", "rendererName", ")", "{", "if", "(", "rendererName", ".", "endsWith", "(", "\".vm\"", ")", ")", "{", "// This is a velocity template, so use a VelocityLayout", "return", "new", "VelocityRenderer"...
Attempts to create a Renderer with the given name. @param rendererName the name of the Renderer @return a Renderer of the given type, or null if the class was not found.
[ "Attempts", "to", "create", "a", "Renderer", "with", "the", "given", "name", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/layout/UIManager.java#L288-L311
zaproxy/zaproxy
src/org/zaproxy/zap/extension/brk/BreakpointMessageHandler2.java
BreakpointMessageHandler2.isBreakpoint
public boolean isBreakpoint(Message aMessage, boolean isRequest, boolean onlyIfInScope) { if (aMessage.isForceIntercept()) { // The browser told us to do it Your Honour return true; } if (onlyIfInScope && ! aMessage.isInScope()) { return false; } if (isBreakOnAllRequests(aMessage, isRequest)) { // Break on all requests return true; } else if (isBreakOnAllResponses(aMessage, isRequest)) { // Break on all responses return true; } else if (isBreakOnStepping(aMessage, isRequest)) { // Stopping through all requests and responses return true; } return isBreakOnEnabledBreakpoint(aMessage, isRequest, onlyIfInScope); }
java
public boolean isBreakpoint(Message aMessage, boolean isRequest, boolean onlyIfInScope) { if (aMessage.isForceIntercept()) { // The browser told us to do it Your Honour return true; } if (onlyIfInScope && ! aMessage.isInScope()) { return false; } if (isBreakOnAllRequests(aMessage, isRequest)) { // Break on all requests return true; } else if (isBreakOnAllResponses(aMessage, isRequest)) { // Break on all responses return true; } else if (isBreakOnStepping(aMessage, isRequest)) { // Stopping through all requests and responses return true; } return isBreakOnEnabledBreakpoint(aMessage, isRequest, onlyIfInScope); }
[ "public", "boolean", "isBreakpoint", "(", "Message", "aMessage", ",", "boolean", "isRequest", ",", "boolean", "onlyIfInScope", ")", "{", "if", "(", "aMessage", ".", "isForceIntercept", "(", ")", ")", "{", "// The browser told us to do it Your Honour\r", "return", "t...
You have to handle {@link Mode#safe} outside. @param aMessage @param isRequest @param onlyIfInScope @return True if a breakpoint for given message exists.
[ "You", "have", "to", "handle", "{", "@link", "Mode#safe", "}", "outside", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/brk/BreakpointMessageHandler2.java#L142-L164
jbundle/jbundle
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java
JdbcTable.setResultSet
public void setResultSet(ResultSet resultSet, int iType) { if (this.getResultSet(iType) != null) { // If this is a new resultSet for my current statement, close the old resultSet. try { this.getResultSet(iType).close(); } catch (SQLException e) { e.printStackTrace(); // Never } } switch (iType) { case DBConstants.SQL_SEEK_TYPE: if (!SHARE_STATEMENTS) { m_seekResultSet = resultSet; break; } case DBConstants.SQL_SELECT_TYPE: case DBConstants.SQL_CREATE_TYPE: m_selectResultSet = resultSet; break; case DBConstants.SQL_AUTOSEQUENCE_TYPE: m_autoSequenceResultSet = resultSet; break; case DBConstants.SQL_UPDATE_TYPE: case DBConstants.SQL_INSERT_TABLE_TYPE: case DBConstants.SQL_DELETE_TYPE: default: // Never break; } m_iResultSetType = iType; if (iType == DBConstants.SQL_SELECT_TYPE) { m_iRow = -1; // Starting from a new query m_iEOFRow = Integer.MAX_VALUE; } }
java
public void setResultSet(ResultSet resultSet, int iType) { if (this.getResultSet(iType) != null) { // If this is a new resultSet for my current statement, close the old resultSet. try { this.getResultSet(iType).close(); } catch (SQLException e) { e.printStackTrace(); // Never } } switch (iType) { case DBConstants.SQL_SEEK_TYPE: if (!SHARE_STATEMENTS) { m_seekResultSet = resultSet; break; } case DBConstants.SQL_SELECT_TYPE: case DBConstants.SQL_CREATE_TYPE: m_selectResultSet = resultSet; break; case DBConstants.SQL_AUTOSEQUENCE_TYPE: m_autoSequenceResultSet = resultSet; break; case DBConstants.SQL_UPDATE_TYPE: case DBConstants.SQL_INSERT_TABLE_TYPE: case DBConstants.SQL_DELETE_TYPE: default: // Never break; } m_iResultSetType = iType; if (iType == DBConstants.SQL_SELECT_TYPE) { m_iRow = -1; // Starting from a new query m_iEOFRow = Integer.MAX_VALUE; } }
[ "public", "void", "setResultSet", "(", "ResultSet", "resultSet", ",", "int", "iType", ")", "{", "if", "(", "this", ".", "getResultSet", "(", "iType", ")", "!=", "null", ")", "{", "// If this is a new resultSet for my current statement, close the old resultSet.", "try"...
Set the ResultSet for this select or seek statement type. @param resultSet The resultSet to set. @return The old resultSet.
[ "Set", "the", "ResultSet", "for", "this", "select", "or", "seek", "statement", "type", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java#L472-L510
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/IntuitResponseDeserializer.java
IntuitResponseDeserializer.getCDCQueryResponse
private CDCResponse getCDCQueryResponse(JsonNode jsonNode) throws IOException { ObjectMapper mapper = new ObjectMapper(); SimpleModule simpleModule = new SimpleModule("CDCQueryResponseDeserializer", new Version(1, 0, 0, null)); simpleModule.addDeserializer(CDCResponse.class, new CDCQueryResponseDeserializer()); mapper.registerModule(simpleModule); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return mapper.treeToValue(jsonNode, CDCResponse.class); }
java
private CDCResponse getCDCQueryResponse(JsonNode jsonNode) throws IOException { ObjectMapper mapper = new ObjectMapper(); SimpleModule simpleModule = new SimpleModule("CDCQueryResponseDeserializer", new Version(1, 0, 0, null)); simpleModule.addDeserializer(CDCResponse.class, new CDCQueryResponseDeserializer()); mapper.registerModule(simpleModule); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); return mapper.treeToValue(jsonNode, CDCResponse.class); }
[ "private", "CDCResponse", "getCDCQueryResponse", "(", "JsonNode", "jsonNode", ")", "throws", "IOException", "{", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "SimpleModule", "simpleModule", "=", "new", "SimpleModule", "(", "\"CDCQueryResponseDe...
Method to deserialize the CDCQueryResponse object @param jsonNode @return CDCResponse
[ "Method", "to", "deserialize", "the", "CDCQueryResponse", "object" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/IntuitResponseDeserializer.java#L336-L346
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java
GlobalUsersInner.stopEnvironmentAsync
public Observable<Void> stopEnvironmentAsync(String userName, String environmentId) { return stopEnvironmentWithServiceResponseAsync(userName, environmentId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> stopEnvironmentAsync(String userName, String environmentId) { return stopEnvironmentWithServiceResponseAsync(userName, environmentId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "stopEnvironmentAsync", "(", "String", "userName", ",", "String", "environmentId", ")", "{", "return", "stopEnvironmentWithServiceResponseAsync", "(", "userName", ",", "environmentId", ")", ".", "map", "(", "new", "Func1", ...
Stops an environment by stopping all resources inside the environment This operation can take a while to complete. @param userName The name of the user. @param environmentId The resourceId of the environment @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Stops", "an", "environment", "by", "stopping", "all", "resources", "inside", "the", "environment", "This", "operation", "can", "take", "a", "while", "to", "complete", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/GlobalUsersInner.java#L1259-L1266
youseries/urule
urule-core/src/main/java/com/bstek/urule/runtime/KnowledgeSessionFactory.java
KnowledgeSessionFactory.newBatchSession
public static BatchSession newBatchSession(KnowledgePackage[] knowledgePackages,int threadSize,int batchSize){ return new BatchSessionImpl(knowledgePackages,threadSize,batchSize); }
java
public static BatchSession newBatchSession(KnowledgePackage[] knowledgePackages,int threadSize,int batchSize){ return new BatchSessionImpl(knowledgePackages,threadSize,batchSize); }
[ "public", "static", "BatchSession", "newBatchSession", "(", "KnowledgePackage", "[", "]", "knowledgePackages", ",", "int", "threadSize", ",", "int", "batchSize", ")", "{", "return", "new", "BatchSessionImpl", "(", "knowledgePackages", ",", "threadSize", ",", "batchS...
创建一个用于批处理的BatchSession对象,第二个参数来指定线程池中可用线程个数,第三个参数用来决定单个线程处理的任务数 @param knowledgePackages 创建BatchSession对象所需要的KnowledgePackage集合对象 @param threadSize 线程池中可用的线程个数 @param batchSize 单个线程处理的任务数 @return 返回一个新的BatchSession对象
[ "创建一个用于批处理的BatchSession对象,第二个参数来指定线程池中可用线程个数,第三个参数用来决定单个线程处理的任务数" ]
train
https://github.com/youseries/urule/blob/3fa0eb4439e97aa292e744bcbd88a9faa36661d8/urule-core/src/main/java/com/bstek/urule/runtime/KnowledgeSessionFactory.java#L132-L134
apptik/jus
android/jus-android/src/main/java/io/apptik/comm/jus/ui/ImageLoader.java
ImageLoader.isCached
public boolean isCached(String requestUrl, int maxWidth, int maxHeight) { return isCached(requestUrl, maxWidth, maxHeight, ScaleType.CENTER_INSIDE); }
java
public boolean isCached(String requestUrl, int maxWidth, int maxHeight) { return isCached(requestUrl, maxWidth, maxHeight, ScaleType.CENTER_INSIDE); }
[ "public", "boolean", "isCached", "(", "String", "requestUrl", ",", "int", "maxWidth", ",", "int", "maxHeight", ")", "{", "return", "isCached", "(", "requestUrl", ",", "maxWidth", ",", "maxHeight", ",", "ScaleType", ".", "CENTER_INSIDE", ")", ";", "}" ]
Checks if the item is available in the cache. @param requestUrl The url of the remote image @param maxWidth The maximum width of the returned image. @param maxHeight The maximum height of the returned image. @return True if the item exists in cache, false otherwise.
[ "Checks", "if", "the", "item", "is", "available", "in", "the", "cache", "." ]
train
https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/android/jus-android/src/main/java/io/apptik/comm/jus/ui/ImageLoader.java#L209-L211
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendBinary
public static void sendBinary(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback, long timeoutmillis) { sendInternal(mergeBuffers(data), WebSocketFrameType.BINARY, wsChannel, callback, null, timeoutmillis); }
java
public static void sendBinary(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<Void> callback, long timeoutmillis) { sendInternal(mergeBuffers(data), WebSocketFrameType.BINARY, wsChannel, callback, null, timeoutmillis); }
[ "public", "static", "void", "sendBinary", "(", "final", "ByteBuffer", "[", "]", "data", ",", "final", "WebSocketChannel", "wsChannel", ",", "final", "WebSocketCallback", "<", "Void", ">", "callback", ",", "long", "timeoutmillis", ")", "{", "sendInternal", "(", ...
Sends a complete binary message, invoking the callback when complete @param data The data to send @param wsChannel The web socket channel @param callback The callback to invoke on completion @param timeoutmillis the timeout in milliseconds
[ "Sends", "a", "complete", "binary", "message", "invoking", "the", "callback", "when", "complete" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L661-L663
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.scrollViewToSide
public void scrollViewToSide(View view, int side, float scrollPosition, int stepCount) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "scrollViewToSide("+view+", "+side+", "+scrollPosition+", "+stepCount+")"); } waitForView(view); sleeper.sleep(); switch (side){ case RIGHT: scroller.scrollViewToSide(view, Scroller.Side.RIGHT, scrollPosition, stepCount); break; case LEFT: scroller.scrollViewToSide(view, Scroller.Side.LEFT, scrollPosition, stepCount); break; } }
java
public void scrollViewToSide(View view, int side, float scrollPosition, int stepCount) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "scrollViewToSide("+view+", "+side+", "+scrollPosition+", "+stepCount+")"); } waitForView(view); sleeper.sleep(); switch (side){ case RIGHT: scroller.scrollViewToSide(view, Scroller.Side.RIGHT, scrollPosition, stepCount); break; case LEFT: scroller.scrollViewToSide(view, Scroller.Side.LEFT, scrollPosition, stepCount); break; } }
[ "public", "void", "scrollViewToSide", "(", "View", "view", ",", "int", "side", ",", "float", "scrollPosition", ",", "int", "stepCount", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag"...
Scrolls a View horizontally. @param view the View to scroll @param side the side to scroll; {@link #RIGHT} or {@link #LEFT} @param scrollPosition the position to scroll to, from 0 to 1 where 1 is all the way. Example is: 0.60 @param stepCount how many move steps to include in the scroll. Less steps results in a faster scroll
[ "Scrolls", "a", "View", "horizontally", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L2356-L2367
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/ChecksumStore.java
ChecksumStore.putIfAbsentChecksum
public Long putIfAbsentChecksum(Block blk, Long newChecksum) throws IOException { Long oldChecksum = putIfAbsent(blk, newChecksum); if (oldChecksum!= null && !oldChecksum.equals(newChecksum)) { throw new IOException("Block " + blk.toString() + " has different checksums " + oldChecksum + "(old) and " + newChecksum+ "(new)"); } return oldChecksum; }
java
public Long putIfAbsentChecksum(Block blk, Long newChecksum) throws IOException { Long oldChecksum = putIfAbsent(blk, newChecksum); if (oldChecksum!= null && !oldChecksum.equals(newChecksum)) { throw new IOException("Block " + blk.toString() + " has different checksums " + oldChecksum + "(old) and " + newChecksum+ "(new)"); } return oldChecksum; }
[ "public", "Long", "putIfAbsentChecksum", "(", "Block", "blk", ",", "Long", "newChecksum", ")", "throws", "IOException", "{", "Long", "oldChecksum", "=", "putIfAbsent", "(", "blk", ",", "newChecksum", ")", ";", "if", "(", "oldChecksum", "!=", "null", "&&", "!...
Save the checksum for a raided block into store and compare the old value with new value, if different throw an exception @param blk @param newChecksum @param oldChecksum @throws IOException
[ "Save", "the", "checksum", "for", "a", "raided", "block", "into", "store", "and", "compare", "the", "old", "value", "with", "new", "value", "if", "different", "throw", "an", "exception" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/ChecksumStore.java#L47-L56
PinaeOS/nala
src/main/java/org/pinae/nala/xb/Xml.java
Xml.toXML
public static String toXML(Object object, String encoding, boolean nodeMode) throws MarshalException { Properties properties = new Properties(); properties.put("node", Boolean.toString(nodeMode)); properties.put("lowcase", "true"); properties.put("pretty", "true"); properties.put("cdata", "true"); properties.put("indent", "\t"); properties.put("endofline", "\n"); properties.put("document-start", String.format("<?xml version='1.0' encoding='%s'?>", encoding)); String xml = toXML(object, encoding, properties); return xml; }
java
public static String toXML(Object object, String encoding, boolean nodeMode) throws MarshalException { Properties properties = new Properties(); properties.put("node", Boolean.toString(nodeMode)); properties.put("lowcase", "true"); properties.put("pretty", "true"); properties.put("cdata", "true"); properties.put("indent", "\t"); properties.put("endofline", "\n"); properties.put("document-start", String.format("<?xml version='1.0' encoding='%s'?>", encoding)); String xml = toXML(object, encoding, properties); return xml; }
[ "public", "static", "String", "toXML", "(", "Object", "object", ",", "String", "encoding", ",", "boolean", "nodeMode", ")", "throws", "MarshalException", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "properties", ".", "put", "(", ...
将对象生成XML文本 @param object 需要生成XML的对象 @param encoding XML文本编码, 例如UTF-8, GBK @param nodeMode 是否采用节点模式, 如果采用节点模式将不生成XML属性 @return XML文本 @throws MarshalException 编组异常
[ "将对象生成XML文本" ]
train
https://github.com/PinaeOS/nala/blob/2047ade4af197cec938278d300d111ea94af6fbf/src/main/java/org/pinae/nala/xb/Xml.java#L88-L102
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/NumberFunctions.java
NumberFunctions.atan
public static Expression atan(String expression1, String expression2) { return atan(x(expression1), x(expression2)); }
java
public static Expression atan(String expression1, String expression2) { return atan(x(expression1), x(expression2)); }
[ "public", "static", "Expression", "atan", "(", "String", "expression1", ",", "String", "expression2", ")", "{", "return", "atan", "(", "x", "(", "expression1", ")", ",", "x", "(", "expression2", ")", ")", ";", "}" ]
Returned expression results in the arctangent of expression2/expression1.
[ "Returned", "expression", "results", "in", "the", "arctangent", "of", "expression2", "/", "expression1", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/NumberFunctions.java#L104-L106
briandilley/jsonrpc4j
src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java
JsonRpcClient.internalCreateRequest
private ObjectNode internalCreateRequest(String methodName, Object arguments, String id) { final ObjectNode request = mapper.createObjectNode(); addId(id, request); addProtocolAndMethod(methodName, request); addParameters(arguments, request); addAdditionalHeaders(request); notifyBeforeRequestListener(request); return request; }
java
private ObjectNode internalCreateRequest(String methodName, Object arguments, String id) { final ObjectNode request = mapper.createObjectNode(); addId(id, request); addProtocolAndMethod(methodName, request); addParameters(arguments, request); addAdditionalHeaders(request); notifyBeforeRequestListener(request); return request; }
[ "private", "ObjectNode", "internalCreateRequest", "(", "String", "methodName", ",", "Object", "arguments", ",", "String", "id", ")", "{", "final", "ObjectNode", "request", "=", "mapper", ".", "createObjectNode", "(", ")", ";", "addId", "(", "id", ",", "request...
Creates RPC request. @param methodName the method name @param arguments the arguments @param id the optional id @return Jackson request object
[ "Creates", "RPC", "request", "." ]
train
https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java#L339-L347
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitEndElement
@Override public R visitEndElement(EndElementTree node, P p) { return defaultAction(node, p); }
java
@Override public R visitEndElement(EndElementTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitEndElement", "(", "EndElementTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L177-L180
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/wrapper/json/PJsonObject.java
PJsonObject.optJSONObject
public final PJsonObject optJSONObject(final String key) { final JSONObject val = this.obj.optJSONObject(key); return val != null ? new PJsonObject(this, val, key) : null; }
java
public final PJsonObject optJSONObject(final String key) { final JSONObject val = this.obj.optJSONObject(key); return val != null ? new PJsonObject(this, val, key) : null; }
[ "public", "final", "PJsonObject", "optJSONObject", "(", "final", "String", "key", ")", "{", "final", "JSONObject", "val", "=", "this", ".", "obj", ".", "optJSONObject", "(", "key", ")", ";", "return", "val", "!=", "null", "?", "new", "PJsonObject", "(", ...
Get a property as a json object or null. @param key the property name
[ "Get", "a", "property", "as", "a", "json", "object", "or", "null", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/json/PJsonObject.java#L145-L148
EdwardRaff/JSAT
JSAT/src/jsat/math/decayrates/ExponetialDecay.java
ExponetialDecay.setMaxTime
public void setMaxTime(double maxTime) { if(maxTime <= 0 || Double.isInfinite(maxTime) || Double.isNaN(maxTime)) throw new RuntimeException("maxTime should be positive, not " + maxTime); this.maxTime = maxTime; }
java
public void setMaxTime(double maxTime) { if(maxTime <= 0 || Double.isInfinite(maxTime) || Double.isNaN(maxTime)) throw new RuntimeException("maxTime should be positive, not " + maxTime); this.maxTime = maxTime; }
[ "public", "void", "setMaxTime", "(", "double", "maxTime", ")", "{", "if", "(", "maxTime", "<=", "0", "||", "Double", ".", "isInfinite", "(", "maxTime", ")", "||", "Double", ".", "isNaN", "(", "maxTime", ")", ")", "throw", "new", "RuntimeException", "(", ...
Sets the maximum amount of time to allow in the rate decay. Any time value larger will be treated as the set maximum.<br> <br> Any calls to {@link #rate(double, double, double) } will use the value provided in that method call instead. @param maxTime the maximum amount of time to allow
[ "Sets", "the", "maximum", "amount", "of", "time", "to", "allow", "in", "the", "rate", "decay", ".", "Any", "time", "value", "larger", "will", "be", "treated", "as", "the", "set", "maximum", ".", "<br", ">", "<br", ">", "Any", "calls", "to", "{" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/decayrates/ExponetialDecay.java#L89-L94
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
DateTimeField.setDateTime
public int setDateTime(java.util.Date date, boolean bDisplayOption, int iMoveMode) { if (date != null) return this.setValue(date.getTime(), bDisplayOption, iMoveMode); else return this.setData(null, bDisplayOption, iMoveMode); }
java
public int setDateTime(java.util.Date date, boolean bDisplayOption, int iMoveMode) { if (date != null) return this.setValue(date.getTime(), bDisplayOption, iMoveMode); else return this.setData(null, bDisplayOption, iMoveMode); }
[ "public", "int", "setDateTime", "(", "java", ".", "util", ".", "Date", "date", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "if", "(", "date", "!=", "null", ")", "return", "this", ".", "setValue", "(", "date", ".", "getTime", "(...
Change the date and time of day. @param date The date to set. @param bDisplayOption Display changed fields if true. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN).
[ "Change", "the", "date", "and", "time", "of", "day", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L285-L291
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java
AipImageSearch.sameHqDeleteBySign
public JSONObject sameHqDeleteBySign(String contSign, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("cont_sign", contSign); if (options != null) { request.addBody(options); } request.setUri(ImageSearchConsts.SAME_HQ_DELETE); postOperation(request); return requestServer(request); }
java
public JSONObject sameHqDeleteBySign(String contSign, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("cont_sign", contSign); if (options != null) { request.addBody(options); } request.setUri(ImageSearchConsts.SAME_HQ_DELETE); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "sameHqDeleteBySign", "(", "String", "contSign", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "requ...
相同图检索—删除接口 **删除图库中的图片,支持批量删除,批量删除时请传cont_sign参数,勿传image,最多支持1000个cont_sign** @param contSign - 图片签名 @param options - 可选参数对象,key: value都为string类型 options - options列表: @return JSONObject
[ "相同图检索—删除接口", "**", "删除图库中的图片,支持批量删除,批量删除时请传cont_sign参数,勿传image,最多支持1000个cont_sign", "**" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/imagesearch/AipImageSearch.java#L345-L356
apache/groovy
src/main/java/org/codehaus/groovy/vmplugin/v7/TypeHelper.java
TypeHelper.replaceWithMoreSpecificType
protected static MethodType replaceWithMoreSpecificType(Object[] args, MethodType callSiteType) { for (int i=0; i<args.length; i++) { // if argument null, take the static type if (args[i]==null) continue; if (callSiteType.parameterType(i).isPrimitive()) continue; Class argClass = args[i].getClass(); callSiteType = callSiteType.changeParameterType(i, argClass); } return callSiteType; }
java
protected static MethodType replaceWithMoreSpecificType(Object[] args, MethodType callSiteType) { for (int i=0; i<args.length; i++) { // if argument null, take the static type if (args[i]==null) continue; if (callSiteType.parameterType(i).isPrimitive()) continue; Class argClass = args[i].getClass(); callSiteType = callSiteType.changeParameterType(i, argClass); } return callSiteType; }
[ "protected", "static", "MethodType", "replaceWithMoreSpecificType", "(", "Object", "[", "]", "args", ",", "MethodType", "callSiteType", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "args", ".", "length", ";", "i", "++", ")", "{", "// if arg...
Replaces the types in the callSiteType parameter if more specific types given through the arguments. This is in general the case, unless the argument is null.
[ "Replaces", "the", "types", "in", "the", "callSiteType", "parameter", "if", "more", "specific", "types", "given", "through", "the", "arguments", ".", "This", "is", "in", "general", "the", "case", "unless", "the", "argument", "is", "null", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/vmplugin/v7/TypeHelper.java#L77-L86
joestelmach/natty
src/main/java/com/joestelmach/natty/WalkerState.java
WalkerState.seekToDayOfWeek
public void seekToDayOfWeek(String direction, String seekType, String seekAmount, String dayOfWeek) { int dayOfWeekInt = Integer.parseInt(dayOfWeek); int seekAmountInt = Integer.parseInt(seekAmount); assert(direction.equals(DIR_LEFT) || direction.equals(DIR_RIGHT)); assert(seekType.equals(SEEK_BY_DAY) || seekType.equals(SEEK_BY_WEEK)); assert(dayOfWeekInt >= 1 && dayOfWeekInt <= 7); markDateInvocation(); int sign = direction.equals(DIR_RIGHT) ? 1 : -1; if(seekType.equals(SEEK_BY_WEEK)) { // set our calendar to this weeks requested day of the week, // then add or subtract the week(s) _calendar.set(Calendar.DAY_OF_WEEK, dayOfWeekInt); _calendar.add(Calendar.DAY_OF_YEAR, seekAmountInt * 7 * sign); } else if(seekType.equals(SEEK_BY_DAY)) { // find the closest day do { _calendar.add(Calendar.DAY_OF_YEAR, sign); } while(_calendar.get(Calendar.DAY_OF_WEEK) != dayOfWeekInt); // now add/subtract any additional days if(seekAmountInt > 0) { _calendar.add(Calendar.WEEK_OF_YEAR, (seekAmountInt - 1) * sign); } } }
java
public void seekToDayOfWeek(String direction, String seekType, String seekAmount, String dayOfWeek) { int dayOfWeekInt = Integer.parseInt(dayOfWeek); int seekAmountInt = Integer.parseInt(seekAmount); assert(direction.equals(DIR_LEFT) || direction.equals(DIR_RIGHT)); assert(seekType.equals(SEEK_BY_DAY) || seekType.equals(SEEK_BY_WEEK)); assert(dayOfWeekInt >= 1 && dayOfWeekInt <= 7); markDateInvocation(); int sign = direction.equals(DIR_RIGHT) ? 1 : -1; if(seekType.equals(SEEK_BY_WEEK)) { // set our calendar to this weeks requested day of the week, // then add or subtract the week(s) _calendar.set(Calendar.DAY_OF_WEEK, dayOfWeekInt); _calendar.add(Calendar.DAY_OF_YEAR, seekAmountInt * 7 * sign); } else if(seekType.equals(SEEK_BY_DAY)) { // find the closest day do { _calendar.add(Calendar.DAY_OF_YEAR, sign); } while(_calendar.get(Calendar.DAY_OF_WEEK) != dayOfWeekInt); // now add/subtract any additional days if(seekAmountInt > 0) { _calendar.add(Calendar.WEEK_OF_YEAR, (seekAmountInt - 1) * sign); } } }
[ "public", "void", "seekToDayOfWeek", "(", "String", "direction", ",", "String", "seekType", ",", "String", "seekAmount", ",", "String", "dayOfWeek", ")", "{", "int", "dayOfWeekInt", "=", "Integer", ".", "parseInt", "(", "dayOfWeek", ")", ";", "int", "seekAmoun...
seeks to a specified day of the week in the past or future. @param direction the direction to seek: two possibilities '<' go backward '>' go forward @param seekType the type of seek to perform (by_day or by_week) by_day means we seek to the very next occurrence of the given day by_week means we seek to the first occurrence of the given day week in the next (or previous,) week (or multiple of next or previous week depending on the seek amount.) @param seekAmount the amount to seek. Must be guaranteed to parse as an integer @param dayOfWeek the day of the week to seek to, represented as an integer from 1 to 7 (1 being Sunday, 7 being Saturday.) Must be guaranteed to parse as an Integer
[ "seeks", "to", "a", "specified", "day", "of", "the", "week", "in", "the", "past", "or", "future", "." ]
train
https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/WalkerState.java#L80-L108
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java
UserAttrs.setDoubleAttribute
public static final void setDoubleAttribute(Path path, String attribute, double value, LinkOption... options) throws IOException { attribute = attribute.startsWith("user:") ? attribute : "user:"+attribute; Files.setAttribute(path, attribute, Primitives.writeDouble(value), options); }
java
public static final void setDoubleAttribute(Path path, String attribute, double value, LinkOption... options) throws IOException { attribute = attribute.startsWith("user:") ? attribute : "user:"+attribute; Files.setAttribute(path, attribute, Primitives.writeDouble(value), options); }
[ "public", "static", "final", "void", "setDoubleAttribute", "(", "Path", "path", ",", "String", "attribute", ",", "double", "value", ",", "LinkOption", "...", "options", ")", "throws", "IOException", "{", "attribute", "=", "attribute", ".", "startsWith", "(", "...
Set user-defined-attribute @param path @param attribute user:attribute name. user: can be omitted. @param value @param options @throws IOException
[ "Set", "user", "-", "defined", "-", "attribute" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/UserAttrs.java#L92-L96
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CriteriaReader.java
CriteriaReader.addCriteria
private void addCriteria(List<GenericCriteria> list, byte[] block) { byte[] leftBlock = getChildBlock(block); byte[] rightBlock1 = getListNextBlock(leftBlock); byte[] rightBlock2 = getListNextBlock(rightBlock1); TestOperator operator = TestOperator.getInstance(MPPUtility.getShort(block, 0) - 0x3E7); FieldType leftValue = getFieldType(leftBlock); Object rightValue1 = getValue(leftValue, rightBlock1); Object rightValue2 = rightBlock2 == null ? null : getValue(leftValue, rightBlock2); GenericCriteria criteria = new GenericCriteria(m_properties); criteria.setLeftValue(leftValue); criteria.setOperator(operator); criteria.setRightValue(0, rightValue1); criteria.setRightValue(1, rightValue2); list.add(criteria); if (m_criteriaType != null) { m_criteriaType[0] = leftValue.getFieldTypeClass() == FieldTypeClass.TASK; m_criteriaType[1] = !m_criteriaType[0]; } if (m_fields != null) { m_fields.add(leftValue); } processBlock(list, getListNextBlock(block)); }
java
private void addCriteria(List<GenericCriteria> list, byte[] block) { byte[] leftBlock = getChildBlock(block); byte[] rightBlock1 = getListNextBlock(leftBlock); byte[] rightBlock2 = getListNextBlock(rightBlock1); TestOperator operator = TestOperator.getInstance(MPPUtility.getShort(block, 0) - 0x3E7); FieldType leftValue = getFieldType(leftBlock); Object rightValue1 = getValue(leftValue, rightBlock1); Object rightValue2 = rightBlock2 == null ? null : getValue(leftValue, rightBlock2); GenericCriteria criteria = new GenericCriteria(m_properties); criteria.setLeftValue(leftValue); criteria.setOperator(operator); criteria.setRightValue(0, rightValue1); criteria.setRightValue(1, rightValue2); list.add(criteria); if (m_criteriaType != null) { m_criteriaType[0] = leftValue.getFieldTypeClass() == FieldTypeClass.TASK; m_criteriaType[1] = !m_criteriaType[0]; } if (m_fields != null) { m_fields.add(leftValue); } processBlock(list, getListNextBlock(block)); }
[ "private", "void", "addCriteria", "(", "List", "<", "GenericCriteria", ">", "list", ",", "byte", "[", "]", "block", ")", "{", "byte", "[", "]", "leftBlock", "=", "getChildBlock", "(", "block", ")", ";", "byte", "[", "]", "rightBlock1", "=", "getListNextB...
Adds a basic LHS OPERATOR RHS block. @param list parent criteria list @param block current block
[ "Adds", "a", "basic", "LHS", "OPERATOR", "RHS", "block", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CriteriaReader.java#L251-L280
KyoriPowered/text
api/src/main/java/net/kyori/text/event/HoverEvent.java
HoverEvent.showEntity
public static @NonNull HoverEvent showEntity(final @NonNull Component entity) { return new HoverEvent(Action.SHOW_ENTITY, entity); }
java
public static @NonNull HoverEvent showEntity(final @NonNull Component entity) { return new HoverEvent(Action.SHOW_ENTITY, entity); }
[ "public", "static", "@", "NonNull", "HoverEvent", "showEntity", "(", "final", "@", "NonNull", "Component", "entity", ")", "{", "return", "new", "HoverEvent", "(", "Action", ".", "SHOW_ENTITY", ",", "entity", ")", ";", "}" ]
Creates a hover event that shows an entity on hover. @param entity the entity to show on hover @return a hover event
[ "Creates", "a", "hover", "event", "that", "shows", "an", "entity", "on", "hover", "." ]
train
https://github.com/KyoriPowered/text/blob/4496c593bf89e8fb036dd6efe26f8ac60f7655c9/api/src/main/java/net/kyori/text/event/HoverEvent.java#L76-L78
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java
ReadMasterDomainModelUtil.processServerConfig
static void processServerConfig(final Resource root, final RequiredConfigurationHolder requiredConfigurationHolder, final IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo serverConfig, final ExtensionRegistry extensionRegistry) { final Set<String> serverGroups = requiredConfigurationHolder.serverGroups; final Set<String> socketBindings = requiredConfigurationHolder.socketBindings; String sbg = serverConfig.getSocketBindingGroup(); if (sbg != null && !socketBindings.contains(sbg)) { processSocketBindingGroup(root, sbg, requiredConfigurationHolder); } final String groupName = serverConfig.getServerGroup(); final PathElement groupElement = PathElement.pathElement(SERVER_GROUP, groupName); // Also check the root, since this also gets executed on the slave which may not have the server-group configured yet if (!serverGroups.contains(groupName) && root.hasChild(groupElement)) { final Resource serverGroup = root.getChild(groupElement); final ModelNode groupModel = serverGroup.getModel(); serverGroups.add(groupName); // Include the socket binding groups if (groupModel.hasDefined(SOCKET_BINDING_GROUP)) { final String socketBindingGroup = groupModel.get(SOCKET_BINDING_GROUP).asString(); processSocketBindingGroup(root, socketBindingGroup, requiredConfigurationHolder); } final String profileName = groupModel.get(PROFILE).asString(); processProfile(root, profileName, requiredConfigurationHolder, extensionRegistry); } }
java
static void processServerConfig(final Resource root, final RequiredConfigurationHolder requiredConfigurationHolder, final IgnoredNonAffectedServerGroupsUtil.ServerConfigInfo serverConfig, final ExtensionRegistry extensionRegistry) { final Set<String> serverGroups = requiredConfigurationHolder.serverGroups; final Set<String> socketBindings = requiredConfigurationHolder.socketBindings; String sbg = serverConfig.getSocketBindingGroup(); if (sbg != null && !socketBindings.contains(sbg)) { processSocketBindingGroup(root, sbg, requiredConfigurationHolder); } final String groupName = serverConfig.getServerGroup(); final PathElement groupElement = PathElement.pathElement(SERVER_GROUP, groupName); // Also check the root, since this also gets executed on the slave which may not have the server-group configured yet if (!serverGroups.contains(groupName) && root.hasChild(groupElement)) { final Resource serverGroup = root.getChild(groupElement); final ModelNode groupModel = serverGroup.getModel(); serverGroups.add(groupName); // Include the socket binding groups if (groupModel.hasDefined(SOCKET_BINDING_GROUP)) { final String socketBindingGroup = groupModel.get(SOCKET_BINDING_GROUP).asString(); processSocketBindingGroup(root, socketBindingGroup, requiredConfigurationHolder); } final String profileName = groupModel.get(PROFILE).asString(); processProfile(root, profileName, requiredConfigurationHolder, extensionRegistry); } }
[ "static", "void", "processServerConfig", "(", "final", "Resource", "root", ",", "final", "RequiredConfigurationHolder", "requiredConfigurationHolder", ",", "final", "IgnoredNonAffectedServerGroupsUtil", ".", "ServerConfigInfo", "serverConfig", ",", "final", "ExtensionRegistry",...
Determine the relevant pieces of configuration which need to be included when processing the domain model. @param root the resource root @param requiredConfigurationHolder the resolution context @param serverConfig the server config @param extensionRegistry the extension registry
[ "Determine", "the", "relevant", "pieces", "of", "configuration", "which", "need", "to", "be", "included", "when", "processing", "the", "domain", "model", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/ReadMasterDomainModelUtil.java#L240-L268
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/SortedBugCollection.java
SortedBugCollection.readXML
public void readXML(File file) throws IOException, DocumentException { project.setCurrentWorkingDirectory(file.getParentFile()); dataSource = file.getAbsolutePath(); InputStream in = progessMonitoredInputStream(file, "Loading analysis"); try { readXML(in, file); } catch (IOException e) { throw newIOException(file, e); } catch (DocumentException e) { throw new DocumentException("Failing reading " + file, e); } }
java
public void readXML(File file) throws IOException, DocumentException { project.setCurrentWorkingDirectory(file.getParentFile()); dataSource = file.getAbsolutePath(); InputStream in = progessMonitoredInputStream(file, "Loading analysis"); try { readXML(in, file); } catch (IOException e) { throw newIOException(file, e); } catch (DocumentException e) { throw new DocumentException("Failing reading " + file, e); } }
[ "public", "void", "readXML", "(", "File", "file", ")", "throws", "IOException", ",", "DocumentException", "{", "project", ".", "setCurrentWorkingDirectory", "(", "file", ".", "getParentFile", "(", ")", ")", ";", "dataSource", "=", "file", ".", "getAbsolutePath",...
Read XML data from given file into this object, populating given Project as a side effect. @param file the file
[ "Read", "XML", "data", "from", "given", "file", "into", "this", "object", "populating", "given", "Project", "as", "a", "side", "effect", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SortedBugCollection.java#L267-L278
jenetics/jenetics
jenetics.ext/src/main/java/io/jenetics/ext/internal/random.java
random.nextLong
public static long nextLong(final long n, final Random random) { if (n <= 0) { throw new IllegalArgumentException(format( "n is smaller than one: %d", n )); } long bits; long result; do { bits = random.nextLong() & 0x7fffffffffffffffL; result = bits%n; } while (bits - result + (n - 1) < 0); return result; }
java
public static long nextLong(final long n, final Random random) { if (n <= 0) { throw new IllegalArgumentException(format( "n is smaller than one: %d", n )); } long bits; long result; do { bits = random.nextLong() & 0x7fffffffffffffffL; result = bits%n; } while (bits - result + (n - 1) < 0); return result; }
[ "public", "static", "long", "nextLong", "(", "final", "long", "n", ",", "final", "Random", "random", ")", "{", "if", "(", "n", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "format", "(", "\"n is smaller than one: %d\"", ",", "n", "...
Returns a pseudo-random, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive), drawn from the given random number generator's sequence. @param n the bound on the random number to be returned. Must be positive. @param random the random engine used for creating the random number. @return the next pseudo-random, uniformly distributed int value between 0 (inclusive) and n (exclusive) from the given random number generator's sequence @throws IllegalArgumentException if n is smaller than 1. @throws NullPointerException if the given {@code random} engine is {@code null}.
[ "Returns", "a", "pseudo", "-", "random", "uniformly", "distributed", "int", "value", "between", "0", "(", "inclusive", ")", "and", "the", "specified", "value", "(", "exclusive", ")", "drawn", "from", "the", "given", "random", "number", "generator", "s", "seq...
train
https://github.com/jenetics/jenetics/blob/ee516770c65ef529b27deb283f071c85f344eff4/jenetics.ext/src/main/java/io/jenetics/ext/internal/random.java#L50-L65
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java
ComputeNodeOperations.disableComputeNodeScheduling
public void disableComputeNodeScheduling(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption) throws BatchErrorException, IOException { disableComputeNodeScheduling(poolId, nodeId, nodeDisableSchedulingOption, null); }
java
public void disableComputeNodeScheduling(String poolId, String nodeId, DisableComputeNodeSchedulingOption nodeDisableSchedulingOption) throws BatchErrorException, IOException { disableComputeNodeScheduling(poolId, nodeId, nodeDisableSchedulingOption, null); }
[ "public", "void", "disableComputeNodeScheduling", "(", "String", "poolId", ",", "String", "nodeId", ",", "DisableComputeNodeSchedulingOption", "nodeDisableSchedulingOption", ")", "throws", "BatchErrorException", ",", "IOException", "{", "disableComputeNodeScheduling", "(", "p...
Disables task scheduling on the specified compute node. @param poolId The ID of the pool. @param nodeId The ID of the compute node. @param nodeDisableSchedulingOption Specifies what to do with currently running tasks. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Disables", "task", "scheduling", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L381-L383
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CreateSyntheticOverheadViewS.java
CreateSyntheticOverheadViewS.process
public void process(T input, T output) { this.output = FactoryGImageGray.wrap(output,this.output); interp.setImage(input); int indexMap = 0; for( int i = 0; i < output.height; i++ ) { int indexOut = output.startIndex + i*output.stride; for( int j = 0; j < output.width; j++ , indexOut++,indexMap++ ) { Point2D_F32 p = mapPixels[indexMap]; if( p != null ) { this.output.set(indexOut,interp.get( p.x, p.y)); } } } }
java
public void process(T input, T output) { this.output = FactoryGImageGray.wrap(output,this.output); interp.setImage(input); int indexMap = 0; for( int i = 0; i < output.height; i++ ) { int indexOut = output.startIndex + i*output.stride; for( int j = 0; j < output.width; j++ , indexOut++,indexMap++ ) { Point2D_F32 p = mapPixels[indexMap]; if( p != null ) { this.output.set(indexOut,interp.get( p.x, p.y)); } } } }
[ "public", "void", "process", "(", "T", "input", ",", "T", "output", ")", "{", "this", ".", "output", "=", "FactoryGImageGray", ".", "wrap", "(", "output", ",", "this", ".", "output", ")", ";", "interp", ".", "setImage", "(", "input", ")", ";", "int",...
Computes overhead view of input image. All pixels in input image are assumed to be on the ground plane. @param input (Input) Camera image. @param output (Output) Image containing overhead view.
[ "Computes", "overhead", "view", "of", "input", "image", ".", "All", "pixels", "in", "input", "image", "are", "assumed", "to", "be", "on", "the", "ground", "plane", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/overhead/CreateSyntheticOverheadViewS.java#L54-L69
carrotsearch/hppc
hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayList.java
KTypeArrayList.forEach
public <T extends KTypeProcedure<? super KType>> T forEach(T procedure, int fromIndex, final int toIndex) { assert (fromIndex >= 0 && fromIndex <= size()) : "Index " + fromIndex + " out of bounds [" + 0 + ", " + size() + ")."; assert (toIndex >= 0 && toIndex <= size()) : "Index " + toIndex + " out of bounds [" + 0 + ", " + size() + "]."; assert fromIndex <= toIndex : "fromIndex must be <= toIndex: " + fromIndex + ", " + toIndex; final KType [] buffer = Intrinsics.<KType[]> cast(this.buffer); for (int i = fromIndex; i < toIndex; i++) { procedure.apply(buffer[i]); } return procedure; }
java
public <T extends KTypeProcedure<? super KType>> T forEach(T procedure, int fromIndex, final int toIndex) { assert (fromIndex >= 0 && fromIndex <= size()) : "Index " + fromIndex + " out of bounds [" + 0 + ", " + size() + ")."; assert (toIndex >= 0 && toIndex <= size()) : "Index " + toIndex + " out of bounds [" + 0 + ", " + size() + "]."; assert fromIndex <= toIndex : "fromIndex must be <= toIndex: " + fromIndex + ", " + toIndex; final KType [] buffer = Intrinsics.<KType[]> cast(this.buffer); for (int i = fromIndex; i < toIndex; i++) { procedure.apply(buffer[i]); } return procedure; }
[ "public", "<", "T", "extends", "KTypeProcedure", "<", "?", "super", "KType", ">", ">", "T", "forEach", "(", "T", "procedure", ",", "int", "fromIndex", ",", "final", "int", "toIndex", ")", "{", "assert", "(", "fromIndex", ">=", "0", "&&", "fromIndex", "...
Applies <code>procedure</code> to a slice of the list, <code>fromIndex</code>, inclusive, to <code>toIndex</code>, exclusive.
[ "Applies", "<code", ">", "procedure<", "/", "code", ">", "to", "a", "slice", "of", "the", "list", "<code", ">", "fromIndex<", "/", "code", ">", "inclusive", "to", "<code", ">", "toIndex<", "/", "code", ">", "exclusive", "." ]
train
https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/templates/com/carrotsearch/hppc/KTypeArrayList.java#L552-L568
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/buffer/factory/CudaDataBufferFactory.java
CudaDataBufferFactory.createHalf
@Override public DataBuffer createHalf(long offset, byte[] data, boolean copy) { return new CudaHalfDataBuffer(ArrayUtil.toFloatArray(data), copy, offset); }
java
@Override public DataBuffer createHalf(long offset, byte[] data, boolean copy) { return new CudaHalfDataBuffer(ArrayUtil.toFloatArray(data), copy, offset); }
[ "@", "Override", "public", "DataBuffer", "createHalf", "(", "long", "offset", ",", "byte", "[", "]", "data", ",", "boolean", "copy", ")", "{", "return", "new", "CudaHalfDataBuffer", "(", "ArrayUtil", ".", "toFloatArray", "(", "data", ")", ",", "copy", ",",...
Creates a half-precision data buffer @param offset @param data the data to create the buffer from @param copy @return the new buffer
[ "Creates", "a", "half", "-", "precision", "data", "buffer" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/buffer/factory/CudaDataBufferFactory.java#L717-L720
UrielCh/ovh-java-sdk
ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java
ApiOvhEmailpro.service_serviceInfos_PUT
public void service_serviceInfos_PUT(String service, net.minidev.ovh.api.services.OvhService body) throws IOException { String qPath = "/email/pro/{service}/serviceInfos"; StringBuilder sb = path(qPath, service); exec(qPath, "PUT", sb.toString(), body); }
java
public void service_serviceInfos_PUT(String service, net.minidev.ovh.api.services.OvhService body) throws IOException { String qPath = "/email/pro/{service}/serviceInfos"; StringBuilder sb = path(qPath, service); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "service_serviceInfos_PUT", "(", "String", "service", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "services", ".", "OvhService", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/pro/{service}/serviceInfos\...
Alter this object properties REST: PUT /email/pro/{service}/serviceInfos @param body [required] New object properties @param service [required] The internal name of your pro organization API beta
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailpro/src/main/java/net/minidev/ovh/api/ApiOvhEmailpro.java#L267-L271
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Operation.java
Operation.fixupVariables
public void fixupVariables(java.util.Vector vars, int globalsSize) { m_left.fixupVariables(vars, globalsSize); m_right.fixupVariables(vars, globalsSize); }
java
public void fixupVariables(java.util.Vector vars, int globalsSize) { m_left.fixupVariables(vars, globalsSize); m_right.fixupVariables(vars, globalsSize); }
[ "public", "void", "fixupVariables", "(", "java", ".", "util", ".", "Vector", "vars", ",", "int", "globalsSize", ")", "{", "m_left", ".", "fixupVariables", "(", "vars", ",", "globalsSize", ")", ";", "m_right", ".", "fixupVariables", "(", "vars", ",", "globa...
This function is used to fixup variables from QNames to stack frame indexes at stylesheet build time. @param vars List of QNames that correspond to variables. This list should be searched backwards for the first qualified name that corresponds to the variable reference qname. The position of the QName in the vector from the start of the vector will be its position in the stack frame (but variables above the globalsTop value will need to be offset to the current stack frame).
[ "This", "function", "is", "used", "to", "fixup", "variables", "from", "QNames", "to", "stack", "frame", "indexes", "at", "stylesheet", "build", "time", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Operation.java#L54-L58
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getCharacterInformation
public void getCharacterInformation(String API, String name, Callback<CharacterCore> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); gw2API.getCharacterCore(name, API).enqueue(callback); }
java
public void getCharacterInformation(String API, String name, Callback<CharacterCore> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API), new ParamChecker(ParamType.CHAR, name)); gw2API.getCharacterCore(name, API).enqueue(callback); }
[ "public", "void", "getCharacterInformation", "(", "String", "API", ",", "String", "name", ",", "Callback", "<", "CharacterCore", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(",...
For more info on Character Core API go <a href="https://wiki.guildwars2.com/wiki/API:2/characters#Core">here</a><br/> Get basic character information for the given character name that is linked to given API key @param API API key @param name name of character @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key | empty character name @throws NullPointerException if given {@link Callback} is empty @see CharacterCore basic character info
[ "For", "more", "info", "on", "Character", "Core", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "characters#Core", ">", "here<", "/", "a", ">", "<br", "/", ">", ...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L721-L724
mlhartme/sushi
src/main/java/net/oneandone/sushi/fs/Node.java
Node.copy
public void copy(Node dest) throws NodeNotFoundException, CopyException { try { if (isDirectory()) { dest.mkdirOpt(); copyDirectory(dest); } else { copyFile(dest); } } catch (FileNotFoundException | CopyException e) { throw e; } catch (IOException e) { throw new CopyException(this, dest, e); } }
java
public void copy(Node dest) throws NodeNotFoundException, CopyException { try { if (isDirectory()) { dest.mkdirOpt(); copyDirectory(dest); } else { copyFile(dest); } } catch (FileNotFoundException | CopyException e) { throw e; } catch (IOException e) { throw new CopyException(this, dest, e); } }
[ "public", "void", "copy", "(", "Node", "dest", ")", "throws", "NodeNotFoundException", ",", "CopyException", "{", "try", "{", "if", "(", "isDirectory", "(", ")", ")", "{", "dest", ".", "mkdirOpt", "(", ")", ";", "copyDirectory", "(", "dest", ")", ";", ...
Copies this to dest. Overwrites existing file and adds to existing directories. @throws NodeNotFoundException if this does not exist
[ "Copies", "this", "to", "dest", ".", "Overwrites", "existing", "file", "and", "adds", "to", "existing", "directories", "." ]
train
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L729-L742
SeleniumHQ/selenium
java/client/src/org/openqa/selenium/remote/ErrorCodes.java
ErrorCodes.getExceptionType
public Class<? extends WebDriverException> getExceptionType(int statusCode) { if (SUCCESS == statusCode) { return null; } // We know that the tuple of (status code, exception) is distinct. Set<Class<? extends WebDriverException>> allPossibleExceptions = KNOWN_ERRORS.stream() .filter(knownError -> knownError.getJsonCode() == statusCode) .map(KnownError::getException) .collect(Collectors.toSet()); return Iterables.getOnlyElement(allPossibleExceptions, WebDriverException.class); }
java
public Class<? extends WebDriverException> getExceptionType(int statusCode) { if (SUCCESS == statusCode) { return null; } // We know that the tuple of (status code, exception) is distinct. Set<Class<? extends WebDriverException>> allPossibleExceptions = KNOWN_ERRORS.stream() .filter(knownError -> knownError.getJsonCode() == statusCode) .map(KnownError::getException) .collect(Collectors.toSet()); return Iterables.getOnlyElement(allPossibleExceptions, WebDriverException.class); }
[ "public", "Class", "<", "?", "extends", "WebDriverException", ">", "getExceptionType", "(", "int", "statusCode", ")", "{", "if", "(", "SUCCESS", "==", "statusCode", ")", "{", "return", "null", ";", "}", "// We know that the tuple of (status code, exception) is distinc...
Returns the exception type that corresponds to the given {@code statusCode}. All unrecognized status codes will be mapped to {@link WebDriverException WebDriverException.class}. @param statusCode The status code to convert. @return The exception type that corresponds to the provided status code or {@code null} if {@code statusCode == 0}.
[ "Returns", "the", "exception", "type", "that", "corresponds", "to", "the", "given", "{", "@code", "statusCode", "}", ".", "All", "unrecognized", "status", "codes", "will", "be", "mapped", "to", "{", "@link", "WebDriverException", "WebDriverException", ".", "clas...
train
https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/ErrorCodes.java#L172-L184
OpenLiberty/open-liberty
dev/com.ibm.ws.security.registry/src/com/ibm/ws/security/registry/internal/CustomUserRegistryFactory.java
CustomUserRegistryFactory.unsetCustomUserRegistry
protected synchronized void unsetCustomUserRegistry(Map<String, Object> props) { String id = getId(props); customUserRegistries.remove(id); ServiceRegistration<UserRegistry> registration = registrynRegistrationsToUnregister.remove(id); if (registration != null) { registration.unregister(); } }
java
protected synchronized void unsetCustomUserRegistry(Map<String, Object> props) { String id = getId(props); customUserRegistries.remove(id); ServiceRegistration<UserRegistry> registration = registrynRegistrationsToUnregister.remove(id); if (registration != null) { registration.unregister(); } }
[ "protected", "synchronized", "void", "unsetCustomUserRegistry", "(", "Map", "<", "String", ",", "Object", ">", "props", ")", "{", "String", "id", "=", "getId", "(", "props", ")", ";", "customUserRegistries", ".", "remove", "(", "id", ")", ";", "ServiceRegist...
Method will be called for each com.ibm.websphere.security.UserRegistry that is unregistered in the OSGi service registry. We must remove this instance from our internal set of listeners. @param ref Reference to an unregistered com.ibm.websphere.security.UserRegistry
[ "Method", "will", "be", "called", "for", "each", "com", ".", "ibm", ".", "websphere", ".", "security", ".", "UserRegistry", "that", "is", "unregistered", "in", "the", "OSGi", "service", "registry", ".", "We", "must", "remove", "this", "instance", "from", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.registry/src/com/ibm/ws/security/registry/internal/CustomUserRegistryFactory.java#L79-L86
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java
RegisterUtils.getLocalVariableEndRange
public static int getLocalVariableEndRange(LocalVariableTable lvt, int reg, int curPC) { int endRange = Integer.MAX_VALUE; if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, curPC); if (lv != null) { endRange = lv.getStartPC() + lv.getLength(); } } return endRange; }
java
public static int getLocalVariableEndRange(LocalVariableTable lvt, int reg, int curPC) { int endRange = Integer.MAX_VALUE; if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, curPC); if (lv != null) { endRange = lv.getStartPC() + lv.getLength(); } } return endRange; }
[ "public", "static", "int", "getLocalVariableEndRange", "(", "LocalVariableTable", "lvt", ",", "int", "reg", ",", "int", "curPC", ")", "{", "int", "endRange", "=", "Integer", ".", "MAX_VALUE", ";", "if", "(", "lvt", "!=", "null", ")", "{", "LocalVariable", ...
returns the end pc of the visible range of this register at this pc @param lvt the local variable table for this method @param reg the register to examine @param curPC the pc of the current instruction @return the endpc
[ "returns", "the", "end", "pc", "of", "the", "visible", "range", "of", "this", "register", "at", "this", "pc" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/utils/RegisterUtils.java#L144-L153
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/MathUtils.java
MathUtils.lerp
static double lerp(double start_, double end_, double t) { // When end == start, we want result to be equal to start, for all t // values. At the same time, when end != start, we want the result to be // equal to start for t==0 and end for t == 1.0 // The regular formula end_ * t + (1.0 - t) * start_, when end_ == // start_, and t at 1/3, produces value different from start double v; if (t <= 0.5) v = start_ + (end_ - start_) * t; else v = end_ - (end_ - start_) * (1.0 - t); assert (t < 0 || t > 1.0 || (v >= start_ && v <= end_) || (v <= start_ && v >= end_) || NumberUtils.isNaN(start_) || NumberUtils.isNaN(end_)); return v; }
java
static double lerp(double start_, double end_, double t) { // When end == start, we want result to be equal to start, for all t // values. At the same time, when end != start, we want the result to be // equal to start for t==0 and end for t == 1.0 // The regular formula end_ * t + (1.0 - t) * start_, when end_ == // start_, and t at 1/3, produces value different from start double v; if (t <= 0.5) v = start_ + (end_ - start_) * t; else v = end_ - (end_ - start_) * (1.0 - t); assert (t < 0 || t > 1.0 || (v >= start_ && v <= end_) || (v <= start_ && v >= end_) || NumberUtils.isNaN(start_) || NumberUtils.isNaN(end_)); return v; }
[ "static", "double", "lerp", "(", "double", "start_", ",", "double", "end_", ",", "double", "t", ")", "{", "// When end == start, we want result to be equal to start, for all t", "// values. At the same time, when end != start, we want the result to be", "// equal to start for t==0 an...
Computes interpolation between two values, using the interpolation factor t. The interpolation formula is (end - start) * t + start. However, the computation ensures that t = 0 produces exactly start, and t = 1, produces exactly end. It also guarantees that for 0 <= t <= 1, the interpolated value v is between start and end.
[ "Computes", "interpolation", "between", "two", "values", "using", "the", "interpolation", "factor", "t", ".", "The", "interpolation", "formula", "is", "(", "end", "-", "start", ")", "*", "t", "+", "start", ".", "However", "the", "computation", "ensures", "th...
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/MathUtils.java#L174-L188
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java
CodepointHelper.verify
public static void verify (@Nullable final String sStr, @Nonnull final ECodepointProfile eProfile) { if (sStr != null) verify (new CodepointIteratorCharSequence (sStr), eProfile); }
java
public static void verify (@Nullable final String sStr, @Nonnull final ECodepointProfile eProfile) { if (sStr != null) verify (new CodepointIteratorCharSequence (sStr), eProfile); }
[ "public", "static", "void", "verify", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nonnull", "final", "ECodepointProfile", "eProfile", ")", "{", "if", "(", "sStr", "!=", "null", ")", "verify", "(", "new", "CodepointIteratorCharSequence", "(", ...
Verifies a sequence of codepoints using the specified profile @param sStr String @param eProfile profile to use
[ "Verifies", "a", "sequence", "of", "codepoints", "using", "the", "specified", "profile" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java#L789-L793
groovy/groovy-core
src/main/groovy/lang/Script.java
Script.invokeMethod
public Object invokeMethod(String name, Object args) { try { return super.invokeMethod(name, args); } // if the method was not found in the current scope (the script's methods) // let's try to see if there's a method closure with the same name in the binding catch (MissingMethodException mme) { try { if (name.equals(mme.getMethod())) { Object boundClosure = getProperty(name); if (boundClosure != null && boundClosure instanceof Closure) { return ((Closure) boundClosure).call((Object[])args); } else { throw mme; } } else { throw mme; } } catch (MissingPropertyException mpe) { throw mme; } } }
java
public Object invokeMethod(String name, Object args) { try { return super.invokeMethod(name, args); } // if the method was not found in the current scope (the script's methods) // let's try to see if there's a method closure with the same name in the binding catch (MissingMethodException mme) { try { if (name.equals(mme.getMethod())) { Object boundClosure = getProperty(name); if (boundClosure != null && boundClosure instanceof Closure) { return ((Closure) boundClosure).call((Object[])args); } else { throw mme; } } else { throw mme; } } catch (MissingPropertyException mpe) { throw mme; } } }
[ "public", "Object", "invokeMethod", "(", "String", "name", ",", "Object", "args", ")", "{", "try", "{", "return", "super", ".", "invokeMethod", "(", "name", ",", "args", ")", ";", "}", "// if the method was not found in the current scope (the script's methods)", "//...
Invoke a method (or closure in the binding) defined. @param name method to call @param args arguments to pass to the method @return value
[ "Invoke", "a", "method", "(", "or", "closure", "in", "the", "binding", ")", "defined", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/lang/Script.java#L79-L101
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java
WebConfigParamUtils.getStringInitParameter
public static String getStringInitParameter(ExternalContext context, String[] names) { return getStringInitParameter(context, names, null); }
java
public static String getStringInitParameter(ExternalContext context, String[] names) { return getStringInitParameter(context, names, null); }
[ "public", "static", "String", "getStringInitParameter", "(", "ExternalContext", "context", ",", "String", "[", "]", "names", ")", "{", "return", "getStringInitParameter", "(", "context", ",", "names", ",", "null", ")", ";", "}" ]
Gets the String init parameter value from the specified context. If the parameter is an empty String or a String containing only white space, this method returns <code>null</code> @param context the application's external context @param names the init parameter's names, the first one is scanned first. Usually used when a param has multiple aliases @return the parameter if it was specified and was not empty, <code>null</code> otherwise @throws NullPointerException if context or name is <code>null</code>
[ "Gets", "the", "String", "init", "parameter", "value", "from", "the", "specified", "context", ".", "If", "the", "parameter", "is", "an", "empty", "String", "or", "a", "String", "containing", "only", "white", "space", "this", "method", "returns", "<code", ">"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java#L108-L111
belaban/JGroups
src/org/jgroups/Message.java
Message.setBuffer
public Message setBuffer(byte[] b, int offset, int length) { buf=b; if(buf != null) { if(offset < 0 || offset > buf.length) throw new ArrayIndexOutOfBoundsException(offset); if((offset + length) > buf.length) throw new ArrayIndexOutOfBoundsException((offset+length)); this.offset=offset; this.length=length; } else this.offset=this.length=0; return this; }
java
public Message setBuffer(byte[] b, int offset, int length) { buf=b; if(buf != null) { if(offset < 0 || offset > buf.length) throw new ArrayIndexOutOfBoundsException(offset); if((offset + length) > buf.length) throw new ArrayIndexOutOfBoundsException((offset+length)); this.offset=offset; this.length=length; } else this.offset=this.length=0; return this; }
[ "public", "Message", "setBuffer", "(", "byte", "[", "]", "b", ",", "int", "offset", ",", "int", "length", ")", "{", "buf", "=", "b", ";", "if", "(", "buf", "!=", "null", ")", "{", "if", "(", "offset", "<", "0", "||", "offset", ">", "buf", ".", ...
Sets the internal buffer to point to a subset of a given buffer.<p/> <em> Note that the byte[] buffer passed as argument must not be modified. Reason: if we retransmit the message, it would still have a ref to the original byte[] buffer passed in as argument, and so we would retransmit a changed byte[] buffer ! </em> @param b The reference to a given buffer. If null, we'll reset the buffer to null @param offset The initial position @param length The number of bytes
[ "Sets", "the", "internal", "buffer", "to", "point", "to", "a", "subset", "of", "a", "given", "buffer", ".", "<p", "/", ">", "<em", ">", "Note", "that", "the", "byte", "[]", "buffer", "passed", "as", "argument", "must", "not", "be", "modified", ".", "...
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L245-L258
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java
SeaGlassSynthPainterImpl.paintSeparatorForeground
public void paintSeparatorForeground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { paintForeground(context, g, x, y, w, h, orientation); }
java
public void paintSeparatorForeground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { paintForeground(context, g, x, y, w, h, orientation); }
[ "public", "void", "paintSeparatorForeground", "(", "SynthContext", "context", ",", "Graphics", "g", ",", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "int", "orientation", ")", "{", "paintForeground", "(", "context", ",", "g", ",",...
Paints the foreground of a separator. @param context SynthContext identifying the <code>JComponent</code> and <code>Region</code> to paint to @param g <code>Graphics</code> to paint to @param x X coordinate of the area to paint to @param y Y coordinate of the area to paint to @param w Width of the area to paint to @param h Height of the area to paint to @param orientation One of <code>JSeparator.HORIZONTAL</code> or <code> JSeparator.VERTICAL</code>
[ "Paints", "the", "foreground", "of", "a", "separator", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassSynthPainterImpl.java#L1598-L1600
alkacon/opencms-core
src/org/opencms/gwt/CmsVfsService.java
CmsVfsService.getNoPreviewReason
public static String getNoPreviewReason(CmsObject cms, CmsResource resource) { Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); String noPreviewReason = null; if (resource.getState().isDeleted() && !(resource instanceof I_CmsHistoryResource)) { noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_DELETED_0); } else if (resource.isFolder()) { noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_FOLDER_0); } else { String siteRoot = OpenCms.getSiteManager().getSiteRoot(resource.getRootPath()); // previewing only resources that are in the same site or don't have a site root at all if ((siteRoot != null) && !siteRoot.equals(cms.getRequestContext().getSiteRoot())) { noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_OTHER_SITE_0); } else if (resource.getTypeId() == CmsResourceTypeBinary.getStaticTypeId()) { String mimeType = OpenCms.getResourceManager().getMimeType(resource.getName(), null, "empty"); if (!m_previewMimeTypes.contains(mimeType)) { noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_WRONG_MIME_TYPE_0); } } } return noPreviewReason; }
java
public static String getNoPreviewReason(CmsObject cms, CmsResource resource) { Locale locale = OpenCms.getWorkplaceManager().getWorkplaceLocale(cms); String noPreviewReason = null; if (resource.getState().isDeleted() && !(resource instanceof I_CmsHistoryResource)) { noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_DELETED_0); } else if (resource.isFolder()) { noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_FOLDER_0); } else { String siteRoot = OpenCms.getSiteManager().getSiteRoot(resource.getRootPath()); // previewing only resources that are in the same site or don't have a site root at all if ((siteRoot != null) && !siteRoot.equals(cms.getRequestContext().getSiteRoot())) { noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_OTHER_SITE_0); } else if (resource.getTypeId() == CmsResourceTypeBinary.getStaticTypeId()) { String mimeType = OpenCms.getResourceManager().getMimeType(resource.getName(), null, "empty"); if (!m_previewMimeTypes.contains(mimeType)) { noPreviewReason = Messages.get().getBundle(locale).key(Messages.GUI_NO_PREVIEW_WRONG_MIME_TYPE_0); } } } return noPreviewReason; }
[ "public", "static", "String", "getNoPreviewReason", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "{", "Locale", "locale", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getWorkplaceLocale", "(", "cms", ")", ";", "String", "noPreview...
Returns the no preview reason if there is any.<p> @param cms the current cms context @param resource the resource to check @return the no preview reason if there is any
[ "Returns", "the", "no", "preview", "reason", "if", "there", "is", "any", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsVfsService.java#L234-L255
orbisgis/h2gis
postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java
JtsBinaryParser.parseMultiLineString
private MultiLineString parseMultiLineString(ValueGetter data, int srid) { int count = data.getInt(); LineString[] strings = new LineString[count]; this.parseGeometryArray(data, strings, srid); return JtsGeometry.geofac.createMultiLineString(strings); }
java
private MultiLineString parseMultiLineString(ValueGetter data, int srid) { int count = data.getInt(); LineString[] strings = new LineString[count]; this.parseGeometryArray(data, strings, srid); return JtsGeometry.geofac.createMultiLineString(strings); }
[ "private", "MultiLineString", "parseMultiLineString", "(", "ValueGetter", "data", ",", "int", "srid", ")", "{", "int", "count", "=", "data", ".", "getInt", "(", ")", ";", "LineString", "[", "]", "strings", "=", "new", "LineString", "[", "count", "]", ";", ...
Parse the given {@link org.postgis.binary.ValueGetter} into a JTS {@link org.locationtech.jts.geom.MultiLineString}. @param data {@link org.postgis.binary.ValueGetter} to parse. @param srid SRID of the parsed geometries. @return The parsed {@link org.locationtech.jts.geom.MultiLineString}.
[ "Parse", "the", "given", "{", "@link", "org", ".", "postgis", ".", "binary", ".", "ValueGetter", "}", "into", "a", "JTS", "{", "@link", "org", ".", "locationtech", ".", "jts", ".", "geom", ".", "MultiLineString", "}", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/postgis-jts/src/main/java/org/h2gis/postgis_jts/JtsBinaryParser.java#L305-L310
nakamura5akihito/six-util
src/main/java/jp/go/aist/six/util/core/web/spring/SpringHttpClientImpl.java
SpringHttpClientImpl.postByRead
public String postByRead( final String url, final Reader input, final String media_type ) { String location = _execute( url, HttpMethod.POST, new ReaderRequestCallback( input, MediaType.parseMediaType( media_type ) ), new LocationHeaderResponseExtractor() ); return location; }
java
public String postByRead( final String url, final Reader input, final String media_type ) { String location = _execute( url, HttpMethod.POST, new ReaderRequestCallback( input, MediaType.parseMediaType( media_type ) ), new LocationHeaderResponseExtractor() ); return location; }
[ "public", "String", "postByRead", "(", "final", "String", "url", ",", "final", "Reader", "input", ",", "final", "String", "media_type", ")", "{", "String", "location", "=", "_execute", "(", "url", ",", "HttpMethod", ".", "POST", ",", "new", "ReaderRequestCal...
HTTP POST: Reads the contents from the specified reader and sends them to the URL. @return the location, as an URI, where the resource is created. @throws HttpException when an exceptional condition occurred during the HTTP method execution.
[ "HTTP", "POST", ":", "Reads", "the", "contents", "from", "the", "specified", "reader", "and", "sends", "them", "to", "the", "URL", "." ]
train
https://github.com/nakamura5akihito/six-util/blob/a6db388a345e220cea2b1fa6324d15c80c6278b6/src/main/java/jp/go/aist/six/util/core/web/spring/SpringHttpClientImpl.java#L404-L415
spotify/docker-client
src/main/java/com/spotify/docker/client/DefaultDockerClient.java
DefaultDockerClient.urlEncodeFilters
private String urlEncodeFilters(final Map<String, List<String>> filters) throws DockerException { try { final String unencodedFilters = objectMapper().writeValueAsString(filters); if (!unencodedFilters.isEmpty()) { return urlEncode(unencodedFilters); } } catch (IOException e) { throw new DockerException(e); } return null; }
java
private String urlEncodeFilters(final Map<String, List<String>> filters) throws DockerException { try { final String unencodedFilters = objectMapper().writeValueAsString(filters); if (!unencodedFilters.isEmpty()) { return urlEncode(unencodedFilters); } } catch (IOException e) { throw new DockerException(e); } return null; }
[ "private", "String", "urlEncodeFilters", "(", "final", "Map", "<", "String", ",", "List", "<", "String", ">", ">", "filters", ")", "throws", "DockerException", "{", "try", "{", "final", "String", "unencodedFilters", "=", "objectMapper", "(", ")", ".", "write...
Takes a map of filters and URL-encodes them. If the map is empty or an exception occurs, return null. @param filters A map of filters. @return String @throws DockerException if there's an IOException
[ "Takes", "a", "map", "of", "filters", "and", "URL", "-", "encodes", "them", ".", "If", "the", "map", "is", "empty", "or", "an", "exception", "occurs", "return", "null", "." ]
train
https://github.com/spotify/docker-client/blob/f297361891f3bb6a2980b08057eede628d681791/src/main/java/com/spotify/docker/client/DefaultDockerClient.java#L698-L708
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setDuration
public void setDuration(int index, Duration value) { set(selectField(AssignmentFieldLists.CUSTOM_DURATION, index), value); }
java
public void setDuration(int index, Duration value) { set(selectField(AssignmentFieldLists.CUSTOM_DURATION, index), value); }
[ "public", "void", "setDuration", "(", "int", "index", ",", "Duration", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "CUSTOM_DURATION", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a duration value. @param index duration index (1-10) @param value duration value
[ "Set", "a", "duration", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1628-L1631
apereo/cas
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/PolicyBasedAuthenticationManager.java
PolicyBasedAuthenticationManager.handleAuthenticationException
protected void handleAuthenticationException(final Throwable ex, final String name, final AuthenticationBuilder builder) { var e = ex; if (ex instanceof UndeclaredThrowableException) { e = ((UndeclaredThrowableException) ex).getUndeclaredThrowable(); } LOGGER.trace(e.getMessage(), e); val msg = new StringBuilder(StringUtils.defaultString(e.getMessage())); if (e.getCause() != null) { msg.append(" / ").append(e.getCause().getMessage()); } if (e instanceof GeneralSecurityException) { LOGGER.debug("[{}] exception details: [{}].", name, msg); builder.addFailure(name, e); } else { LOGGER.error("[{}]: [{}]", name, msg); builder.addFailure(name, e); } }
java
protected void handleAuthenticationException(final Throwable ex, final String name, final AuthenticationBuilder builder) { var e = ex; if (ex instanceof UndeclaredThrowableException) { e = ((UndeclaredThrowableException) ex).getUndeclaredThrowable(); } LOGGER.trace(e.getMessage(), e); val msg = new StringBuilder(StringUtils.defaultString(e.getMessage())); if (e.getCause() != null) { msg.append(" / ").append(e.getCause().getMessage()); } if (e instanceof GeneralSecurityException) { LOGGER.debug("[{}] exception details: [{}].", name, msg); builder.addFailure(name, e); } else { LOGGER.error("[{}]: [{}]", name, msg); builder.addFailure(name, e); } }
[ "protected", "void", "handleAuthenticationException", "(", "final", "Throwable", "ex", ",", "final", "String", "name", ",", "final", "AuthenticationBuilder", "builder", ")", "{", "var", "e", "=", "ex", ";", "if", "(", "ex", "instanceof", "UndeclaredThrowableExcept...
Handle authentication exception. @param ex the exception @param name the name @param builder the builder
[ "Handle", "authentication", "exception", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/PolicyBasedAuthenticationManager.java#L406-L425
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/sampling/ReservoirLongsSketch.java
ReservoirLongsSketch.getInstance
static ReservoirLongsSketch getInstance(final long[] data, final long itemsSeen, final ResizeFactor rf, final int k) { return new ReservoirLongsSketch(data, itemsSeen, rf, k); }
java
static ReservoirLongsSketch getInstance(final long[] data, final long itemsSeen, final ResizeFactor rf, final int k) { return new ReservoirLongsSketch(data, itemsSeen, rf, k); }
[ "static", "ReservoirLongsSketch", "getInstance", "(", "final", "long", "[", "]", "data", ",", "final", "long", "itemsSeen", ",", "final", "ResizeFactor", "rf", ",", "final", "int", "k", ")", "{", "return", "new", "ReservoirLongsSketch", "(", "data", ",", "it...
Thin wrapper around private constructor @param data Reservoir items as long[] @param itemsSeen Number of items presented to the sketch so far @param rf <a href="{@docRoot}/resources/dictionary.html#resizeFactor">See Resize Factor</a> @param k Maximum reservoir size @return New sketch built with the provided inputs
[ "Thin", "wrapper", "around", "private", "constructor" ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/sampling/ReservoirLongsSketch.java#L241-L244
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.getExactXField
public static XField getExactXField(@SlashedClassName String className, String name, String signature, boolean isStatic) { FieldDescriptor fieldDesc = DescriptorFactory.instance().getFieldDescriptor(ClassName.toSlashedClassName(className), name, signature, isStatic); return getExactXField(fieldDesc); }
java
public static XField getExactXField(@SlashedClassName String className, String name, String signature, boolean isStatic) { FieldDescriptor fieldDesc = DescriptorFactory.instance().getFieldDescriptor(ClassName.toSlashedClassName(className), name, signature, isStatic); return getExactXField(fieldDesc); }
[ "public", "static", "XField", "getExactXField", "(", "@", "SlashedClassName", "String", "className", ",", "String", "name", ",", "String", "signature", ",", "boolean", "isStatic", ")", "{", "FieldDescriptor", "fieldDesc", "=", "DescriptorFactory", ".", "instance", ...
Get an XField object exactly matching given class, name, and signature. May return an unresolved object (if the class can't be found, or does not directly declare named field). @param className name of class containing the field @param name name of field @param signature field signature @param isStatic field access flags @return XField exactly matching class name, field name, and field signature
[ "Get", "an", "XField", "object", "exactly", "matching", "given", "class", "name", "and", "signature", ".", "May", "return", "an", "unresolved", "object", "(", "if", "the", "class", "can", "t", "be", "found", "or", "does", "not", "directly", "declare", "nam...
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L534-L538
wg/lettuce
src/main/java/com/lambdaworks/redis/RedisConnection.java
RedisConnection.evalsha
@SuppressWarnings("unchecked") public <T> T evalsha(String digest, ScriptOutputType type, K... keys) { return (T) await(c.evalsha(digest, type, keys, (V[]) new Object[0])); }
java
@SuppressWarnings("unchecked") public <T> T evalsha(String digest, ScriptOutputType type, K... keys) { return (T) await(c.evalsha(digest, type, keys, (V[]) new Object[0])); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "evalsha", "(", "String", "digest", ",", "ScriptOutputType", "type", ",", "K", "...", "keys", ")", "{", "return", "(", "T", ")", "await", "(", "c", ".", "evalsha", "(", ...
Eval a pre-loaded script identified by its SHA-1 digest, which must result in the requested {@link ScriptOutputType type}. @param digest Lowercase hex string of script's SHA-1 digest. @param type Script output type. @param keys Redis keys to pass to script. @param <T> Expected return type. @return The result of evaluating the script.
[ "Eval", "a", "pre", "-", "loaded", "script", "identified", "by", "its", "SHA", "-", "1", "digest", "which", "must", "result", "in", "the", "requested", "{", "@link", "ScriptOutputType", "type", "}", "." ]
train
https://github.com/wg/lettuce/blob/5141640dc8289ff3af07b44a87020cef719c5f4a/src/main/java/com/lambdaworks/redis/RedisConnection.java#L203-L206
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/AppsImpl.java
AppsImpl.importMethodAsync
public Observable<UUID> importMethodAsync(LuisApp luisApp, ImportMethodAppsOptionalParameter importMethodOptionalParameter) { return importMethodWithServiceResponseAsync(luisApp, importMethodOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() { @Override public UUID call(ServiceResponse<UUID> response) { return response.body(); } }); }
java
public Observable<UUID> importMethodAsync(LuisApp luisApp, ImportMethodAppsOptionalParameter importMethodOptionalParameter) { return importMethodWithServiceResponseAsync(luisApp, importMethodOptionalParameter).map(new Func1<ServiceResponse<UUID>, UUID>() { @Override public UUID call(ServiceResponse<UUID> response) { return response.body(); } }); }
[ "public", "Observable", "<", "UUID", ">", "importMethodAsync", "(", "LuisApp", "luisApp", ",", "ImportMethodAppsOptionalParameter", "importMethodOptionalParameter", ")", "{", "return", "importMethodWithServiceResponseAsync", "(", "luisApp", ",", "importMethodOptionalParameter",...
Imports an application to LUIS, the application's structure should be included in in the request body. @param luisApp A LUIS application structure. @param importMethodOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UUID object
[ "Imports", "an", "application", "to", "LUIS", "the", "application", "s", "structure", "should", "be", "included", "in", "in", "the", "request", "body", "." ]
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/AppsImpl.java#L424-L431
knowm/XChange
xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java
CoinbaseMarketDataServiceRaw.getCoinbaseBuyPrice
public CoinbasePrice getCoinbaseBuyPrice(Currency base, Currency counter) throws IOException { return coinbase.getBuyPrice(Coinbase.CB_VERSION_VALUE, base + "-" + counter).getData(); }
java
public CoinbasePrice getCoinbaseBuyPrice(Currency base, Currency counter) throws IOException { return coinbase.getBuyPrice(Coinbase.CB_VERSION_VALUE, base + "-" + counter).getData(); }
[ "public", "CoinbasePrice", "getCoinbaseBuyPrice", "(", "Currency", "base", ",", "Currency", "counter", ")", "throws", "IOException", "{", "return", "coinbase", ".", "getBuyPrice", "(", "Coinbase", ".", "CB_VERSION_VALUE", ",", "base", "+", "\"-\"", "+", "counter",...
Unauthenticated resource that tells you the price to buy one unit. @param pair The currency pair. @return The price in the desired {@code currency} to buy one unit. @throws IOException @see <a href="https://developers.coinbase.com/api/v2#get-buy-price">developers.coinbase.com/api/v2#get-buy-price</a>
[ "Unauthenticated", "resource", "that", "tells", "you", "the", "price", "to", "buy", "one", "unit", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java#L44-L47
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource.java
xen_health_resource.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_resource_responses result = (xen_health_resource_responses) service.get_payload_formatter().string_to_resource(xen_health_resource_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_resource_response_array); } xen_health_resource[] result_xen_health_resource = new xen_health_resource[result.xen_health_resource_response_array.length]; for(int i = 0; i < result.xen_health_resource_response_array.length; i++) { result_xen_health_resource[i] = result.xen_health_resource_response_array[i].xen_health_resource[0]; } return result_xen_health_resource; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_resource_responses result = (xen_health_resource_responses) service.get_payload_formatter().string_to_resource(xen_health_resource_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_resource_response_array); } xen_health_resource[] result_xen_health_resource = new xen_health_resource[result.xen_health_resource_response_array.length]; for(int i = 0; i < result.xen_health_resource_response_array.length; i++) { result_xen_health_resource[i] = result.xen_health_resource_response_array[i].xen_health_resource[0]; } return result_xen_health_resource; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "xen_health_resource_responses", "result", "=", "(", "xen_health_resource_responses", ")", "service", ".", "ge...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource.java#L313-L330
apache/flink
flink-core/src/main/java/org/apache/flink/types/parser/BooleanParser.java
BooleanParser.byteArrayEquals
private static boolean byteArrayEquals(byte[] source, int start, int length, byte[] other) { if (length != other.length) { return false; } for (int i = 0; i < other.length; i++) { if (Character.toLowerCase(source[i + start]) != other[i]) { return false; } } return true; }
java
private static boolean byteArrayEquals(byte[] source, int start, int length, byte[] other) { if (length != other.length) { return false; } for (int i = 0; i < other.length; i++) { if (Character.toLowerCase(source[i + start]) != other[i]) { return false; } } return true; }
[ "private", "static", "boolean", "byteArrayEquals", "(", "byte", "[", "]", "source", ",", "int", "start", ",", "int", "length", ",", "byte", "[", "]", "other", ")", "{", "if", "(", "length", "!=", "other", ".", "length", ")", "{", "return", "false", "...
Checks if a part of a byte array matches another byte array with chars (case-insensitive). @param source The source byte array. @param start The offset into the source byte array. @param length The length of the match. @param other The byte array which is fully compared to the part of the source array. @return true if other can be found in the specified part of source, false otherwise.
[ "Checks", "if", "a", "part", "of", "a", "byte", "array", "matches", "another", "byte", "array", "with", "chars", "(", "case", "-", "insensitive", ")", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/parser/BooleanParser.java#L84-L94
wanglinsong/testharness
src/main/java/com/tascape/qa/th/Utils.java
Utils.cmd
public static List<String> cmd(String[] command) throws IOException, InterruptedException { return cmd(command, null, null, 300000L, null); }
java
public static List<String> cmd(String[] command) throws IOException, InterruptedException { return cmd(command, null, null, 300000L, null); }
[ "public", "static", "List", "<", "String", ">", "cmd", "(", "String", "[", "]", "command", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "cmd", "(", "command", ",", "null", ",", "null", ",", "300000L", ",", "null", ")", ";", ...
Executes command, and waits for the expected phrase in console printout. @param command command line @return console output as a list of strings @throws IOException for command error @throws InterruptedException when interrupted
[ "Executes", "command", "and", "waits", "for", "the", "expected", "phrase", "in", "console", "printout", "." ]
train
https://github.com/wanglinsong/testharness/blob/76f3e4546648e0720f6f87a58cb91a09cd36dfca/src/main/java/com/tascape/qa/th/Utils.java#L126-L128
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IntegerExtensions.java
IntegerExtensions.operator_upTo
@Pure @Inline(value="new $3($1, $2)", imported=IntegerRange.class, statementExpression=false) public static IntegerRange operator_upTo(final int a, final int b) { return new IntegerRange(a, b); }
java
@Pure @Inline(value="new $3($1, $2)", imported=IntegerRange.class, statementExpression=false) public static IntegerRange operator_upTo(final int a, final int b) { return new IntegerRange(a, b); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"new $3($1, $2)\"", ",", "imported", "=", "IntegerRange", ".", "class", ",", "statementExpression", "=", "false", ")", "public", "static", "IntegerRange", "operator_upTo", "(", "final", "int", "a", ",", "final",...
The <code>..</code> operator yields an {@link IntegerRange}. @param a the start of the range. @param b the end of the range. @return an {@link IntegerRange}. Never <code>null</code>. @since 2.3
[ "The", "<code", ">", "..", "<", "/", "code", ">", "operator", "yields", "an", "{", "@link", "IntegerRange", "}", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IntegerExtensions.java#L31-L35
h2oai/h2o-3
h2o-core/src/main/java/water/util/VecUtils.java
VecUtils.stringToNumeric
public static Vec stringToNumeric(Vec src) { if(!src.isString()) throw new H2OIllegalArgumentException("stringToNumeric conversion only works on string columns"); Vec res = new MRTask() { @Override public void map(Chunk chk, NewChunk newChk){ if (chk instanceof C0DChunk) { // all NAs for (int i=0; i < chk._len; i++) newChk.addNA(); } else { BufferedString tmpStr = new BufferedString(); for (int i=0; i < chk._len; i++) { if (!chk.isNA(i)) { tmpStr = chk.atStr(tmpStr, i); switch (tmpStr.getNumericType()) { case BufferedString.NA: newChk.addNA(); break; case BufferedString.INT: newChk.addNum(Long.parseLong(tmpStr.toString()),0); break; case BufferedString.REAL: newChk.addNum(Double.parseDouble(tmpStr.toString())); break; default: throw new H2OIllegalValueException("Received unexpected type when parsing a string to a number.", this); } } else newChk.addNA(); } } } }.doAll(Vec.T_NUM, src).outputFrame().anyVec(); assert res != null; return res; }
java
public static Vec stringToNumeric(Vec src) { if(!src.isString()) throw new H2OIllegalArgumentException("stringToNumeric conversion only works on string columns"); Vec res = new MRTask() { @Override public void map(Chunk chk, NewChunk newChk){ if (chk instanceof C0DChunk) { // all NAs for (int i=0; i < chk._len; i++) newChk.addNA(); } else { BufferedString tmpStr = new BufferedString(); for (int i=0; i < chk._len; i++) { if (!chk.isNA(i)) { tmpStr = chk.atStr(tmpStr, i); switch (tmpStr.getNumericType()) { case BufferedString.NA: newChk.addNA(); break; case BufferedString.INT: newChk.addNum(Long.parseLong(tmpStr.toString()),0); break; case BufferedString.REAL: newChk.addNum(Double.parseDouble(tmpStr.toString())); break; default: throw new H2OIllegalValueException("Received unexpected type when parsing a string to a number.", this); } } else newChk.addNA(); } } } }.doAll(Vec.T_NUM, src).outputFrame().anyVec(); assert res != null; return res; }
[ "public", "static", "Vec", "stringToNumeric", "(", "Vec", "src", ")", "{", "if", "(", "!", "src", ".", "isString", "(", ")", ")", "throw", "new", "H2OIllegalArgumentException", "(", "\"stringToNumeric conversion only works on string columns\"", ")", ";", "Vec", "r...
Create a new {@link Vec} of numeric values from a string {@link Vec}. Any rows that cannot be converted to a number are set to NA. Currently only does basic numeric formats. No exponents, or hex values. Doesn't even like commas or spaces. :( Needs love. Handling more numeric representations is PUBDEV-2209 @param src a string {@link Vec} @return a numeric {@link Vec}
[ "Create", "a", "new", "{", "@link", "Vec", "}", "of", "numeric", "values", "from", "a", "string", "{", "@link", "Vec", "}", ".", "Any", "rows", "that", "cannot", "be", "converted", "to", "a", "number", "are", "set", "to", "NA", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/VecUtils.java#L193-L222
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/alias/AliasFactory.java
AliasFactory.createAliasForVariable
@SuppressWarnings("unchecked") public <A> A createAliasForVariable(Class<A> cl, String var) { try { Expression<?> path = pathCache.get(Pair.<Class<?>, String>of(cl, var)); return (A) proxyCache.get(Pair.<Class<?>, Expression<?>>of(cl, path)); } catch (ExecutionException e) { throw new QueryException(e); } }
java
@SuppressWarnings("unchecked") public <A> A createAliasForVariable(Class<A> cl, String var) { try { Expression<?> path = pathCache.get(Pair.<Class<?>, String>of(cl, var)); return (A) proxyCache.get(Pair.<Class<?>, Expression<?>>of(cl, path)); } catch (ExecutionException e) { throw new QueryException(e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "A", ">", "A", "createAliasForVariable", "(", "Class", "<", "A", ">", "cl", ",", "String", "var", ")", "{", "try", "{", "Expression", "<", "?", ">", "path", "=", "pathCache", ".", "get"...
Create an alias instance for the given class and variable name @param <A> @param cl type for alias @param var variable name for the underlying expression @return alias instance
[ "Create", "an", "alias", "instance", "for", "the", "given", "class", "and", "variable", "name" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/alias/AliasFactory.java#L108-L116
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/cluster/topology/Connections.java
Connections.addConnection
public void addConnection(RedisURI redisURI, StatefulRedisConnection<String, String> connection) { if (this.closed) { // fastpath connection.closeAsync(); return; } synchronized (this.connections) { if (this.closed) { connection.closeAsync(); return; } this.connections.put(redisURI, connection); } }
java
public void addConnection(RedisURI redisURI, StatefulRedisConnection<String, String> connection) { if (this.closed) { // fastpath connection.closeAsync(); return; } synchronized (this.connections) { if (this.closed) { connection.closeAsync(); return; } this.connections.put(redisURI, connection); } }
[ "public", "void", "addConnection", "(", "RedisURI", "redisURI", ",", "StatefulRedisConnection", "<", "String", ",", "String", ">", "connection", ")", "{", "if", "(", "this", ".", "closed", ")", "{", "// fastpath", "connection", ".", "closeAsync", "(", ")", "...
Add a connection for a {@link RedisURI} @param redisURI @param connection
[ "Add", "a", "connection", "for", "a", "{", "@link", "RedisURI", "}" ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/topology/Connections.java#L54-L70
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/cache/memory/impl/LruMemoryCache.java
LruMemoryCache.put
@Override public final boolean put(String key, Bitmap value) { if (key == null || value == null) { throw new NullPointerException("key == null || value == null"); } synchronized (this) { size += sizeOf(key, value); Bitmap previous = map.put(key, value); if (previous != null) { size -= sizeOf(key, previous); } } trimToSize(maxSize); return true; }
java
@Override public final boolean put(String key, Bitmap value) { if (key == null || value == null) { throw new NullPointerException("key == null || value == null"); } synchronized (this) { size += sizeOf(key, value); Bitmap previous = map.put(key, value); if (previous != null) { size -= sizeOf(key, previous); } } trimToSize(maxSize); return true; }
[ "@", "Override", "public", "final", "boolean", "put", "(", "String", "key", ",", "Bitmap", "value", ")", "{", "if", "(", "key", "==", "null", "||", "value", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"key == null || value == null\...
Caches {@code Bitmap} for {@code key}. The Bitmap is moved to the head of the queue.
[ "Caches", "{" ]
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/cache/memory/impl/LruMemoryCache.java#L55-L71
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/SignatureFileVerifier.java
SignatureFileVerifier.verifyTimestamp
private void verifyTimestamp(TimestampToken token, byte[] signature) throws NoSuchAlgorithmException, SignatureException { MessageDigest md = MessageDigest.getInstance(token.getHashAlgorithm().getName()); if (!Arrays.equals(token.getHashedMessage(), md.digest(signature))) { throw new SignatureException("Signature timestamp (#" + token.getSerialNumber() + ") generated on " + token.getDate() + " is inapplicable"); } if (debug != null) { debug.println(); debug.println("Detected signature timestamp (#" + token.getSerialNumber() + ") generated on " + token.getDate()); debug.println(); } }
java
private void verifyTimestamp(TimestampToken token, byte[] signature) throws NoSuchAlgorithmException, SignatureException { MessageDigest md = MessageDigest.getInstance(token.getHashAlgorithm().getName()); if (!Arrays.equals(token.getHashedMessage(), md.digest(signature))) { throw new SignatureException("Signature timestamp (#" + token.getSerialNumber() + ") generated on " + token.getDate() + " is inapplicable"); } if (debug != null) { debug.println(); debug.println("Detected signature timestamp (#" + token.getSerialNumber() + ") generated on " + token.getDate()); debug.println(); } }
[ "private", "void", "verifyTimestamp", "(", "TimestampToken", "token", ",", "byte", "[", "]", "signature", ")", "throws", "NoSuchAlgorithmException", ",", "SignatureException", "{", "MessageDigest", "md", "=", "MessageDigest", ".", "getInstance", "(", "token", ".", ...
/* Check that the signature timestamp applies to this signature. Match the hash present in the signature timestamp token against the hash of this signature.
[ "/", "*", "Check", "that", "the", "signature", "timestamp", "applies", "to", "this", "signature", ".", "Match", "the", "hash", "present", "in", "the", "signature", "timestamp", "token", "against", "the", "hash", "of", "this", "signature", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/SignatureFileVerifier.java#L566-L584
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
ConstantsSummaryBuilder.buildConstantSummaries
public void buildConstantSummaries(XMLNode node, Content contentTree) { printedPackageHeaders = new HashSet<>(); Content summariesTree = writer.getConstantSummaries(); for (PackageDoc aPackage : configuration.packages) { if (hasConstantField(aPackage)) { currentPackage = aPackage; //Build the documentation for the current package. buildChildren(node, summariesTree); first = false; } } writer.addConstantSummaries(contentTree, summariesTree); }
java
public void buildConstantSummaries(XMLNode node, Content contentTree) { printedPackageHeaders = new HashSet<>(); Content summariesTree = writer.getConstantSummaries(); for (PackageDoc aPackage : configuration.packages) { if (hasConstantField(aPackage)) { currentPackage = aPackage; //Build the documentation for the current package. buildChildren(node, summariesTree); first = false; } } writer.addConstantSummaries(contentTree, summariesTree); }
[ "public", "void", "buildConstantSummaries", "(", "XMLNode", "node", ",", "Content", "contentTree", ")", "{", "printedPackageHeaders", "=", "new", "HashSet", "<>", "(", ")", ";", "Content", "summariesTree", "=", "writer", ".", "getConstantSummaries", "(", ")", ";...
Build the summary for each documented package. @param node the XML element that specifies which components to document @param contentTree the tree to which the summaries will be added
[ "Build", "the", "summary", "for", "each", "documented", "package", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java#L177-L189
google/closure-templates
java/src/com/google/template/soy/jssrc/dsl/CodeChunkUtils.java
CodeChunkUtils.checkId
static void checkId(String id) { if (!ID.matcher(id).matches()) { throw new IllegalArgumentException(String.format("not a valid js identifier: %s", id)); } }
java
static void checkId(String id) { if (!ID.matcher(id).matches()) { throw new IllegalArgumentException(String.format("not a valid js identifier: %s", id)); } }
[ "static", "void", "checkId", "(", "String", "id", ")", "{", "if", "(", "!", "ID", ".", "matcher", "(", "id", ")", ".", "matches", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"not a valid js identif...
Validates that the given string is a valid javascript identifier.
[ "Validates", "that", "the", "given", "string", "is", "a", "valid", "javascript", "identifier", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/dsl/CodeChunkUtils.java#L44-L48
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/syncer/Syncer.java
Syncer.getFieldIndexes
private int getFieldIndexes(ISyncHandler<?, ? extends ISyncableData> handler, String... syncNames) { int indexes = 0; for (String str : syncNames) { ObjectData od = handler.getObjectData(str); if (od != null) indexes |= 1 << od.getIndex(); } return indexes; }
java
private int getFieldIndexes(ISyncHandler<?, ? extends ISyncableData> handler, String... syncNames) { int indexes = 0; for (String str : syncNames) { ObjectData od = handler.getObjectData(str); if (od != null) indexes |= 1 << od.getIndex(); } return indexes; }
[ "private", "int", "getFieldIndexes", "(", "ISyncHandler", "<", "?", ",", "?", "extends", "ISyncableData", ">", "handler", ",", "String", "...", "syncNames", ")", "{", "int", "indexes", "=", "0", ";", "for", "(", "String", "str", ":", "syncNames", ")", "{...
Gets the indexes of the sync fields into a single integer. @param handler the handler @param syncNames the sync names @return the field indexes
[ "Gets", "the", "indexes", "of", "the", "sync", "fields", "into", "a", "single", "integer", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/syncer/Syncer.java#L253-L263
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesStrategy.java
HystrixPropertiesStrategy.getCollapserProperties
public HystrixCollapserProperties getCollapserProperties(HystrixCollapserKey collapserKey, HystrixCollapserProperties.Setter builder) { return new HystrixPropertiesCollapserDefault(collapserKey, builder); }
java
public HystrixCollapserProperties getCollapserProperties(HystrixCollapserKey collapserKey, HystrixCollapserProperties.Setter builder) { return new HystrixPropertiesCollapserDefault(collapserKey, builder); }
[ "public", "HystrixCollapserProperties", "getCollapserProperties", "(", "HystrixCollapserKey", "collapserKey", ",", "HystrixCollapserProperties", ".", "Setter", "builder", ")", "{", "return", "new", "HystrixPropertiesCollapserDefault", "(", "collapserKey", ",", "builder", ")",...
Construct an implementation of {@link HystrixCollapserProperties} for {@link HystrixCollapser} instances with {@link HystrixCollapserKey}. <p> <b>Default Implementation</b> <p> Constructs instance of {@link HystrixPropertiesCollapserDefault}. @param collapserKey {@link HystrixCollapserKey} representing the name or type of {@link HystrixCollapser} @param builder {@link com.netflix.hystrix.HystrixCollapserProperties.Setter} with default overrides as injected to the {@link HystrixCollapser} implementation. <p> The builder will return NULL for each value if no override was provided. @return Implementation of {@link HystrixCollapserProperties}
[ "Construct", "an", "implementation", "of", "{", "@link", "HystrixCollapserProperties", "}", "for", "{", "@link", "HystrixCollapser", "}", "instances", "with", "{", "@link", "HystrixCollapserKey", "}", ".", "<p", ">", "<b", ">", "Default", "Implementation<", "/", ...
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/properties/HystrixPropertiesStrategy.java#L131-L133
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ObjectUtils.java
ObjectUtils.isNullOrEqualTo
@NullSafe public static boolean isNullOrEqualTo(Object obj1, Object obj2) { return obj1 == null || obj1.equals(obj2); }
java
@NullSafe public static boolean isNullOrEqualTo(Object obj1, Object obj2) { return obj1 == null || obj1.equals(obj2); }
[ "@", "NullSafe", "public", "static", "boolean", "isNullOrEqualTo", "(", "Object", "obj1", ",", "Object", "obj2", ")", "{", "return", "obj1", "==", "null", "||", "obj1", ".", "equals", "(", "obj2", ")", ";", "}" ]
Determines whether {@code obj1} is {@literal null} or equal to {@code obj2}. @param obj1 {@link Object} being evaluated in the equality comparison. @param obj2 {@link Object} to compare for equality with {@code obj1} if {@code obj1} is not {@literal null}. @return a boolean value indicating whether {@code obj1} is {@literal null} or equal to {@code obj2}. @see java.lang.Object#equals(Object)
[ "Determines", "whether", "{", "@code", "obj1", "}", "is", "{", "@literal", "null", "}", "or", "equal", "to", "{", "@code", "obj2", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ObjectUtils.java#L281-L284
ical4j/ical4j
src/main/java/net/fortuna/ical4j/util/Dates.java
Dates.getInstance
public static Date getInstance(final java.util.Date date, final Value type) { if (Value.DATE.equals(type)) { return new Date(date); } return new DateTime(date); }
java
public static Date getInstance(final java.util.Date date, final Value type) { if (Value.DATE.equals(type)) { return new Date(date); } return new DateTime(date); }
[ "public", "static", "Date", "getInstance", "(", "final", "java", ".", "util", ".", "Date", "date", ",", "final", "Value", "type", ")", "{", "if", "(", "Value", ".", "DATE", ".", "equals", "(", "type", ")", ")", "{", "return", "new", "Date", "(", "d...
Returns a new date instance of the specified type. If no type is specified a DateTime instance is returned. @param date a seed Java date instance @param type the type of date instance @return an instance of <code>net.fortuna.ical4j.model.Date</code>
[ "Returns", "a", "new", "date", "instance", "of", "the", "specified", "type", ".", "If", "no", "type", "is", "specified", "a", "DateTime", "instance", "is", "returned", "." ]
train
https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/util/Dates.java#L220-L225