repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/NLS.java
NLS.objectsToString
String objectsToString(String key, Object objects) { java.io.StringWriter stringWriter = new java.io.StringWriter(); stringWriter.write(key); stringWriter.write(":"); if (objects == null) { stringWriter.write("\n"); } else if (objects instanceof Object[]) { for (int i = 0; i < ((Object[]) objects).length; i++) { Object object = ((Object[]) objects)[i]; if (object == null) stringWriter.write("null\n"); else { stringWriter.write(((Object[]) objects)[i].toString()); stringWriter.write("\n"); } } } else { stringWriter.write(objects.toString()); stringWriter.write("\n"); } return stringWriter.toString(); }
java
String objectsToString(String key, Object objects) { java.io.StringWriter stringWriter = new java.io.StringWriter(); stringWriter.write(key); stringWriter.write(":"); if (objects == null) { stringWriter.write("\n"); } else if (objects instanceof Object[]) { for (int i = 0; i < ((Object[]) objects).length; i++) { Object object = ((Object[]) objects)[i]; if (object == null) stringWriter.write("null\n"); else { stringWriter.write(((Object[]) objects)[i].toString()); stringWriter.write("\n"); } } } else { stringWriter.write(objects.toString()); stringWriter.write("\n"); } return stringWriter.toString(); }
[ "String", "objectsToString", "(", "String", "key", ",", "Object", "objects", ")", "{", "java", ".", "io", ".", "StringWriter", "stringWriter", "=", "new", "java", ".", "io", ".", "StringWriter", "(", ")", ";", "stringWriter", ".", "write", "(", "key", ")...
Create a simple default formatted string. @param key which would look up the message in a resource bundle. @param objects which would be inserted into the message. @return String the formatted String.
[ "Create", "a", "simple", "default", "formatted", "string", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/objectManager/utils/NLS.java#L84-L109
softindex/datakernel
core-eventloop/src/main/java/io/datakernel/jmx/ValueStats.java
ValueStats.binarySearch
private static int binarySearch(int[] arr, int value) { int found = 0; int left = 0; int right = arr.length - 1; while (left < right) { if (right - left == 1) { found = value < arr[left] ? left : right; break; } int middle = left + (right - left) / 2; if (value < arr[middle]) { right = middle; } else { left = middle; } } return found; }
java
private static int binarySearch(int[] arr, int value) { int found = 0; int left = 0; int right = arr.length - 1; while (left < right) { if (right - left == 1) { found = value < arr[left] ? left : right; break; } int middle = left + (right - left) / 2; if (value < arr[middle]) { right = middle; } else { left = middle; } } return found; }
[ "private", "static", "int", "binarySearch", "(", "int", "[", "]", "arr", ",", "int", "value", ")", "{", "int", "found", "=", "0", ";", "int", "left", "=", "0", ";", "int", "right", "=", "arr", ".", "length", "-", "1", ";", "while", "(", "left", ...
return index of smallest element that is greater than "value"
[ "return", "index", "of", "smallest", "element", "that", "is", "greater", "than", "value" ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/core-eventloop/src/main/java/io/datakernel/jmx/ValueStats.java#L344-L362
jenkinsci/jenkins
core/src/main/java/jenkins/model/PeepholePermalink.java
PeepholePermalink.updateCache
protected void updateCache(@Nonnull Job<?,?> job, @Nullable Run<?,?> b) { final int n = b==null ? RESOLVES_TO_NONE : b.getNumber(); File cache = getPermalinkFile(job); cache.getParentFile().mkdirs(); try { String target = String.valueOf(n); if (b != null && !new File(job.getBuildDir(), target).exists()) { // (re)create the build Number->Id symlink Util.createSymlink(job.getBuildDir(),b.getId(),target,TaskListener.NULL); } writeSymlink(cache, target); } catch (IOException | InterruptedException e) { LOGGER.log(Level.WARNING, "Failed to update "+job+" "+getId()+" permalink for " + b, e); cache.delete(); } }
java
protected void updateCache(@Nonnull Job<?,?> job, @Nullable Run<?,?> b) { final int n = b==null ? RESOLVES_TO_NONE : b.getNumber(); File cache = getPermalinkFile(job); cache.getParentFile().mkdirs(); try { String target = String.valueOf(n); if (b != null && !new File(job.getBuildDir(), target).exists()) { // (re)create the build Number->Id symlink Util.createSymlink(job.getBuildDir(),b.getId(),target,TaskListener.NULL); } writeSymlink(cache, target); } catch (IOException | InterruptedException e) { LOGGER.log(Level.WARNING, "Failed to update "+job+" "+getId()+" permalink for " + b, e); cache.delete(); } }
[ "protected", "void", "updateCache", "(", "@", "Nonnull", "Job", "<", "?", ",", "?", ">", "job", ",", "@", "Nullable", "Run", "<", "?", ",", "?", ">", "b", ")", "{", "final", "int", "n", "=", "b", "==", "null", "?", "RESOLVES_TO_NONE", ":", "b", ...
Remembers the value 'n' in the cache for future {@link #resolve(Job)}.
[ "Remembers", "the", "value", "n", "in", "the", "cache", "for", "future", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/PeepholePermalink.java#L138-L155
davidmoten/rxjava-extras
src/main/java/com/github/davidmoten/rx/Transformers.java
Transformers.orderedMergeWith
public static final <T> Transformer<T, T> orderedMergeWith(final Observable<T> other, final Comparator<? super T> comparator) { @SuppressWarnings("unchecked") Collection<Observable<T>> collection = Arrays.asList(other); return orderedMergeWith(collection, comparator); }
java
public static final <T> Transformer<T, T> orderedMergeWith(final Observable<T> other, final Comparator<? super T> comparator) { @SuppressWarnings("unchecked") Collection<Observable<T>> collection = Arrays.asList(other); return orderedMergeWith(collection, comparator); }
[ "public", "static", "final", "<", "T", ">", "Transformer", "<", "T", ",", "T", ">", "orderedMergeWith", "(", "final", "Observable", "<", "T", ">", "other", ",", "final", "Comparator", "<", "?", "super", "T", ">", "comparator", ")", "{", "@", "SuppressW...
<p> Returns the source {@link Observable} merged with the <code>other</code> observable using the given {@link Comparator} for order. A precondition is that the source and other are already ordered. This transformer supports backpressure and its inputs must also support backpressure. <p> <img src= "https://github.com/davidmoten/rxjava-extras/blob/master/src/docs/orderedMerge.png?raw=true" alt="marble diagram"> @param other the other already ordered observable @param comparator the ordering to use @param <T> the generic type of the objects being compared @return merged and ordered observable
[ "<p", ">", "Returns", "the", "source", "{", "@link", "Observable", "}", "merged", "with", "the", "<code", ">", "other<", "/", "code", ">", "observable", "using", "the", "given", "{", "@link", "Comparator", "}", "for", "order", ".", "A", "precondition", "...
train
https://github.com/davidmoten/rxjava-extras/blob/a91d2ba7d454843250e0b0fce36084f9fb02a551/src/main/java/com/github/davidmoten/rx/Transformers.java#L334-L339
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/reflection/EntityClassReader.java
EntityClassReader.getPropertyType
public Class getPropertyType(String propertyPath) { if (propertyPath == null) { throw new IllegalArgumentException("Propertyname may not be null"); } StringTokenizer tokenizer = new StringTokenizer(propertyPath, ".", false); return getPropertyType(tokenizer); }
java
public Class getPropertyType(String propertyPath) { if (propertyPath == null) { throw new IllegalArgumentException("Propertyname may not be null"); } StringTokenizer tokenizer = new StringTokenizer(propertyPath, ".", false); return getPropertyType(tokenizer); }
[ "public", "Class", "getPropertyType", "(", "String", "propertyPath", ")", "{", "if", "(", "propertyPath", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Propertyname may not be null\"", ")", ";", "}", "StringTokenizer", "tokenizer", "=",...
Retrieves the type of the given property path. @param propertyPath The dot-separated path of the property type to retrieve. E.g. directly property: "name", sub property: "streetAddress.number" @return the type of the property with the given name or null if the propertyName is not a property of the class managed by this reader. @throws IllegalArgumentException if propertyName is null.
[ "Retrieves", "the", "type", "of", "the", "given", "property", "path", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/reflection/EntityClassReader.java#L370-L378
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PoseFromPairLinear6.java
PoseFromPairLinear6.processHomogenous
public boolean processHomogenous( List<AssociatedPair> observations , List<Point4D_F64> locations ) { if( observations.size() != locations.size() ) throw new IllegalArgumentException("Number of observations and locations must match."); if( observations.size() < 6 ) throw new IllegalArgumentException("At least (if not more than) six points are required."); setupHomogenousA(observations,locations); if( !solveNullspace.process(A,1,P)) return false; P.numRows = 3; P.numCols = 4; return true; }
java
public boolean processHomogenous( List<AssociatedPair> observations , List<Point4D_F64> locations ) { if( observations.size() != locations.size() ) throw new IllegalArgumentException("Number of observations and locations must match."); if( observations.size() < 6 ) throw new IllegalArgumentException("At least (if not more than) six points are required."); setupHomogenousA(observations,locations); if( !solveNullspace.process(A,1,P)) return false; P.numRows = 3; P.numCols = 4; return true; }
[ "public", "boolean", "processHomogenous", "(", "List", "<", "AssociatedPair", ">", "observations", ",", "List", "<", "Point4D_F64", ">", "locations", ")", "{", "if", "(", "observations", ".", "size", "(", ")", "!=", "locations", ".", "size", "(", ")", ")",...
Computes the transformation between two camera frames using a linear equation. Both the observed feature locations in each camera image and the depth (z-coordinate) of each feature must be known. Feature locations are in calibrated image coordinates. @param observations List of observations on the image plane in calibrated coordinates. @param locations List of object locations in homogenous coordinates. One for each observation pair.
[ "Computes", "the", "transformation", "between", "two", "camera", "frames", "using", "a", "linear", "equation", ".", "Both", "the", "observed", "feature", "locations", "in", "each", "camera", "image", "and", "the", "depth", "(", "z", "-", "coordinate", ")", "...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/PoseFromPairLinear6.java#L105-L121
vst/commons-math-extensions
src/main/java/com/vsthost/rnd/commons/math/ext/linear/EMatrixUtils.java
EMatrixUtils.rbrMultiply
public static RealMatrix rbrMultiply(RealMatrix matrix, RealVector vector) { // Define the return value: RealMatrix retval = MatrixUtils.createRealMatrix(matrix.getRowDimension(), matrix.getColumnDimension()); // Iterate over rows: for (int i = 0; i < retval.getRowDimension(); i++) { retval.setRowVector(i, matrix.getRowVector(i).ebeMultiply(vector)); } // Done, return: return retval; }
java
public static RealMatrix rbrMultiply(RealMatrix matrix, RealVector vector) { // Define the return value: RealMatrix retval = MatrixUtils.createRealMatrix(matrix.getRowDimension(), matrix.getColumnDimension()); // Iterate over rows: for (int i = 0; i < retval.getRowDimension(); i++) { retval.setRowVector(i, matrix.getRowVector(i).ebeMultiply(vector)); } // Done, return: return retval; }
[ "public", "static", "RealMatrix", "rbrMultiply", "(", "RealMatrix", "matrix", ",", "RealVector", "vector", ")", "{", "// Define the return value:", "RealMatrix", "retval", "=", "MatrixUtils", ".", "createRealMatrix", "(", "matrix", ".", "getRowDimension", "(", ")", ...
Multiplies the matrix' rows using the vector element-by-element. @param matrix The input matrix. @param vector The vector which will be used to multiply rows of the matrix element-by-element. @return The new matrix of which rows are multiplied with the vector element-by-element.
[ "Multiplies", "the", "matrix", "rows", "using", "the", "vector", "element", "-", "by", "-", "element", "." ]
train
https://github.com/vst/commons-math-extensions/blob/a11ee78ffe53ab7c016062be93c5af07aa8e1823/src/main/java/com/vsthost/rnd/commons/math/ext/linear/EMatrixUtils.java#L265-L276
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/derivative/GradientReduceToSingle.java
GradientReduceToSingle.maxf
public static void maxf(Planar<GrayF32> inX , Planar<GrayF32> inY , GrayF32 outX , GrayF32 outY ) { // input and output should be the same shape InputSanityCheck.checkSameShape(inX,inY); InputSanityCheck.reshapeOneIn(inX,outX,outY); // make sure that the pixel index is the same InputSanityCheck.checkIndexing(inX,inY); InputSanityCheck.checkIndexing(outX,outY); for (int y = 0; y < inX.height; y++) { int indexIn = inX.startIndex + inX.stride*y; int indexOut = outX.startIndex + outX.stride*y; for (int x = 0; x < inX.width; x++, indexIn++, indexOut++ ) { float maxValueX = inX.bands[0].data[indexIn]; float maxValueY = inY.bands[0].data[indexIn]; float maxNorm = maxValueX*maxValueX + maxValueY*maxValueY; for (int band = 1; band < inX.bands.length; band++) { float valueX = inX.bands[band].data[indexIn]; float valueY = inY.bands[band].data[indexIn]; float n = valueX*valueX + valueY*valueY; if( n > maxNorm ) { maxNorm = n; maxValueX = valueX; maxValueY = valueY; } } outX.data[indexOut] = maxValueX; outY.data[indexOut] = maxValueY; } } }
java
public static void maxf(Planar<GrayF32> inX , Planar<GrayF32> inY , GrayF32 outX , GrayF32 outY ) { // input and output should be the same shape InputSanityCheck.checkSameShape(inX,inY); InputSanityCheck.reshapeOneIn(inX,outX,outY); // make sure that the pixel index is the same InputSanityCheck.checkIndexing(inX,inY); InputSanityCheck.checkIndexing(outX,outY); for (int y = 0; y < inX.height; y++) { int indexIn = inX.startIndex + inX.stride*y; int indexOut = outX.startIndex + outX.stride*y; for (int x = 0; x < inX.width; x++, indexIn++, indexOut++ ) { float maxValueX = inX.bands[0].data[indexIn]; float maxValueY = inY.bands[0].data[indexIn]; float maxNorm = maxValueX*maxValueX + maxValueY*maxValueY; for (int band = 1; band < inX.bands.length; band++) { float valueX = inX.bands[band].data[indexIn]; float valueY = inY.bands[band].data[indexIn]; float n = valueX*valueX + valueY*valueY; if( n > maxNorm ) { maxNorm = n; maxValueX = valueX; maxValueY = valueY; } } outX.data[indexOut] = maxValueX; outY.data[indexOut] = maxValueY; } } }
[ "public", "static", "void", "maxf", "(", "Planar", "<", "GrayF32", ">", "inX", ",", "Planar", "<", "GrayF32", ">", "inY", ",", "GrayF32", "outX", ",", "GrayF32", "outY", ")", "{", "// input and output should be the same shape", "InputSanityCheck", ".", "checkSam...
Reduces the number of bands by selecting the band with the largest Frobenius norm and using its gradient to be the output gradient on a pixel-by-pixel basis @param inX Input gradient X @param inY Input gradient Y @param outX Output gradient X @param outY Output gradient Y
[ "Reduces", "the", "number", "of", "bands", "by", "selecting", "the", "band", "with", "the", "largest", "Frobenius", "norm", "and", "using", "its", "gradient", "to", "be", "the", "output", "gradient", "on", "a", "pixel", "-", "by", "-", "pixel", "basis" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/derivative/GradientReduceToSingle.java#L42-L77
di2e/Argo
clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java
CLIContext.getBoolean
public boolean getBoolean(String key, boolean defaultValue) { Object o = getObject(key); if (o == null) { return defaultValue; } boolean b = defaultValue; try { b = Boolean.parseBoolean(o.toString()); } catch (Exception e) { throw new IllegalArgumentException("Object ["+o+"] associated with key ["+key+"] is not of type Boolean."); } return b; }
java
public boolean getBoolean(String key, boolean defaultValue) { Object o = getObject(key); if (o == null) { return defaultValue; } boolean b = defaultValue; try { b = Boolean.parseBoolean(o.toString()); } catch (Exception e) { throw new IllegalArgumentException("Object ["+o+"] associated with key ["+key+"] is not of type Boolean."); } return b; }
[ "public", "boolean", "getBoolean", "(", "String", "key", ",", "boolean", "defaultValue", ")", "{", "Object", "o", "=", "getObject", "(", "key", ")", ";", "if", "(", "o", "==", "null", ")", "{", "return", "defaultValue", ";", "}", "boolean", "b", "=", ...
Get the boolean value, or the defaultValue if not found. @param key The key to search for. @param defaultValue the default value @return The value, or defaultValue if not found.
[ "Get", "the", "boolean", "value", "or", "the", "defaultValue", "if", "not", "found", "." ]
train
https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java#L182-L195
FitLayout/tools
src/main/java/org/fit/layout/process/ScriptableProcessor.java
ScriptableProcessor.drawToImageWithAreas
public void drawToImageWithAreas(String path, String areaNames) { try { ImageOutputDisplay disp = new ImageOutputDisplay(getPage().getWidth(), getPage().getHeight()); disp.drawPage(getPage()); showAreas(disp, getAreaTree().getRoot(), areaNames); disp.saveTo(path); } catch (IOException e) { log.error("Couldn't write to " + path + ": " + e.getMessage()); } }
java
public void drawToImageWithAreas(String path, String areaNames) { try { ImageOutputDisplay disp = new ImageOutputDisplay(getPage().getWidth(), getPage().getHeight()); disp.drawPage(getPage()); showAreas(disp, getAreaTree().getRoot(), areaNames); disp.saveTo(path); } catch (IOException e) { log.error("Couldn't write to " + path + ": " + e.getMessage()); } }
[ "public", "void", "drawToImageWithAreas", "(", "String", "path", ",", "String", "areaNames", ")", "{", "try", "{", "ImageOutputDisplay", "disp", "=", "new", "ImageOutputDisplay", "(", "getPage", "(", ")", ".", "getWidth", "(", ")", ",", "getPage", "(", ")", ...
Draws the page to an image file and marks selected areas in the image. @param path The path to the destination image file. @param areaNames A substring of the names of areas that should be marked in the image. When set to {@code null}, all the areas are marked.
[ "Draws", "the", "page", "to", "an", "image", "file", "and", "marks", "selected", "areas", "in", "the", "image", "." ]
train
https://github.com/FitLayout/tools/blob/43a8e3f4ddf21a031d3ab7247b8d37310bda4856/src/main/java/org/fit/layout/process/ScriptableProcessor.java#L204-L215
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java
ElementsExceptionsFactory.newAssertionException
public static AssertionException newAssertionException(Throwable cause, String message, Object... args) { return new AssertionException(format(message, args), cause); }
java
public static AssertionException newAssertionException(Throwable cause, String message, Object... args) { return new AssertionException(format(message, args), cause); }
[ "public", "static", "AssertionException", "newAssertionException", "(", "Throwable", "cause", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "new", "AssertionException", "(", "format", "(", "message", ",", "args", ")", ",", "cause", ...
Constructs and initializes a new {@link AssertionException} with the given {@link Throwable cause} and {@link String message} formatted with the given {@link Object[] arguments}. @param cause {@link Throwable} identified as the reason this {@link AssertionException} was thrown. @param message {@link String} describing the {@link AssertionException exception}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link AssertionException} with the given {@link Throwable cause} and {@link String message}. @see org.cp.elements.lang.AssertionException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "AssertionException", "}", "with", "the", "given", "{", "@link", "Throwable", "cause", "}", "and", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Objec...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L257-L259
ironjacamar/ironjacamar
deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java
AbstractResourceAdapterDeployer.findManagedConnectionFactory
private String findManagedConnectionFactory(String className, Connector connector) { for (org.ironjacamar.common.api.metadata.spec.ConnectionDefinition cd : connector.getResourceadapter().getOutboundResourceadapter().getConnectionDefinitions()) { if (className.equals(cd.getManagedConnectionFactoryClass().getValue()) || className.equals(cd.getConnectionFactoryInterface().getValue())) return cd.getManagedConnectionFactoryClass().getValue(); } return className; }
java
private String findManagedConnectionFactory(String className, Connector connector) { for (org.ironjacamar.common.api.metadata.spec.ConnectionDefinition cd : connector.getResourceadapter().getOutboundResourceadapter().getConnectionDefinitions()) { if (className.equals(cd.getManagedConnectionFactoryClass().getValue()) || className.equals(cd.getConnectionFactoryInterface().getValue())) return cd.getManagedConnectionFactoryClass().getValue(); } return className; }
[ "private", "String", "findManagedConnectionFactory", "(", "String", "className", ",", "Connector", "connector", ")", "{", "for", "(", "org", ".", "ironjacamar", ".", "common", ".", "api", ".", "metadata", ".", "spec", ".", "ConnectionDefinition", "cd", ":", "c...
Find the ManagedConnectionFactory class @param className The initial class name @param connector The metadata @return The ManagedConnectionFactory
[ "Find", "the", "ManagedConnectionFactory", "class" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java#L654-L664
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/MapServiceContextImpl.java
MapServiceContextImpl.destroyPartitionsAndMapContainer
private void destroyPartitionsAndMapContainer(MapContainer mapContainer) { final List<LocalRetryableExecution> executions = new ArrayList<>(); for (PartitionContainer container : partitionContainers) { final MapPartitionDestroyOperation op = new MapPartitionDestroyOperation(container, mapContainer); executions.add(InvocationUtil.executeLocallyWithRetry(nodeEngine, op)); } for (LocalRetryableExecution execution : executions) { try { if (!execution.awaitCompletion(DESTROY_TIMEOUT_SECONDS, TimeUnit.SECONDS)) { logger.warning("Map partition was not destroyed in expected time, possible leak"); } } catch (InterruptedException e) { currentThread().interrupt(); nodeEngine.getLogger(getClass()).warning(e); } } }
java
private void destroyPartitionsAndMapContainer(MapContainer mapContainer) { final List<LocalRetryableExecution> executions = new ArrayList<>(); for (PartitionContainer container : partitionContainers) { final MapPartitionDestroyOperation op = new MapPartitionDestroyOperation(container, mapContainer); executions.add(InvocationUtil.executeLocallyWithRetry(nodeEngine, op)); } for (LocalRetryableExecution execution : executions) { try { if (!execution.awaitCompletion(DESTROY_TIMEOUT_SECONDS, TimeUnit.SECONDS)) { logger.warning("Map partition was not destroyed in expected time, possible leak"); } } catch (InterruptedException e) { currentThread().interrupt(); nodeEngine.getLogger(getClass()).warning(e); } } }
[ "private", "void", "destroyPartitionsAndMapContainer", "(", "MapContainer", "mapContainer", ")", "{", "final", "List", "<", "LocalRetryableExecution", ">", "executions", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "PartitionContainer", "container", ":"...
Destroys the map data on local partition threads and waits for {@value #DESTROY_TIMEOUT_SECONDS} seconds for each partition segment destruction to complete. @param mapContainer the map container to destroy
[ "Destroys", "the", "map", "data", "on", "local", "partition", "threads", "and", "waits", "for", "{", "@value", "#DESTROY_TIMEOUT_SECONDS", "}", "seconds", "for", "each", "partition", "segment", "destruction", "to", "complete", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/MapServiceContextImpl.java#L412-L430
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java
CPOptionPersistenceImpl.findAll
@Override public List<CPOption> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CPOption> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CPOption", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp options. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPOptionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of cp options @param end the upper bound of the range of cp options (not inclusive) @return the range of cp options
[ "Returns", "a", "range", "of", "all", "the", "cp", "options", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L3170-L3173
m-m-m/util
datatype/src/main/java/net/sf/mmm/util/datatype/api/phone/PhoneCountryCode.java
PhoneCountryCode.parseCountryCode
private static int parseCountryCode(String countryCode) { String normalized = countryCode; if (normalized.startsWith(InternationalCallPrefix.PREFIX_PLUS)) { normalized = normalized.substring(1); } else if (normalized.startsWith(InternationalCallPrefix.PREFIX_00)) { normalized = normalized.substring(2); } else if (normalized.startsWith(InternationalCallPrefix.PREFIX_011)) { normalized = normalized.substring(3); } if (normalized.startsWith("0")) { throw new IllegalArgumentException(countryCode); } try { int cc = Integer.parseInt(normalized); return cc; } catch (NumberFormatException e) { throw new IllegalArgumentException(countryCode, e); } }
java
private static int parseCountryCode(String countryCode) { String normalized = countryCode; if (normalized.startsWith(InternationalCallPrefix.PREFIX_PLUS)) { normalized = normalized.substring(1); } else if (normalized.startsWith(InternationalCallPrefix.PREFIX_00)) { normalized = normalized.substring(2); } else if (normalized.startsWith(InternationalCallPrefix.PREFIX_011)) { normalized = normalized.substring(3); } if (normalized.startsWith("0")) { throw new IllegalArgumentException(countryCode); } try { int cc = Integer.parseInt(normalized); return cc; } catch (NumberFormatException e) { throw new IllegalArgumentException(countryCode, e); } }
[ "private", "static", "int", "parseCountryCode", "(", "String", "countryCode", ")", "{", "String", "normalized", "=", "countryCode", ";", "if", "(", "normalized", ".", "startsWith", "(", "InternationalCallPrefix", ".", "PREFIX_PLUS", ")", ")", "{", "normalized", ...
This method parses a {@link PhoneCountryCode} given as {@link String} to its {@link #getCountryCode() int representation}. @param countryCode is the {@link PhoneCountryCode} as {@link String}. @return the {@link PhoneCountryCode} as int.
[ "This", "method", "parses", "a", "{", "@link", "PhoneCountryCode", "}", "given", "as", "{", "@link", "String", "}", "to", "its", "{", "@link", "#getCountryCode", "()", "int", "representation", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/datatype/src/main/java/net/sf/mmm/util/datatype/api/phone/PhoneCountryCode.java#L68-L87
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java
ArrayFunctions.arrayContains
public static Expression arrayContains(JsonArray array, Expression value) { return arrayContains(x(array), value); }
java
public static Expression arrayContains(JsonArray array, Expression value) { return arrayContains(x(array), value); }
[ "public", "static", "Expression", "arrayContains", "(", "JsonArray", "array", ",", "Expression", "value", ")", "{", "return", "arrayContains", "(", "x", "(", "array", ")", ",", "value", ")", ";", "}" ]
Returned expression results in true if the array contains value.
[ "Returned", "expression", "results", "in", "true", "if", "the", "array", "contains", "value", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L125-L127
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java
SeleniumDriverSetup.connectToDriverForAt
public boolean connectToDriverForAt(String browser, String url) throws MalformedURLException { return connectToDriverForVersionOnAt(browser, "", Platform.ANY.name(), url); }
java
public boolean connectToDriverForAt(String browser, String url) throws MalformedURLException { return connectToDriverForVersionOnAt(browser, "", Platform.ANY.name(), url); }
[ "public", "boolean", "connectToDriverForAt", "(", "String", "browser", ",", "String", "url", ")", "throws", "MalformedURLException", "{", "return", "connectToDriverForVersionOnAt", "(", "browser", ",", "\"\"", ",", "Platform", ".", "ANY", ".", "name", "(", ")", ...
Connects SeleniumHelper to a remote web driver, without specifying browser version. @param browser name of browser to connect to. @param url url to connect to browser. @return true. @throws MalformedURLException if supplied url can not be transformed to URL.
[ "Connects", "SeleniumHelper", "to", "a", "remote", "web", "driver", "without", "specifying", "browser", "version", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java#L111-L114
roboconf/roboconf-platform
core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java
DockerUtils.findImageByIdOrByTag
public static Image findImageByIdOrByTag( String name, DockerClient dockerClient ) { Image image = null; if( ! Utils.isEmptyOrWhitespaces( name )) { Logger logger = Logger.getLogger( DockerUtils.class.getName()); List<Image> images = dockerClient.listImagesCmd().exec(); if(( image = DockerUtils.findImageById( name, images )) != null ) logger.fine( "Found a Docker image with ID " + name ); else if(( image = DockerUtils.findImageByTag( name, images )) != null ) logger.fine( "Found a Docker image with tag " + name ); } return image; }
java
public static Image findImageByIdOrByTag( String name, DockerClient dockerClient ) { Image image = null; if( ! Utils.isEmptyOrWhitespaces( name )) { Logger logger = Logger.getLogger( DockerUtils.class.getName()); List<Image> images = dockerClient.listImagesCmd().exec(); if(( image = DockerUtils.findImageById( name, images )) != null ) logger.fine( "Found a Docker image with ID " + name ); else if(( image = DockerUtils.findImageByTag( name, images )) != null ) logger.fine( "Found a Docker image with tag " + name ); } return image; }
[ "public", "static", "Image", "findImageByIdOrByTag", "(", "String", "name", ",", "DockerClient", "dockerClient", ")", "{", "Image", "image", "=", "null", ";", "if", "(", "!", "Utils", ".", "isEmptyOrWhitespaces", "(", "name", ")", ")", "{", "Logger", "logger...
Finds an image by ID or by tag. @param name an image ID or a tag name (can be null) @param dockerClient a Docker client (not null) @return an image, or null if none matched
[ "Finds", "an", "image", "by", "ID", "or", "by", "tag", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java#L118-L132
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java
Journal.syncLog
File syncLog(long stamp, final long startTxId, final URL url, String name, File tmpFile) throws IOException { final File[] localPaths = new File[] { tmpFile }; // TODO add security if needed. LOG.info("Synchronizing log " + name + " from " + url); boolean success = false; try { TransferFsImage.doGetUrl( url, ImageSet.convertFilesToStreams(localPaths, journalStorage, url.toString()), journalStorage, true); assert tmpFile.exists(); success = true; } finally { if (!success) { if (!tmpFile.delete()) { LOG.warn("Failed to delete temporary file " + tmpFile); } } } return tmpFile; }
java
File syncLog(long stamp, final long startTxId, final URL url, String name, File tmpFile) throws IOException { final File[] localPaths = new File[] { tmpFile }; // TODO add security if needed. LOG.info("Synchronizing log " + name + " from " + url); boolean success = false; try { TransferFsImage.doGetUrl( url, ImageSet.convertFilesToStreams(localPaths, journalStorage, url.toString()), journalStorage, true); assert tmpFile.exists(); success = true; } finally { if (!success) { if (!tmpFile.delete()) { LOG.warn("Failed to delete temporary file " + tmpFile); } } } return tmpFile; }
[ "File", "syncLog", "(", "long", "stamp", ",", "final", "long", "startTxId", ",", "final", "URL", "url", ",", "String", "name", ",", "File", "tmpFile", ")", "throws", "IOException", "{", "final", "File", "[", "]", "localPaths", "=", "new", "File", "[", ...
Synchronize a log segment from another JournalNode. The log is downloaded from the provided URL into a temporary location on disk
[ "Synchronize", "a", "log", "segment", "from", "another", "JournalNode", ".", "The", "log", "is", "downloaded", "from", "the", "provided", "URL", "into", "a", "temporary", "location", "on", "disk" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/Journal.java#L1178-L1200
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java
KeyVaultCredentials.isValidChallenge
private static boolean isValidChallenge(String authenticateHeader, String authChallengePrefix) { if (authenticateHeader != null && !authenticateHeader.isEmpty() && authenticateHeader.toLowerCase().startsWith(authChallengePrefix.toLowerCase())) { return true; } return false; }
java
private static boolean isValidChallenge(String authenticateHeader, String authChallengePrefix) { if (authenticateHeader != null && !authenticateHeader.isEmpty() && authenticateHeader.toLowerCase().startsWith(authChallengePrefix.toLowerCase())) { return true; } return false; }
[ "private", "static", "boolean", "isValidChallenge", "(", "String", "authenticateHeader", ",", "String", "authChallengePrefix", ")", "{", "if", "(", "authenticateHeader", "!=", "null", "&&", "!", "authenticateHeader", ".", "isEmpty", "(", ")", "&&", "authenticateHead...
Verifies whether a challenge is bearer or not. @param authenticateHeader the authentication header containing all the challenges. @param authChallengePrefix the authentication challenge name. @return
[ "Verifies", "whether", "a", "challenge", "is", "bearer", "or", "not", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/KeyVaultCredentials.java#L258-L264
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java
CheckArg.isNotLessThan
public static void isNotLessThan( int argument, int notLessThanValue, String name ) { if (argument < notLessThanValue) { throw new IllegalArgumentException(CommonI18n.argumentMayNotBeLessThan.text(name, argument, notLessThanValue)); } }
java
public static void isNotLessThan( int argument, int notLessThanValue, String name ) { if (argument < notLessThanValue) { throw new IllegalArgumentException(CommonI18n.argumentMayNotBeLessThan.text(name, argument, notLessThanValue)); } }
[ "public", "static", "void", "isNotLessThan", "(", "int", "argument", ",", "int", "notLessThanValue", ",", "String", "name", ")", "{", "if", "(", "argument", "<", "notLessThanValue", ")", "{", "throw", "new", "IllegalArgumentException", "(", "CommonI18n", ".", ...
Check that the argument is not less than the supplied value @param argument The argument @param notLessThanValue the value that is to be used to check the value @param name The name of the argument @throws IllegalArgumentException If argument greater than or equal to the supplied vlaue
[ "Check", "that", "the", "argument", "is", "not", "less", "than", "the", "supplied", "value" ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L41-L47
petergeneric/stdlib
guice/common/src/main/java/com/peterphi/std/guice/apploader/impl/GuiceFactory.java
GuiceFactory.applyNetworkConfiguration
private static void applyNetworkConfiguration(final GuiceConfig config) { final String configEndpoint = config.get(GuiceProperties.CONFIG_ENDPOINT, null); final Boolean configSkip = config.getBoolean(GuiceProperties.CONFIG_SKIP, false); if (configEndpoint != null && !configSkip) { final boolean useMoxy = config.getBoolean(GuiceProperties.MOXY_ENABLED, true); final JAXBContextResolver jaxb = new JAXBContextResolver(new JAXBSerialiserFactory(useMoxy)); final ResteasyClientFactoryImpl clientFactory = new ResteasyClientFactoryImpl(null, null, null, jaxb); try { final ResteasyProxyClientFactoryImpl proxyFactory = new ResteasyProxyClientFactoryImpl(clientFactory, config); final ConfigRestService client = proxyFactory.getClient(ConfigRestService.class); // Set up the config path if it's not already defined // We set it in the config because otherwise the NetworkConfigReloadDaemon won't be able to load the config if (config.get(GuiceProperties.CONFIG_PATH) == null) { config.set(GuiceProperties.CONFIG_PATH, "services/" + config.get(GuiceProperties.SERVLET_CONTEXT_NAME, "unknown-service")); } // Get the config path to read final String path = config.get(GuiceProperties.CONFIG_PATH); final ConfigPropertyData data = client.read(path, config.get(GuiceProperties.INSTANCE_ID), null); for (ConfigPropertyValue property : data.properties) { config.set(property.name, property.value); } // Let others know that the configuration data is coming from a network source config.set(GuiceProperties.CONFIG_SOURCE, GuiceConstants.CONFIG_SOURCE_NETWORK); if (data.revision != null) config.set(GuiceProperties.CONFIG_REVISION, data.revision); } finally { clientFactory.shutdown(); } } else { // Config is not coming from the network config.set(GuiceProperties.CONFIG_SOURCE, GuiceConstants.CONFIG_SOURCE_LOCAL); } }
java
private static void applyNetworkConfiguration(final GuiceConfig config) { final String configEndpoint = config.get(GuiceProperties.CONFIG_ENDPOINT, null); final Boolean configSkip = config.getBoolean(GuiceProperties.CONFIG_SKIP, false); if (configEndpoint != null && !configSkip) { final boolean useMoxy = config.getBoolean(GuiceProperties.MOXY_ENABLED, true); final JAXBContextResolver jaxb = new JAXBContextResolver(new JAXBSerialiserFactory(useMoxy)); final ResteasyClientFactoryImpl clientFactory = new ResteasyClientFactoryImpl(null, null, null, jaxb); try { final ResteasyProxyClientFactoryImpl proxyFactory = new ResteasyProxyClientFactoryImpl(clientFactory, config); final ConfigRestService client = proxyFactory.getClient(ConfigRestService.class); // Set up the config path if it's not already defined // We set it in the config because otherwise the NetworkConfigReloadDaemon won't be able to load the config if (config.get(GuiceProperties.CONFIG_PATH) == null) { config.set(GuiceProperties.CONFIG_PATH, "services/" + config.get(GuiceProperties.SERVLET_CONTEXT_NAME, "unknown-service")); } // Get the config path to read final String path = config.get(GuiceProperties.CONFIG_PATH); final ConfigPropertyData data = client.read(path, config.get(GuiceProperties.INSTANCE_ID), null); for (ConfigPropertyValue property : data.properties) { config.set(property.name, property.value); } // Let others know that the configuration data is coming from a network source config.set(GuiceProperties.CONFIG_SOURCE, GuiceConstants.CONFIG_SOURCE_NETWORK); if (data.revision != null) config.set(GuiceProperties.CONFIG_REVISION, data.revision); } finally { clientFactory.shutdown(); } } else { // Config is not coming from the network config.set(GuiceProperties.CONFIG_SOURCE, GuiceConstants.CONFIG_SOURCE_LOCAL); } }
[ "private", "static", "void", "applyNetworkConfiguration", "(", "final", "GuiceConfig", "config", ")", "{", "final", "String", "configEndpoint", "=", "config", ".", "get", "(", "GuiceProperties", ".", "CONFIG_ENDPOINT", ",", "null", ")", ";", "final", "Boolean", ...
Add to the configuration any properties defined by the network configuration endpoint (if network config is enabled in a previous property) @param config
[ "Add", "to", "the", "configuration", "any", "properties", "defined", "by", "the", "network", "configuration", "endpoint", "(", "if", "network", "config", "is", "enabled", "in", "a", "previous", "property", ")" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/common/src/main/java/com/peterphi/std/guice/apploader/impl/GuiceFactory.java#L372-L424
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.forbidUser
public ResponseWrapper forbidUser(String username, boolean disable) throws APIConnectionException, APIRequestException { return _userClient.forbidUser(username, disable); }
java
public ResponseWrapper forbidUser(String username, boolean disable) throws APIConnectionException, APIRequestException { return _userClient.forbidUser(username, disable); }
[ "public", "ResponseWrapper", "forbidUser", "(", "String", "username", ",", "boolean", "disable", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_userClient", ".", "forbidUser", "(", "username", ",", "disable", ")", ";", "}" ]
Forbid or activate user @param username username @param disable true means forbid, false means activate @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Forbid", "or", "activate", "user" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L354-L357
codeprimate-software/cp-elements
src/main/java/org/cp/elements/util/ArrayUtils.java
ArrayUtils.getElementAt
public static <T> T getElementAt(T[] array, int index) { return getElementAt(array, index, null); }
java
public static <T> T getElementAt(T[] array, int index) { return getElementAt(array, index, null); }
[ "public", "static", "<", "T", ">", "T", "getElementAt", "(", "T", "[", "]", "array", ",", "int", "index", ")", "{", "return", "getElementAt", "(", "array", ",", "index", ",", "null", ")", ";", "}" ]
Returns the element at the given index in the {@code array}. @param <T> {@link Class} type of elements in the array. @param array array from which to extract the given element at index. @param index integer indicating the index of the element in the array to return. @return the element at the given index in the array. @see #getElementAt(Object[], int, Object)
[ "Returns", "the", "element", "at", "the", "given", "index", "in", "the", "{", "@code", "array", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/util/ArrayUtils.java#L424-L426
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ProjectFilePanel.java
ProjectFilePanel.saveFile
public void saveFile(File file, String type) { if (file != null) { m_treeController.saveFile(file, type); } }
java
public void saveFile(File file, String type) { if (file != null) { m_treeController.saveFile(file, type); } }
[ "public", "void", "saveFile", "(", "File", "file", ",", "String", "type", ")", "{", "if", "(", "file", "!=", "null", ")", "{", "m_treeController", ".", "saveFile", "(", "file", ",", "type", ")", ";", "}", "}" ]
Saves the project file displayed in this panel. @param file target file @param type file type
[ "Saves", "the", "project", "file", "displayed", "in", "this", "panel", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ProjectFilePanel.java#L104-L110
Alluxio/alluxio
integration/fuse/src/main/java/alluxio/fuse/AlluxioFuseFileSystem.java
AlluxioFuseFileSystem.mkdir
@Override public int mkdir(String path, @mode_t long mode) { final AlluxioURI turi = mPathResolverCache.getUnchecked(path); LOG.trace("mkdir({}) [Alluxio: {}]", path, turi); try { mFileSystem.createDirectory(turi); } catch (FileAlreadyExistsException e) { LOG.debug("Failed to create directory {}, directory already exists", path); return -ErrorCodes.EEXIST(); } catch (InvalidPathException e) { LOG.debug("Failed to create directory {}, path is invalid", path); return -ErrorCodes.ENOENT(); } catch (Throwable t) { LOG.error("Failed to create directory {}", path, t); return AlluxioFuseUtils.getErrorCode(t); } return 0; }
java
@Override public int mkdir(String path, @mode_t long mode) { final AlluxioURI turi = mPathResolverCache.getUnchecked(path); LOG.trace("mkdir({}) [Alluxio: {}]", path, turi); try { mFileSystem.createDirectory(turi); } catch (FileAlreadyExistsException e) { LOG.debug("Failed to create directory {}, directory already exists", path); return -ErrorCodes.EEXIST(); } catch (InvalidPathException e) { LOG.debug("Failed to create directory {}, path is invalid", path); return -ErrorCodes.ENOENT(); } catch (Throwable t) { LOG.error("Failed to create directory {}", path, t); return AlluxioFuseUtils.getErrorCode(t); } return 0; }
[ "@", "Override", "public", "int", "mkdir", "(", "String", "path", ",", "@", "mode_t", "long", "mode", ")", "{", "final", "AlluxioURI", "turi", "=", "mPathResolverCache", ".", "getUnchecked", "(", "path", ")", ";", "LOG", ".", "trace", "(", "\"mkdir({}) [Al...
Creates a new dir. @param path the path on the FS of the new dir @param mode Dir creation flags (IGNORED) @return 0 on success, a negative value on error
[ "Creates", "a", "new", "dir", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/integration/fuse/src/main/java/alluxio/fuse/AlluxioFuseFileSystem.java#L389-L407
michel-kraemer/bson4jackson
src/main/java/de/undercouch/bson4jackson/io/StaticBuffers.java
StaticBuffers.charBuffer
public CharBuffer charBuffer(Key key, int minSize) { minSize = Math.max(minSize, GLOBAL_MIN_SIZE); CharBuffer r = _charBuffers[key.ordinal()]; if (r == null || r.capacity() < minSize) { r = CharBuffer.allocate(minSize); } else { _charBuffers[key.ordinal()] = null; r.clear(); } return r; }
java
public CharBuffer charBuffer(Key key, int minSize) { minSize = Math.max(minSize, GLOBAL_MIN_SIZE); CharBuffer r = _charBuffers[key.ordinal()]; if (r == null || r.capacity() < minSize) { r = CharBuffer.allocate(minSize); } else { _charBuffers[key.ordinal()] = null; r.clear(); } return r; }
[ "public", "CharBuffer", "charBuffer", "(", "Key", "key", ",", "int", "minSize", ")", "{", "minSize", "=", "Math", ".", "max", "(", "minSize", ",", "GLOBAL_MIN_SIZE", ")", ";", "CharBuffer", "r", "=", "_charBuffers", "[", "key", ".", "ordinal", "(", ")", ...
Creates or re-uses a {@link CharBuffer} that has a minimum size. Calling this method multiple times with the same key will always return the same buffer, as long as it has the minimum size and is marked to be re-used. Buffers that are allowed to be re-used should be released using {@link #releaseCharBuffer(Key, CharBuffer)}. @param key the buffer's identifier @param minSize the minimum size @return the {@link CharBuffer} instance @see #byteBuffer(Key, int)
[ "Creates", "or", "re", "-", "uses", "a", "{" ]
train
https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/io/StaticBuffers.java#L95-L106
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/FastByteArrayOutputStream.java
FastByteArrayOutputStream.writeToViaString
void writeToViaString(Writer out, String encoding) throws IOException { byte[] bufferToWrite = buffer; // this is always the last buffer to write int bufferToWriteLen = index; // index points to our place in the last buffer writeToImpl(out, encoding, bufferToWrite, bufferToWriteLen); }
java
void writeToViaString(Writer out, String encoding) throws IOException { byte[] bufferToWrite = buffer; // this is always the last buffer to write int bufferToWriteLen = index; // index points to our place in the last buffer writeToImpl(out, encoding, bufferToWrite, bufferToWriteLen); }
[ "void", "writeToViaString", "(", "Writer", "out", ",", "String", "encoding", ")", "throws", "IOException", "{", "byte", "[", "]", "bufferToWrite", "=", "buffer", ";", "// this is always the last buffer to write", "int", "bufferToWriteLen", "=", "index", ";", "// ind...
This can <b>ONLY</b> be called if there is only a single buffer to write, instead use {@link #writeTo(java.io.Writer, String)}, which auto detects if {@link #writeToViaString(java.io.Writer, String)} is to be used or {@link #writeToViaSmoosh(java.io.Writer, String)}. @param out the JspWriter @param encoding the encoding @throws IOException
[ "This", "can", "<b", ">", "ONLY<", "/", "b", ">", "be", "called", "if", "there", "is", "only", "a", "single", "buffer", "to", "write", "instead", "use", "{", "@link", "#writeTo", "(", "java", ".", "io", ".", "Writer", "String", ")", "}", "which", "...
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/FastByteArrayOutputStream.java#L217-L221
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/spacefillingcurves/ZCurveSpatialSorter.java
ZCurveSpatialSorter.getMinPlusMaxObject
private static double getMinPlusMaxObject(List<? extends SpatialComparable> objs, int s, int dim) { SpatialComparable sobj = objs.get(s); return sobj.getMin(dim) + sobj.getMax(dim); }
java
private static double getMinPlusMaxObject(List<? extends SpatialComparable> objs, int s, int dim) { SpatialComparable sobj = objs.get(s); return sobj.getMin(dim) + sobj.getMax(dim); }
[ "private", "static", "double", "getMinPlusMaxObject", "(", "List", "<", "?", "extends", "SpatialComparable", ">", "objs", ",", "int", "s", ",", "int", "dim", ")", "{", "SpatialComparable", "sobj", "=", "objs", ".", "get", "(", "s", ")", ";", "return", "s...
Compute getMin(dim) + getMax(dim) for the spatial object. @param objs Objects @param s index @param dim Dimensionality @return Min+Max
[ "Compute", "getMin", "(", "dim", ")", "+", "getMax", "(", "dim", ")", "for", "the", "spatial", "object", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/spacefillingcurves/ZCurveSpatialSorter.java#L166-L169
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java
CPSpecificationOptionPersistenceImpl.findAll
@Override public List<CPSpecificationOption> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CPSpecificationOption> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CPSpecificationOption", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp specification options. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPSpecificationOptionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of cp specification options @param end the upper bound of the range of cp specification options (not inclusive) @return the range of cp specification options
[ "Returns", "a", "range", "of", "all", "the", "cp", "specification", "options", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java#L3495-L3498
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindDataSourceBuilder.java
BindDataSourceBuilder.orderEntitiesList
public static List<SQLiteEntity> orderEntitiesList(SQLiteDatabaseSchema schema) { List<SQLiteEntity> entities = schema.getEntitiesAsList(); Collections.sort(entities, new Comparator<SQLiteEntity>() { @Override public int compare(SQLiteEntity lhs, SQLiteEntity rhs) { return lhs.getTableName().compareTo(rhs.getTableName()); } }); List<SQLiteEntity> list = schema.getEntitiesAsList(); EntitySorter<SQLiteEntity> sorder = new EntitySorter<SQLiteEntity>(list) { @Override public Collection<SQLiteEntity> getDependencies(SQLiteEntity item) { return item.referedEntities; } @Override public void generateError(SQLiteEntity item) { throw new CircularRelationshipException(item); } }; return sorder.order(); }
java
public static List<SQLiteEntity> orderEntitiesList(SQLiteDatabaseSchema schema) { List<SQLiteEntity> entities = schema.getEntitiesAsList(); Collections.sort(entities, new Comparator<SQLiteEntity>() { @Override public int compare(SQLiteEntity lhs, SQLiteEntity rhs) { return lhs.getTableName().compareTo(rhs.getTableName()); } }); List<SQLiteEntity> list = schema.getEntitiesAsList(); EntitySorter<SQLiteEntity> sorder = new EntitySorter<SQLiteEntity>(list) { @Override public Collection<SQLiteEntity> getDependencies(SQLiteEntity item) { return item.referedEntities; } @Override public void generateError(SQLiteEntity item) { throw new CircularRelationshipException(item); } }; return sorder.order(); }
[ "public", "static", "List", "<", "SQLiteEntity", ">", "orderEntitiesList", "(", "SQLiteDatabaseSchema", "schema", ")", "{", "List", "<", "SQLiteEntity", ">", "entities", "=", "schema", ".", "getEntitiesAsList", "(", ")", ";", "Collections", ".", "sort", "(", "...
Generate ordered entities list. @param schema the schema @return the list
[ "Generate", "ordered", "entities", "list", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/BindDataSourceBuilder.java#L1008-L1034
hibernate/hibernate-ogm
mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java
MongoDBDialect.getEmbeddingEntity
private Document getEmbeddingEntity(AssociationKey key, AssociationContext associationContext) { Document embeddingEntityDocument = associationContext.getEntityTuplePointer().getTuple() != null ? ( (MongoDBTupleSnapshot) associationContext.getEntityTuplePointer().getTuple().getSnapshot() ).getDbObject() : null; if ( embeddingEntityDocument != null ) { return embeddingEntityDocument; } else { MongoCollection<Document> collection = getCollection( key.getEntityKey(), associationContext.getAssociationTypeContext().getOptionsContext() ); Document searchObject = prepareIdObject( key.getEntityKey() ); Document projection = getProjection( key, true ); return collection.find( searchObject ).projection( projection ).first(); } }
java
private Document getEmbeddingEntity(AssociationKey key, AssociationContext associationContext) { Document embeddingEntityDocument = associationContext.getEntityTuplePointer().getTuple() != null ? ( (MongoDBTupleSnapshot) associationContext.getEntityTuplePointer().getTuple().getSnapshot() ).getDbObject() : null; if ( embeddingEntityDocument != null ) { return embeddingEntityDocument; } else { MongoCollection<Document> collection = getCollection( key.getEntityKey(), associationContext.getAssociationTypeContext().getOptionsContext() ); Document searchObject = prepareIdObject( key.getEntityKey() ); Document projection = getProjection( key, true ); return collection.find( searchObject ).projection( projection ).first(); } }
[ "private", "Document", "getEmbeddingEntity", "(", "AssociationKey", "key", ",", "AssociationContext", "associationContext", ")", "{", "Document", "embeddingEntityDocument", "=", "associationContext", ".", "getEntityTuplePointer", "(", ")", ".", "getTuple", "(", ")", "!=...
Returns a {@link Document} representing the entity which embeds the specified association.
[ "Returns", "a", "{" ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/mongodb/src/main/java/org/hibernate/ogm/datastore/mongodb/MongoDBDialect.java#L315-L329
leadware/jpersistence-tools
jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java
RestrictionsContainer.addNotEq
public <Y extends Comparable<? super Y>> RestrictionsContainer addNotEq(String property, Y value) { // Ajout de la restriction restrictions.add(new NotEq<Y>(property, value)); // On retourne le conteneur return this; }
java
public <Y extends Comparable<? super Y>> RestrictionsContainer addNotEq(String property, Y value) { // Ajout de la restriction restrictions.add(new NotEq<Y>(property, value)); // On retourne le conteneur return this; }
[ "public", "<", "Y", "extends", "Comparable", "<", "?", "super", "Y", ">", ">", "RestrictionsContainer", "addNotEq", "(", "String", "property", ",", "Y", "value", ")", "{", "// Ajout de la restriction\r", "restrictions", ".", "add", "(", "new", "NotEq", "<", ...
Methode d'ajout de la restriction NotEq @param property Nom de la Propriete @param value Valeur de la propriete @param <Y> Type de valeur @return Conteneur
[ "Methode", "d", "ajout", "de", "la", "restriction", "NotEq" ]
train
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/RestrictionsContainer.java#L105-L112
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/eip/EipClient.java
EipClient.bindEip
public void bindEip(String eip, String instanceId, String instanceType) { this.bindEip(new BindEipRequest().withEip(eip).withInstanceId(instanceId).withInstanceType(instanceType)); }
java
public void bindEip(String eip, String instanceId, String instanceType) { this.bindEip(new BindEipRequest().withEip(eip).withInstanceId(instanceId).withInstanceType(instanceType)); }
[ "public", "void", "bindEip", "(", "String", "eip", ",", "String", "instanceId", ",", "String", "instanceType", ")", "{", "this", ".", "bindEip", "(", "new", "BindEipRequest", "(", ")", ".", "withEip", "(", "eip", ")", ".", "withInstanceId", "(", "instanceI...
bind the eip to a specified instanceId and instanceType(BCC|BLB). @param eip eip address to be bound @param instanceId id of instance to be bound @param instanceType type of instance to be bound
[ "bind", "the", "eip", "to", "a", "specified", "instanceId", "and", "instanceType", "(", "BCC|BLB", ")", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/eip/EipClient.java#L202-L204
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java
PathNormalizer.joinDomainToPath
public static String joinDomainToPath(String domainName, String path) { StringBuilder sb = new StringBuilder(); if (domainName.endsWith(JawrConstant.URL_SEPARATOR)) { sb.append(domainName.substring(0, domainName.length() - 1)); } else { sb.append(domainName); } sb.append(JawrConstant.URL_SEPARATOR).append(PathNormalizer.normalizePath(path)); return sb.toString(); }
java
public static String joinDomainToPath(String domainName, String path) { StringBuilder sb = new StringBuilder(); if (domainName.endsWith(JawrConstant.URL_SEPARATOR)) { sb.append(domainName.substring(0, domainName.length() - 1)); } else { sb.append(domainName); } sb.append(JawrConstant.URL_SEPARATOR).append(PathNormalizer.normalizePath(path)); return sb.toString(); }
[ "public", "static", "String", "joinDomainToPath", "(", "String", "domainName", ",", "String", "path", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "domainName", ".", "endsWith", "(", "JawrConstant", ".", "URL_SEPARATO...
Normalizes a domain name and a path and joins them as a single url. @param domainName @param path @return
[ "Normalizes", "a", "domain", "name", "and", "a", "path", "and", "joins", "them", "as", "a", "single", "url", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java#L341-L353
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/reporter/ConfiguredScheduledReporter.java
ConfiguredScheduledReporter.getMetricNamePrefix
protected String getMetricNamePrefix(Map<String, Object> tags){ String currentContextName = (String) tags.get(MetricContext.METRIC_CONTEXT_NAME_TAG_NAME); if (metricContextName == null || (currentContextName.indexOf(metricContextName) > -1)) { return currentContextName; } return JOINER.join(Strings.emptyToNull(metricsPrefix), metricContextName, tags.get("taskId"), tags.get("forkBranchName"), tags.get("class")); }
java
protected String getMetricNamePrefix(Map<String, Object> tags){ String currentContextName = (String) tags.get(MetricContext.METRIC_CONTEXT_NAME_TAG_NAME); if (metricContextName == null || (currentContextName.indexOf(metricContextName) > -1)) { return currentContextName; } return JOINER.join(Strings.emptyToNull(metricsPrefix), metricContextName, tags.get("taskId"), tags.get("forkBranchName"), tags.get("class")); }
[ "protected", "String", "getMetricNamePrefix", "(", "Map", "<", "String", ",", "Object", ">", "tags", ")", "{", "String", "currentContextName", "=", "(", "String", ")", "tags", ".", "get", "(", "MetricContext", ".", "METRIC_CONTEXT_NAME_TAG_NAME", ")", ";", "if...
Constructs the prefix of metric key to be emitted. Enriches {@link ConfiguredScheduledReporter#metricContextName} with the current task id and fork id to be able to identify the emitted metric by its origin @param tags @return Prefix of the metric key
[ "Constructs", "the", "prefix", "of", "metric", "key", "to", "be", "emitted", ".", "Enriches", "{", "@link", "ConfiguredScheduledReporter#metricContextName", "}", "with", "the", "current", "task", "id", "and", "fork", "id", "to", "be", "able", "to", "identify", ...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/reporter/ConfiguredScheduledReporter.java#L232-L240
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java
RandomMatrices_DSCC.ensureNotSingular
public static void ensureNotSingular( DMatrixSparseCSC A , Random rand ) { // if( A.numRows < A.numCols ) { // throw new IllegalArgumentException("Fewer equations than variables"); // } int []s = UtilEjml.shuffled(A.numRows,rand); Arrays.sort(s); int N = Math.min(A.numCols,A.numRows); for (int col = 0; col < N; col++) { A.set(s[col],col,rand.nextDouble()+0.5); } }
java
public static void ensureNotSingular( DMatrixSparseCSC A , Random rand ) { // if( A.numRows < A.numCols ) { // throw new IllegalArgumentException("Fewer equations than variables"); // } int []s = UtilEjml.shuffled(A.numRows,rand); Arrays.sort(s); int N = Math.min(A.numCols,A.numRows); for (int col = 0; col < N; col++) { A.set(s[col],col,rand.nextDouble()+0.5); } }
[ "public", "static", "void", "ensureNotSingular", "(", "DMatrixSparseCSC", "A", ",", "Random", "rand", ")", "{", "// if( A.numRows < A.numCols ) {", "// throw new IllegalArgumentException(\"Fewer equations than variables\");", "// }", "int", "[", "]", "s",...
Modies the matrix to make sure that at least one element in each column has a value
[ "Modies", "the", "matrix", "to", "make", "sure", "that", "at", "least", "one", "element", "in", "each", "column", "has", "a", "value" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java#L271-L283
jhunters/jprotobuf
v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java
CodedConstant.computeElementSize
public static int computeElementSize(final WireFormat.FieldType type, final int number, final Object value) { int tagSize = CodedOutputStream.computeTagSize(number); if (type == WireFormat.FieldType.GROUP) { // Only count the end group tag for proto2 messages as for proto1 the end // group tag will be counted as a part of getSerializedSize(). tagSize *= 2; } return tagSize + computeElementSizeNoTag(type, value); }
java
public static int computeElementSize(final WireFormat.FieldType type, final int number, final Object value) { int tagSize = CodedOutputStream.computeTagSize(number); if (type == WireFormat.FieldType.GROUP) { // Only count the end group tag for proto2 messages as for proto1 the end // group tag will be counted as a part of getSerializedSize(). tagSize *= 2; } return tagSize + computeElementSizeNoTag(type, value); }
[ "public", "static", "int", "computeElementSize", "(", "final", "WireFormat", ".", "FieldType", "type", ",", "final", "int", "number", ",", "final", "Object", "value", ")", "{", "int", "tagSize", "=", "CodedOutputStream", ".", "computeTagSize", "(", "number", "...
Compute the number of bytes that would be needed to encode a single tag/value pair of arbitrary type. @param type The field's type. @param number The field's number. @param value Object representing the field's value. Must be of the exact type which would be returned by {@link Message#getField(Descriptors.FieldDescriptor)} for this field. @return the int
[ "Compute", "the", "number", "of", "bytes", "that", "would", "be", "needed", "to", "encode", "a", "single", "tag", "/", "value", "pair", "of", "arbitrary", "type", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L118-L126
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePositionPatternDetector.java
QrCodePositionPatternDetector.positionSquareIntensityCheck
static boolean positionSquareIntensityCheck(float values[] , float threshold ) { if( values[0] > threshold || values[1] < threshold ) return false; if( values[2] > threshold || values[3] > threshold || values[4] > threshold ) return false; if( values[5] < threshold || values[6] > threshold ) return false; return true; }
java
static boolean positionSquareIntensityCheck(float values[] , float threshold ) { if( values[0] > threshold || values[1] < threshold ) return false; if( values[2] > threshold || values[3] > threshold || values[4] > threshold ) return false; if( values[5] < threshold || values[6] > threshold ) return false; return true; }
[ "static", "boolean", "positionSquareIntensityCheck", "(", "float", "values", "[", "]", ",", "float", "threshold", ")", "{", "if", "(", "values", "[", "0", "]", ">", "threshold", "||", "values", "[", "1", "]", "<", "threshold", ")", "return", "false", ";"...
Checks to see if the array of sampled intensity values follows the expected pattern for a position pattern. X.XXX.X where x = black and . = white.
[ "Checks", "to", "see", "if", "the", "array", "of", "sampled", "intensity", "values", "follows", "the", "expected", "pattern", "for", "a", "position", "pattern", ".", "X", ".", "XXX", ".", "X", "where", "x", "=", "black", "and", ".", "=", "white", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodePositionPatternDetector.java#L422-L430
prestodb/presto
presto-main/src/main/java/com/facebook/presto/execution/QueryIdGenerator.java
QueryIdGenerator.createNextQueryId
public synchronized QueryId createNextQueryId() { // only generate 100,000 ids per day if (counter > 99_999) { // wait for the second to rollover while (MILLISECONDS.toSeconds(nowInMillis()) == lastTimeInSeconds) { Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); } counter = 0; } // if it has been a second since the last id was generated, generate a new timestamp long now = nowInMillis(); if (MILLISECONDS.toSeconds(now) != lastTimeInSeconds) { // generate new timestamp lastTimeInSeconds = MILLISECONDS.toSeconds(now); lastTimestamp = TIMESTAMP_FORMAT.print(now); // if the day has rolled over, restart the counter if (MILLISECONDS.toDays(now) != lastTimeInDays) { lastTimeInDays = MILLISECONDS.toDays(now); counter = 0; } } return new QueryId(String.format("%s_%05d_%s", lastTimestamp, counter++, coordinatorId)); }
java
public synchronized QueryId createNextQueryId() { // only generate 100,000 ids per day if (counter > 99_999) { // wait for the second to rollover while (MILLISECONDS.toSeconds(nowInMillis()) == lastTimeInSeconds) { Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS); } counter = 0; } // if it has been a second since the last id was generated, generate a new timestamp long now = nowInMillis(); if (MILLISECONDS.toSeconds(now) != lastTimeInSeconds) { // generate new timestamp lastTimeInSeconds = MILLISECONDS.toSeconds(now); lastTimestamp = TIMESTAMP_FORMAT.print(now); // if the day has rolled over, restart the counter if (MILLISECONDS.toDays(now) != lastTimeInDays) { lastTimeInDays = MILLISECONDS.toDays(now); counter = 0; } } return new QueryId(String.format("%s_%05d_%s", lastTimestamp, counter++, coordinatorId)); }
[ "public", "synchronized", "QueryId", "createNextQueryId", "(", ")", "{", "// only generate 100,000 ids per day", "if", "(", "counter", ">", "99_999", ")", "{", "// wait for the second to rollover", "while", "(", "MILLISECONDS", ".", "toSeconds", "(", "nowInMillis", "(",...
Generate next queryId using the following format: <tt>YYYYMMdd_HHmmss_index_coordId</tt> <p/> Index rolls at the start of every day or when it reaches 99,999, and the coordId is a randomly generated when this instance is created.
[ "Generate", "next", "queryId", "using", "the", "following", "format", ":", "<tt", ">", "YYYYMMdd_HHmmss_index_coordId<", "/", "tt", ">", "<p", "/", ">", "Index", "rolls", "at", "the", "start", "of", "every", "day", "or", "when", "it", "reaches", "99", "999...
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/execution/QueryIdGenerator.java#L81-L107
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Notification.java
Notification.isActiveForTriggerAndMetric
public boolean isActiveForTriggerAndMetric(Trigger trigger, Metric metric) { String key = _hashTriggerAndMetric(trigger, metric); return this.activeStatusByTriggerAndMetric.containsKey(key) ? activeStatusByTriggerAndMetric.get(key) : false; }
java
public boolean isActiveForTriggerAndMetric(Trigger trigger, Metric metric) { String key = _hashTriggerAndMetric(trigger, metric); return this.activeStatusByTriggerAndMetric.containsKey(key) ? activeStatusByTriggerAndMetric.get(key) : false; }
[ "public", "boolean", "isActiveForTriggerAndMetric", "(", "Trigger", "trigger", ",", "Metric", "metric", ")", "{", "String", "key", "=", "_hashTriggerAndMetric", "(", "trigger", ",", "metric", ")", ";", "return", "this", ".", "activeStatusByTriggerAndMetric", ".", ...
Given a metric,notification combination, indicates whether a triggering condition associated with this notification is still in a triggering state. @param trigger The Trigger that caused this notification @param metric The metric that caused this notification @return True if the triggering condition is still in a triggering state.
[ "Given", "a", "metric", "notification", "combination", "indicates", "whether", "a", "triggering", "condition", "associated", "with", "this", "notification", "is", "still", "in", "a", "triggering", "state", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Notification.java#L600-L603
Ordinastie/MalisisCore
src/main/java/net/malisis/core/asm/AsmUtils.java
AsmUtils.findInstruction
public static AbstractInsnNode findInstruction(MethodNode method, InsnList matches, int index) { AbstractInsnNode node = method.instructions.get(index); AbstractInsnNode match = matches.getFirst(); while (node != null) { if (insnEqual(node, match)) { AbstractInsnNode m = match.getNext(); AbstractInsnNode n = node.getNext(); while (m != null && n != null && insnEqual(m, n)) { m = m.getNext(); n = n.getNext(); } if (m == null) return node; } node = node.getNext(); } return null; }
java
public static AbstractInsnNode findInstruction(MethodNode method, InsnList matches, int index) { AbstractInsnNode node = method.instructions.get(index); AbstractInsnNode match = matches.getFirst(); while (node != null) { if (insnEqual(node, match)) { AbstractInsnNode m = match.getNext(); AbstractInsnNode n = node.getNext(); while (m != null && n != null && insnEqual(m, n)) { m = m.getNext(); n = n.getNext(); } if (m == null) return node; } node = node.getNext(); } return null; }
[ "public", "static", "AbstractInsnNode", "findInstruction", "(", "MethodNode", "method", ",", "InsnList", "matches", ",", "int", "index", ")", "{", "AbstractInsnNode", "node", "=", "method", ".", "instructions", ".", "get", "(", "index", ")", ";", "AbstractInsnNo...
Finds instruction a specific instruction list inside a method, starting from the specified index. @param method the method @param matches the matches @param index the index @return the abstract insn node
[ "Finds", "instruction", "a", "specific", "instruction", "list", "inside", "a", "method", "starting", "from", "the", "specified", "index", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/asm/AsmUtils.java#L116-L138
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderItemUrl.java
OrderItemUrl.updateItemQuantityUrl
public static MozuUrl updateItemQuantityUrl(String orderId, String orderItemId, Integer quantity, String responseFields, String updateMode, String version) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items/{orderItemId}/quantity/{quantity}?updatemode={updateMode}&version={version}&responseFields={responseFields}"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("orderItemId", orderItemId); formatter.formatUrl("quantity", quantity); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("updateMode", updateMode); formatter.formatUrl("version", version); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateItemQuantityUrl(String orderId, String orderItemId, Integer quantity, String responseFields, String updateMode, String version) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items/{orderItemId}/quantity/{quantity}?updatemode={updateMode}&version={version}&responseFields={responseFields}"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("orderItemId", orderItemId); formatter.formatUrl("quantity", quantity); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("updateMode", updateMode); formatter.formatUrl("version", version); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateItemQuantityUrl", "(", "String", "orderId", ",", "String", "orderItemId", ",", "Integer", "quantity", ",", "String", "responseFields", ",", "String", "updateMode", ",", "String", "version", ")", "{", "UrlFormatter", "formatter",...
Get Resource Url for UpdateItemQuantity @param orderId Unique identifier of the order. @param orderItemId Unique identifier of the item to remove from the order. @param quantity The number of cart items in the shopper's active cart. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param updateMode Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit." @param version Determines whether or not to check versioning of items for concurrency purposes. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateItemQuantity" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderItemUrl.java#L185-L195
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.scale
public Matrix4f scale(float x, float y, float z) { return scale(x, y, z, thisOrNew()); }
java
public Matrix4f scale(float x, float y, float z) { return scale(x, y, z, thisOrNew()); }
[ "public", "Matrix4f", "scale", "(", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "return", "scale", "(", "x", ",", "y", ",", "z", ",", "thisOrNew", "(", ")", ")", ";", "}" ]
Apply scaling to this matrix by scaling the base axes by the given sx, sy and sz factors. <p> If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix, then the new matrix will be <code>M * S</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the scaling will be applied first! @param x the factor of the x component @param y the factor of the y component @param z the factor of the z component @return a matrix holding the result
[ "Apply", "scaling", "to", "this", "matrix", "by", "scaling", "the", "base", "axes", "by", "the", "given", "sx", "sy", "and", "sz", "factors", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">",...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L4782-L4784
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/RecordChangedHandler.java
RecordChangedHandler.init
public void init(Record record, DateTimeField field) { super.init(record); m_field = field; FieldDataScratchHandler listener = new FieldDataScratchHandler(null); listener.setAlwaysEnabled(true); // Since this holds the current key m_field.addListener(listener); // I will need the original value for the sql update this.setMasterSlaveFlag(FileListener.RUN_IN_SLAVE | FileListener.RUN_IN_MASTER); // Set date key in slave code, check for error in master code }
java
public void init(Record record, DateTimeField field) { super.init(record); m_field = field; FieldDataScratchHandler listener = new FieldDataScratchHandler(null); listener.setAlwaysEnabled(true); // Since this holds the current key m_field.addListener(listener); // I will need the original value for the sql update this.setMasterSlaveFlag(FileListener.RUN_IN_SLAVE | FileListener.RUN_IN_MASTER); // Set date key in slave code, check for error in master code }
[ "public", "void", "init", "(", "Record", "record", ",", "DateTimeField", "field", ")", "{", "super", ".", "init", "(", "record", ")", ";", "m_field", "=", "field", ";", "FieldDataScratchHandler", "listener", "=", "new", "FieldDataScratchHandler", "(", "null", ...
Constructor. @param record My owner (usually passed as null, and set on addListener in setOwner()). @param iMainFilesField The sequence of the date changed field in this record. @param field The date changed field in this record.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/RecordChangedHandler.java#L74-L82
kaazing/gateway
resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java
URIUtils.getCanonicalizedURI
public static String getCanonicalizedURI(String uri, boolean canonicalizePath) { String canonicalURI = uri; if (uri != null) { String host = getHost(uri); String path = getPath(uri); final boolean emptyPath = "".equals(path); final boolean noPathToCanonicalize = canonicalizePath && (path == null || emptyPath); final boolean trailingSlashPath = "/".equals(path); final String scheme = getScheme(uri); final boolean pathlessScheme = "ssl".equals(scheme) || "tcp".equals(scheme) || "pipe".equals(scheme) || "udp".equals(scheme) || "mux".equals(scheme); final boolean trailingSlashWithPathlessScheme = trailingSlashPath && pathlessScheme; String newPath = trailingSlashWithPathlessScheme ? "" : noPathToCanonicalize ? (pathlessScheme ? null : "/") : null; if (((host != null) && !host.equals(host.toLowerCase())) || newPath != null) { path = newPath == null ? path : newPath; try { canonicalURI = buildURIAsString(scheme, getUserInfo(uri), host == null ? null : host.toLowerCase(), getPort(uri), path, getQuery(uri), getFragment(uri)); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid URI: " + uri + " in Gateway configuration file", ex); } } } return canonicalURI; }
java
public static String getCanonicalizedURI(String uri, boolean canonicalizePath) { String canonicalURI = uri; if (uri != null) { String host = getHost(uri); String path = getPath(uri); final boolean emptyPath = "".equals(path); final boolean noPathToCanonicalize = canonicalizePath && (path == null || emptyPath); final boolean trailingSlashPath = "/".equals(path); final String scheme = getScheme(uri); final boolean pathlessScheme = "ssl".equals(scheme) || "tcp".equals(scheme) || "pipe".equals(scheme) || "udp".equals(scheme) || "mux".equals(scheme); final boolean trailingSlashWithPathlessScheme = trailingSlashPath && pathlessScheme; String newPath = trailingSlashWithPathlessScheme ? "" : noPathToCanonicalize ? (pathlessScheme ? null : "/") : null; if (((host != null) && !host.equals(host.toLowerCase())) || newPath != null) { path = newPath == null ? path : newPath; try { canonicalURI = buildURIAsString(scheme, getUserInfo(uri), host == null ? null : host.toLowerCase(), getPort(uri), path, getQuery(uri), getFragment(uri)); } catch (URISyntaxException ex) { throw new IllegalArgumentException("Invalid URI: " + uri + " in Gateway configuration file", ex); } } } return canonicalURI; }
[ "public", "static", "String", "getCanonicalizedURI", "(", "String", "uri", ",", "boolean", "canonicalizePath", ")", "{", "String", "canonicalURI", "=", "uri", ";", "if", "(", "uri", "!=", "null", ")", "{", "String", "host", "=", "getHost", "(", "uri", ")",...
Create a canonical URI from a given URI. A canonical URI is a URI with:<ul> <li>the host part of the authority lower-case since URI semantics dictate that hostnames are case insensitive <li>(optionally, NOT appropriate for Origin headers) the path part set to "/" except for tcp uris if there was no path in the input URI (this conforms to the WebSocket and HTTP protocol specifications and avoids us having to do special handling for path throughout the server code). </ul> @param uri the URI to canonicalize @param canonicalizePath if true, append trailing '/' when missing @return a URI with the host part of the authority lower-case and (optionally if not tcp) trailing / added, or null if the uri is null @throws IllegalArgumentException if the uri is not valid syntax
[ "Create", "a", "canonical", "URI", "from", "a", "given", "URI", ".", "A", "canonical", "URI", "is", "a", "URI", "with", ":", "<ul", ">", "<li", ">", "the", "host", "part", "of", "the", "authority", "lower", "-", "case", "since", "URI", "semantics", "...
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java#L661-L686
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setBaselineWork
public void setBaselineWork(int baselineNumber, Duration value) { set(selectField(ResourceFieldLists.BASELINE_WORKS, baselineNumber), value); }
java
public void setBaselineWork(int baselineNumber, Duration value) { set(selectField(ResourceFieldLists.BASELINE_WORKS, baselineNumber), value); }
[ "public", "void", "setBaselineWork", "(", "int", "baselineNumber", ",", "Duration", "value", ")", "{", "set", "(", "selectField", "(", "ResourceFieldLists", ".", "BASELINE_WORKS", ",", "baselineNumber", ")", ",", "value", ")", ";", "}" ]
Set a baseline value. @param baselineNumber baseline index (1-10) @param value baseline value
[ "Set", "a", "baseline", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L2205-L2208
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/Stage.java
Stage.commonSupervisorOr
Supervisor commonSupervisorOr(final Class<?> protocol, final Supervisor defaultSupervisor) { final Supervisor common = commonSupervisors.get(protocol); if (common != null) { return common; } return defaultSupervisor; }
java
Supervisor commonSupervisorOr(final Class<?> protocol, final Supervisor defaultSupervisor) { final Supervisor common = commonSupervisors.get(protocol); if (common != null) { return common; } return defaultSupervisor; }
[ "Supervisor", "commonSupervisorOr", "(", "final", "Class", "<", "?", ">", "protocol", ",", "final", "Supervisor", "defaultSupervisor", ")", "{", "final", "Supervisor", "common", "=", "commonSupervisors", ".", "get", "(", "protocol", ")", ";", "if", "(", "commo...
Answers the common Supervisor for the given protocol or the defaultSupervisor if there is no registered common Supervisor. (INTERNAL ONLY) @param protocol the {@code Class<?>} protocol to supervise @param defaultSupervisor the Supervisor default to be used if there is no registered common Supervisor @return Supervisor
[ "Answers", "the", "common", "Supervisor", "for", "the", "given", "protocol", "or", "the", "defaultSupervisor", "if", "there", "is", "no", "registered", "common", "Supervisor", ".", "(", "INTERNAL", "ONLY", ")" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Stage.java#L505-L513
datastax/java-driver
core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/registry/CachingCodecRegistry.java
CachingCodecRegistry.codecFor
protected <JavaTypeT> TypeCodec<JavaTypeT> codecFor( DataType cqlType, GenericType<JavaTypeT> javaType, boolean isJavaCovariant) { LOG.trace("[{}] Looking up codec for {} <-> {}", logPrefix, cqlType, javaType); TypeCodec<?> primitiveCodec = primitiveCodecsByCode.get(cqlType.getProtocolCode()); if (primitiveCodec != null && matches(primitiveCodec, javaType, isJavaCovariant)) { LOG.trace("[{}] Found matching primitive codec {}", logPrefix, primitiveCodec); return uncheckedCast(primitiveCodec); } for (TypeCodec<?> userCodec : userCodecs) { if (userCodec.accepts(cqlType) && matches(userCodec, javaType, isJavaCovariant)) { LOG.trace("[{}] Found matching user codec {}", logPrefix, userCodec); return uncheckedCast(userCodec); } } return uncheckedCast(getCachedCodec(cqlType, javaType, isJavaCovariant)); }
java
protected <JavaTypeT> TypeCodec<JavaTypeT> codecFor( DataType cqlType, GenericType<JavaTypeT> javaType, boolean isJavaCovariant) { LOG.trace("[{}] Looking up codec for {} <-> {}", logPrefix, cqlType, javaType); TypeCodec<?> primitiveCodec = primitiveCodecsByCode.get(cqlType.getProtocolCode()); if (primitiveCodec != null && matches(primitiveCodec, javaType, isJavaCovariant)) { LOG.trace("[{}] Found matching primitive codec {}", logPrefix, primitiveCodec); return uncheckedCast(primitiveCodec); } for (TypeCodec<?> userCodec : userCodecs) { if (userCodec.accepts(cqlType) && matches(userCodec, javaType, isJavaCovariant)) { LOG.trace("[{}] Found matching user codec {}", logPrefix, userCodec); return uncheckedCast(userCodec); } } return uncheckedCast(getCachedCodec(cqlType, javaType, isJavaCovariant)); }
[ "protected", "<", "JavaTypeT", ">", "TypeCodec", "<", "JavaTypeT", ">", "codecFor", "(", "DataType", "cqlType", ",", "GenericType", "<", "JavaTypeT", ">", "javaType", ",", "boolean", "isJavaCovariant", ")", "{", "LOG", ".", "trace", "(", "\"[{}] Looking up codec...
Not exposed publicly, (isJavaCovariant=true) is only used for internal recursion
[ "Not", "exposed", "publicly", "(", "isJavaCovariant", "=", "true", ")", "is", "only", "used", "for", "internal", "recursion" ]
train
https://github.com/datastax/java-driver/blob/612a63f2525618e2020e86c9ad75ab37adba6132/core/src/main/java/com/datastax/oss/driver/internal/core/type/codec/registry/CachingCodecRegistry.java#L98-L113
alkacon/opencms-core
src-gwt/org/opencms/ugc/client/export/CmsClientUgcSession.java
CmsClientUgcSession.getLink
public void getLink(String path, final I_CmsStringCallback callback) { m_apiRoot.getRpcHelper().executeRpc(CmsXmlContentUgcApi.SERVICE.getLink(path, new AsyncCallback<String>() { @SuppressWarnings("synthetic-access") public void onFailure(Throwable caught) { m_apiRoot.handleError(caught, null); } public void onSuccess(String result) { callback.call(result); } })); }
java
public void getLink(String path, final I_CmsStringCallback callback) { m_apiRoot.getRpcHelper().executeRpc(CmsXmlContentUgcApi.SERVICE.getLink(path, new AsyncCallback<String>() { @SuppressWarnings("synthetic-access") public void onFailure(Throwable caught) { m_apiRoot.handleError(caught, null); } public void onSuccess(String result) { callback.call(result); } })); }
[ "public", "void", "getLink", "(", "String", "path", ",", "final", "I_CmsStringCallback", "callback", ")", "{", "m_apiRoot", ".", "getRpcHelper", "(", ")", ".", "executeRpc", "(", "CmsXmlContentUgcApi", ".", "SERVICE", ".", "getLink", "(", "path", ",", "new", ...
Fetches the link for a given path from the server.<p> @param path the path for which we want the link @param callback the callback to call with the result
[ "Fetches", "the", "link", "for", "a", "given", "path", "from", "the", "server", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ugc/client/export/CmsClientUgcSession.java#L121-L136
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskInfo.java
DiskInfo.of
public static DiskInfo of(DiskId diskId, DiskConfiguration configuration) { return newBuilder(diskId, configuration).build(); }
java
public static DiskInfo of(DiskId diskId, DiskConfiguration configuration) { return newBuilder(diskId, configuration).build(); }
[ "public", "static", "DiskInfo", "of", "(", "DiskId", "diskId", ",", "DiskConfiguration", "configuration", ")", "{", "return", "newBuilder", "(", "diskId", ",", "configuration", ")", ".", "build", "(", ")", ";", "}" ]
Returns a {@code DiskInfo} object given its identity and configuration. Use {@link StandardDiskConfiguration} to create a simple disk given its type and size. Use {@link SnapshotDiskConfiguration} to create a disk from a snapshot. Use {@link ImageDiskConfiguration} to create a disk from a disk image.
[ "Returns", "a", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskInfo.java#L368-L370
devnied/Bit-lib4j
src/main/java/fr/devnied/bitlib/BitUtils.java
BitUtils.getNextString
public String getNextString(final int pSize, final Charset pCharset) { return new String(getNextByte(pSize, true), pCharset); }
java
public String getNextString(final int pSize, final Charset pCharset) { return new String(getNextByte(pSize, true), pCharset); }
[ "public", "String", "getNextString", "(", "final", "int", "pSize", ",", "final", "Charset", "pCharset", ")", "{", "return", "new", "String", "(", "getNextByte", "(", "pSize", ",", "true", ")", ",", "pCharset", ")", ";", "}" ]
This method is used to get the next String with the specified size @param pSize the length of the string int bit @param pCharset the charset @return the string
[ "This", "method", "is", "used", "to", "get", "the", "next", "String", "with", "the", "specified", "size" ]
train
https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BitUtils.java#L384-L386
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.telephony_trunks_serviceName_updateSimultaneousChannels_GET
public OvhOrder telephony_trunks_serviceName_updateSimultaneousChannels_GET(String serviceName, Long quantity) throws IOException { String qPath = "/order/telephony/trunks/{serviceName}/updateSimultaneousChannels"; StringBuilder sb = path(qPath, serviceName); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder telephony_trunks_serviceName_updateSimultaneousChannels_GET(String serviceName, Long quantity) throws IOException { String qPath = "/order/telephony/trunks/{serviceName}/updateSimultaneousChannels"; StringBuilder sb = path(qPath, serviceName); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "telephony_trunks_serviceName_updateSimultaneousChannels_GET", "(", "String", "serviceName", ",", "Long", "quantity", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/telephony/trunks/{serviceName}/updateSimultaneousChannels\"", ";", "Str...
Get prices and contracts information REST: GET /order/telephony/trunks/{serviceName}/updateSimultaneousChannels @param quantity [required] The quantity of total simultaneous channels requested @param serviceName [required] Your trunk number
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6838-L6844
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java
ExpressRouteCircuitsInner.updateTags
public ExpressRouteCircuitInner updateTags(String resourceGroupName, String circuitName) { return updateTagsWithServiceResponseAsync(resourceGroupName, circuitName).toBlocking().last().body(); }
java
public ExpressRouteCircuitInner updateTags(String resourceGroupName, String circuitName) { return updateTagsWithServiceResponseAsync(resourceGroupName, circuitName).toBlocking().last().body(); }
[ "public", "ExpressRouteCircuitInner", "updateTags", "(", "String", "resourceGroupName", ",", "String", "circuitName", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "circuitName", ")", ".", "toBlocking", "(", ")", ".", "last", ...
Updates an express route circuit tags. @param resourceGroupName The name of the resource group. @param circuitName The name of the circuit. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ExpressRouteCircuitInner object if successful.
[ "Updates", "an", "express", "route", "circuit", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L562-L564
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java
SureTrakDatabaseReader.readHours
private void readHours(ProjectCalendar calendar, Day day, Integer hours) { int value = hours.intValue(); int startHour = 0; ProjectCalendarHours calendarHours = null; Calendar cal = DateHelper.popCalendar(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); calendar.setWorkingDay(day, false); while (value != 0) { // Move forward until we find a working hour while (startHour < 24 && (value & 0x1) == 0) { value = value >> 1; ++startHour; } // No more working hours, bail out if (startHour >= 24) { break; } // Move forward until we find the end of the working hours int endHour = startHour; while (endHour < 24 && (value & 0x1) != 0) { value = value >> 1; ++endHour; } cal.set(Calendar.HOUR_OF_DAY, startHour); Date startDate = cal.getTime(); cal.set(Calendar.HOUR_OF_DAY, endHour); Date endDate = cal.getTime(); if (calendarHours == null) { calendarHours = calendar.addCalendarHours(day); calendar.setWorkingDay(day, true); } calendarHours.addRange(new DateRange(startDate, endDate)); startHour = endHour; } DateHelper.pushCalendar(cal); }
java
private void readHours(ProjectCalendar calendar, Day day, Integer hours) { int value = hours.intValue(); int startHour = 0; ProjectCalendarHours calendarHours = null; Calendar cal = DateHelper.popCalendar(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); calendar.setWorkingDay(day, false); while (value != 0) { // Move forward until we find a working hour while (startHour < 24 && (value & 0x1) == 0) { value = value >> 1; ++startHour; } // No more working hours, bail out if (startHour >= 24) { break; } // Move forward until we find the end of the working hours int endHour = startHour; while (endHour < 24 && (value & 0x1) != 0) { value = value >> 1; ++endHour; } cal.set(Calendar.HOUR_OF_DAY, startHour); Date startDate = cal.getTime(); cal.set(Calendar.HOUR_OF_DAY, endHour); Date endDate = cal.getTime(); if (calendarHours == null) { calendarHours = calendar.addCalendarHours(day); calendar.setWorkingDay(day, true); } calendarHours.addRange(new DateRange(startDate, endDate)); startHour = endHour; } DateHelper.pushCalendar(cal); }
[ "private", "void", "readHours", "(", "ProjectCalendar", "calendar", ",", "Day", "day", ",", "Integer", "hours", ")", "{", "int", "value", "=", "hours", ".", "intValue", "(", ")", ";", "int", "startHour", "=", "0", ";", "ProjectCalendarHours", "calendarHours"...
Reads the integer representation of calendar hours for a given day and populates the calendar. @param calendar parent calendar @param day target day @param hours working hours
[ "Reads", "the", "integer", "representation", "of", "calendar", "hours", "for", "a", "given", "day", "and", "populates", "the", "calendar", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java#L374-L426
liferay/com-liferay-commerce
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java
CommercePriceEntryPersistenceImpl.findByCommercePriceListId
@Override public List<CommercePriceEntry> findByCommercePriceListId( long commercePriceListId, int start, int end) { return findByCommercePriceListId(commercePriceListId, start, end, null); }
java
@Override public List<CommercePriceEntry> findByCommercePriceListId( long commercePriceListId, int start, int end) { return findByCommercePriceListId(commercePriceListId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommercePriceEntry", ">", "findByCommercePriceListId", "(", "long", "commercePriceListId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCommercePriceListId", "(", "commercePriceListId", ",", "start", ","...
Returns a range of all the commerce price entries where commercePriceListId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommercePriceEntryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param commercePriceListId the commerce price list ID @param start the lower bound of the range of commerce price entries @param end the upper bound of the range of commerce price entries (not inclusive) @return the range of matching commerce price entries
[ "Returns", "a", "range", "of", "all", "the", "commerce", "price", "entries", "where", "commercePriceListId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java#L2559-L2563
soi-toolkit/soi-toolkit-mule
commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/sftp/SftpUtil.java
SftpUtil.initEndpointDirectory
public static void initEndpointDirectory(MuleContext muleContext, String endpointName) throws MuleException, IOException, SftpException { SftpClient sftpClient = getSftpClient(muleContext, endpointName); try { ChannelSftp channelSftp = sftpClient.getChannelSftp(); try { recursiveDelete(muleContext, sftpClient, endpointName, ""); } catch (IOException e) { if (logger.isErrorEnabled()) logger.error("Failed to recursivly delete endpoint " + endpointName, e); } String path = getPathByEndpoint(muleContext, sftpClient, endpointName); mkDirs(channelSftp, path); } finally { sftpClient.disconnect(); if (logger.isDebugEnabled()) logger.debug("Done init endpoint directory: " + endpointName); } }
java
public static void initEndpointDirectory(MuleContext muleContext, String endpointName) throws MuleException, IOException, SftpException { SftpClient sftpClient = getSftpClient(muleContext, endpointName); try { ChannelSftp channelSftp = sftpClient.getChannelSftp(); try { recursiveDelete(muleContext, sftpClient, endpointName, ""); } catch (IOException e) { if (logger.isErrorEnabled()) logger.error("Failed to recursivly delete endpoint " + endpointName, e); } String path = getPathByEndpoint(muleContext, sftpClient, endpointName); mkDirs(channelSftp, path); } finally { sftpClient.disconnect(); if (logger.isDebugEnabled()) logger.debug("Done init endpoint directory: " + endpointName); } }
[ "public", "static", "void", "initEndpointDirectory", "(", "MuleContext", "muleContext", ",", "String", "endpointName", ")", "throws", "MuleException", ",", "IOException", ",", "SftpException", "{", "SftpClient", "sftpClient", "=", "getSftpClient", "(", "muleContext", ...
Ensures that the directory exists and is writable by deleting the directory and then recreate it. @param muleContext @param endpointName @throws org.mule.api.MuleException @throws java.io.IOException @throws com.jcraft.jsch.SftpException
[ "Ensures", "that", "the", "directory", "exists", "and", "is", "writable", "by", "deleting", "the", "directory", "and", "then", "recreate", "it", "." ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/sftp/SftpUtil.java#L116-L134
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java
Item.withInt
public Item withInt(String attrName, int val) { checkInvalidAttrName(attrName); return withNumber(attrName, Integer.valueOf(val)); }
java
public Item withInt(String attrName, int val) { checkInvalidAttrName(attrName); return withNumber(attrName, Integer.valueOf(val)); }
[ "public", "Item", "withInt", "(", "String", "attrName", ",", "int", "val", ")", "{", "checkInvalidAttrName", "(", "attrName", ")", ";", "return", "withNumber", "(", "attrName", ",", "Integer", ".", "valueOf", "(", "val", ")", ")", ";", "}" ]
Sets the value of the specified attribute in the current item to the given value.
[ "Sets", "the", "value", "of", "the", "specified", "attribute", "in", "the", "current", "item", "to", "the", "given", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java#L287-L290
scireum/server-sass
src/main/java/org/serversass/Generator.java
Generator.addResultSection
private void addResultSection(String mediaQueryPath, Section section) { Section qry = mediaQueries.get(mediaQueryPath); if (qry == null) { qry = new Section(); qry.getSelectors().add(Collections.singletonList(mediaQueryPath)); mediaQueries.put(mediaQueryPath, qry); } qry.addSubSection(section); }
java
private void addResultSection(String mediaQueryPath, Section section) { Section qry = mediaQueries.get(mediaQueryPath); if (qry == null) { qry = new Section(); qry.getSelectors().add(Collections.singletonList(mediaQueryPath)); mediaQueries.put(mediaQueryPath, qry); } qry.addSubSection(section); }
[ "private", "void", "addResultSection", "(", "String", "mediaQueryPath", ",", "Section", "section", ")", "{", "Section", "qry", "=", "mediaQueries", ".", "get", "(", "mediaQueryPath", ")", ";", "if", "(", "qry", "==", "null", ")", "{", "qry", "=", "new", ...
/* Adds a section to the given media query section - creates if necessary
[ "/", "*", "Adds", "a", "section", "to", "the", "given", "media", "query", "section", "-", "creates", "if", "necessary" ]
train
https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Generator.java#L359-L367
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/graph/huffman/GraphHuffman.java
GraphHuffman.buildTree
public void buildTree(int[] vertexDegree) { PriorityQueue<Node> pq = new PriorityQueue<>(); for (int i = 0; i < vertexDegree.length; i++) pq.add(new Node(i, vertexDegree[i], null, null)); while (pq.size() > 1) { Node left = pq.remove(); Node right = pq.remove(); Node newNode = new Node(-1, left.count + right.count, left, right); pq.add(newNode); } //Eventually: only one node left -> full tree Node tree = pq.remove(); //Now: convert tree into binary codes. Traverse tree (preorder traversal) -> record path (left/right) -> code int[] innerNodePath = new int[MAX_CODE_LENGTH]; traverse(tree, 0L, (byte) 0, -1, innerNodePath, 0); }
java
public void buildTree(int[] vertexDegree) { PriorityQueue<Node> pq = new PriorityQueue<>(); for (int i = 0; i < vertexDegree.length; i++) pq.add(new Node(i, vertexDegree[i], null, null)); while (pq.size() > 1) { Node left = pq.remove(); Node right = pq.remove(); Node newNode = new Node(-1, left.count + right.count, left, right); pq.add(newNode); } //Eventually: only one node left -> full tree Node tree = pq.remove(); //Now: convert tree into binary codes. Traverse tree (preorder traversal) -> record path (left/right) -> code int[] innerNodePath = new int[MAX_CODE_LENGTH]; traverse(tree, 0L, (byte) 0, -1, innerNodePath, 0); }
[ "public", "void", "buildTree", "(", "int", "[", "]", "vertexDegree", ")", "{", "PriorityQueue", "<", "Node", ">", "pq", "=", "new", "PriorityQueue", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "vertexDegree", ".", "length", ...
Build the Huffman tree given an array of vertex degrees @param vertexDegree vertexDegree[i] = degree of ith vertex
[ "Build", "the", "Huffman", "tree", "given", "an", "array", "of", "vertex", "degrees" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/graph/huffman/GraphHuffman.java#L58-L76
kite-sdk/kite
kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/tool/SchemaTool.java
SchemaTool.modifyTable
private void modifyTable(String tableName, HTableDescriptor newDescriptor) { LOG.info("Modifying table " + tableName); HColumnDescriptor[] newFamilies = newDescriptor.getColumnFamilies(); try { List<HColumnDescriptor> columnsToAdd = Lists.newArrayList(); HTableDescriptor currentFamilies = hbaseAdmin .getTableDescriptor(Bytes.toBytes(tableName)); for (HColumnDescriptor newFamily : newFamilies) { if (!currentFamilies.hasFamily(newFamily.getName())) { columnsToAdd.add(new HColumnDescriptor(newFamily.getName())); } } // Add all the necessary column families if (!columnsToAdd.isEmpty()) { hbaseAdmin.disableTable(tableName); try { for (HColumnDescriptor columnToAdd : columnsToAdd) { hbaseAdmin.addColumn(tableName, columnToAdd); } } finally { hbaseAdmin.enableTable(tableName); } } } catch (IOException e) { throw new DatasetException(e); } }
java
private void modifyTable(String tableName, HTableDescriptor newDescriptor) { LOG.info("Modifying table " + tableName); HColumnDescriptor[] newFamilies = newDescriptor.getColumnFamilies(); try { List<HColumnDescriptor> columnsToAdd = Lists.newArrayList(); HTableDescriptor currentFamilies = hbaseAdmin .getTableDescriptor(Bytes.toBytes(tableName)); for (HColumnDescriptor newFamily : newFamilies) { if (!currentFamilies.hasFamily(newFamily.getName())) { columnsToAdd.add(new HColumnDescriptor(newFamily.getName())); } } // Add all the necessary column families if (!columnsToAdd.isEmpty()) { hbaseAdmin.disableTable(tableName); try { for (HColumnDescriptor columnToAdd : columnsToAdd) { hbaseAdmin.addColumn(tableName, columnToAdd); } } finally { hbaseAdmin.enableTable(tableName); } } } catch (IOException e) { throw new DatasetException(e); } }
[ "private", "void", "modifyTable", "(", "String", "tableName", ",", "HTableDescriptor", "newDescriptor", ")", "{", "LOG", ".", "info", "(", "\"Modifying table \"", "+", "tableName", ")", ";", "HColumnDescriptor", "[", "]", "newFamilies", "=", "newDescriptor", ".", ...
add the column families which are not already present to the given table
[ "add", "the", "column", "families", "which", "are", "not", "already", "present", "to", "the", "given", "table" ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/tool/SchemaTool.java#L369-L395
alexa/alexa-skills-kit-sdk-for-java
ask-sdk-lambda-support/src/com/amazon/ask/SkillStreamHandler.java
SkillStreamHandler.handleRequest
@Override public final void handleRequest(InputStream input, OutputStream output, Context context) throws IOException { byte[] inputBytes = IOUtils.toByteArray(input); for (AlexaSkill skill : skills) { SkillResponse response = skill.execute(new BaseSkillRequest(inputBytes), context); if (response != null) { if (response.isPresent()) { response.writeTo(output); } return; } } throw new AskSdkException("Could not find a skill to handle the incoming request"); }
java
@Override public final void handleRequest(InputStream input, OutputStream output, Context context) throws IOException { byte[] inputBytes = IOUtils.toByteArray(input); for (AlexaSkill skill : skills) { SkillResponse response = skill.execute(new BaseSkillRequest(inputBytes), context); if (response != null) { if (response.isPresent()) { response.writeTo(output); } return; } } throw new AskSdkException("Could not find a skill to handle the incoming request"); }
[ "@", "Override", "public", "final", "void", "handleRequest", "(", "InputStream", "input", ",", "OutputStream", "output", ",", "Context", "context", ")", "throws", "IOException", "{", "byte", "[", "]", "inputBytes", "=", "IOUtils", ".", "toByteArray", "(", "inp...
This method is the primary entry point when executing your Lambda function. The configured {@code SkillStreamHandler} determines the type of request and passes the request to the configured {@code Skill}. <p> Any errors that occur in either the {@code Skill} or the {@code SkillStreamHandler} are converted into a {@code RuntimeException}, causing the Lambda call to fail. Details on the failure are then available in the Lambda console logs within CloudWatch. {@inheritDoc}
[ "This", "method", "is", "the", "primary", "entry", "point", "when", "executing", "your", "Lambda", "function", ".", "The", "configured", "{", "@code", "SkillStreamHandler", "}", "determines", "the", "type", "of", "request", "and", "passes", "the", "request", "...
train
https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-lambda-support/src/com/amazon/ask/SkillStreamHandler.java#L67-L80
milaboratory/milib
src/main/java/com/milaboratory/core/motif/BitapPattern.java
BitapPattern.substitutionAndIndelMatcherLast
public BitapMatcher substitutionAndIndelMatcherLast(int maxNumberOfErrors, final Sequence sequence) { return substitutionAndIndelMatcherLast(maxNumberOfErrors, sequence, 0, sequence.size()); }
java
public BitapMatcher substitutionAndIndelMatcherLast(int maxNumberOfErrors, final Sequence sequence) { return substitutionAndIndelMatcherLast(maxNumberOfErrors, sequence, 0, sequence.size()); }
[ "public", "BitapMatcher", "substitutionAndIndelMatcherLast", "(", "int", "maxNumberOfErrors", ",", "final", "Sequence", "sequence", ")", "{", "return", "substitutionAndIndelMatcherLast", "(", "maxNumberOfErrors", ",", "sequence", ",", "0", ",", "sequence", ".", "size", ...
Returns a BitapMatcher preforming a fuzzy search in a whole {@code sequence}. Search allows no more than {@code maxNumberOfErrors} number of substitutions/insertions/deletions. Matcher will return positions of last matched letter in the motif in ascending order. @param maxNumberOfErrors maximal number of allowed substitutions/insertions/deletions @param sequence target sequence @return matcher which will return positions of last matched letter in the motif
[ "Returns", "a", "BitapMatcher", "preforming", "a", "fuzzy", "search", "in", "a", "whole", "{", "@code", "sequence", "}", ".", "Search", "allows", "no", "more", "than", "{", "@code", "maxNumberOfErrors", "}", "number", "of", "substitutions", "/", "insertions", ...
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/motif/BitapPattern.java#L174-L176
JOML-CI/JOML
src/org/joml/Vector2d.java
Vector2d.set
public Vector2d set(int index, ByteBuffer buffer) { MemUtil.INSTANCE.get(this, index, buffer); return this; }
java
public Vector2d set(int index, ByteBuffer buffer) { MemUtil.INSTANCE.get(this, index, buffer); return this; }
[ "public", "Vector2d", "set", "(", "int", "index", ",", "ByteBuffer", "buffer", ")", "{", "MemUtil", ".", "INSTANCE", ".", "get", "(", "this", ",", "index", ",", "buffer", ")", ";", "return", "this", ";", "}" ]
Read this vector from the supplied {@link ByteBuffer} starting at the specified absolute buffer position/index. <p> This method will not increment the position of the given ByteBuffer. @param index the absolute position into the ByteBuffer @param buffer values will be read in <code>x, y</code> order @return this
[ "Read", "this", "vector", "from", "the", "supplied", "{", "@link", "ByteBuffer", "}", "starting", "at", "the", "specified", "absolute", "buffer", "position", "/", "index", ".", "<p", ">", "This", "method", "will", "not", "increment", "the", "position", "of",...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector2d.java#L301-L304
Minecrell/TerminalConsoleAppender
src/main/java/net/minecrell/terminalconsole/util/LoggerNamePatternSelector.java
LoggerNamePatternSelector.createSelector
@PluginFactory public static LoggerNamePatternSelector createSelector( @Required(message = "Default pattern is required") @PluginAttribute(value = "defaultPattern") String defaultPattern, @PluginElement("PatternMatch") PatternMatch[] properties, @PluginAttribute(value = "alwaysWriteExceptions", defaultBoolean = true) boolean alwaysWriteExceptions, @PluginAttribute("disableAnsi") boolean disableAnsi, @PluginAttribute("noConsoleNoAnsi") boolean noConsoleNoAnsi, @PluginConfiguration Configuration config) { return new LoggerNamePatternSelector(defaultPattern, properties, alwaysWriteExceptions, disableAnsi, noConsoleNoAnsi, config); }
java
@PluginFactory public static LoggerNamePatternSelector createSelector( @Required(message = "Default pattern is required") @PluginAttribute(value = "defaultPattern") String defaultPattern, @PluginElement("PatternMatch") PatternMatch[] properties, @PluginAttribute(value = "alwaysWriteExceptions", defaultBoolean = true) boolean alwaysWriteExceptions, @PluginAttribute("disableAnsi") boolean disableAnsi, @PluginAttribute("noConsoleNoAnsi") boolean noConsoleNoAnsi, @PluginConfiguration Configuration config) { return new LoggerNamePatternSelector(defaultPattern, properties, alwaysWriteExceptions, disableAnsi, noConsoleNoAnsi, config); }
[ "@", "PluginFactory", "public", "static", "LoggerNamePatternSelector", "createSelector", "(", "@", "Required", "(", "message", "=", "\"Default pattern is required\"", ")", "@", "PluginAttribute", "(", "value", "=", "\"defaultPattern\"", ")", "String", "defaultPattern", ...
Creates a new {@link LoggerNamePatternSelector}. @param defaultPattern The default pattern to use if no logger name matches @param properties The pattern match rules to use @param alwaysWriteExceptions Write exceptions even if pattern does not include exception conversion @param disableAnsi If true, disable all ANSI escape codes @param noConsoleNoAnsi If true and {@link System#console()} is null, disable ANSI escape codes @param config The configuration @return The new pattern selector
[ "Creates", "a", "new", "{", "@link", "LoggerNamePatternSelector", "}", "." ]
train
https://github.com/Minecrell/TerminalConsoleAppender/blob/a540454b397ee488993019fbcacc49b2d88f1752/src/main/java/net/minecrell/terminalconsole/util/LoggerNamePatternSelector.java#L151-L160
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/plugins/PluginCommandLine.java
PluginCommandLine.getOptionValue
public String getOptionValue(final char shortOption, final String defaultValue) { return (String) commandLine.getValue("-" + shortOption, defaultValue); }
java
public String getOptionValue(final char shortOption, final String defaultValue) { return (String) commandLine.getValue("-" + shortOption, defaultValue); }
[ "public", "String", "getOptionValue", "(", "final", "char", "shortOption", ",", "final", "String", "defaultValue", ")", "{", "return", "(", "String", ")", "commandLine", ".", "getValue", "(", "\"-\"", "+", "shortOption", ",", "defaultValue", ")", ";", "}" ]
Returns the value of the specified option If the option is not present, returns the default value. @param shortOption The option short name @param defaultValue The default value @return The option value or, if not specified, the default value * @see it.jnrpe.ICommandLine#getOptionValue(char, String)
[ "Returns", "the", "value", "of", "the", "specified", "option", "If", "the", "option", "is", "not", "present", "returns", "the", "default", "value", "." ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/plugins/PluginCommandLine.java#L130-L132
rometools/rome
rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java
MediaModuleGenerator.generateScenes
private void generateScenes(final Metadata m, final Element e) { final Element scenesElement = new Element("scenes", NS); for (final Scene scene : m.getScenes()) { final Element sceneElement = new Element("scene", NS); addNotNullElement(sceneElement, "sceneTitle", scene.getTitle()); addNotNullElement(sceneElement, "sceneDescription", scene.getDescription()); addNotNullElement(sceneElement, "sceneStartTime", scene.getStartTime()); addNotNullElement(sceneElement, "sceneEndTime", scene.getEndTime()); if (!sceneElement.getChildren().isEmpty()) { scenesElement.addContent(sceneElement); } } if (!scenesElement.getChildren().isEmpty()) { e.addContent(scenesElement); } }
java
private void generateScenes(final Metadata m, final Element e) { final Element scenesElement = new Element("scenes", NS); for (final Scene scene : m.getScenes()) { final Element sceneElement = new Element("scene", NS); addNotNullElement(sceneElement, "sceneTitle", scene.getTitle()); addNotNullElement(sceneElement, "sceneDescription", scene.getDescription()); addNotNullElement(sceneElement, "sceneStartTime", scene.getStartTime()); addNotNullElement(sceneElement, "sceneEndTime", scene.getEndTime()); if (!sceneElement.getChildren().isEmpty()) { scenesElement.addContent(sceneElement); } } if (!scenesElement.getChildren().isEmpty()) { e.addContent(scenesElement); } }
[ "private", "void", "generateScenes", "(", "final", "Metadata", "m", ",", "final", "Element", "e", ")", "{", "final", "Element", "scenesElement", "=", "new", "Element", "(", "\"scenes\"", ",", "NS", ")", ";", "for", "(", "final", "Scene", "scene", ":", "m...
Generation of scenes tag. @param m source @param e element to attach new element to
[ "Generation", "of", "scenes", "tag", "." ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-modules/src/main/java/com/rometools/modules/mediarss/io/MediaModuleGenerator.java#L369-L384
aalmiray/Json-lib
src/main/java/net/sf/json/xml/XMLSerializer.java
XMLSerializer.removeNamespace
public void removeNamespace( String prefix, String elementName ) { if( prefix == null ){ prefix = ""; } if( StringUtils.isBlank( elementName ) ){ rootNamespace.remove( prefix.trim() ); }else{ Map nameSpaces = (Map) namespacesPerElement.get( elementName ); nameSpaces.remove( prefix ); } }
java
public void removeNamespace( String prefix, String elementName ) { if( prefix == null ){ prefix = ""; } if( StringUtils.isBlank( elementName ) ){ rootNamespace.remove( prefix.trim() ); }else{ Map nameSpaces = (Map) namespacesPerElement.get( elementName ); nameSpaces.remove( prefix ); } }
[ "public", "void", "removeNamespace", "(", "String", "prefix", ",", "String", "elementName", ")", "{", "if", "(", "prefix", "==", "null", ")", "{", "prefix", "=", "\"\"", ";", "}", "if", "(", "StringUtils", ".", "isBlank", "(", "elementName", ")", ")", ...
Removes a namespace from the root element.<br> If the elementName is null or blank, the namespace will be removed from the root element. @param prefix namespace prefix @param elementName name of target element
[ "Removes", "a", "namespace", "from", "the", "root", "element", ".", "<br", ">", "If", "the", "elementName", "is", "null", "or", "blank", "the", "namespace", "will", "be", "removed", "from", "the", "root", "element", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/xml/XMLSerializer.java#L464-L474
alkacon/opencms-core
src/org/opencms/ui/apps/modules/CmsModuleInfoDialog.java
CmsModuleInfoDialog.formatExplorerType
CmsResourceInfo formatExplorerType(CmsExplorerTypeSettings explorerType) { Resource icon = CmsResourceUtil.getBigIconResource(explorerType, null); String title = CmsVaadinUtils.getMessageText(explorerType.getKey()); if (title.startsWith("???")) { title = explorerType.getName(); } String subtitle = explorerType.getName(); if (explorerType.getReference() != null) { subtitle += " (" + explorerType.getReference() + ")"; } CmsResourceInfo info = new CmsResourceInfo(title, subtitle, icon); return info; }
java
CmsResourceInfo formatExplorerType(CmsExplorerTypeSettings explorerType) { Resource icon = CmsResourceUtil.getBigIconResource(explorerType, null); String title = CmsVaadinUtils.getMessageText(explorerType.getKey()); if (title.startsWith("???")) { title = explorerType.getName(); } String subtitle = explorerType.getName(); if (explorerType.getReference() != null) { subtitle += " (" + explorerType.getReference() + ")"; } CmsResourceInfo info = new CmsResourceInfo(title, subtitle, icon); return info; }
[ "CmsResourceInfo", "formatExplorerType", "(", "CmsExplorerTypeSettings", "explorerType", ")", "{", "Resource", "icon", "=", "CmsResourceUtil", ".", "getBigIconResource", "(", "explorerType", ",", "null", ")", ";", "String", "title", "=", "CmsVaadinUtils", ".", "getMes...
Creates the resource info box for an explorer type.<p> @param explorerType the explorer type @return the resource info box
[ "Creates", "the", "resource", "info", "box", "for", "an", "explorer", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/modules/CmsModuleInfoDialog.java#L151-L164
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Flowable.java
Flowable.doOnLifecycle
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) public final Flowable<T> doOnLifecycle(final Consumer<? super Subscription> onSubscribe, final LongConsumer onRequest, final Action onCancel) { ObjectHelper.requireNonNull(onSubscribe, "onSubscribe is null"); ObjectHelper.requireNonNull(onRequest, "onRequest is null"); ObjectHelper.requireNonNull(onCancel, "onCancel is null"); return RxJavaPlugins.onAssembly(new FlowableDoOnLifecycle<T>(this, onSubscribe, onRequest, onCancel)); }
java
@CheckReturnValue @BackpressureSupport(BackpressureKind.PASS_THROUGH) @SchedulerSupport(SchedulerSupport.NONE) public final Flowable<T> doOnLifecycle(final Consumer<? super Subscription> onSubscribe, final LongConsumer onRequest, final Action onCancel) { ObjectHelper.requireNonNull(onSubscribe, "onSubscribe is null"); ObjectHelper.requireNonNull(onRequest, "onRequest is null"); ObjectHelper.requireNonNull(onCancel, "onCancel is null"); return RxJavaPlugins.onAssembly(new FlowableDoOnLifecycle<T>(this, onSubscribe, onRequest, onCancel)); }
[ "@", "CheckReturnValue", "@", "BackpressureSupport", "(", "BackpressureKind", ".", "PASS_THROUGH", ")", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "Flowable", "<", "T", ">", "doOnLifecycle", "(", "final", "Consumer", "<"...
Calls the appropriate onXXX method (shared between all Subscribers) for the lifecycle events of the sequence (subscription, cancellation, requesting). <p> <img width="640" height="310" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/doOnNext.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The operator doesn't interfere with backpressure which is determined by the source {@code Publisher}'s backpressure behavior.</dd> <dt><b>Scheduler:</b></dt> <dd>{@code doOnLifecycle} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param onSubscribe a Consumer called with the Subscription sent via Subscriber.onSubscribe() @param onRequest a LongConsumer called with the request amount sent via Subscription.request() @param onCancel called when the downstream cancels the Subscription via cancel() @return the source Publisher with the side-effecting behavior applied @see <a href="http://reactivex.io/documentation/operators/do.html">ReactiveX operators documentation: Do</a>
[ "Calls", "the", "appropriate", "onXXX", "method", "(", "shared", "between", "all", "Subscribers", ")", "for", "the", "lifecycle", "events", "of", "the", "sequence", "(", "subscription", "cancellation", "requesting", ")", ".", "<p", ">", "<img", "width", "=", ...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L9032-L9041
wcm-io/wcm-io-tooling
commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/PackageManagerHelper.java
PackageManagerHelper.executePackageManagerMethodStatus
public void executePackageManagerMethodStatus(CloseableHttpClient httpClient, HttpRequestBase method) { PackageManagerStatusCall call = new PackageManagerStatusCall(httpClient, method, log); executeHttpCallWithRetry(call, 0); }
java
public void executePackageManagerMethodStatus(CloseableHttpClient httpClient, HttpRequestBase method) { PackageManagerStatusCall call = new PackageManagerStatusCall(httpClient, method, log); executeHttpCallWithRetry(call, 0); }
[ "public", "void", "executePackageManagerMethodStatus", "(", "CloseableHttpClient", "httpClient", ",", "HttpRequestBase", "method", ")", "{", "PackageManagerStatusCall", "call", "=", "new", "PackageManagerStatusCall", "(", "httpClient", ",", "method", ",", "log", ")", ";...
Execute CRX HTTP Package manager method and checks response status. If the response status is not 200 the call fails (after retrying). @param httpClient Http client @param method Get or Post method
[ "Execute", "CRX", "HTTP", "Package", "manager", "method", "and", "checks", "response", "status", ".", "If", "the", "response", "status", "is", "not", "200", "the", "call", "fails", "(", "after", "retrying", ")", "." ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/PackageManagerHelper.java#L264-L267
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java
ComponentDao.selectByKeysAndBranches
public List<ComponentDto> selectByKeysAndBranches(DbSession session, Map<String, String> branchesByKey) { Set<String> dbKeys = branchesByKey.entrySet().stream() .map(entry -> generateBranchKey(entry.getKey(), entry.getValue())) .collect(toSet()); return selectByDbKeys(session, dbKeys); }
java
public List<ComponentDto> selectByKeysAndBranches(DbSession session, Map<String, String> branchesByKey) { Set<String> dbKeys = branchesByKey.entrySet().stream() .map(entry -> generateBranchKey(entry.getKey(), entry.getValue())) .collect(toSet()); return selectByDbKeys(session, dbKeys); }
[ "public", "List", "<", "ComponentDto", ">", "selectByKeysAndBranches", "(", "DbSession", "session", ",", "Map", "<", "String", ",", "String", ">", "branchesByKey", ")", "{", "Set", "<", "String", ">", "dbKeys", "=", "branchesByKey", ".", "entrySet", "(", ")"...
Return list of components that will will mix main and branch components. Please note that a project can only appear once in the list, it's not possible to ask for many branches on same project with this method.
[ "Return", "list", "of", "components", "that", "will", "will", "mix", "main", "and", "branch", "components", ".", "Please", "note", "that", "a", "project", "can", "only", "appear", "once", "in", "the", "list", "it", "s", "not", "possible", "to", "ask", "f...
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/component/ComponentDao.java#L212-L217
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/store/AbstractStoreResource.java
AbstractStoreResource.setFileInfo
protected void setFileInfo(final String _filename, final long _fileLength) throws EFapsException { if (!_filename.equals(this.fileName) || _fileLength != this.fileLength) { ConnectionResource res = null; try { res = Context.getThreadContext().getConnectionResource(); final AbstractDatabase<?> db = Context.getDbType(); final StringBuilder cmd = new StringBuilder().append(db.getSQLPart(SQLPart.UPDATE)).append(" ") .append(db.getTableQuote()).append(AbstractStoreResource.TABLENAME_STORE) .append(db.getTableQuote()) .append(" ").append(db.getSQLPart(SQLPart.SET)).append(" ") .append(db.getColumnQuote()) .append(AbstractStoreResource.COLNAME_FILENAME) .append(db.getColumnQuote()).append(db.getSQLPart(SQLPart.EQUAL)).append("? ") .append(db.getSQLPart(SQLPart.COMMA)) .append(db.getColumnQuote()) .append(AbstractStoreResource.COLNAME_FILELENGTH) .append(db.getColumnQuote()).append(db.getSQLPart(SQLPart.EQUAL)).append("? ") .append(db.getSQLPart(SQLPart.WHERE)).append(" ") .append(db.getColumnQuote()).append("ID").append(db.getColumnQuote()) .append(db.getSQLPart(SQLPart.EQUAL)).append(getGeneralID()); final PreparedStatement stmt = res.prepareStatement(cmd.toString()); try { stmt.setString(1, _filename); stmt.setLong(2, _fileLength); stmt.execute(); } finally { stmt.close(); } } catch (final EFapsException e) { throw e; } catch (final SQLException e) { throw new EFapsException(JDBCStoreResource.class, "write.SQLException", e); } } }
java
protected void setFileInfo(final String _filename, final long _fileLength) throws EFapsException { if (!_filename.equals(this.fileName) || _fileLength != this.fileLength) { ConnectionResource res = null; try { res = Context.getThreadContext().getConnectionResource(); final AbstractDatabase<?> db = Context.getDbType(); final StringBuilder cmd = new StringBuilder().append(db.getSQLPart(SQLPart.UPDATE)).append(" ") .append(db.getTableQuote()).append(AbstractStoreResource.TABLENAME_STORE) .append(db.getTableQuote()) .append(" ").append(db.getSQLPart(SQLPart.SET)).append(" ") .append(db.getColumnQuote()) .append(AbstractStoreResource.COLNAME_FILENAME) .append(db.getColumnQuote()).append(db.getSQLPart(SQLPart.EQUAL)).append("? ") .append(db.getSQLPart(SQLPart.COMMA)) .append(db.getColumnQuote()) .append(AbstractStoreResource.COLNAME_FILELENGTH) .append(db.getColumnQuote()).append(db.getSQLPart(SQLPart.EQUAL)).append("? ") .append(db.getSQLPart(SQLPart.WHERE)).append(" ") .append(db.getColumnQuote()).append("ID").append(db.getColumnQuote()) .append(db.getSQLPart(SQLPart.EQUAL)).append(getGeneralID()); final PreparedStatement stmt = res.prepareStatement(cmd.toString()); try { stmt.setString(1, _filename); stmt.setLong(2, _fileLength); stmt.execute(); } finally { stmt.close(); } } catch (final EFapsException e) { throw e; } catch (final SQLException e) { throw new EFapsException(JDBCStoreResource.class, "write.SQLException", e); } } }
[ "protected", "void", "setFileInfo", "(", "final", "String", "_filename", ",", "final", "long", "_fileLength", ")", "throws", "EFapsException", "{", "if", "(", "!", "_filename", ".", "equals", "(", "this", ".", "fileName", ")", "||", "_fileLength", "!=", "thi...
Set the info for the file in this store reosurce. @param _filename name of the file @param _fileLength length of the file @throws EFapsException on error
[ "Set", "the", "info", "for", "the", "file", "in", "this", "store", "reosurce", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/store/AbstractStoreResource.java#L253-L291
kiegroup/jbpm
jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java
QueryCriteriaUtil.createRangePredicate
@SuppressWarnings("unchecked") private static <Y extends Comparable<? super Y>> Predicate createRangePredicate( CriteriaBuilder builder, Expression field, Object start, Object end, Class<Y> rangeType ) { if( start != null && end != null ) { // TODO :asserts! return builder.between(field, (Y) start, (Y) end); } else if ( start != null ) { return builder.greaterThanOrEqualTo(field, (Y) start); } else { return builder.lessThanOrEqualTo(field, (Y) end); } }
java
@SuppressWarnings("unchecked") private static <Y extends Comparable<? super Y>> Predicate createRangePredicate( CriteriaBuilder builder, Expression field, Object start, Object end, Class<Y> rangeType ) { if( start != null && end != null ) { // TODO :asserts! return builder.between(field, (Y) start, (Y) end); } else if ( start != null ) { return builder.greaterThanOrEqualTo(field, (Y) start); } else { return builder.lessThanOrEqualTo(field, (Y) end); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "<", "Y", "extends", "Comparable", "<", "?", "super", "Y", ">", ">", "Predicate", "createRangePredicate", "(", "CriteriaBuilder", "builder", ",", "Expression", "field", ",", "Object", "star...
Helper method for creating a ranged (between, open-ended) {@link Predicate} @param builder The {@link CriteriaBuilder}, helpful when creating {@link Predicate}s to add to the {@link CriteriaQuery} @param entityField The {@link Expression} representing a field/column in an entity/table. @param start The start value of the range, or null if open-ended (on the lower end) @param end The end value of the range, or null if open-ended (on the upper end) @param rangeType The {@link Class} or the parameter values @return The created {@link Predicate}
[ "Helper", "method", "for", "creating", "a", "ranged", "(", "between", "open", "-", "ended", ")", "{", "@link", "Predicate", "}" ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java#L552-L562
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/OverrideService.java
OverrideService.getCurrentMethodOrdinal
public int getCurrentMethodOrdinal(int overrideId, int pathId, String clientUUID, String[] filters) throws Exception { int currentOrdinal = 0; List<EnabledEndpoint> enabledEndpoints = getEnabledEndpoints(pathId, clientUUID, filters); for (EnabledEndpoint enabledEndpoint : enabledEndpoints) { if (enabledEndpoint.getOverrideId() == overrideId) { currentOrdinal++; } } return currentOrdinal; }
java
public int getCurrentMethodOrdinal(int overrideId, int pathId, String clientUUID, String[] filters) throws Exception { int currentOrdinal = 0; List<EnabledEndpoint> enabledEndpoints = getEnabledEndpoints(pathId, clientUUID, filters); for (EnabledEndpoint enabledEndpoint : enabledEndpoints) { if (enabledEndpoint.getOverrideId() == overrideId) { currentOrdinal++; } } return currentOrdinal; }
[ "public", "int", "getCurrentMethodOrdinal", "(", "int", "overrideId", ",", "int", "pathId", ",", "String", "clientUUID", ",", "String", "[", "]", "filters", ")", "throws", "Exception", "{", "int", "currentOrdinal", "=", "0", ";", "List", "<", "EnabledEndpoint"...
Get the ordinal value for the last of a particular override on a path @param overrideId Id of the override to check @param pathId Path the override is on @param clientUUID UUID of the client @param filters If supplied, only endpoints ending with values in filters are returned @return The integer ordinal @throws Exception
[ "Get", "the", "ordinal", "value", "for", "the", "last", "of", "a", "particular", "override", "on", "a", "path" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/OverrideService.java#L692-L701
alkacon/opencms-core
src/org/opencms/cmis/CmsCmisUtil.java
CmsCmisUtil.addPropertyDefault
@SuppressWarnings("unchecked") public static boolean addPropertyDefault(PropertiesImpl props, PropertyDefinition<?> propDef) { if ((props == null) || (props.getProperties() == null)) { throw new IllegalArgumentException("Props must not be null!"); } if (propDef == null) { return false; } List<?> defaultValue = propDef.getDefaultValue(); if ((defaultValue != null) && (!defaultValue.isEmpty())) { switch (propDef.getPropertyType()) { case BOOLEAN: props.addProperty(new PropertyBooleanImpl(propDef.getId(), (List<Boolean>)defaultValue)); break; case DATETIME: props.addProperty(new PropertyDateTimeImpl(propDef.getId(), (List<GregorianCalendar>)defaultValue)); break; case DECIMAL: props.addProperty(new PropertyDecimalImpl(propDef.getId(), (List<BigDecimal>)defaultValue)); break; case HTML: props.addProperty(new PropertyHtmlImpl(propDef.getId(), (List<String>)defaultValue)); break; case ID: props.addProperty(new PropertyIdImpl(propDef.getId(), (List<String>)defaultValue)); break; case INTEGER: props.addProperty(new PropertyIntegerImpl(propDef.getId(), (List<BigInteger>)defaultValue)); break; case STRING: props.addProperty(new PropertyStringImpl(propDef.getId(), (List<String>)defaultValue)); break; case URI: props.addProperty(new PropertyUriImpl(propDef.getId(), (List<String>)defaultValue)); break; default: throw new RuntimeException("Unknown datatype! Spec change?"); } return true; } return false; }
java
@SuppressWarnings("unchecked") public static boolean addPropertyDefault(PropertiesImpl props, PropertyDefinition<?> propDef) { if ((props == null) || (props.getProperties() == null)) { throw new IllegalArgumentException("Props must not be null!"); } if (propDef == null) { return false; } List<?> defaultValue = propDef.getDefaultValue(); if ((defaultValue != null) && (!defaultValue.isEmpty())) { switch (propDef.getPropertyType()) { case BOOLEAN: props.addProperty(new PropertyBooleanImpl(propDef.getId(), (List<Boolean>)defaultValue)); break; case DATETIME: props.addProperty(new PropertyDateTimeImpl(propDef.getId(), (List<GregorianCalendar>)defaultValue)); break; case DECIMAL: props.addProperty(new PropertyDecimalImpl(propDef.getId(), (List<BigDecimal>)defaultValue)); break; case HTML: props.addProperty(new PropertyHtmlImpl(propDef.getId(), (List<String>)defaultValue)); break; case ID: props.addProperty(new PropertyIdImpl(propDef.getId(), (List<String>)defaultValue)); break; case INTEGER: props.addProperty(new PropertyIntegerImpl(propDef.getId(), (List<BigInteger>)defaultValue)); break; case STRING: props.addProperty(new PropertyStringImpl(propDef.getId(), (List<String>)defaultValue)); break; case URI: props.addProperty(new PropertyUriImpl(propDef.getId(), (List<String>)defaultValue)); break; default: throw new RuntimeException("Unknown datatype! Spec change?"); } return true; } return false; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "boolean", "addPropertyDefault", "(", "PropertiesImpl", "props", ",", "PropertyDefinition", "<", "?", ">", "propDef", ")", "{", "if", "(", "(", "props", "==", "null", ")", "||", "(", "pr...
Adds the default value of property if defined. @param props the Properties object @param propDef the property definition @return true if the property could be added
[ "Adds", "the", "default", "value", "of", "property", "if", "defined", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cmis/CmsCmisUtil.java#L215-L261
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/MBTilesHelper.java
MBTilesHelper.getTile
public BufferedImage getTile( int x, int y, int z ) throws Exception { try (PreparedStatement statement = connection.prepareStatement(SELECTQUERY)) { statement.setInt(1, z); statement.setInt(2, x); statement.setInt(3, y); ResultSet resultSet = statement.executeQuery(); if (resultSet.next()) { byte[] imageBytes = resultSet.getBytes(1); boolean orig = ImageIO.getUseCache(); ImageIO.setUseCache(false); InputStream in = new ByteArrayInputStream(imageBytes); BufferedImage bufferedImage = ImageIO.read(in); ImageIO.setUseCache(orig); return bufferedImage; } } return null; }
java
public BufferedImage getTile( int x, int y, int z ) throws Exception { try (PreparedStatement statement = connection.prepareStatement(SELECTQUERY)) { statement.setInt(1, z); statement.setInt(2, x); statement.setInt(3, y); ResultSet resultSet = statement.executeQuery(); if (resultSet.next()) { byte[] imageBytes = resultSet.getBytes(1); boolean orig = ImageIO.getUseCache(); ImageIO.setUseCache(false); InputStream in = new ByteArrayInputStream(imageBytes); BufferedImage bufferedImage = ImageIO.read(in); ImageIO.setUseCache(orig); return bufferedImage; } } return null; }
[ "public", "BufferedImage", "getTile", "(", "int", "x", ",", "int", "y", ",", "int", "z", ")", "throws", "Exception", "{", "try", "(", "PreparedStatement", "statement", "=", "connection", ".", "prepareStatement", "(", "SELECTQUERY", ")", ")", "{", "statement"...
Get a Tile image from the database. @param x @param y @param z @return @throws Exception
[ "Get", "a", "Tile", "image", "from", "the", "database", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/MBTilesHelper.java#L275-L292
jbossas/jboss-invocation
src/main/java/org/jboss/invocation/proxy/ProxyFactory.java
ProxyFactory.getInvocationHandlerStatic
public static InvocationHandler getInvocationHandlerStatic(Object proxy) { try { final Field field = proxy.getClass().getDeclaredField(INVOCATION_HANDLER_FIELD); AccessController.doPrivileged(new SetAccessiblePrivilege(field)); return (InvocationHandler) field.get(proxy); } catch (NoSuchFieldException e) { throw new RuntimeException("Could not find invocation handler on generated proxy", e); } catch (IllegalArgumentException e) { throw new RuntimeException("Object is not a proxy of correct type", e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
java
public static InvocationHandler getInvocationHandlerStatic(Object proxy) { try { final Field field = proxy.getClass().getDeclaredField(INVOCATION_HANDLER_FIELD); AccessController.doPrivileged(new SetAccessiblePrivilege(field)); return (InvocationHandler) field.get(proxy); } catch (NoSuchFieldException e) { throw new RuntimeException("Could not find invocation handler on generated proxy", e); } catch (IllegalArgumentException e) { throw new RuntimeException("Object is not a proxy of correct type", e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
[ "public", "static", "InvocationHandler", "getInvocationHandlerStatic", "(", "Object", "proxy", ")", "{", "try", "{", "final", "Field", "field", "=", "proxy", ".", "getClass", "(", ")", ".", "getDeclaredField", "(", "INVOCATION_HANDLER_FIELD", ")", ";", "AccessCont...
Gets the {@link InvocationHandler} for a given proxy instance. This method is less efficient than {@link #getInvocationHandler(Object)}, however it will work for any proxy, not just proxies from a specific factory instance. @param proxy the proxy @return the invocation handler
[ "Gets", "the", "{", "@link", "InvocationHandler", "}", "for", "a", "given", "proxy", "instance", ".", "This", "method", "is", "less", "efficient", "than", "{", "@link", "#getInvocationHandler", "(", "Object", ")", "}", "however", "it", "will", "work", "for",...
train
https://github.com/jbossas/jboss-invocation/blob/f72586a554264cbc78fcdad9fdd3e84b833249c9/src/main/java/org/jboss/invocation/proxy/ProxyFactory.java#L416-L428
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/source/extractor/partition/Partitioner.java
Partitioner.adjustWatermark
private static long adjustWatermark(String baseWatermark, WatermarkType watermarkType) { long result = ConfigurationKeys.DEFAULT_WATERMARK_VALUE; switch (watermarkType) { case SIMPLE: result = SimpleWatermark.adjustWatermark(baseWatermark, 0); break; case DATE: result = DateWatermark.adjustWatermark(baseWatermark, 0); break; case HOUR: result = HourWatermark.adjustWatermark(baseWatermark, 0); break; case TIMESTAMP: result = TimestampWatermark.adjustWatermark(baseWatermark, 0); break; } return result; }
java
private static long adjustWatermark(String baseWatermark, WatermarkType watermarkType) { long result = ConfigurationKeys.DEFAULT_WATERMARK_VALUE; switch (watermarkType) { case SIMPLE: result = SimpleWatermark.adjustWatermark(baseWatermark, 0); break; case DATE: result = DateWatermark.adjustWatermark(baseWatermark, 0); break; case HOUR: result = HourWatermark.adjustWatermark(baseWatermark, 0); break; case TIMESTAMP: result = TimestampWatermark.adjustWatermark(baseWatermark, 0); break; } return result; }
[ "private", "static", "long", "adjustWatermark", "(", "String", "baseWatermark", ",", "WatermarkType", "watermarkType", ")", "{", "long", "result", "=", "ConfigurationKeys", ".", "DEFAULT_WATERMARK_VALUE", ";", "switch", "(", "watermarkType", ")", "{", "case", "SIMPL...
Adjust a watermark based on watermark type @param baseWatermark the original watermark @param watermarkType Watermark Type @return the adjusted watermark value
[ "Adjust", "a", "watermark", "based", "on", "watermark", "type" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/partition/Partitioner.java#L285-L302
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/ClassUtils.java
ClassUtils.isAssignable
@GwtIncompatible("incompatible method") public static boolean isAssignable(final Class<?> cls, final Class<?> toClass) { return isAssignable(cls, toClass, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5)); }
java
@GwtIncompatible("incompatible method") public static boolean isAssignable(final Class<?> cls, final Class<?> toClass) { return isAssignable(cls, toClass, SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_5)); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "boolean", "isAssignable", "(", "final", "Class", "<", "?", ">", "cls", ",", "final", "Class", "<", "?", ">", "toClass", ")", "{", "return", "isAssignable", "(", "cls", ",", "...
<p>Checks if one {@code Class} can be assigned to a variable of another {@code Class}.</p> <p>Unlike the {@link Class#isAssignableFrom(java.lang.Class)} method, this method takes into account widenings of primitive classes and {@code null}s.</p> <p>Primitive widenings allow an int to be assigned to a long, float or double. This method returns the correct result for these cases.</p> <p>{@code Null} may be assigned to any reference type. This method will return {@code true} if {@code null} is passed in and the toClass is non-primitive.</p> <p>Specifically, this method tests whether the type represented by the specified {@code Class} parameter can be converted to the type represented by this {@code Class} object via an identity conversion widening primitive or widening reference conversion. See <em><a href="http://docs.oracle.com/javase/specs/">The Java Language Specification</a></em>, sections 5.1.1, 5.1.2 and 5.1.4 for details.</p> <p><strong>Since Lang 3.0,</strong> this method will default behavior for calculating assignability between primitive and wrapper types <em>corresponding to the running Java version</em>; i.e. autoboxing will be the default behavior in VMs running Java versions &gt; 1.5.</p> @param cls the Class to check, may be null @param toClass the Class to try to assign into, returns false if null @return {@code true} if assignment possible
[ "<p", ">", "Checks", "if", "one", "{", "@code", "Class", "}", "can", "be", "assigned", "to", "a", "variable", "of", "another", "{", "@code", "Class", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/ClassUtils.java#L766-L769
cose-wg/COSE-JAVA
src/main/java/COSE/Attribute.java
Attribute.addAttribute
public void addAttribute(HeaderKeys label, CBORObject value, int where) throws CoseException { addAttribute(label.AsCBOR(), value, where); }
java
public void addAttribute(HeaderKeys label, CBORObject value, int where) throws CoseException { addAttribute(label.AsCBOR(), value, where); }
[ "public", "void", "addAttribute", "(", "HeaderKeys", "label", ",", "CBORObject", "value", ",", "int", "where", ")", "throws", "CoseException", "{", "addAttribute", "(", "label", ".", "AsCBOR", "(", ")", ",", "value", ",", "where", ")", ";", "}" ]
Set an attribute in the COSE object. Setting an attribute in one map will remove it from all other maps as a side effect. @param label HeaderKeys label which identifies the attribute in the map @param value CBOR object which contains the value of the attribute @param where Identifies which of the buckets to place the attribute in. ProtectedAttributes - attributes cryptographically protected UnprotectedAttributes - attributes not cryptographically protected DontSendAttributes - attributes used locally and not transmitted @exception CoseException COSE Package exception
[ "Set", "an", "attribute", "in", "the", "COSE", "object", ".", "Setting", "an", "attribute", "in", "one", "map", "will", "remove", "it", "from", "all", "other", "maps", "as", "a", "side", "effect", "." ]
train
https://github.com/cose-wg/COSE-JAVA/blob/f972b11ab4c9a18f911bc49a15225a6951cf6f63/src/main/java/COSE/Attribute.java#L148-L150
Alluxio/alluxio
core/base/src/main/java/alluxio/security/authorization/AccessControlList.java
AccessControlList.checkPermission
public boolean checkPermission(String user, List<String> groups, AclAction action) { return getPermission(user, groups).contains(action); }
java
public boolean checkPermission(String user, List<String> groups, AclAction action) { return getPermission(user, groups).contains(action); }
[ "public", "boolean", "checkPermission", "(", "String", "user", ",", "List", "<", "String", ">", "groups", ",", "AclAction", "action", ")", "{", "return", "getPermission", "(", "user", ",", "groups", ")", ".", "contains", "(", "action", ")", ";", "}" ]
Checks whether the user has the permission to perform the action. 1. If the user is the owner, then the owner entry determines the permission; 2. Else if the user matches the name of one of the named user entries, this entry determines the permission; 3. Else if one of the groups is the owning group and the owning group entry contains the requested permission, the permission is granted; 4. Else if one of the groups matches the name of one of the named group entries and this entry contains the requested permission, the permission is granted; 5. Else if one of the groups is the owning group or matches the name of one of the named group entries, but neither the owning group entry nor any of the matching named group entries contains the requested permission, the permission is denied; 6. Otherwise, the other entry determines the permission. @param user the user @param groups the groups the user belongs to @param action the action @return whether user has the permission to perform the action
[ "Checks", "whether", "the", "user", "has", "the", "permission", "to", "perform", "the", "action", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/base/src/main/java/alluxio/security/authorization/AccessControlList.java#L310-L312
prestodb/presto
presto-main/src/main/java/com/facebook/presto/memory/MemoryPool.java
MemoryPool.tryReserve
public boolean tryReserve(QueryId queryId, String allocationTag, long bytes) { checkArgument(bytes >= 0, "bytes is negative"); synchronized (this) { if (getFreeBytes() - bytes < 0) { return false; } reservedBytes += bytes; if (bytes != 0) { queryMemoryReservations.merge(queryId, bytes, Long::sum); updateTaggedMemoryAllocations(queryId, allocationTag, bytes); } } onMemoryReserved(); return true; }
java
public boolean tryReserve(QueryId queryId, String allocationTag, long bytes) { checkArgument(bytes >= 0, "bytes is negative"); synchronized (this) { if (getFreeBytes() - bytes < 0) { return false; } reservedBytes += bytes; if (bytes != 0) { queryMemoryReservations.merge(queryId, bytes, Long::sum); updateTaggedMemoryAllocations(queryId, allocationTag, bytes); } } onMemoryReserved(); return true; }
[ "public", "boolean", "tryReserve", "(", "QueryId", "queryId", ",", "String", "allocationTag", ",", "long", "bytes", ")", "{", "checkArgument", "(", "bytes", ">=", "0", ",", "\"bytes is negative\"", ")", ";", "synchronized", "(", "this", ")", "{", "if", "(", ...
Try to reserve the given number of bytes. Return value indicates whether the caller may use the requested memory.
[ "Try", "to", "reserve", "the", "given", "number", "of", "bytes", ".", "Return", "value", "indicates", "whether", "the", "caller", "may", "use", "the", "requested", "memory", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-main/src/main/java/com/facebook/presto/memory/MemoryPool.java#L171-L187
KostyaSha/yet-another-docker-plugin
yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/utils/HostAndPortChecker.java
HostAndPortChecker.bySshWithEveryRetryWaitFor
public void bySshWithEveryRetryWaitFor(int time, TimeUnit units) throws IOException { checkState(withEveryRetryWaitFor(time, units), "Port %s is not opened to connect to", hostAndPort.getPort()); for (int i = 1; i <= retries; i++) { Connection connection = new Connection(hostAndPort.getHostText(), hostAndPort.getPort()); try { connection.connect(null, 0, sshTimeoutMillis, sshTimeoutMillis); LOG.info("SSH port is open on {}:{}", hostAndPort.getHostText(), hostAndPort.getPort()); return; } catch (IOException e) { LOG.error("Failed to connect to {}:{} (try {}/{}) - {}", hostAndPort.getHostText(), hostAndPort.getPort(), i, retries, e.getMessage()); if (i == retries) { throw e; } } finally { connection.close(); } sleepFor(time, units); } }
java
public void bySshWithEveryRetryWaitFor(int time, TimeUnit units) throws IOException { checkState(withEveryRetryWaitFor(time, units), "Port %s is not opened to connect to", hostAndPort.getPort()); for (int i = 1; i <= retries; i++) { Connection connection = new Connection(hostAndPort.getHostText(), hostAndPort.getPort()); try { connection.connect(null, 0, sshTimeoutMillis, sshTimeoutMillis); LOG.info("SSH port is open on {}:{}", hostAndPort.getHostText(), hostAndPort.getPort()); return; } catch (IOException e) { LOG.error("Failed to connect to {}:{} (try {}/{}) - {}", hostAndPort.getHostText(), hostAndPort.getPort(), i, retries, e.getMessage()); if (i == retries) { throw e; } } finally { connection.close(); } sleepFor(time, units); } }
[ "public", "void", "bySshWithEveryRetryWaitFor", "(", "int", "time", ",", "TimeUnit", "units", ")", "throws", "IOException", "{", "checkState", "(", "withEveryRetryWaitFor", "(", "time", ",", "units", ")", ",", "\"Port %s is not opened to connect to\"", ",", "hostAndPo...
Connects to sshd on host:port Retries while attempts reached with delay First with tcp port wait, then with ssh connection wait @throws IOException if no retries left
[ "Connects", "to", "sshd", "on", "host", ":", "port", "Retries", "while", "attempts", "reached", "with", "delay", "First", "with", "tcp", "port", "wait", "then", "with", "ssh", "connection", "wait" ]
train
https://github.com/KostyaSha/yet-another-docker-plugin/blob/40b12e39ff94c3834cff7e028c3dd01c88e87d77/yet-another-docker-plugin/src/main/java/com/github/kostyasha/yad/utils/HostAndPortChecker.java#L83-L103
alkacon/opencms-core
src/org/opencms/jlan/CmsJlanRepository.java
CmsJlanRepository.getCms
public CmsObjectWrapper getCms(SrvSession session, TreeConnection connection) throws CmsException { String userName = session.getClientInformation().getUserName(); userName = CmsJlanUsers.translateUser(userName); CmsContextInfo contextInfo = new CmsContextInfo(m_cms.getRequestContext()); contextInfo.setUserName(userName); CmsObject newCms = OpenCms.initCmsObject(m_cms, contextInfo); newCms.getRequestContext().setSiteRoot(getRoot()); newCms.getRequestContext().setCurrentProject(getProject()); CmsObjectWrapper result = new CmsObjectWrapper(newCms, getWrappers()); result.setAddByteOrderMark(m_addByteOrderMark); result.getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE); return result; }
java
public CmsObjectWrapper getCms(SrvSession session, TreeConnection connection) throws CmsException { String userName = session.getClientInformation().getUserName(); userName = CmsJlanUsers.translateUser(userName); CmsContextInfo contextInfo = new CmsContextInfo(m_cms.getRequestContext()); contextInfo.setUserName(userName); CmsObject newCms = OpenCms.initCmsObject(m_cms, contextInfo); newCms.getRequestContext().setSiteRoot(getRoot()); newCms.getRequestContext().setCurrentProject(getProject()); CmsObjectWrapper result = new CmsObjectWrapper(newCms, getWrappers()); result.setAddByteOrderMark(m_addByteOrderMark); result.getRequestContext().setAttribute(CmsXmlContent.AUTO_CORRECTION_ATTRIBUTE, Boolean.TRUE); return result; }
[ "public", "CmsObjectWrapper", "getCms", "(", "SrvSession", "session", ",", "TreeConnection", "connection", ")", "throws", "CmsException", "{", "String", "userName", "=", "session", ".", "getClientInformation", "(", ")", ".", "getUserName", "(", ")", ";", "userName...
Creates a CmsObjectWrapper for the current session.<p> @param session the current session @param connection the tree connection @return the correctly configured CmsObjectWrapper for this session @throws CmsException if something goes wrong
[ "Creates", "a", "CmsObjectWrapper", "for", "the", "current", "session", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jlan/CmsJlanRepository.java#L217-L230
google/closure-compiler
src/com/google/javascript/refactoring/Matchers.java
Matchers.not
public static Matcher not(final Matcher matcher) { return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { return !matcher.matches(node, metadata); } }; }
java
public static Matcher not(final Matcher matcher) { return new Matcher() { @Override public boolean matches(Node node, NodeMetadata metadata) { return !matcher.matches(node, metadata); } }; }
[ "public", "static", "Matcher", "not", "(", "final", "Matcher", "matcher", ")", "{", "return", "new", "Matcher", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "Node", "node", ",", "NodeMetadata", "metadata", ")", "{", "return", "!", ...
Returns a Matcher that matches the opposite of the provided matcher.
[ "Returns", "a", "Matcher", "that", "matches", "the", "opposite", "of", "the", "provided", "matcher", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/refactoring/Matchers.java#L81-L87
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/OrientedBox3f.java
OrientedBox3f.setFirstAxis
@Override public void setFirstAxis(double x, double y, double z, double extent) { setFirstAxis(x, y, z, extent, CoordinateSystem3D.getDefaultCoordinateSystem()); }
java
@Override public void setFirstAxis(double x, double y, double z, double extent) { setFirstAxis(x, y, z, extent, CoordinateSystem3D.getDefaultCoordinateSystem()); }
[ "@", "Override", "public", "void", "setFirstAxis", "(", "double", "x", ",", "double", "y", ",", "double", "z", ",", "double", "extent", ")", "{", "setFirstAxis", "(", "x", ",", "y", ",", "z", ",", "extent", ",", "CoordinateSystem3D", ".", "getDefaultCoor...
Set the first axis of the box. The third axis is updated to be perpendicular to the two other axis. @param x @param y @param z @param extent
[ "Set", "the", "first", "axis", "of", "the", "box", ".", "The", "third", "axis", "is", "updated", "to", "be", "perpendicular", "to", "the", "two", "other", "axis", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/OrientedBox3f.java#L439-L442
pwittchen/NetworkEvents
network-events-library/src/main/java/com/github/pwittchen/networkevents/library/NetworkEvents.java
NetworkEvents.setPingParameters
public NetworkEvents setPingParameters(String host, int port, int timeoutInMs) { onlineChecker.setPingParameters(host, port, timeoutInMs); return this; }
java
public NetworkEvents setPingParameters(String host, int port, int timeoutInMs) { onlineChecker.setPingParameters(host, port, timeoutInMs); return this; }
[ "public", "NetworkEvents", "setPingParameters", "(", "String", "host", ",", "int", "port", ",", "int", "timeoutInMs", ")", "{", "onlineChecker", ".", "setPingParameters", "(", "host", ",", "port", ",", "timeoutInMs", ")", ";", "return", "this", ";", "}" ]
Sets ping parameters of the host used to check Internet connection. If it's not set, library will use default ping parameters. @param host host to be pinged @param port port of the host @param timeoutInMs timeout in milliseconds @return NetworkEvents object
[ "Sets", "ping", "parameters", "of", "the", "host", "used", "to", "check", "Internet", "connection", ".", "If", "it", "s", "not", "set", "library", "will", "use", "default", "ping", "parameters", "." ]
train
https://github.com/pwittchen/NetworkEvents/blob/6a76a75f95bff92ac3824275fd6b2f5d92db1c7d/network-events-library/src/main/java/com/github/pwittchen/networkevents/library/NetworkEvents.java#L117-L120
craftercms/search
crafter-search-client/src/main/java/org/craftercms/search/service/utils/RestClientUtils.java
RestClientUtils.getSearchException
public static SearchException getSearchException(final String indexId, final String message, final HttpStatusCodeException e) { switch (e.getStatusCode()) { case SERVICE_UNAVAILABLE: return new SearchServerException(message, e); default: return new SearchException(indexId, message, e); } }
java
public static SearchException getSearchException(final String indexId, final String message, final HttpStatusCodeException e) { switch (e.getStatusCode()) { case SERVICE_UNAVAILABLE: return new SearchServerException(message, e); default: return new SearchException(indexId, message, e); } }
[ "public", "static", "SearchException", "getSearchException", "(", "final", "String", "indexId", ",", "final", "String", "message", ",", "final", "HttpStatusCodeException", "e", ")", "{", "switch", "(", "e", ".", "getStatusCode", "(", ")", ")", "{", "case", "SE...
Returns an instance of the appropriate {@link SearchException} depending on the value of the {@link HttpStatus}. @param indexId the id of the index @param message the message for the exception @param e the exception thrown by the http client @return the instance of the exception
[ "Returns", "an", "instance", "of", "the", "appropriate", "{" ]
train
https://github.com/craftercms/search/blob/337ba446badbfbc4912cd8ccd7d50fd62d6be2cc/crafter-search-client/src/main/java/org/craftercms/search/service/utils/RestClientUtils.java#L107-L115
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java
ArrayUtil.readLong
public static long readLong(byte b[], int offset) { long retValue; retValue = ((long)b[offset++]) << 56; retValue |= ((long)b[offset++] & 0xff) << 48; retValue |= ((long)b[offset++] & 0xff) << 40; retValue |= ((long)b[offset++] & 0xff) << 32; retValue |= ((long)b[offset++] & 0xff) << 24; retValue |= ((long)b[offset++] & 0xff) << 16; retValue |= ((long)b[offset++] & 0xff) << 8; retValue |= (long)b[offset] & 0xff; return retValue; }
java
public static long readLong(byte b[], int offset) { long retValue; retValue = ((long)b[offset++]) << 56; retValue |= ((long)b[offset++] & 0xff) << 48; retValue |= ((long)b[offset++] & 0xff) << 40; retValue |= ((long)b[offset++] & 0xff) << 32; retValue |= ((long)b[offset++] & 0xff) << 24; retValue |= ((long)b[offset++] & 0xff) << 16; retValue |= ((long)b[offset++] & 0xff) << 8; retValue |= (long)b[offset] & 0xff; return retValue; }
[ "public", "static", "long", "readLong", "(", "byte", "b", "[", "]", ",", "int", "offset", ")", "{", "long", "retValue", ";", "retValue", "=", "(", "(", "long", ")", "b", "[", "offset", "++", "]", ")", "<<", "56", ";", "retValue", "|=", "(", "(", ...
Unserializes a long from a byte array at a specific offset in big-endian order @param b byte array from which to read a long value. @param offset offset within byte array to start reading. @return long read from byte array.
[ "Unserializes", "a", "long", "from", "a", "byte", "array", "at", "a", "specific", "offset", "in", "big", "-", "endian", "order" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java#L46-L59
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java
SequenceManagerNextValImpl.getUniqueLong
protected long getUniqueLong(FieldDescriptor field) throws SequenceManagerException { long result; // lookup sequence name String sequenceName = calculateSequenceName(field); try { result = buildNextSequence(field.getClassDescriptor(), sequenceName); } catch (Throwable e) { // maybe the sequence was not created try { log.info("Create DB sequence key '"+sequenceName+"'"); createSequence(field.getClassDescriptor(), sequenceName); } catch (Exception e1) { throw new SequenceManagerException( SystemUtils.LINE_SEPARATOR + "Could not grab next id, failed with " + SystemUtils.LINE_SEPARATOR + e.getMessage() + SystemUtils.LINE_SEPARATOR + "Creation of new sequence failed with " + SystemUtils.LINE_SEPARATOR + e1.getMessage() + SystemUtils.LINE_SEPARATOR , e1); } try { result = buildNextSequence(field.getClassDescriptor(), sequenceName); } catch (Throwable e1) { throw new SequenceManagerException("Could not grab next id, sequence seems to exist", e); } } return result; }
java
protected long getUniqueLong(FieldDescriptor field) throws SequenceManagerException { long result; // lookup sequence name String sequenceName = calculateSequenceName(field); try { result = buildNextSequence(field.getClassDescriptor(), sequenceName); } catch (Throwable e) { // maybe the sequence was not created try { log.info("Create DB sequence key '"+sequenceName+"'"); createSequence(field.getClassDescriptor(), sequenceName); } catch (Exception e1) { throw new SequenceManagerException( SystemUtils.LINE_SEPARATOR + "Could not grab next id, failed with " + SystemUtils.LINE_SEPARATOR + e.getMessage() + SystemUtils.LINE_SEPARATOR + "Creation of new sequence failed with " + SystemUtils.LINE_SEPARATOR + e1.getMessage() + SystemUtils.LINE_SEPARATOR , e1); } try { result = buildNextSequence(field.getClassDescriptor(), sequenceName); } catch (Throwable e1) { throw new SequenceManagerException("Could not grab next id, sequence seems to exist", e); } } return result; }
[ "protected", "long", "getUniqueLong", "(", "FieldDescriptor", "field", ")", "throws", "SequenceManagerException", "{", "long", "result", ";", "// lookup sequence name\r", "String", "sequenceName", "=", "calculateSequenceName", "(", "field", ")", ";", "try", "{", "resu...
returns a unique long value for class clazz and field fieldName. the returned number is unique accross all tables in the extent of clazz.
[ "returns", "a", "unique", "long", "value", "for", "class", "clazz", "and", "field", "fieldName", ".", "the", "returned", "number", "is", "unique", "accross", "all", "tables", "in", "the", "extent", "of", "clazz", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/sequence/SequenceManagerNextValImpl.java#L118-L155
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addScriptProperties
public void addScriptProperties(Content head) { HtmlTree javascript = HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath()); head.addContent(javascript); if (configuration.createindex) { if (pathToRoot != null && script != null) { String ptrPath = pathToRoot.isEmpty() ? "." : pathToRoot.getPath(); script.addContent(new RawHtml("var pathtoroot = \"" + ptrPath + "/\";loadScripts(document, \'script\');")); } addJQueryFile(head, DocPaths.JSZIP_MIN); addJQueryFile(head, DocPaths.JSZIPUTILS_MIN); head.addContent(new RawHtml("<!--[if IE]>")); addJQueryFile(head, DocPaths.JSZIPUTILS_IE_MIN); head.addContent(new RawHtml("<![endif]-->")); addJQueryFile(head, DocPaths.JQUERY_JS_1_10); addJQueryFile(head, DocPaths.JQUERY_JS); } }
java
public void addScriptProperties(Content head) { HtmlTree javascript = HtmlTree.SCRIPT(pathToRoot.resolve(DocPaths.JAVASCRIPT).getPath()); head.addContent(javascript); if (configuration.createindex) { if (pathToRoot != null && script != null) { String ptrPath = pathToRoot.isEmpty() ? "." : pathToRoot.getPath(); script.addContent(new RawHtml("var pathtoroot = \"" + ptrPath + "/\";loadScripts(document, \'script\');")); } addJQueryFile(head, DocPaths.JSZIP_MIN); addJQueryFile(head, DocPaths.JSZIPUTILS_MIN); head.addContent(new RawHtml("<!--[if IE]>")); addJQueryFile(head, DocPaths.JSZIPUTILS_IE_MIN); head.addContent(new RawHtml("<![endif]-->")); addJQueryFile(head, DocPaths.JQUERY_JS_1_10); addJQueryFile(head, DocPaths.JQUERY_JS); } }
[ "public", "void", "addScriptProperties", "(", "Content", "head", ")", "{", "HtmlTree", "javascript", "=", "HtmlTree", ".", "SCRIPT", "(", "pathToRoot", ".", "resolve", "(", "DocPaths", ".", "JAVASCRIPT", ")", ".", "getPath", "(", ")", ")", ";", "head", "."...
Add a link to the JavaScript file. @param head the content tree to which the files will be added
[ "Add", "a", "link", "to", "the", "JavaScript", "file", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L2163-L2179
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.getDisplayCountry
public static String getDisplayCountry(String localeID, ULocale displayLocale) { return getDisplayCountryInternal(new ULocale(localeID), displayLocale); }
java
public static String getDisplayCountry(String localeID, ULocale displayLocale) { return getDisplayCountryInternal(new ULocale(localeID), displayLocale); }
[ "public", "static", "String", "getDisplayCountry", "(", "String", "localeID", ",", "ULocale", "displayLocale", ")", "{", "return", "getDisplayCountryInternal", "(", "new", "ULocale", "(", "localeID", ")", ",", "displayLocale", ")", ";", "}" ]
<strong>[icu]</strong> Returns a locale's country localized for display in the provided locale. <b>Warning: </b>this is for the region part of a valid locale ID; it cannot just be the region code (like "FR"). To get the display name for a region alone, or for other options, use {@link LocaleDisplayNames} instead. This is a cover for the ICU4C API. @param localeID the id of the locale whose country will be displayed. @param displayLocale the locale in which to display the name. @return the localized country name.
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "a", "locale", "s", "country", "localized", "for", "display", "in", "the", "provided", "locale", ".", "<b", ">", "Warning", ":", "<", "/", "b", ">", "this", "is", "for", "the", "r...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1606-L1608
threerings/narya
core/src/main/java/com/threerings/presents/dobj/DObject.java
DObject.setLocal
public <T> void setLocal (Class<T> key, T attr) { // locate any existing attribute that matches our key for (int ii = 0, ll = _locattrs.length; ii < ll; ii++) { if (key.isInstance(_locattrs[ii])) { if (attr != null) { throw new IllegalStateException( "Attribute already exists that matches the supplied key " + "[key=" + key + ", have=" + _locattrs[ii].getClass()); } _locattrs = ArrayUtil.splice(_locattrs, ii, 1); return; } } // if we were trying to clear out an attribute but didn't find it, then stop here if (attr == null) { return; } // otherwise append our attribute to the end of the list _locattrs = ArrayUtil.append(_locattrs, attr); }
java
public <T> void setLocal (Class<T> key, T attr) { // locate any existing attribute that matches our key for (int ii = 0, ll = _locattrs.length; ii < ll; ii++) { if (key.isInstance(_locattrs[ii])) { if (attr != null) { throw new IllegalStateException( "Attribute already exists that matches the supplied key " + "[key=" + key + ", have=" + _locattrs[ii].getClass()); } _locattrs = ArrayUtil.splice(_locattrs, ii, 1); return; } } // if we were trying to clear out an attribute but didn't find it, then stop here if (attr == null) { return; } // otherwise append our attribute to the end of the list _locattrs = ArrayUtil.append(_locattrs, attr); }
[ "public", "<", "T", ">", "void", "setLocal", "(", "Class", "<", "T", ">", "key", ",", "T", "attr", ")", "{", "// locate any existing attribute that matches our key", "for", "(", "int", "ii", "=", "0", ",", "ll", "=", "_locattrs", ".", "length", ";", "ii"...
Configures a local attribute on this object. Local attributes are not sent over the network and are thus only available on the server or client that set the attribute. Local attributes are keyed by the class of the value being set as an attribute (the expectation is that local attributes will be encapsulated into helper classes). <p> Also note that it is illegal to replace the value of a local attribute. Attempting to set a local attribute that already contains a value will fail. This is intended to catch programmer error as early as possible. You may clear a local attribute by setting it to null and then it can be set to a new value. <p> Lastly, note that key polymorphism is implemented to allow a lower level framework to define a local attribute and users of that framework to extend the attribute class and have it returned whether the derived or base class is used to look up the attribute. For example: <pre> class BaseLocalAttr { public int foo; } class DerivedLocalAttr extends BaseLocalAttr { public int bar; } // simple usage DObject o1 = new DObject(); BaseLocalAttr base = new BaseLocalAttr(); o1.setLocal(BaseLocalAttr.class, base); assertSame(o1.getLocal(BaseLocalAttr.class), base); // true // polymorphic usage DObject o2 = new DObject(); DerivedLocalAttr derived = new DerivedLocalAttr(); o2.setLocal(DerivedLocalAttr.class, derived); BaseLocalAttr upcasted = derived; assertSame(o2.getLocal(DerivedLocalAttr.class), derived); // true assertSame(o2.getLocal(BaseLocalAttr.class), upcasted); // true // cannot overwrite already set attribute DObject o3 = new DObject(); o3.setLocal(DerivedLocalAttr.class, derived); o3.setLocal(DerivedLocalAttr.class, new DerivedLocalAttr()); // will fail o3.setLocal(BaseLocalAttr.class, new BaseLocalAttr()); // will fail </pre> @exception IllegalStateException thrown if an attempt is made to set a local attribute that already contains a non-null value with any non-null value.
[ "Configures", "a", "local", "attribute", "on", "this", "object", ".", "Local", "attributes", "are", "not", "sent", "over", "the", "network", "and", "are", "thus", "only", "available", "on", "the", "server", "or", "client", "that", "set", "the", "attribute", ...
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L613-L635
geomajas/geomajas-project-server
impl/src/main/java/org/geomajas/internal/rendering/strategy/TileUtil.java
TileUtil.getTileBounds
public static Envelope getTileBounds(TileCode code, Envelope maxExtent, double scale) { double[] layerSize = getTileLayerSize(code, maxExtent, scale); if (layerSize[0] == 0) { return null; } double cX = maxExtent.getMinX() + code.getX() * layerSize[0]; double cY = maxExtent.getMinY() + code.getY() * layerSize[1]; return new Envelope(cX, cX + layerSize[0], cY, cY + layerSize[1]); }
java
public static Envelope getTileBounds(TileCode code, Envelope maxExtent, double scale) { double[] layerSize = getTileLayerSize(code, maxExtent, scale); if (layerSize[0] == 0) { return null; } double cX = maxExtent.getMinX() + code.getX() * layerSize[0]; double cY = maxExtent.getMinY() + code.getY() * layerSize[1]; return new Envelope(cX, cX + layerSize[0], cY, cY + layerSize[1]); }
[ "public", "static", "Envelope", "getTileBounds", "(", "TileCode", "code", ",", "Envelope", "maxExtent", ",", "double", "scale", ")", "{", "double", "[", "]", "layerSize", "=", "getTileLayerSize", "(", "code", ",", "maxExtent", ",", "scale", ")", ";", "if", ...
Get the bounding box for a certain tile. @param code The unique tile code. Determines what tile we're talking about. @param maxExtent The maximum extent of the grid to which this tile belongs. @param scale The current client side scale. @return Returns the bounding box for the tile, expressed in the layer's coordinate system.
[ "Get", "the", "bounding", "box", "for", "a", "certain", "tile", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/strategy/TileUtil.java#L77-L85
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/ClassIntrospectorImpl.java
ClassIntrospectorImpl.getDeclaredMethod
@Override public Method getDeclaredMethod(String name, Class<?>... params) throws IllegalArgumentException { return MethodUtils.getDeclaredMethod(target, name, params); }
java
@Override public Method getDeclaredMethod(String name, Class<?>... params) throws IllegalArgumentException { return MethodUtils.getDeclaredMethod(target, name, params); }
[ "@", "Override", "public", "Method", "getDeclaredMethod", "(", "String", "name", ",", "Class", "<", "?", ">", "...", "params", ")", "throws", "IllegalArgumentException", "{", "return", "MethodUtils", ".", "getDeclaredMethod", "(", "target", ",", "name", ",", "...
Returns the named method from class <i>clazz</i>, does not throw checked exceptions. @param clazz The class to inspect @param name The name of the method to get @param params Parameter types for the method @return Returns the named method from class <i>clazz</i>. @throws IllegalArgumentException if method could not be found or security issues occurred when trying to retrieve the method.
[ "Returns", "the", "named", "method", "from", "class", "<i", ">", "clazz<", "/", "i", ">", "does", "not", "throw", "checked", "exceptions", "." ]
train
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/ClassIntrospectorImpl.java#L75-L78
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/configuration/GreenMailConfiguration.java
GreenMailConfiguration.withUser
public GreenMailConfiguration withUser(final String email, final String login, final String password) { this.usersToCreate.add(new UserBean(email, login, password)); return this; }
java
public GreenMailConfiguration withUser(final String email, final String login, final String password) { this.usersToCreate.add(new UserBean(email, login, password)); return this; }
[ "public", "GreenMailConfiguration", "withUser", "(", "final", "String", "email", ",", "final", "String", "login", ",", "final", "String", "password", ")", "{", "this", ".", "usersToCreate", ".", "add", "(", "new", "UserBean", "(", "email", ",", "login", ",",...
The given {@link com.icegreen.greenmail.user.GreenMailUser} will be created when servers will start. @param email Email address @param login Login name of user @param password Password of user that belongs to login name @return Modified configuration
[ "The", "given", "{", "@link", "com", ".", "icegreen", ".", "greenmail", ".", "user", ".", "GreenMailUser", "}", "will", "be", "created", "when", "servers", "will", "start", "." ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/configuration/GreenMailConfiguration.java#L32-L35
aws/aws-sdk-java
aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/CreateJobRequest.java
CreateJobRequest.withTags
public CreateJobRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public CreateJobRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateJobRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags to use with this job. You may use tags to limit access to the job. For more information about tags in AWS Glue, see <a href="http://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in AWS Glue</a> in the developer guide. </p> @param tags The tags to use with this job. You may use tags to limit access to the job. For more information about tags in AWS Glue, see <a href="http://docs.aws.amazon.com/glue/latest/dg/monitor-tags.html">AWS Tags in AWS Glue</a> in the developer guide. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "to", "use", "with", "this", "job", ".", "You", "may", "use", "tags", "to", "limit", "access", "to", "the", "job", ".", "For", "more", "information", "about", "tags", "in", "AWS", "Glue", "see", "<a", "href", "=", "http", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/CreateJobRequest.java#L1359-L1362
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/NamespaceContextParser.java
NamespaceContextParser.parseNamespaceDefinitions
private void parseNamespaceDefinitions(BeanDefinitionBuilder builder, Element element) { Map<String, String> namespaces = new LinkedHashMap<String, String>(); for (Element namespace : DomUtils.getChildElementsByTagName(element, "namespace")) { namespaces.put(namespace.getAttribute("prefix"), namespace.getAttribute("uri")); } if (!namespaces.isEmpty()) { builder.addPropertyValue("namespaceMappings", namespaces); } }
java
private void parseNamespaceDefinitions(BeanDefinitionBuilder builder, Element element) { Map<String, String> namespaces = new LinkedHashMap<String, String>(); for (Element namespace : DomUtils.getChildElementsByTagName(element, "namespace")) { namespaces.put(namespace.getAttribute("prefix"), namespace.getAttribute("uri")); } if (!namespaces.isEmpty()) { builder.addPropertyValue("namespaceMappings", namespaces); } }
[ "private", "void", "parseNamespaceDefinitions", "(", "BeanDefinitionBuilder", "builder", ",", "Element", "element", ")", "{", "Map", "<", "String", ",", "String", ">", "namespaces", "=", "new", "LinkedHashMap", "<", "String", ",", "String", ">", "(", ")", ";",...
Parses all variable definitions and adds those to the bean definition builder as property value. @param builder the target bean definition builder. @param element the source element.
[ "Parses", "all", "variable", "definitions", "and", "adds", "those", "to", "the", "bean", "definition", "builder", "as", "property", "value", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/config/xml/NamespaceContextParser.java#L51-L60
DiUS/pact-jvm
pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java
PactDslJsonArray.arrayMaxLike
public static PactDslJsonArray arrayMaxLike(int maxSize, int numberExamples, PactDslJsonRootValue value) { if (numberExamples > maxSize) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, maxSize)); } PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMax(maxSize)); parent.putObject(value); return parent; }
java
public static PactDslJsonArray arrayMaxLike(int maxSize, int numberExamples, PactDslJsonRootValue value) { if (numberExamples > maxSize) { throw new IllegalArgumentException(String.format("Number of example %d is more than the maximum size of %d", numberExamples, maxSize)); } PactDslJsonArray parent = new PactDslJsonArray("", "", null, true); parent.setNumberExamples(numberExamples); parent.matchers.addRule("", parent.matchMax(maxSize)); parent.putObject(value); return parent; }
[ "public", "static", "PactDslJsonArray", "arrayMaxLike", "(", "int", "maxSize", ",", "int", "numberExamples", ",", "PactDslJsonRootValue", "value", ")", "{", "if", "(", "numberExamples", ">", "maxSize", ")", "{", "throw", "new", "IllegalArgumentException", "(", "St...
Root level array with maximum size where each item must match the provided matcher @param maxSize maximum size @param numberExamples Number of examples to generate
[ "Root", "level", "array", "with", "maximum", "size", "where", "each", "item", "must", "match", "the", "provided", "matcher" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L851-L861