repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
infinispan/infinispan
core/src/main/java/org/infinispan/interceptors/BaseAsyncInterceptor.java
BaseAsyncInterceptor.valueOrException
public static Object valueOrException(Object rv, Throwable throwable) throws Throwable { if (throwable == null) { return rv; } else { throw throwable; } }
java
public static Object valueOrException(Object rv, Throwable throwable) throws Throwable { if (throwable == null) { return rv; } else { throw throwable; } }
[ "public", "static", "Object", "valueOrException", "(", "Object", "rv", ",", "Throwable", "throwable", ")", "throws", "Throwable", "{", "if", "(", "throwable", "==", "null", ")", "{", "return", "rv", ";", "}", "else", "{", "throw", "throwable", ";", "}", ...
Return the value if {@code throwable != null}, throw the exception otherwise.
[ "Return", "the", "value", "if", "{" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/BaseAsyncInterceptor.java#L271-L277
livetribe/livetribe-slp
core/src/main/java/org/livetribe/slp/Attributes.java
Attributes.unescapeValue
public static String unescapeValue(String escapedValue) { // Check that the escaped value does not contain reserved characters checkEscaped(escapedValue, Value.reservedChars, false); // Unescape the value return unescape(escapedValue, Value.reservedChars); }
java
public static String unescapeValue(String escapedValue) { // Check that the escaped value does not contain reserved characters checkEscaped(escapedValue, Value.reservedChars, false); // Unescape the value return unescape(escapedValue, Value.reservedChars); }
[ "public", "static", "String", "unescapeValue", "(", "String", "escapedValue", ")", "{", "// Check that the escaped value does not contain reserved characters", "checkEscaped", "(", "escapedValue", ",", "Value", ".", "reservedChars", ",", "false", ")", ";", "// Unescape the ...
Unescapes the given escaped value string following RFC 2608, 5.0. <br /> For example, the string value <code>\3cA\3e</code> will be converted into the string <code>&lt;A&gt;</code>. @param escapedValue the value string to unescape @return the unescaped value string @see #escapeValue(String)
[ "Unescapes", "the", "given", "escaped", "value", "string", "following", "RFC", "2608", "5", ".", "0", ".", "<br", "/", ">", "For", "example", "the", "string", "value", "<code", ">", "\\", "3cA", "\\", "3e<", "/", "code", ">", "will", "be", "converted",...
train
https://github.com/livetribe/livetribe-slp/blob/6cc13dbe81feab133fe3dd291ca081cbc6e1f591/core/src/main/java/org/livetribe/slp/Attributes.java#L385-L391
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemoveRepeatedPoints.java
ST_RemoveRepeatedPoints.removeDuplicateCoordinates
public static LinearRing removeDuplicateCoordinates(LinearRing linearRing, double tolerance) { Coordinate[] coords = CoordinateUtils.removeRepeatedCoordinates(linearRing.getCoordinates(), tolerance, true); return FACTORY.createLinearRing(coords); }
java
public static LinearRing removeDuplicateCoordinates(LinearRing linearRing, double tolerance) { Coordinate[] coords = CoordinateUtils.removeRepeatedCoordinates(linearRing.getCoordinates(), tolerance, true); return FACTORY.createLinearRing(coords); }
[ "public", "static", "LinearRing", "removeDuplicateCoordinates", "(", "LinearRing", "linearRing", ",", "double", "tolerance", ")", "{", "Coordinate", "[", "]", "coords", "=", "CoordinateUtils", ".", "removeRepeatedCoordinates", "(", "linearRing", ".", "getCoordinates", ...
Removes duplicated coordinates within a linearRing. @param linearRing @param tolerance to delete the coordinates @return
[ "Removes", "duplicated", "coordinates", "within", "a", "linearRing", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/edit/ST_RemoveRepeatedPoints.java#L128-L131
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java
EffectUtil.booleanValue
static public Value booleanValue (String name, final boolean currentValue, final String description) { return new DefaultValue(name, String.valueOf(currentValue)) { public void showDialog () { JCheckBox checkBox = new JCheckBox(); checkBox.setSelected(currentValue); if (showValueDialog(checkBox, description)) value = String.valueOf(checkBox.isSelected()); } public Object getObject () { return Boolean.valueOf(value); } }; }
java
static public Value booleanValue (String name, final boolean currentValue, final String description) { return new DefaultValue(name, String.valueOf(currentValue)) { public void showDialog () { JCheckBox checkBox = new JCheckBox(); checkBox.setSelected(currentValue); if (showValueDialog(checkBox, description)) value = String.valueOf(checkBox.isSelected()); } public Object getObject () { return Boolean.valueOf(value); } }; }
[ "static", "public", "Value", "booleanValue", "(", "String", "name", ",", "final", "boolean", "currentValue", ",", "final", "String", "description", ")", "{", "return", "new", "DefaultValue", "(", "name", ",", "String", ".", "valueOf", "(", "currentValue", ")",...
Prompts the user for boolean value @param name The name of the dialog to show @param currentValue The current value to be displayed @param description The help text to provide @return The value selected by the user
[ "Prompts", "the", "user", "for", "boolean", "value" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/font/effects/EffectUtil.java#L130-L142
impossibl/stencil
engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java
StencilOperands.narrowBigInteger
protected Number narrowBigInteger(Object lhs, Object rhs, BigInteger bigi) { // coerce to long if possible if (!(lhs instanceof BigInteger || rhs instanceof BigInteger) && bigi.compareTo(BIGI_LONG_MAX_VALUE) <= 0 && bigi.compareTo(BIGI_LONG_MIN_VALUE) >= 0) { // coerce to int if possible long l = bigi.longValue(); // coerce to int when possible (int being so often used in method parms) if (!(lhs instanceof Long || rhs instanceof Long) && l <= Integer.MAX_VALUE && l >= Integer.MIN_VALUE) { return Integer.valueOf((int) l); } return Long.valueOf(l); } return bigi; }
java
protected Number narrowBigInteger(Object lhs, Object rhs, BigInteger bigi) { // coerce to long if possible if (!(lhs instanceof BigInteger || rhs instanceof BigInteger) && bigi.compareTo(BIGI_LONG_MAX_VALUE) <= 0 && bigi.compareTo(BIGI_LONG_MIN_VALUE) >= 0) { // coerce to int if possible long l = bigi.longValue(); // coerce to int when possible (int being so often used in method parms) if (!(lhs instanceof Long || rhs instanceof Long) && l <= Integer.MAX_VALUE && l >= Integer.MIN_VALUE) { return Integer.valueOf((int) l); } return Long.valueOf(l); } return bigi; }
[ "protected", "Number", "narrowBigInteger", "(", "Object", "lhs", ",", "Object", "rhs", ",", "BigInteger", "bigi", ")", "{", "// coerce to long if possible", "if", "(", "!", "(", "lhs", "instanceof", "BigInteger", "||", "rhs", "instanceof", "BigInteger", ")", "&&...
Given a BigInteger, narrow it to an Integer or Long if it fits and the arguments class allow it. <p> The rules are: if either arguments is a BigInteger, no narrowing will occur if either arguments is a Long, no narrowing to Integer will occur </p> @param lhs the left hand side operand that lead to the bigi result @param rhs the right hand side operand that lead to the bigi result @param bigi the BigInteger to narrow @return an Integer or Long if narrowing is possible, the original BigInteger otherwise
[ "Given", "a", "BigInteger", "narrow", "it", "to", "an", "Integer", "or", "Long", "if", "it", "fits", "and", "the", "arguments", "class", "allow", "it", ".", "<p", ">", "The", "rules", "are", ":", "if", "either", "arguments", "is", "a", "BigInteger", "n...
train
https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/internal/StencilOperands.java#L181-L193
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobContext.java
JobContext.setTaskStagingDir
private void setTaskStagingDir() { if (this.jobState.contains(ConfigurationKeys.WRITER_STAGING_DIR)) { LOG.warn(String.format("Property %s is deprecated. No need to use it if %s is specified.", ConfigurationKeys.WRITER_STAGING_DIR, ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY)); } else { String workingDir = this.jobState.getProp(ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY); this.jobState .setProp(ConfigurationKeys.WRITER_STAGING_DIR, new Path(workingDir, TASK_STAGING_DIR_NAME).toString()); LOG.info(String.format("Writer Staging Directory is set to %s.", this.jobState.getProp(ConfigurationKeys.WRITER_STAGING_DIR))); } }
java
private void setTaskStagingDir() { if (this.jobState.contains(ConfigurationKeys.WRITER_STAGING_DIR)) { LOG.warn(String.format("Property %s is deprecated. No need to use it if %s is specified.", ConfigurationKeys.WRITER_STAGING_DIR, ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY)); } else { String workingDir = this.jobState.getProp(ConfigurationKeys.TASK_DATA_ROOT_DIR_KEY); this.jobState .setProp(ConfigurationKeys.WRITER_STAGING_DIR, new Path(workingDir, TASK_STAGING_DIR_NAME).toString()); LOG.info(String.format("Writer Staging Directory is set to %s.", this.jobState.getProp(ConfigurationKeys.WRITER_STAGING_DIR))); } }
[ "private", "void", "setTaskStagingDir", "(", ")", "{", "if", "(", "this", ".", "jobState", ".", "contains", "(", "ConfigurationKeys", ".", "WRITER_STAGING_DIR", ")", ")", "{", "LOG", ".", "warn", "(", "String", ".", "format", "(", "\"Property %s is deprecated....
If {@link ConfigurationKeys#WRITER_STAGING_DIR} (which is deprecated) is specified, use its value. Otherwise, if {@link ConfigurationKeys#TASK_DATA_ROOT_DIR_KEY} is specified, use its value plus {@link #TASK_STAGING_DIR_NAME}.
[ "If", "{", "@link", "ConfigurationKeys#WRITER_STAGING_DIR", "}", "(", "which", "is", "deprecated", ")", "is", "specified", "use", "its", "value", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobContext.java#L345-L356
axibase/atsd-api-java
src/main/java/com/axibase/tsd/model/data/series/Sample.java
Sample.ofIsoDouble
public static Sample ofIsoDouble(String isoDate, double numericValue) { return new Sample(null, isoDate, null, null) .setNumericValueFromDouble(numericValue); }
java
public static Sample ofIsoDouble(String isoDate, double numericValue) { return new Sample(null, isoDate, null, null) .setNumericValueFromDouble(numericValue); }
[ "public", "static", "Sample", "ofIsoDouble", "(", "String", "isoDate", ",", "double", "numericValue", ")", "{", "return", "new", "Sample", "(", "null", ",", "isoDate", ",", "null", ",", "null", ")", ".", "setNumericValueFromDouble", "(", "numericValue", ")", ...
Creates a new {@link Sample} with date in ISO 8061 format and double value specified @param isoDate date in ISO 8061 format according to <a href="https://www.ietf.org/rfc/rfc3339.txt">RFC3339</a> @param numericValue the numeric value of the sample @return the Sample with specified fields
[ "Creates", "a", "new", "{", "@link", "Sample", "}", "with", "date", "in", "ISO", "8061", "format", "and", "double", "value", "specified" ]
train
https://github.com/axibase/atsd-api-java/blob/63a0767d08b202dad2ebef4372ff947d6fba0246/src/main/java/com/axibase/tsd/model/data/series/Sample.java#L79-L82
protostuff/protostuff
protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java
MsgpackIOUtil.parseListFrom
public static <T> List<T> parseListFrom(MessageUnpacker unpacker, Schema<T> schema, boolean numeric) throws IOException { MsgpackParser parser = new MsgpackParser(unpacker, numeric); MsgpackInput input = new MsgpackInput(parser); List<T> list = new ArrayList<T>(); while (parser.hasNext()) { T message = schema.newMessage(); schema.mergeFrom(input, message); list.add(message); parser.reset(); } return list; }
java
public static <T> List<T> parseListFrom(MessageUnpacker unpacker, Schema<T> schema, boolean numeric) throws IOException { MsgpackParser parser = new MsgpackParser(unpacker, numeric); MsgpackInput input = new MsgpackInput(parser); List<T> list = new ArrayList<T>(); while (parser.hasNext()) { T message = schema.newMessage(); schema.mergeFrom(input, message); list.add(message); parser.reset(); } return list; }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "parseListFrom", "(", "MessageUnpacker", "unpacker", ",", "Schema", "<", "T", ">", "schema", ",", "boolean", "numeric", ")", "throws", "IOException", "{", "MsgpackParser", "parser", "=", "new", "Msg...
Parses the {@code messages} from the parser using the given {@code schema}.
[ "Parses", "the", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java#L346-L368
comapi/comapi-chat-sdk-android
COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java
ComapiChatClient.createProfileManager
public ProfileManager createProfileManager(@NonNull Context context) { return new ProfileManager(context, client, new ObservableExecutor() { @Override public <T> void execute(final Observable<T> obs) { obs.subscribe(new Subscriber<T>() { @Override public void onCompleted() { // Completed, will unsubscribe automatically } @Override public void onError(Throwable e) { // Report errors in doOnError } @Override public void onNext(T t) { // Ignore result } }); } }); }
java
public ProfileManager createProfileManager(@NonNull Context context) { return new ProfileManager(context, client, new ObservableExecutor() { @Override public <T> void execute(final Observable<T> obs) { obs.subscribe(new Subscriber<T>() { @Override public void onCompleted() { // Completed, will unsubscribe automatically } @Override public void onError(Throwable e) { // Report errors in doOnError } @Override public void onNext(T t) { // Ignore result } }); } }); }
[ "public", "ProfileManager", "createProfileManager", "(", "@", "NonNull", "Context", "context", ")", "{", "return", "new", "ProfileManager", "(", "context", ",", "client", ",", "new", "ObservableExecutor", "(", ")", "{", "@", "Override", "public", "<", "T", ">"...
Create ProfileManager to manage profile data. @param context Application context. @return ProfileManager to manage profile data.
[ "Create", "ProfileManager", "to", "manage", "profile", "data", "." ]
train
https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ComapiChatClient.java#L341-L364
shekhargulati/strman-java
src/main/java/strman/Strman.java
Strman.lastIndexOf
public static int lastIndexOf(final String value, final String needle) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); return lastIndexOf(value, needle, value.length(), true); }
java
public static int lastIndexOf(final String value, final String needle) { validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER); return lastIndexOf(value, needle, value.length(), true); }
[ "public", "static", "int", "lastIndexOf", "(", "final", "String", "value", ",", "final", "String", "needle", ")", "{", "validate", "(", "value", ",", "NULL_STRING_PREDICATE", ",", "NULL_STRING_MSG_SUPPLIER", ")", ";", "return", "lastIndexOf", "(", "value", ",", ...
This method returns the index within the calling String object of the last occurrence of the specified value, searching backwards from the offset. Returns -1 if the value is not found. The search starts from the end and case sensitive. @param value The input String @param needle The search String @return Return position of the last occurrence of 'needle'.
[ "This", "method", "returns", "the", "index", "within", "the", "calling", "String", "object", "of", "the", "last", "occurrence", "of", "the", "specified", "value", "searching", "backwards", "from", "the", "offset", ".", "Returns", "-", "1", "if", "the", "valu...
train
https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L614-L617
zxing/zxing
core/src/main/java/com/google/zxing/aztec/detector/Detector.java
Detector.getMatrixCenter
private Point getMatrixCenter() { ResultPoint pointA; ResultPoint pointB; ResultPoint pointC; ResultPoint pointD; //Get a white rectangle that can be the border of the matrix in center bull's eye or try { ResultPoint[] cornerPoints = new WhiteRectangleDetector(image).detect(); pointA = cornerPoints[0]; pointB = cornerPoints[1]; pointC = cornerPoints[2]; pointD = cornerPoints[3]; } catch (NotFoundException e) { // This exception can be in case the initial rectangle is white // In that case, surely in the bull's eye, we try to expand the rectangle. int cx = image.getWidth() / 2; int cy = image.getHeight() / 2; pointA = getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toResultPoint(); pointB = getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toResultPoint(); pointC = getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toResultPoint(); pointD = getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toResultPoint(); } //Compute the center of the rectangle int cx = MathUtils.round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0f); int cy = MathUtils.round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0f); // Redetermine the white rectangle starting from previously computed center. // This will ensure that we end up with a white rectangle in center bull's eye // in order to compute a more accurate center. try { ResultPoint[] cornerPoints = new WhiteRectangleDetector(image, 15, cx, cy).detect(); pointA = cornerPoints[0]; pointB = cornerPoints[1]; pointC = cornerPoints[2]; pointD = cornerPoints[3]; } catch (NotFoundException e) { // This exception can be in case the initial rectangle is white // In that case we try to expand the rectangle. pointA = getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toResultPoint(); pointB = getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toResultPoint(); pointC = getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toResultPoint(); pointD = getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toResultPoint(); } // Recompute the center of the rectangle cx = MathUtils.round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0f); cy = MathUtils.round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0f); return new Point(cx, cy); }
java
private Point getMatrixCenter() { ResultPoint pointA; ResultPoint pointB; ResultPoint pointC; ResultPoint pointD; //Get a white rectangle that can be the border of the matrix in center bull's eye or try { ResultPoint[] cornerPoints = new WhiteRectangleDetector(image).detect(); pointA = cornerPoints[0]; pointB = cornerPoints[1]; pointC = cornerPoints[2]; pointD = cornerPoints[3]; } catch (NotFoundException e) { // This exception can be in case the initial rectangle is white // In that case, surely in the bull's eye, we try to expand the rectangle. int cx = image.getWidth() / 2; int cy = image.getHeight() / 2; pointA = getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toResultPoint(); pointB = getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toResultPoint(); pointC = getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toResultPoint(); pointD = getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toResultPoint(); } //Compute the center of the rectangle int cx = MathUtils.round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0f); int cy = MathUtils.round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0f); // Redetermine the white rectangle starting from previously computed center. // This will ensure that we end up with a white rectangle in center bull's eye // in order to compute a more accurate center. try { ResultPoint[] cornerPoints = new WhiteRectangleDetector(image, 15, cx, cy).detect(); pointA = cornerPoints[0]; pointB = cornerPoints[1]; pointC = cornerPoints[2]; pointD = cornerPoints[3]; } catch (NotFoundException e) { // This exception can be in case the initial rectangle is white // In that case we try to expand the rectangle. pointA = getFirstDifferent(new Point(cx + 7, cy - 7), false, 1, -1).toResultPoint(); pointB = getFirstDifferent(new Point(cx + 7, cy + 7), false, 1, 1).toResultPoint(); pointC = getFirstDifferent(new Point(cx - 7, cy + 7), false, -1, 1).toResultPoint(); pointD = getFirstDifferent(new Point(cx - 7, cy - 7), false, -1, -1).toResultPoint(); } // Recompute the center of the rectangle cx = MathUtils.round((pointA.getX() + pointD.getX() + pointB.getX() + pointC.getX()) / 4.0f); cy = MathUtils.round((pointA.getY() + pointD.getY() + pointB.getY() + pointC.getY()) / 4.0f); return new Point(cx, cy); }
[ "private", "Point", "getMatrixCenter", "(", ")", "{", "ResultPoint", "pointA", ";", "ResultPoint", "pointB", ";", "ResultPoint", "pointC", ";", "ResultPoint", "pointD", ";", "//Get a white rectangle that can be the border of the matrix in center bull's eye or", "try", "{", ...
Finds a candidate center point of an Aztec code from an image @return the center point
[ "Finds", "a", "candidate", "center", "point", "of", "an", "Aztec", "code", "from", "an", "image" ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/detector/Detector.java#L294-L350
js-lib-com/commons
src/main/java/js/util/Params.java
Params.EQ
public static void EQ(long parameter, long expected, String name) throws IllegalArgumentException { if (parameter != expected) { throw new IllegalArgumentException(String.format("%s is not %d.", name, expected)); } }
java
public static void EQ(long parameter, long expected, String name) throws IllegalArgumentException { if (parameter != expected) { throw new IllegalArgumentException(String.format("%s is not %d.", name, expected)); } }
[ "public", "static", "void", "EQ", "(", "long", "parameter", ",", "long", "expected", ",", "String", "name", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parameter", "!=", "expected", ")", "{", "throw", "new", "IllegalArgumentException", "(", "St...
Test if numeric parameter has expected value. @param parameter invocation numeric parameter, @param expected expected value, @param name the name of invocation parameter. @throws IllegalArgumentException if <code>parameter</code> has not expected value.
[ "Test", "if", "numeric", "parameter", "has", "expected", "value", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L289-L293
cdk/cdk
descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/LingoSimilarity.java
LingoSimilarity.calculate
public static float calculate(Map<String, Integer> features1, Map<String, Integer> features2) { TreeSet<String> keys = new TreeSet<String>(features1.keySet()); keys.addAll(features2.keySet()); float sum = 0.0f; for (String key : keys) { Integer c1 = features1.get(key); Integer c2 = features2.get(key); c1 = c1 == null ? 0 : c1; c2 = c2 == null ? 0 : c2; sum += 1.0 - Math.abs(c1 - c2) / (c1 + c2); } return sum / keys.size(); }
java
public static float calculate(Map<String, Integer> features1, Map<String, Integer> features2) { TreeSet<String> keys = new TreeSet<String>(features1.keySet()); keys.addAll(features2.keySet()); float sum = 0.0f; for (String key : keys) { Integer c1 = features1.get(key); Integer c2 = features2.get(key); c1 = c1 == null ? 0 : c1; c2 = c2 == null ? 0 : c2; sum += 1.0 - Math.abs(c1 - c2) / (c1 + c2); } return sum / keys.size(); }
[ "public", "static", "float", "calculate", "(", "Map", "<", "String", ",", "Integer", ">", "features1", ",", "Map", "<", "String", ",", "Integer", ">", "features2", ")", "{", "TreeSet", "<", "String", ">", "keys", "=", "new", "TreeSet", "<", "String", "...
Evaluate the LINGO similarity between two key,value sty;e fingerprints. The value will range from 0.0 to 1.0. @param features1 @param features2 @return similarity
[ "Evaluate", "the", "LINGO", "similarity", "between", "two", "key", "value", "sty", ";", "e", "fingerprints", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/LingoSimilarity.java#L54-L69
Impetus/Kundera
src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClient.java
DSClient.createSelectQuery
private StringBuilder createSelectQuery(Object rowId, EntityMetadata metadata, String tableName) { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(metadata.getPersistenceUnit()); CQLTranslator translator = new CQLTranslator(); String select_Query = translator.SELECTALL_QUERY; select_Query = StringUtils.replace(select_Query, CQLTranslator.COLUMN_FAMILY, translator.ensureCase(new StringBuilder(), tableName, false).toString()); StringBuilder builder = new StringBuilder(select_Query); builder.append(CQLTranslator.ADD_WHERE_CLAUSE); onWhereClause(metadata, rowId, translator, builder, metaModel, metadata.getIdAttribute()); builder.delete(builder.lastIndexOf(CQLTranslator.AND_CLAUSE), builder.length()); return builder; }
java
private StringBuilder createSelectQuery(Object rowId, EntityMetadata metadata, String tableName) { MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(metadata.getPersistenceUnit()); CQLTranslator translator = new CQLTranslator(); String select_Query = translator.SELECTALL_QUERY; select_Query = StringUtils.replace(select_Query, CQLTranslator.COLUMN_FAMILY, translator.ensureCase(new StringBuilder(), tableName, false).toString()); StringBuilder builder = new StringBuilder(select_Query); builder.append(CQLTranslator.ADD_WHERE_CLAUSE); onWhereClause(metadata, rowId, translator, builder, metaModel, metadata.getIdAttribute()); builder.delete(builder.lastIndexOf(CQLTranslator.AND_CLAUSE), builder.length()); return builder; }
[ "private", "StringBuilder", "createSelectQuery", "(", "Object", "rowId", ",", "EntityMetadata", "metadata", ",", "String", "tableName", ")", "{", "MetamodelImpl", "metaModel", "=", "(", "MetamodelImpl", ")", "kunderaMetadata", ".", "getApplicationMetadata", "(", ")", ...
Creates the select query. @param rowId the row id @param metadata the metadata @param tableName the table name @return the string builder
[ "Creates", "the", "select", "query", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClient.java#L177-L193
RKumsher/utils
src/main/java/com/github/rkumsher/number/RandomNumberUtils.java
RandomNumberUtils.randomIntLessThan
public static int randomIntLessThan(int maxExclusive) { checkArgument( maxExclusive > Integer.MIN_VALUE, "Cannot produce int less than %s", Integer.MIN_VALUE); return randomInt(Integer.MIN_VALUE, maxExclusive); }
java
public static int randomIntLessThan(int maxExclusive) { checkArgument( maxExclusive > Integer.MIN_VALUE, "Cannot produce int less than %s", Integer.MIN_VALUE); return randomInt(Integer.MIN_VALUE, maxExclusive); }
[ "public", "static", "int", "randomIntLessThan", "(", "int", "maxExclusive", ")", "{", "checkArgument", "(", "maxExclusive", ">", "Integer", ".", "MIN_VALUE", ",", "\"Cannot produce int less than %s\"", ",", "Integer", ".", "MIN_VALUE", ")", ";", "return", "randomInt...
Returns a random int that is less than the given int. @param maxExclusive the value that returned int must be less than @return the random int @throws IllegalArgumentException if maxExclusive is less than or equal to {@link Integer#MIN_VALUE}
[ "Returns", "a", "random", "int", "that", "is", "less", "than", "the", "given", "int", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/number/RandomNumberUtils.java#L82-L86
apache/flink
flink-core/src/main/java/org/apache/flink/util/FileUtils.java
FileUtils.readAllBytes
public static byte[] readAllBytes(java.nio.file.Path path) throws IOException { try (SeekableByteChannel channel = Files.newByteChannel(path); InputStream in = Channels.newInputStream(channel)) { long size = channel.size(); if (size > (long) MAX_BUFFER_SIZE) { throw new OutOfMemoryError("Required array size too large"); } return read(in, (int) size); } }
java
public static byte[] readAllBytes(java.nio.file.Path path) throws IOException { try (SeekableByteChannel channel = Files.newByteChannel(path); InputStream in = Channels.newInputStream(channel)) { long size = channel.size(); if (size > (long) MAX_BUFFER_SIZE) { throw new OutOfMemoryError("Required array size too large"); } return read(in, (int) size); } }
[ "public", "static", "byte", "[", "]", "readAllBytes", "(", "java", ".", "nio", ".", "file", ".", "Path", "path", ")", "throws", "IOException", "{", "try", "(", "SeekableByteChannel", "channel", "=", "Files", ".", "newByteChannel", "(", "path", ")", ";", ...
Reads all the bytes from a file. The method ensures that the file is closed when all bytes have been read or an I/O error, or other runtime exception, is thrown. <p>This is an implementation that follow {@link java.nio.file.Files#readAllBytes(java.nio.file.Path)}, and the difference is that it limits the size of the direct buffer to avoid direct-buffer OutOfMemoryError. When {@link java.nio.file.Files#readAllBytes(java.nio.file.Path)} or other interfaces in java API can do this in the future, we should remove it. @param path the path to the file @return a byte array containing the bytes read from the file @throws IOException if an I/O error occurs reading from the stream @throws OutOfMemoryError if an array of the required size cannot be allocated, for example the file is larger that {@code 2GB}
[ "Reads", "all", "the", "bytes", "from", "a", "file", ".", "The", "method", "ensures", "that", "the", "file", "is", "closed", "when", "all", "bytes", "have", "been", "read", "or", "an", "I", "/", "O", "error", "or", "other", "runtime", "exception", "is"...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/FileUtils.java#L143-L154
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/factory/feature/describe/FactoryDescribeRegionPoint.java
FactoryDescribeRegionPoint.surfColorStable
public static <T extends ImageBase<T>, II extends ImageGray<II>> DescribeRegionPoint<T,BrightFeature> surfColorStable(ConfigSurfDescribe.Stability config, ImageType<T> imageType) { Class bandType = imageType.getImageClass(); Class<II> integralType = GIntegralImageOps.getIntegralType(bandType); DescribePointSurf<II> alg = FactoryDescribePointAlgs.surfStability( config, integralType); if( imageType.getFamily() == ImageType.Family.PLANAR) { DescribePointSurfPlanar<II> color = FactoryDescribePointAlgs.surfColor( alg,imageType.getNumBands()); return new SurfPlanar_to_DescribeRegionPoint(color,bandType,integralType); } else { throw new IllegalArgumentException("Unknown image type"); } }
java
public static <T extends ImageBase<T>, II extends ImageGray<II>> DescribeRegionPoint<T,BrightFeature> surfColorStable(ConfigSurfDescribe.Stability config, ImageType<T> imageType) { Class bandType = imageType.getImageClass(); Class<II> integralType = GIntegralImageOps.getIntegralType(bandType); DescribePointSurf<II> alg = FactoryDescribePointAlgs.surfStability( config, integralType); if( imageType.getFamily() == ImageType.Family.PLANAR) { DescribePointSurfPlanar<II> color = FactoryDescribePointAlgs.surfColor( alg,imageType.getNumBands()); return new SurfPlanar_to_DescribeRegionPoint(color,bandType,integralType); } else { throw new IllegalArgumentException("Unknown image type"); } }
[ "public", "static", "<", "T", "extends", "ImageBase", "<", "T", ">", ",", "II", "extends", "ImageGray", "<", "II", ">", ">", "DescribeRegionPoint", "<", "T", ",", "BrightFeature", ">", "surfColorStable", "(", "ConfigSurfDescribe", ".", "Stability", "config", ...
Color variant of the SURF descriptor which has been designed for stability. @see DescribePointSurfPlanar @param config SURF configuration. Pass in null for default options. @param imageType Type of input image. @return SURF color description extractor
[ "Color", "variant", "of", "the", "SURF", "descriptor", "which", "has", "been", "designed", "for", "stability", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/describe/FactoryDescribeRegionPoint.java#L127-L142
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/NonAtomicVolatileUpdate.java
NonAtomicVolatileUpdate.expressionFromUnaryTree
private static Matcher<UnaryTree> expressionFromUnaryTree( final Matcher<ExpressionTree> exprMatcher) { return new Matcher<UnaryTree>() { @Override public boolean matches(UnaryTree tree, VisitorState state) { return exprMatcher.matches(tree.getExpression(), state); } }; }
java
private static Matcher<UnaryTree> expressionFromUnaryTree( final Matcher<ExpressionTree> exprMatcher) { return new Matcher<UnaryTree>() { @Override public boolean matches(UnaryTree tree, VisitorState state) { return exprMatcher.matches(tree.getExpression(), state); } }; }
[ "private", "static", "Matcher", "<", "UnaryTree", ">", "expressionFromUnaryTree", "(", "final", "Matcher", "<", "ExpressionTree", ">", "exprMatcher", ")", "{", "return", "new", "Matcher", "<", "UnaryTree", ">", "(", ")", "{", "@", "Override", "public", "boolea...
Extracts the expression from a UnaryTree and applies a matcher to it.
[ "Extracts", "the", "expression", "from", "a", "UnaryTree", "and", "applies", "a", "matcher", "to", "it", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/NonAtomicVolatileUpdate.java#L57-L65
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/JUnit3FloatingPointComparisonWithoutDelta.java
JUnit3FloatingPointComparisonWithoutDelta.isFloatingPoint
private boolean isFloatingPoint(VisitorState state, Type type) { Type trueType = unboxedTypeOrType(state, type); return (trueType.getKind() == TypeKind.DOUBLE) || (trueType.getKind() == TypeKind.FLOAT); }
java
private boolean isFloatingPoint(VisitorState state, Type type) { Type trueType = unboxedTypeOrType(state, type); return (trueType.getKind() == TypeKind.DOUBLE) || (trueType.getKind() == TypeKind.FLOAT); }
[ "private", "boolean", "isFloatingPoint", "(", "VisitorState", "state", ",", "Type", "type", ")", "{", "Type", "trueType", "=", "unboxedTypeOrType", "(", "state", ",", "type", ")", ";", "return", "(", "trueType", ".", "getKind", "(", ")", "==", "TypeKind", ...
Determines if the type is a floating-point type, including reference types.
[ "Determines", "if", "the", "type", "is", "a", "floating", "-", "point", "type", "including", "reference", "types", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/JUnit3FloatingPointComparisonWithoutDelta.java#L125-L128
goldmansachs/reladomo
reladomo/src/main/java/com/gs/fw/common/mithra/mtloader/MatcherThread.java
MatcherThread.handleUpdate
protected void handleUpdate(T oldObject, T newObject) { this.preprocessMatch(oldObject, newObject); executor.addForUpdate(oldObject, newObject); }
java
protected void handleUpdate(T oldObject, T newObject) { this.preprocessMatch(oldObject, newObject); executor.addForUpdate(oldObject, newObject); }
[ "protected", "void", "handleUpdate", "(", "T", "oldObject", ",", "T", "newObject", ")", "{", "this", ".", "preprocessMatch", "(", "oldObject", ",", "newObject", ")", ";", "executor", ".", "addForUpdate", "(", "oldObject", ",", "newObject", ")", ";", "}" ]
If the comparator decides that the (non-key) attributes do no match, this method is called. Default implementation is to call preprocessMatch, followed by executor.addForUpdate @param oldObject The existing version of the object (typically from the database) @param newObject The new version of the object (typically from a file or other source)
[ "If", "the", "comparator", "decides", "that", "the", "(", "non", "-", "key", ")", "attributes", "do", "no", "match", "this", "method", "is", "called", ".", "Default", "implementation", "is", "to", "call", "preprocessMatch", "followed", "by", "executor", ".",...
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/mtloader/MatcherThread.java#L210-L214
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/concurrent/TimeUnit.java
TimeUnit.x
static long x(long d, long m, long over) { if (d > over) return Long.MAX_VALUE; if (d < -over) return Long.MIN_VALUE; return d * m; }
java
static long x(long d, long m, long over) { if (d > over) return Long.MAX_VALUE; if (d < -over) return Long.MIN_VALUE; return d * m; }
[ "static", "long", "x", "(", "long", "d", ",", "long", "m", ",", "long", "over", ")", "{", "if", "(", "d", ">", "over", ")", "return", "Long", ".", "MAX_VALUE", ";", "if", "(", "d", "<", "-", "over", ")", "return", "Long", ".", "MIN_VALUE", ";",...
Scale d by m, checking for overflow. This has a short name to make above code more readable.
[ "Scale", "d", "by", "m", "checking", "for", "overflow", ".", "This", "has", "a", "short", "name", "to", "make", "above", "code", "more", "readable", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/util/internal/concurrent/TimeUnit.java#L160-L164
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java
PoiWorkSheet.createTitleCell
public Cell createTitleCell(String str, double width) { int cellCnt = this.getCellCnt(); Cell cell = this.getLastRow().createCell(cellCnt); cell.setCellValue(str); cell.setCellType(CellType.STRING); cell.setCellStyle(this.style.getStringCs()); sheet.setColumnWidth(cellCnt, (int) (sheet.getColumnWidth(cellCnt) * width)); return cell; }
java
public Cell createTitleCell(String str, double width) { int cellCnt = this.getCellCnt(); Cell cell = this.getLastRow().createCell(cellCnt); cell.setCellValue(str); cell.setCellType(CellType.STRING); cell.setCellStyle(this.style.getStringCs()); sheet.setColumnWidth(cellCnt, (int) (sheet.getColumnWidth(cellCnt) * width)); return cell; }
[ "public", "Cell", "createTitleCell", "(", "String", "str", ",", "double", "width", ")", "{", "int", "cellCnt", "=", "this", ".", "getCellCnt", "(", ")", ";", "Cell", "cell", "=", "this", ".", "getLastRow", "(", ")", ".", "createCell", "(", "cellCnt", "...
Create title cell cell. @param str the str @param width the width @return the cell
[ "Create", "title", "cell", "cell", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/excel/PoiWorkSheet.java#L134-L146
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsLock.java
CmsLock.buildLockRequest
public String buildLockRequest(int hiddenTimeout, boolean includeRelated) { StringBuffer html = new StringBuffer(512); html.append("<script type='text/javascript'><!--\n"); html.append("makeRequest('"); html.append(getJsp().link("/system/workplace/commons/report-locks.jsp")); html.append("', '"); html.append(CmsWorkplace.PARAM_RESOURCELIST); html.append("="); html.append(getParamResourcelist()); html.append("&"); html.append(CmsDialog.PARAM_RESOURCE); html.append("="); html.append(getParamResource()); html.append("&"); html.append(CmsLock.PARAM_INCLUDERELATED); html.append("="); html.append(includeRelated); html.append("', 'doReportUpdate');\n"); html.append("function showLockDialog() {\n"); html.append("\tdocument.getElementById('lock-body-id').className = '';\n"); html.append("}\n"); html.append("setTimeout('showLockDialog()', " + hiddenTimeout + ");\n"); html.append("// -->\n"); html.append("</script>\n"); return html.toString(); }
java
public String buildLockRequest(int hiddenTimeout, boolean includeRelated) { StringBuffer html = new StringBuffer(512); html.append("<script type='text/javascript'><!--\n"); html.append("makeRequest('"); html.append(getJsp().link("/system/workplace/commons/report-locks.jsp")); html.append("', '"); html.append(CmsWorkplace.PARAM_RESOURCELIST); html.append("="); html.append(getParamResourcelist()); html.append("&"); html.append(CmsDialog.PARAM_RESOURCE); html.append("="); html.append(getParamResource()); html.append("&"); html.append(CmsLock.PARAM_INCLUDERELATED); html.append("="); html.append(includeRelated); html.append("', 'doReportUpdate');\n"); html.append("function showLockDialog() {\n"); html.append("\tdocument.getElementById('lock-body-id').className = '';\n"); html.append("}\n"); html.append("setTimeout('showLockDialog()', " + hiddenTimeout + ");\n"); html.append("// -->\n"); html.append("</script>\n"); return html.toString(); }
[ "public", "String", "buildLockRequest", "(", "int", "hiddenTimeout", ",", "boolean", "includeRelated", ")", "{", "StringBuffer", "html", "=", "new", "StringBuffer", "(", "512", ")", ";", "html", ".", "append", "(", "\"<script type='text/javascript'><!--\\n\"", ")", ...
Returns the html code to build the lock request.<p> @param hiddenTimeout the maximal number of millis the dialog will be hidden @param includeRelated indicates if the report should include related resources @return html code
[ "Returns", "the", "html", "code", "to", "build", "the", "lock", "request", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsLock.java#L480-L506
pmwmedia/tinylog
log4j1.2-api/src/main/java/org/apache/log4j/LogManager.java
LogManager.getOrCreateLogger
private static Logger getOrCreateLogger(final String name) { if (name == null || name.length() == 0) { return root; } else { Logger logger = loggers.get(name); if (logger == null) { Logger parent = getOrCreateLogger(reduce(name)); logger = new Logger(parent, name); loggers.put(name, logger); } return logger; } }
java
private static Logger getOrCreateLogger(final String name) { if (name == null || name.length() == 0) { return root; } else { Logger logger = loggers.get(name); if (logger == null) { Logger parent = getOrCreateLogger(reduce(name)); logger = new Logger(parent, name); loggers.put(name, logger); } return logger; } }
[ "private", "static", "Logger", "getOrCreateLogger", "(", "final", "String", "name", ")", "{", "if", "(", "name", "==", "null", "||", "name", ".", "length", "(", ")", "==", "0", ")", "{", "return", "root", ";", "}", "else", "{", "Logger", "logger", "=...
Retrieves a logger by name. @param name Name of the logger @return Logger instance
[ "Retrieves", "a", "logger", "by", "name", "." ]
train
https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/log4j1.2-api/src/main/java/org/apache/log4j/LogManager.java#L153-L165
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/features/FeatureUtilities.java
FeatureUtilities.findAttributeName
public static String findAttributeName( SimpleFeatureType featureType, String field ) { List<AttributeDescriptor> attributeDescriptors = featureType.getAttributeDescriptors(); for( AttributeDescriptor attributeDescriptor : attributeDescriptors ) { String name = attributeDescriptor.getLocalName(); if (name.toLowerCase().equals(field.toLowerCase())) { return name; } } return null; }
java
public static String findAttributeName( SimpleFeatureType featureType, String field ) { List<AttributeDescriptor> attributeDescriptors = featureType.getAttributeDescriptors(); for( AttributeDescriptor attributeDescriptor : attributeDescriptors ) { String name = attributeDescriptor.getLocalName(); if (name.toLowerCase().equals(field.toLowerCase())) { return name; } } return null; }
[ "public", "static", "String", "findAttributeName", "(", "SimpleFeatureType", "featureType", ",", "String", "field", ")", "{", "List", "<", "AttributeDescriptor", ">", "attributeDescriptors", "=", "featureType", ".", "getAttributeDescriptors", "(", ")", ";", "for", "...
Find the name of an attribute, case insensitive. @param featureType the feature type to check. @param field the case insensitive field name. @return the real name of the field, or <code>null</code>, if none found.
[ "Find", "the", "name", "of", "an", "attribute", "case", "insensitive", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/features/FeatureUtilities.java#L617-L626
threerings/playn
html/src/playn/html/HtmlGraphics.java
HtmlGraphics.setSize
public void setSize(int width, int height) { rootElement.getStyle().setWidth(width, Unit.PX); rootElement.getStyle().setHeight(height, Unit.PX); }
java
public void setSize(int width, int height) { rootElement.getStyle().setWidth(width, Unit.PX); rootElement.getStyle().setHeight(height, Unit.PX); }
[ "public", "void", "setSize", "(", "int", "width", ",", "int", "height", ")", "{", "rootElement", ".", "getStyle", "(", ")", ".", "setWidth", "(", "width", ",", "Unit", ".", "PX", ")", ";", "rootElement", ".", "getStyle", "(", ")", ".", "setHeight", "...
Sizes or resizes the root element that contains the PlayN view. @param width the new width, in pixels, of the view. @param height the new height, in pixels, of the view.
[ "Sizes", "or", "resizes", "the", "root", "element", "that", "contains", "the", "PlayN", "view", "." ]
train
https://github.com/threerings/playn/blob/c266eeb39188dcada4b00992a0d1199759e03d42/html/src/playn/html/HtmlGraphics.java#L83-L86
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/ClassUtils.java
ClassUtils.findMethod
@SuppressWarnings("all") public static Method findMethod(Class<?> type, String methodName, Object... arguments) { for (Method method : type.getDeclaredMethods()) { if (method.getName().equals(methodName)) { Class<?>[] parameterTypes = method.getParameterTypes(); if (ArrayUtils.nullSafeLength(arguments) == parameterTypes.length) { boolean match = true; for (int index = 0; match && index < parameterTypes.length; index++) { match &= instanceOf(arguments[index], parameterTypes[index]); } if (match) { return method; } } } } return (type.getSuperclass() != null ? findMethod(type.getSuperclass(), methodName, arguments) : null); }
java
@SuppressWarnings("all") public static Method findMethod(Class<?> type, String methodName, Object... arguments) { for (Method method : type.getDeclaredMethods()) { if (method.getName().equals(methodName)) { Class<?>[] parameterTypes = method.getParameterTypes(); if (ArrayUtils.nullSafeLength(arguments) == parameterTypes.length) { boolean match = true; for (int index = 0; match && index < parameterTypes.length; index++) { match &= instanceOf(arguments[index], parameterTypes[index]); } if (match) { return method; } } } } return (type.getSuperclass() != null ? findMethod(type.getSuperclass(), methodName, arguments) : null); }
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "public", "static", "Method", "findMethod", "(", "Class", "<", "?", ">", "type", ",", "String", "methodName", ",", "Object", "...", "arguments", ")", "{", "for", "(", "Method", "method", ":", "type", ".", "ge...
Attempts to find a method with the specified name on the given class type having a signature with parameter types that are compatible with the given arguments. This method searches recursively up the inherited class hierarchy for the given class type until the desired method is found or the class type hierarchy is exhausted, in which case, null is returned. @param type the Class type to search for the desired method. @param methodName a String value indicating the name of the method to find. @param arguments an array of object values indicating the arguments the method's parameters must accept. @return a Method on the given class type with the specified name having a signature compatible with the arguments, or null if no such Method exists on the given class type or one of it's inherited (parent) class types. @throws NullPointerException if the given class type is null. @see java.lang.Class @see java.lang.Class#getDeclaredMethods() @see java.lang.Class#getSuperclass() @see java.lang.reflect.Method
[ "Attempts", "to", "find", "a", "method", "with", "the", "specified", "name", "on", "the", "given", "class", "type", "having", "a", "signature", "with", "parameter", "types", "that", "are", "compatible", "with", "the", "given", "arguments", ".", "This", "meth...
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ClassUtils.java#L330-L355
hypfvieh/java-utils
src/main/java/com/github/hypfvieh/system/NativeLibraryLoader.java
NativeLibraryLoader.loadLibrary
public static void loadLibrary(String _libName, SearchOrder[] _loadOrder, String... _searchPathes) { if (!isEnabled()) { return; } for (SearchOrder order : _loadOrder) { if (INSTANCE.findProperNativeLib(order, _libName, _searchPathes) == null) { return; } } throw new RuntimeException("Could not load library from any given source: " + Arrays.toString(_loadOrder)); }
java
public static void loadLibrary(String _libName, SearchOrder[] _loadOrder, String... _searchPathes) { if (!isEnabled()) { return; } for (SearchOrder order : _loadOrder) { if (INSTANCE.findProperNativeLib(order, _libName, _searchPathes) == null) { return; } } throw new RuntimeException("Could not load library from any given source: " + Arrays.toString(_loadOrder)); }
[ "public", "static", "void", "loadLibrary", "(", "String", "_libName", ",", "SearchOrder", "[", "]", "_loadOrder", ",", "String", "...", "_searchPathes", ")", "{", "if", "(", "!", "isEnabled", "(", ")", ")", "{", "return", ";", "}", "for", "(", "SearchOrd...
Tries to load the given library using the given load/search order. @param _libName library name @param _loadOrder load order @param _searchPathes search pathes
[ "Tries", "to", "load", "the", "given", "library", "using", "the", "given", "load", "/", "search", "order", "." ]
train
https://github.com/hypfvieh/java-utils/blob/407c32d6b485596d4d2b644f5f7fc7a02d0169c6/src/main/java/com/github/hypfvieh/system/NativeLibraryLoader.java#L79-L90
code4everything/util
src/main/java/com/zhazhapan/util/FileExecutor.java
FileExecutor.mergeFiles
private static void mergeFiles(File file, File destinationFile, String filter) throws IOException { String content = readFile(file); if (Checker.isNotEmpty(filter)) { content = content.replaceAll(filter, ValueConsts.EMPTY_STRING); } saveFile(destinationFile, content, ValueConsts.TRUE); }
java
private static void mergeFiles(File file, File destinationFile, String filter) throws IOException { String content = readFile(file); if (Checker.isNotEmpty(filter)) { content = content.replaceAll(filter, ValueConsts.EMPTY_STRING); } saveFile(destinationFile, content, ValueConsts.TRUE); }
[ "private", "static", "void", "mergeFiles", "(", "File", "file", ",", "File", "destinationFile", ",", "String", "filter", ")", "throws", "IOException", "{", "String", "content", "=", "readFile", "(", "file", ")", ";", "if", "(", "Checker", ".", "isNotEmpty", ...
合并文件 @param file 待读取文件 @param destinationFile 目标文件 @param filter 过滤规则 @throws IOException 异常
[ "合并文件" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L766-L772
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/TableRow.java
TableRow.setCellMerge
public void setCellMerge(final int colIndex, final int rowMerge, final int columnMerge) throws IOException { if (rowMerge <= 0 || columnMerge <= 0) return; if (rowMerge <= 1 && columnMerge <= 1) return; this.parent.setCellMerge(this.rowIndex, colIndex, rowMerge, columnMerge); }
java
public void setCellMerge(final int colIndex, final int rowMerge, final int columnMerge) throws IOException { if (rowMerge <= 0 || columnMerge <= 0) return; if (rowMerge <= 1 && columnMerge <= 1) return; this.parent.setCellMerge(this.rowIndex, colIndex, rowMerge, columnMerge); }
[ "public", "void", "setCellMerge", "(", "final", "int", "colIndex", ",", "final", "int", "rowMerge", ",", "final", "int", "columnMerge", ")", "throws", "IOException", "{", "if", "(", "rowMerge", "<=", "0", "||", "columnMerge", "<=", "0", ")", "return", ";",...
Set the merging of multiple cells to one cell. @param colIndex The column, 0 is the first column @param rowMerge the number of rows to merge @param columnMerge the number of cells to merge @throws IOException if the cells can't be merged
[ "Set", "the", "merging", "of", "multiple", "cells", "to", "one", "cell", "." ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/TableRow.java#L160-L165
OpenLiberty/open-liberty
dev/com.ibm.ws.security.audit.reader/src/com/ibm/ws/security/audit/reader/tasks/BaseCommandTask.java
BaseCommandTask.getArgumentValue
protected String getArgumentValue(String arg, String[] args, String defalt, String passwordArgKey, ConsoleWrapper stdin, PrintStream stdout) { for (int i = 1; i < args.length; i++) { String key = args[i].split("=")[0]; if (key.equals(arg)) { String value = getValue(args[i]); if (arg.equals(passwordArgKey) && value == null) { return promptForPassword(stdin, stdout); } else { return value; } } } return defalt; }
java
protected String getArgumentValue(String arg, String[] args, String defalt, String passwordArgKey, ConsoleWrapper stdin, PrintStream stdout) { for (int i = 1; i < args.length; i++) { String key = args[i].split("=")[0]; if (key.equals(arg)) { String value = getValue(args[i]); if (arg.equals(passwordArgKey) && value == null) { return promptForPassword(stdin, stdout); } else { return value; } } } return defalt; }
[ "protected", "String", "getArgumentValue", "(", "String", "arg", ",", "String", "[", "]", "args", ",", "String", "defalt", ",", "String", "passwordArgKey", ",", "ConsoleWrapper", "stdin", ",", "PrintStream", "stdout", ")", "{", "for", "(", "int", "i", "=", ...
Gets the value for the specified argument String. If the default value argument is null, it indicates the argument is required. No validation is done in the format of args as it is assumed to have been done previously. @param arg Argument name to resolve a value for @param args List of arguments. Assumes the script name is included and therefore minimum length is 2. @param defalt Default value if the argument is not specified @param passwordArgKey The password argument key (required to know when to prompt for password) @param stdin Standard in interface @param stdout Standard out interface @return Value of the argument @throws IllegalArgumentException if the argument is defined but no value is given.
[ "Gets", "the", "value", "for", "the", "specified", "argument", "String", ".", "If", "the", "default", "value", "argument", "is", "null", "it", "indicates", "the", "argument", "is", "required", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.reader/src/com/ibm/ws/security/audit/reader/tasks/BaseCommandTask.java#L237-L252
fuzzylite/jfuzzylite
jfuzzylite/src/main/java/com/fuzzylite/imex/RScriptExporter.java
RScriptExporter.toFile
@Override public void toFile(File file, Engine engine) throws IOException { if (engine.getInputVariables().isEmpty()) { throw new RuntimeException("[exporter error] engine has no input variables to export the surface"); } if (engine.getOutputVariables().isEmpty()) { throw new RuntimeException("[exporter error] engine has no output variables to export the surface"); } InputVariable a = engine.getInputVariables().get(0); InputVariable b = engine.getInputVariables().get(1 % engine.numberOfInputVariables()); toFile(file, engine, a, b, 1024, FldExporter.ScopeOfValues.AllVariables, engine.getOutputVariables()); }
java
@Override public void toFile(File file, Engine engine) throws IOException { if (engine.getInputVariables().isEmpty()) { throw new RuntimeException("[exporter error] engine has no input variables to export the surface"); } if (engine.getOutputVariables().isEmpty()) { throw new RuntimeException("[exporter error] engine has no output variables to export the surface"); } InputVariable a = engine.getInputVariables().get(0); InputVariable b = engine.getInputVariables().get(1 % engine.numberOfInputVariables()); toFile(file, engine, a, b, 1024, FldExporter.ScopeOfValues.AllVariables, engine.getOutputVariables()); }
[ "@", "Override", "public", "void", "toFile", "(", "File", "file", ",", "Engine", "engine", ")", "throws", "IOException", "{", "if", "(", "engine", ".", "getInputVariables", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "RuntimeException", ...
Creates an R script file plotting multiple surfaces based on a data frame generated with 1024 values in the scope of FldExporter::AllVariables for the two input variables @param file is the R script file @param engine is the engine to export @throws IOException if any error occurs during writing the file
[ "Creates", "an", "R", "script", "file", "plotting", "multiple", "surfaces", "based", "on", "a", "data", "frame", "generated", "with", "1024", "values", "in", "the", "scope", "of", "FldExporter", "::", "AllVariables", "for", "the", "two", "input", "variables" ]
train
https://github.com/fuzzylite/jfuzzylite/blob/583ac1928f39512af75de80d560e67448039595a/jfuzzylite/src/main/java/com/fuzzylite/imex/RScriptExporter.java#L197-L209
manupsunny/PinLock
pinlock/src/main/java/com/manusunny/pinlock/components/KeypadAdapter.java
KeypadAdapter.setValues
private void setValues(int position, Button view) { if (position == 10) { view.setText("0"); } else if (position == 9) { view.setVisibility(View.INVISIBLE); } else { view.setText(String.valueOf((position + 1) % 10)); } }
java
private void setValues(int position, Button view) { if (position == 10) { view.setText("0"); } else if (position == 9) { view.setVisibility(View.INVISIBLE); } else { view.setText(String.valueOf((position + 1) % 10)); } }
[ "private", "void", "setValues", "(", "int", "position", ",", "Button", "view", ")", "{", "if", "(", "position", "==", "10", ")", "{", "view", ".", "setText", "(", "\"0\"", ")", ";", "}", "else", "if", "(", "position", "==", "9", ")", "{", "view", ...
Setting Button text @param position Position of Button in GridView @param view Button itself
[ "Setting", "Button", "text" ]
train
https://github.com/manupsunny/PinLock/blob/bbb5d53cc57d4e163be01a95157d335231b55dc0/pinlock/src/main/java/com/manusunny/pinlock/components/KeypadAdapter.java#L170-L178
killme2008/xmemcached
src/main/java/net/rubyeye/xmemcached/aws/AWSElasticCacheClient.java
AWSElasticCacheClient.getConfig
public ClusterConfigration getConfig(String key) throws MemcachedException, InterruptedException, TimeoutException { Command cmd = this.commandFactory.createAWSElasticCacheConfigCommand("get", key); final Session session = this.sendCommand(cmd); this.latchWait(cmd, opTimeout, session); cmd.getIoBuffer().free(); this.checkException(cmd); String result = (String) cmd.getResult(); if (result == null) { throw new MemcachedException("Operation fail,may be caused by networking or timeout"); } return AWSUtils.parseConfiguration(result); }
java
public ClusterConfigration getConfig(String key) throws MemcachedException, InterruptedException, TimeoutException { Command cmd = this.commandFactory.createAWSElasticCacheConfigCommand("get", key); final Session session = this.sendCommand(cmd); this.latchWait(cmd, opTimeout, session); cmd.getIoBuffer().free(); this.checkException(cmd); String result = (String) cmd.getResult(); if (result == null) { throw new MemcachedException("Operation fail,may be caused by networking or timeout"); } return AWSUtils.parseConfiguration(result); }
[ "public", "ClusterConfigration", "getConfig", "(", "String", "key", ")", "throws", "MemcachedException", ",", "InterruptedException", ",", "TimeoutException", "{", "Command", "cmd", "=", "this", ".", "commandFactory", ".", "createAWSElasticCacheConfigCommand", "(", "\"g...
Get config by key from cache node by network command. @since 2.3.0 @return clusetr config.
[ "Get", "config", "by", "key", "from", "cache", "node", "by", "network", "command", "." ]
train
https://github.com/killme2008/xmemcached/blob/66150915938813b3e3413de1d7b43b6ff9b1478d/src/main/java/net/rubyeye/xmemcached/aws/AWSElasticCacheClient.java#L253-L265
Jasig/uPortal
uPortal-web/src/main/java/org/apereo/portal/portlet/dao/trans/TransientPortletEntityDao.java
TransientPortletEntityDao.wrapEntity
protected IPortletEntity wrapEntity(IPortletEntity portletEntity) { if (portletEntity == null) { return null; } final String persistentLayoutNodeId = portletEntity.getLayoutNodeId(); if (persistentLayoutNodeId.startsWith(TransientUserLayoutManagerWrapper.SUBSCRIBE_PREFIX)) { final IUserLayoutManager userLayoutManager = this.getUserLayoutManager(); if (userLayoutManager == null) { this.logger.warn( "Could not find IUserLayoutManager when trying to wrap transient portlet entity: " + portletEntity); return portletEntity; } final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition(); final String fname = portletDefinition.getFName(); final String layoutNodeId = userLayoutManager.getSubscribeId(fname); return new TransientPortletEntity(portletEntity, layoutNodeId); } return portletEntity; }
java
protected IPortletEntity wrapEntity(IPortletEntity portletEntity) { if (portletEntity == null) { return null; } final String persistentLayoutNodeId = portletEntity.getLayoutNodeId(); if (persistentLayoutNodeId.startsWith(TransientUserLayoutManagerWrapper.SUBSCRIBE_PREFIX)) { final IUserLayoutManager userLayoutManager = this.getUserLayoutManager(); if (userLayoutManager == null) { this.logger.warn( "Could not find IUserLayoutManager when trying to wrap transient portlet entity: " + portletEntity); return portletEntity; } final IPortletDefinition portletDefinition = portletEntity.getPortletDefinition(); final String fname = portletDefinition.getFName(); final String layoutNodeId = userLayoutManager.getSubscribeId(fname); return new TransientPortletEntity(portletEntity, layoutNodeId); } return portletEntity; }
[ "protected", "IPortletEntity", "wrapEntity", "(", "IPortletEntity", "portletEntity", ")", "{", "if", "(", "portletEntity", "==", "null", ")", "{", "return", "null", ";", "}", "final", "String", "persistentLayoutNodeId", "=", "portletEntity", ".", "getLayoutNodeId", ...
Adds a TransientPortletEntity wrapper to the portletEntity if it is needed. If the specified entity is transient but no transient subscribe id has been registered for it yet in the transientIdMap null is returned. If no wrapping is needed the original entity is returned.
[ "Adds", "a", "TransientPortletEntity", "wrapper", "to", "the", "portletEntity", "if", "it", "is", "needed", ".", "If", "the", "specified", "entity", "is", "transient", "but", "no", "transient", "subscribe", "id", "has", "been", "registered", "for", "it", "yet"...
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-web/src/main/java/org/apereo/portal/portlet/dao/trans/TransientPortletEntityDao.java#L188-L210
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java
MapPolyline.getSubSegmentForDistance
@Pure public Segment1D<?, ?> getSubSegmentForDistance(double distance) { final double rd = distance < 0. ? 0. : distance; double onGoingDistance = 0.; for (final PointGroup group : groups()) { Point2d previousPts = null; for (final Point2d pts : group.points()) { if (previousPts != null) { onGoingDistance += previousPts.getDistance(pts); if (rd <= onGoingDistance) { // The desired distance is on the current point pair return new DefaultSegment1d(previousPts, pts); } } previousPts = pts; } } throw new IllegalArgumentException("distance must be lower or equal than getLength(); distance=" //$NON-NLS-1$ + Double.toString(distance) + "; length=" //$NON-NLS-1$ + Double.toString(getLength())); }
java
@Pure public Segment1D<?, ?> getSubSegmentForDistance(double distance) { final double rd = distance < 0. ? 0. : distance; double onGoingDistance = 0.; for (final PointGroup group : groups()) { Point2d previousPts = null; for (final Point2d pts : group.points()) { if (previousPts != null) { onGoingDistance += previousPts.getDistance(pts); if (rd <= onGoingDistance) { // The desired distance is on the current point pair return new DefaultSegment1d(previousPts, pts); } } previousPts = pts; } } throw new IllegalArgumentException("distance must be lower or equal than getLength(); distance=" //$NON-NLS-1$ + Double.toString(distance) + "; length=" //$NON-NLS-1$ + Double.toString(getLength())); }
[ "@", "Pure", "public", "Segment1D", "<", "?", ",", "?", ">", "getSubSegmentForDistance", "(", "double", "distance", ")", "{", "final", "double", "rd", "=", "distance", "<", "0.", "?", "0.", ":", "distance", ";", "double", "onGoingDistance", "=", "0.", ";...
Replies the subsegment which is corresponding to the given position. <p>A subsegment is a pair if connected points in the polyline. @param distance is position on the polyline (in {@code 0} to {@code getLength()}). @return the point pair, never <code>null</code>.
[ "Replies", "the", "subsegment", "which", "is", "corresponding", "to", "the", "given", "position", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java#L360-L381
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java
CommerceCountryPersistenceImpl.findByG_S_A
@Override public List<CommerceCountry> findByG_S_A(long groupId, boolean shippingAllowed, boolean active, int start, int end) { return findByG_S_A(groupId, shippingAllowed, active, start, end, null); }
java
@Override public List<CommerceCountry> findByG_S_A(long groupId, boolean shippingAllowed, boolean active, int start, int end) { return findByG_S_A(groupId, shippingAllowed, active, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceCountry", ">", "findByG_S_A", "(", "long", "groupId", ",", "boolean", "shippingAllowed", ",", "boolean", "active", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByG_S_A", "(", "groupId", ","...
Returns a range of all the commerce countries where groupId = &#63; and shippingAllowed = &#63; and active = &#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 CommerceCountryModelImpl}. 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 groupId the group ID @param shippingAllowed the shipping allowed @param active the active @param start the lower bound of the range of commerce countries @param end the upper bound of the range of commerce countries (not inclusive) @return the range of matching commerce countries
[ "Returns", "a", "range", "of", "all", "the", "commerce", "countries", "where", "groupId", "=", "&#63", ";", "and", "shippingAllowed", "=", "&#63", ";", "and", "active", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceCountryPersistenceImpl.java#L3654-L3658
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
JaxbUtils.unmarshal
public static <T> T unmarshal(Class<T> cl, Reader r) throws JAXBException { return unmarshal(cl, new StreamSource(r)); }
java
public static <T> T unmarshal(Class<T> cl, Reader r) throws JAXBException { return unmarshal(cl, new StreamSource(r)); }
[ "public", "static", "<", "T", ">", "T", "unmarshal", "(", "Class", "<", "T", ">", "cl", ",", "Reader", "r", ")", "throws", "JAXBException", "{", "return", "unmarshal", "(", "cl", ",", "new", "StreamSource", "(", "r", ")", ")", ";", "}" ]
Convert the contents of a Reader to an object of a given class. @param cl Type of object @param r Reader to be read @return Object of the given type
[ "Convert", "the", "contents", "of", "a", "Reader", "to", "an", "object", "of", "a", "given", "class", "." ]
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L264-L266
Stratio/cassandra-lucene-index
builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java
Builder.geoBBox
public static GeoBBoxCondition geoBBox(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) { return new GeoBBoxCondition(field, minLatitude, maxLatitude, minLongitude, maxLongitude); }
java
public static GeoBBoxCondition geoBBox(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) { return new GeoBBoxCondition(field, minLatitude, maxLatitude, minLongitude, maxLongitude); }
[ "public", "static", "GeoBBoxCondition", "geoBBox", "(", "String", "field", ",", "double", "minLatitude", ",", "double", "maxLatitude", ",", "double", "minLongitude", ",", "double", "maxLongitude", ")", "{", "return", "new", "GeoBBoxCondition", "(", "field", ",", ...
Returns a new {@link GeoBBoxCondition} with the specified field name and bounding box coordinates. @param field the name of the field to be matched @param minLongitude the minimum accepted longitude @param maxLongitude the maximum accepted longitude @param minLatitude the minimum accepted latitude @param maxLatitude the maximum accepted latitude @return a new geo bounding box condition
[ "Returns", "a", "new", "{", "@link", "GeoBBoxCondition", "}", "with", "the", "specified", "field", "name", "and", "bounding", "box", "coordinates", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java#L439-L445
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java
PathfindableModel.updateObjectId
private void updateObjectId(int lastStep, int nextStep) { final int max = getMaxStep(); if (nextStep < max) { // Next step is free if (checkObjectId(path.getX(nextStep), path.getY(nextStep))) { takeNextStep(lastStep, nextStep); } else { avoidObstacle(nextStep, max); } } }
java
private void updateObjectId(int lastStep, int nextStep) { final int max = getMaxStep(); if (nextStep < max) { // Next step is free if (checkObjectId(path.getX(nextStep), path.getY(nextStep))) { takeNextStep(lastStep, nextStep); } else { avoidObstacle(nextStep, max); } } }
[ "private", "void", "updateObjectId", "(", "int", "lastStep", ",", "int", "nextStep", ")", "{", "final", "int", "max", "=", "getMaxStep", "(", ")", ";", "if", "(", "nextStep", "<", "max", ")", "{", "// Next step is free", "if", "(", "checkObjectId", "(", ...
Update reference by updating map object Id. @param lastStep The last step. @param nextStep The next step.
[ "Update", "reference", "by", "updating", "map", "object", "Id", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/PathfindableModel.java#L209-L224
groupon/odo
client/src/main/java/com/groupon/odo/client/Client.java
Client.updateServerRedirectHost
public ServerRedirect updateServerRedirectHost(int serverMappingId, String hostHeader) { ServerRedirect redirect = new ServerRedirect(); BasicNameValuePair[] params = { new BasicNameValuePair("hostHeader", hostHeader), new BasicNameValuePair("profileIdentifier", this._profileName) }; try { JSONObject response = new JSONObject(doPost(BASE_SERVER + "/" + serverMappingId + "/host", params)); redirect = getServerRedirectFromJSON(response); } catch (Exception e) { e.printStackTrace(); return null; } return redirect; }
java
public ServerRedirect updateServerRedirectHost(int serverMappingId, String hostHeader) { ServerRedirect redirect = new ServerRedirect(); BasicNameValuePair[] params = { new BasicNameValuePair("hostHeader", hostHeader), new BasicNameValuePair("profileIdentifier", this._profileName) }; try { JSONObject response = new JSONObject(doPost(BASE_SERVER + "/" + serverMappingId + "/host", params)); redirect = getServerRedirectFromJSON(response); } catch (Exception e) { e.printStackTrace(); return null; } return redirect; }
[ "public", "ServerRedirect", "updateServerRedirectHost", "(", "int", "serverMappingId", ",", "String", "hostHeader", ")", "{", "ServerRedirect", "redirect", "=", "new", "ServerRedirect", "(", ")", ";", "BasicNameValuePair", "[", "]", "params", "=", "{", "new", "Bas...
Update server mapping's host header @param serverMappingId ID of server mapping @param hostHeader value of host header @return updated ServerRedirect
[ "Update", "server", "mapping", "s", "host", "header" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L1159-L1173
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java
CmsGalleryController.searchElement
public void searchElement(final String path, final Runnable nextAction) { m_dialogBean.setCurrentElement(path); m_dialogBean.setStartTab(GalleryTabId.cms_tab_results); m_dialogBean.setTreeToken(getTreeToken()); CmsRpcAction<CmsGallerySearchBean> searchAction = new CmsRpcAction<CmsGallerySearchBean>() { @Override public void execute() { start(200, true); getGalleryService().getSearch(m_dialogBean, this); } @Override protected void onResponse(CmsGallerySearchBean result) { stop(false); m_searchObject = result; m_handler.onInitialSearch(result, m_dialogBean, CmsGalleryController.this, false); if (nextAction != null) { nextAction.run(); } } }; searchAction.execute(); }
java
public void searchElement(final String path, final Runnable nextAction) { m_dialogBean.setCurrentElement(path); m_dialogBean.setStartTab(GalleryTabId.cms_tab_results); m_dialogBean.setTreeToken(getTreeToken()); CmsRpcAction<CmsGallerySearchBean> searchAction = new CmsRpcAction<CmsGallerySearchBean>() { @Override public void execute() { start(200, true); getGalleryService().getSearch(m_dialogBean, this); } @Override protected void onResponse(CmsGallerySearchBean result) { stop(false); m_searchObject = result; m_handler.onInitialSearch(result, m_dialogBean, CmsGalleryController.this, false); if (nextAction != null) { nextAction.run(); } } }; searchAction.execute(); }
[ "public", "void", "searchElement", "(", "final", "String", "path", ",", "final", "Runnable", "nextAction", ")", "{", "m_dialogBean", ".", "setCurrentElement", "(", "path", ")", ";", "m_dialogBean", ".", "setStartTab", "(", "GalleryTabId", ".", "cms_tab_results", ...
Searches for a specific element and opens it's preview if found.<p> @param path the element path @param nextAction the next action to execute after the search data for the element has been loaded into the gallery dialog
[ "Searches", "for", "a", "specific", "element", "and", "opens", "it", "s", "preview", "if", "found", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java#L1208-L1236
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeTree.java
InodeTree.lockFullInodePath
public LockedInodePath lockFullInodePath(long id, LockPattern lockPattern) throws FileDoesNotExistException { LockedInodePath inodePath = lockInodePathById(id, lockPattern); if (!inodePath.fullPathExists()) { inodePath.close(); throw new FileDoesNotExistException(ExceptionMessage.INODE_DOES_NOT_EXIST.getMessage(id)); } return inodePath; }
java
public LockedInodePath lockFullInodePath(long id, LockPattern lockPattern) throws FileDoesNotExistException { LockedInodePath inodePath = lockInodePathById(id, lockPattern); if (!inodePath.fullPathExists()) { inodePath.close(); throw new FileDoesNotExistException(ExceptionMessage.INODE_DOES_NOT_EXIST.getMessage(id)); } return inodePath; }
[ "public", "LockedInodePath", "lockFullInodePath", "(", "long", "id", ",", "LockPattern", "lockPattern", ")", "throws", "FileDoesNotExistException", "{", "LockedInodePath", "inodePath", "=", "lockInodePathById", "(", "id", ",", "lockPattern", ")", ";", "if", "(", "!"...
Locks a path and throws an exception if the path does not exist. @param id the inode id to lock @param lockPattern the pattern to lock with @return a locked inode path for the uri
[ "Locks", "a", "path", "and", "throws", "an", "exception", "if", "the", "path", "does", "not", "exist", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeTree.java#L389-L397
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java
AbstractBigtableAdmin.modifyColumns
public void modifyColumns(final String tableName, HColumnDescriptor descriptor) throws IOException { modifyColumn(TableName.valueOf(tableName), descriptor); }
java
public void modifyColumns(final String tableName, HColumnDescriptor descriptor) throws IOException { modifyColumn(TableName.valueOf(tableName), descriptor); }
[ "public", "void", "modifyColumns", "(", "final", "String", "tableName", ",", "HColumnDescriptor", "descriptor", ")", "throws", "IOException", "{", "modifyColumn", "(", "TableName", ".", "valueOf", "(", "tableName", ")", ",", "descriptor", ")", ";", "}" ]
Modify an existing column family on a table. NOTE: this is needed for backwards compatibility for the hbase shell. @param tableName a {@link TableName} object. @param descriptor a {@link HColumnDescriptor} object. @throws java.io.IOException if any.
[ "Modify", "an", "existing", "column", "family", "on", "a", "table", ".", "NOTE", ":", "this", "is", "needed", "for", "backwards", "compatibility", "for", "the", "hbase", "shell", "." ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java#L631-L634
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java
AbstractRadial.create_POINTER_Image
protected BufferedImage create_POINTER_Image(final int WIDTH, final PointerType POINTER_TYPE, final ColorDef POINTER_COLOR) { return POINTER_FACTORY.createStandardPointer(WIDTH, POINTER_TYPE, POINTER_COLOR, getBackgroundColor()); }
java
protected BufferedImage create_POINTER_Image(final int WIDTH, final PointerType POINTER_TYPE, final ColorDef POINTER_COLOR) { return POINTER_FACTORY.createStandardPointer(WIDTH, POINTER_TYPE, POINTER_COLOR, getBackgroundColor()); }
[ "protected", "BufferedImage", "create_POINTER_Image", "(", "final", "int", "WIDTH", ",", "final", "PointerType", "POINTER_TYPE", ",", "final", "ColorDef", "POINTER_COLOR", ")", "{", "return", "POINTER_FACTORY", ".", "createStandardPointer", "(", "WIDTH", ",", "POINTER...
Returns the image of the pointer. This pointer is centered in the gauge. @param WIDTH @param POINTER_TYPE @param POINTER_COLOR @return the pointer image that is used in all gauges that have a centered pointer
[ "Returns", "the", "image", "of", "the", "pointer", ".", "This", "pointer", "is", "centered", "in", "the", "gauge", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractRadial.java#L2983-L2985
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java
ZipUtil.copy
private static void copy(ZipFile zipFile, ZipEntry zipEntry, File outItemFile) throws IOException { InputStream in = null; OutputStream out = null; try { in = zipFile.getInputStream(zipEntry); out = FileUtil.getOutputStream(outItemFile); IoUtil.copy(in, out); } finally { IoUtil.close(out); IoUtil.close(in); } }
java
private static void copy(ZipFile zipFile, ZipEntry zipEntry, File outItemFile) throws IOException { InputStream in = null; OutputStream out = null; try { in = zipFile.getInputStream(zipEntry); out = FileUtil.getOutputStream(outItemFile); IoUtil.copy(in, out); } finally { IoUtil.close(out); IoUtil.close(in); } }
[ "private", "static", "void", "copy", "(", "ZipFile", "zipFile", ",", "ZipEntry", "zipEntry", ",", "File", "outItemFile", ")", "throws", "IOException", "{", "InputStream", "in", "=", "null", ";", "OutputStream", "out", "=", "null", ";", "try", "{", "in", "=...
从Zip文件流中拷贝文件出来 @param zipFile Zip文件 @param zipEntry zip文件中的子文件 @param outItemFile 输出到的文件 @throws IOException IO异常
[ "从Zip文件流中拷贝文件出来" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ZipUtil.java#L905-L916
tvesalainen/util
util/src/main/java/org/vesalainen/navi/Navis.java
Navis.deltaLongitude
public static final double deltaLongitude(double latitude, double distance, double bearing) { double departure = departure(latitude); double sin = Math.sin(Math.toRadians(bearing)); return (sin*distance)/(60*departure); }
java
public static final double deltaLongitude(double latitude, double distance, double bearing) { double departure = departure(latitude); double sin = Math.sin(Math.toRadians(bearing)); return (sin*distance)/(60*departure); }
[ "public", "static", "final", "double", "deltaLongitude", "(", "double", "latitude", ",", "double", "distance", ",", "double", "bearing", ")", "{", "double", "departure", "=", "departure", "(", "latitude", ")", ";", "double", "sin", "=", "Math", ".", "sin", ...
Return longitude change after moving distance at bearing @param latitude @param distance @param bearing @return
[ "Return", "longitude", "change", "after", "moving", "distance", "at", "bearing" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/navi/Navis.java#L55-L60
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java
FSImageCompression.readCompressionHeader
public static FSImageCompression readCompressionHeader( Configuration conf, DataInputStream dis) throws IOException { boolean isCompressed = dis.readBoolean(); if (!isCompressed) { return createNoopCompression(); } else { String codecClassName = Text.readString(dis); return createCompression(conf, codecClassName); } }
java
public static FSImageCompression readCompressionHeader( Configuration conf, DataInputStream dis) throws IOException { boolean isCompressed = dis.readBoolean(); if (!isCompressed) { return createNoopCompression(); } else { String codecClassName = Text.readString(dis); return createCompression(conf, codecClassName); } }
[ "public", "static", "FSImageCompression", "readCompressionHeader", "(", "Configuration", "conf", ",", "DataInputStream", "dis", ")", "throws", "IOException", "{", "boolean", "isCompressed", "=", "dis", ".", "readBoolean", "(", ")", ";", "if", "(", "!", "isCompress...
Create a compression instance based on a header read from an input stream. @throws IOException if the specified codec is not available or the underlying IO fails.
[ "Create", "a", "compression", "instance", "based", "on", "a", "header", "read", "from", "an", "input", "stream", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImageCompression.java#L110-L122
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/collection/MapConverter.java
MapConverter.getString
public String getString(Map<String, Object> data, String attr) { Object value = data.get(attr); if (null == value) { return null; } if (!value.getClass().isArray()) { return value.toString(); } String[] values = (String[]) value; if (values.length == 1) { return values[0]; } else { return Strings.join(values, ","); } }
java
public String getString(Map<String, Object> data, String attr) { Object value = data.get(attr); if (null == value) { return null; } if (!value.getClass().isArray()) { return value.toString(); } String[] values = (String[]) value; if (values.length == 1) { return values[0]; } else { return Strings.join(values, ","); } }
[ "public", "String", "getString", "(", "Map", "<", "String", ",", "Object", ">", "data", ",", "String", "attr", ")", "{", "Object", "value", "=", "data", ".", "get", "(", "attr", ")", ";", "if", "(", "null", "==", "value", ")", "{", "return", "null"...
get parameter named attr @param attr a {@link java.lang.String} object. @return single value or multivalue joined with comma @param data a {@link java.util.Map} object.
[ "get", "parameter", "named", "attr" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/collection/MapConverter.java#L96-L106
jenkinsci/jenkins
core/src/main/java/hudson/util/RunList.java
RunList.byTimestamp
public RunList<R> byTimestamp(final long start, final long end) { return limit(new CountingPredicate<R>() { public boolean apply(int index, R r) { return start<=r.getTimeInMillis(); } }).filter(new Predicate<R>() { public boolean apply(R r) { return r.getTimeInMillis()<end; } }); }
java
public RunList<R> byTimestamp(final long start, final long end) { return limit(new CountingPredicate<R>() { public boolean apply(int index, R r) { return start<=r.getTimeInMillis(); } }).filter(new Predicate<R>() { public boolean apply(R r) { return r.getTimeInMillis()<end; } }); }
[ "public", "RunList", "<", "R", ">", "byTimestamp", "(", "final", "long", "start", ",", "final", "long", "end", ")", "{", "return", "limit", "(", "new", "CountingPredicate", "<", "R", ">", "(", ")", "{", "public", "boolean", "apply", "(", "int", "index"...
Filter the list by timestamp. {@code s&lt=;e}. <em>Warning:</em> this method mutates the original list and then returns it.
[ "Filter", "the", "list", "by", "timestamp", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/RunList.java#L322-L333
google/closure-compiler
src/com/google/javascript/rhino/Node.java
Node.replaceFirstOrChildAfter
public final void replaceFirstOrChildAfter(@Nullable Node prev, Node newChild) { Node target = prev == null ? first : prev.next; checkNotNull(target, "prev doesn't have a sibling to replace."); replaceChild(target, newChild); }
java
public final void replaceFirstOrChildAfter(@Nullable Node prev, Node newChild) { Node target = prev == null ? first : prev.next; checkNotNull(target, "prev doesn't have a sibling to replace."); replaceChild(target, newChild); }
[ "public", "final", "void", "replaceFirstOrChildAfter", "(", "@", "Nullable", "Node", "prev", ",", "Node", "newChild", ")", "{", "Node", "target", "=", "prev", "==", "null", "?", "first", ":", "prev", ".", "next", ";", "checkNotNull", "(", "target", ",", ...
Detaches the child after the given child, or the first child if prev is null.
[ "Detaches", "the", "child", "after", "the", "given", "child", "or", "the", "first", "child", "if", "prev", "is", "null", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/Node.java#L1033-L1037
aws/aws-sdk-java
aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/DescribeInputSecurityGroupResult.java
DescribeInputSecurityGroupResult.withTags
public DescribeInputSecurityGroupResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public DescribeInputSecurityGroupResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "DescribeInputSecurityGroupResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
A collection of key-value pairs. @param tags A collection of key-value pairs. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "collection", "of", "key", "-", "value", "pairs", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-medialive/src/main/java/com/amazonaws/services/medialive/model/DescribeInputSecurityGroupResult.java#L250-L253
wildfly/wildfly-core
domain-management/src/main/java/org/jboss/as/domain/management/security/PropertiesFileLoader.java
PropertiesFileLoader.getValue
private String getValue(String key, String previousValue) { final String value; final String valueUpdated = toSave.getProperty(key); if (valueUpdated == null) { value = previousValue; } else { value = valueUpdated; } return value; }
java
private String getValue(String key, String previousValue) { final String value; final String valueUpdated = toSave.getProperty(key); if (valueUpdated == null) { value = previousValue; } else { value = valueUpdated; } return value; }
[ "private", "String", "getValue", "(", "String", "key", ",", "String", "previousValue", ")", "{", "final", "String", "value", ";", "final", "String", "valueUpdated", "=", "toSave", ".", "getProperty", "(", "key", ")", ";", "if", "(", "valueUpdated", "==", "...
Get the value of the property.<br/> If the value to save is null, return the previous value (enable/disable mode). @param key The key of the property @param previousValue The previous value @return The value of the property
[ "Get", "the", "value", "of", "the", "property", ".", "<br", "/", ">", "If", "the", "value", "to", "save", "is", "null", "return", "the", "previous", "value", "(", "enable", "/", "disable", "mode", ")", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/PropertiesFileLoader.java#L359-L368
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java
KeyValueLocator.handleNotEqualNodeSizes
private static boolean handleNotEqualNodeSizes(int configNodeSize, int actualNodeSize) { if (configNodeSize != actualNodeSize) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Node list and configuration's partition hosts sizes : {} <> {}, rescheduling", actualNodeSize, configNodeSize); } return true; } return false; }
java
private static boolean handleNotEqualNodeSizes(int configNodeSize, int actualNodeSize) { if (configNodeSize != actualNodeSize) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Node list and configuration's partition hosts sizes : {} <> {}, rescheduling", actualNodeSize, configNodeSize); } return true; } return false; }
[ "private", "static", "boolean", "handleNotEqualNodeSizes", "(", "int", "configNodeSize", ",", "int", "actualNodeSize", ")", "{", "if", "(", "configNodeSize", "!=", "actualNodeSize", ")", "{", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG...
Helper method to handle potentially different node sizes in the actual list and in the config. @return true if they are not equal, false if they are.
[ "Helper", "method", "to", "handle", "potentially", "different", "node", "sizes", "in", "the", "actual", "list", "and", "in", "the", "config", "." ]
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/node/locate/KeyValueLocator.java#L283-L292
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java
SpannerClient.beginTransaction
public final Transaction beginTransaction(SessionName session, TransactionOptions options) { BeginTransactionRequest request = BeginTransactionRequest.newBuilder() .setSession(session == null ? null : session.toString()) .setOptions(options) .build(); return beginTransaction(request); }
java
public final Transaction beginTransaction(SessionName session, TransactionOptions options) { BeginTransactionRequest request = BeginTransactionRequest.newBuilder() .setSession(session == null ? null : session.toString()) .setOptions(options) .build(); return beginTransaction(request); }
[ "public", "final", "Transaction", "beginTransaction", "(", "SessionName", "session", ",", "TransactionOptions", "options", ")", "{", "BeginTransactionRequest", "request", "=", "BeginTransactionRequest", ".", "newBuilder", "(", ")", ".", "setSession", "(", "session", "...
Begins a new transaction. This step can often be skipped: [Read][google.spanner.v1.Spanner.Read], [ExecuteSql][google.spanner.v1.Spanner.ExecuteSql] and [Commit][google.spanner.v1.Spanner.Commit] can begin a new transaction as a side-effect. <p>Sample code: <pre><code> try (SpannerClient spannerClient = SpannerClient.create()) { SessionName session = SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); TransactionOptions options = TransactionOptions.newBuilder().build(); Transaction response = spannerClient.beginTransaction(session, options); } </code></pre> @param session Required. The session in which the transaction runs. @param options Required. Options for the new transaction. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Begins", "a", "new", "transaction", ".", "This", "step", "can", "often", "be", "skipped", ":", "[", "Read", "]", "[", "google", ".", "spanner", ".", "v1", ".", "Spanner", ".", "Read", "]", "[", "ExecuteSql", "]", "[", "google", ".", "spanner", ".", ...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java#L940-L948
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/TokenCachingStrategy.java
TokenCachingStrategy.putExpirationMilliseconds
public static void putExpirationMilliseconds(Bundle bundle, long value) { Validate.notNull(bundle, "bundle"); bundle.putLong(EXPIRATION_DATE_KEY, value); }
java
public static void putExpirationMilliseconds(Bundle bundle, long value) { Validate.notNull(bundle, "bundle"); bundle.putLong(EXPIRATION_DATE_KEY, value); }
[ "public", "static", "void", "putExpirationMilliseconds", "(", "Bundle", "bundle", ",", "long", "value", ")", "{", "Validate", ".", "notNull", "(", "bundle", ",", "\"bundle\"", ")", ";", "bundle", ".", "putLong", "(", "EXPIRATION_DATE_KEY", ",", "value", ")", ...
Puts the expiration date into a Bundle. @param bundle A Bundle in which the expiration date should be stored. @param value The long representing the expiration date in milliseconds since the epoch. @throws NullPointerException if the passed in Bundle is null
[ "Puts", "the", "expiration", "date", "into", "a", "Bundle", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/TokenCachingStrategy.java#L232-L235
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemMetadataProvider.java
FileSystemMetadataProvider.pathForMetadata
private static Path pathForMetadata(Path root, String namespace, String name) { return new Path( FileSystemDatasetRepository.pathForDataset(root, namespace, name), METADATA_DIRECTORY); }
java
private static Path pathForMetadata(Path root, String namespace, String name) { return new Path( FileSystemDatasetRepository.pathForDataset(root, namespace, name), METADATA_DIRECTORY); }
[ "private", "static", "Path", "pathForMetadata", "(", "Path", "root", ",", "String", "namespace", ",", "String", "name", ")", "{", "return", "new", "Path", "(", "FileSystemDatasetRepository", ".", "pathForDataset", "(", "root", ",", "namespace", ",", "name", ")...
Returns the correct metadata path for the given dataset. @param root A Path @param name A String dataset name @return the metadata Path
[ "Returns", "the", "correct", "metadata", "path", "for", "the", "given", "dataset", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemMetadataProvider.java#L561-L565
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/meta/AbstractBlockMeta.java
AbstractBlockMeta.commitPath
public static String commitPath(StorageDir dir, long blockId) { return PathUtils.concatPath(dir.getDirPath(), blockId); }
java
public static String commitPath(StorageDir dir, long blockId) { return PathUtils.concatPath(dir.getDirPath(), blockId); }
[ "public", "static", "String", "commitPath", "(", "StorageDir", "dir", ",", "long", "blockId", ")", "{", "return", "PathUtils", ".", "concatPath", "(", "dir", ".", "getDirPath", "(", ")", ",", "blockId", ")", ";", "}" ]
Committed block is stored in BlockStore under its {@link StorageDir} as a block file named after its blockId. e.g. Block 100 of StorageDir "/mnt/mem/0" has path: <p> /mnt/mem/0/100 @param blockId the block id @param dir the parent directory @return committed file path
[ "Committed", "block", "is", "stored", "in", "BlockStore", "under", "its", "{", "@link", "StorageDir", "}", "as", "a", "block", "file", "named", "after", "its", "blockId", ".", "e", ".", "g", ".", "Block", "100", "of", "StorageDir", "/", "mnt", "/", "me...
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/meta/AbstractBlockMeta.java#L61-L63
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/operations/ClassPath.java
ClassPath.newInstance
public static <T> T newInstance(String className, Class<?> parameterType,Object initarg) throws SetupException { try { return newInstance(Class.forName(className),parameterType,initarg); } catch (ClassNotFoundException e) { throw new SetupException(e); } }
java
public static <T> T newInstance(String className, Class<?> parameterType,Object initarg) throws SetupException { try { return newInstance(Class.forName(className),parameterType,initarg); } catch (ClassNotFoundException e) { throw new SetupException(e); } }
[ "public", "static", "<", "T", ">", "T", "newInstance", "(", "String", "className", ",", "Class", "<", "?", ">", "parameterType", ",", "Object", "initarg", ")", "throws", "SetupException", "{", "try", "{", "return", "newInstance", "(", "Class", ".", "forNam...
Use a constructor of the a class to create an instance @param className the class the create @param parameterType the parameter type @param initarg the initial constructor argument @param <T> the type to be created @return the initiate object @throws SetupException the setup error
[ "Use", "a", "constructor", "of", "the", "a", "class", "to", "create", "an", "instance" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/operations/ClassPath.java#L143-L155
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/query/CassQuery.java
CassQuery.appendIn
private boolean appendIn(StringBuilder builder, CQLTranslator translator, String columnName) { boolean isPresent; isPresent = true; translator.ensureCase(builder, columnName, false); builder.append(" IN "); return isPresent; }
java
private boolean appendIn(StringBuilder builder, CQLTranslator translator, String columnName) { boolean isPresent; isPresent = true; translator.ensureCase(builder, columnName, false); builder.append(" IN "); return isPresent; }
[ "private", "boolean", "appendIn", "(", "StringBuilder", "builder", ",", "CQLTranslator", "translator", ",", "String", "columnName", ")", "{", "boolean", "isPresent", ";", "isPresent", "=", "true", ";", "translator", ".", "ensureCase", "(", "builder", ",", "colum...
Append in. @param builder the builder @param translator the translator @param columnName the column name @return true, if successful
[ "Append", "in", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/query/CassQuery.java#L1077-L1083
jhunters/jprotobuf
v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java
CodedConstant.writeObject
public static void writeObject(CodedOutputStream out, int order, FieldType type, Object o, boolean list) throws IOException { writeObject(out, order, type, o, list, true); }
java
public static void writeObject(CodedOutputStream out, int order, FieldType type, Object o, boolean list) throws IOException { writeObject(out, order, type, o, list, true); }
[ "public", "static", "void", "writeObject", "(", "CodedOutputStream", "out", ",", "int", "order", ",", "FieldType", "type", ",", "Object", "o", ",", "boolean", "list", ")", "throws", "IOException", "{", "writeObject", "(", "out", ",", "order", ",", "type", ...
Write object. @param out the out @param order the order @param type the type @param o the o @param list the list @throws IOException Signals that an I/O exception has occurred.
[ "Write", "object", "." ]
train
https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/code/CodedConstant.java#L731-L734
phax/ph-oton
ph-oton-uicore/src/main/java/com/helger/photon/uicore/page/AbstractWebPageForm.java
AbstractWebPageForm.createEditToolbar
@Nonnull @OverrideOnDemand protected TOOLBAR_TYPE createEditToolbar (@Nonnull final WPECTYPE aWPEC, @Nonnull final FORM_TYPE aForm, @Nonnull final DATATYPE aSelectedObject) { final Locale aDisplayLocale = aWPEC.getDisplayLocale (); final TOOLBAR_TYPE aToolbar = createNewEditToolbar (aWPEC); aToolbar.addHiddenField (CPageParam.PARAM_ACTION, CPageParam.ACTION_EDIT); aToolbar.addHiddenField (CPageParam.PARAM_OBJECT, aSelectedObject.getID ()); aToolbar.addHiddenField (CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE); // Save button aToolbar.addSubmitButton (getEditToolbarSubmitButtonText (aDisplayLocale), getEditToolbarSubmitButtonIcon ()); // Cancel button aToolbar.addButtonCancel (aDisplayLocale); // Callback modifyEditToolbar (aWPEC, aSelectedObject, aToolbar); return aToolbar; }
java
@Nonnull @OverrideOnDemand protected TOOLBAR_TYPE createEditToolbar (@Nonnull final WPECTYPE aWPEC, @Nonnull final FORM_TYPE aForm, @Nonnull final DATATYPE aSelectedObject) { final Locale aDisplayLocale = aWPEC.getDisplayLocale (); final TOOLBAR_TYPE aToolbar = createNewEditToolbar (aWPEC); aToolbar.addHiddenField (CPageParam.PARAM_ACTION, CPageParam.ACTION_EDIT); aToolbar.addHiddenField (CPageParam.PARAM_OBJECT, aSelectedObject.getID ()); aToolbar.addHiddenField (CPageParam.PARAM_SUBACTION, CPageParam.ACTION_SAVE); // Save button aToolbar.addSubmitButton (getEditToolbarSubmitButtonText (aDisplayLocale), getEditToolbarSubmitButtonIcon ()); // Cancel button aToolbar.addButtonCancel (aDisplayLocale); // Callback modifyEditToolbar (aWPEC, aSelectedObject, aToolbar); return aToolbar; }
[ "@", "Nonnull", "@", "OverrideOnDemand", "protected", "TOOLBAR_TYPE", "createEditToolbar", "(", "@", "Nonnull", "final", "WPECTYPE", "aWPEC", ",", "@", "Nonnull", "final", "FORM_TYPE", "aForm", ",", "@", "Nonnull", "final", "DATATYPE", "aSelectedObject", ")", "{",...
Create toolbar for editing an existing object @param aWPEC The web page execution context. Never <code>null</code>. @param aForm The handled form. Never <code>null</code>. @param aSelectedObject The selected object. Never <code>null</code>. @return Never <code>null</code>.
[ "Create", "toolbar", "for", "editing", "an", "existing", "object" ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-uicore/src/main/java/com/helger/photon/uicore/page/AbstractWebPageForm.java#L747-L767
alkacon/opencms-core
src/org/opencms/site/CmsSiteManagerImpl.java
CmsSiteManagerImpl.checkUUIDOfSiteRoot
private void checkUUIDOfSiteRoot(CmsSite site, CmsObject clone, CmsObject cms_offline) { CmsUUID id = null; try { id = clone.readResource(site.getSiteRoot()).getStructureId(); } catch (CmsException e) { //Ok, site root not available for online repository. } if (id == null) { try { id = cms_offline.readResource(site.getSiteRoot()).getStructureId(); m_onlyOfflineSites.add(site); } catch (CmsException e) { //Siteroot not valid for on- and offline repository. } } if (id != null) { site.setSiteRootUUID(id); m_siteUUIDs.put(id, site); } }
java
private void checkUUIDOfSiteRoot(CmsSite site, CmsObject clone, CmsObject cms_offline) { CmsUUID id = null; try { id = clone.readResource(site.getSiteRoot()).getStructureId(); } catch (CmsException e) { //Ok, site root not available for online repository. } if (id == null) { try { id = cms_offline.readResource(site.getSiteRoot()).getStructureId(); m_onlyOfflineSites.add(site); } catch (CmsException e) { //Siteroot not valid for on- and offline repository. } } if (id != null) { site.setSiteRootUUID(id); m_siteUUIDs.put(id, site); } }
[ "private", "void", "checkUUIDOfSiteRoot", "(", "CmsSite", "site", ",", "CmsObject", "clone", ",", "CmsObject", "cms_offline", ")", "{", "CmsUUID", "id", "=", "null", ";", "try", "{", "id", "=", "clone", ".", "readResource", "(", "site", ".", "getSiteRoot", ...
Fetches UUID for given site root from online and offline repository.<p> @param site to read and set UUID for @param clone online CmsObject @param cms_offline offline CmsObject
[ "Fetches", "UUID", "for", "given", "site", "root", "from", "online", "and", "offline", "repository", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSiteManagerImpl.java#L1646-L1667
ecclesia/kipeto
kipeto/src/main/java/de/ecclesia/kipeto/RepositoryResolver.java
RepositoryResolver.resolveRepos
private String resolveRepos(String localIp, Properties config) { for (Object key : config.keySet()) { String ipPraefix = (String) key; String repos = config.getProperty(ipPraefix); if (localIp.startsWith(ipPraefix)) { log.info("Local IP " + localIp + " starts with '{}', selecting [{}]", ipPraefix, repos); return repos; } else { log.debug("Local IP " + localIp + " does not start with '{}' --> {}", ipPraefix, repos); } } log.warn("No matching config-entry found for {}, falling back to default-repository {}", localIp, defaultRepositoryUrl); return defaultRepositoryUrl; }
java
private String resolveRepos(String localIp, Properties config) { for (Object key : config.keySet()) { String ipPraefix = (String) key; String repos = config.getProperty(ipPraefix); if (localIp.startsWith(ipPraefix)) { log.info("Local IP " + localIp + " starts with '{}', selecting [{}]", ipPraefix, repos); return repos; } else { log.debug("Local IP " + localIp + " does not start with '{}' --> {}", ipPraefix, repos); } } log.warn("No matching config-entry found for {}, falling back to default-repository {}", localIp, defaultRepositoryUrl); return defaultRepositoryUrl; }
[ "private", "String", "resolveRepos", "(", "String", "localIp", ",", "Properties", "config", ")", "{", "for", "(", "Object", "key", ":", "config", ".", "keySet", "(", ")", ")", "{", "String", "ipPraefix", "=", "(", "String", ")", "key", ";", "String", "...
Ermittelt anhand der lokalen IP-Adresse und der übergebenen Konfiguration, welches Repository für den Update-Vorgang verwendet werden soll.
[ "Ermittelt", "anhand", "der", "lokalen", "IP", "-", "Adresse", "und", "der", "übergebenen", "Konfiguration", "welches", "Repository", "für", "den", "Update", "-", "Vorgang", "verwendet", "werden", "soll", "." ]
train
https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto/src/main/java/de/ecclesia/kipeto/RepositoryResolver.java#L180-L197
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.getUpdateSummary
public UpdateSummaryInner getUpdateSummary(String deviceName, String resourceGroupName) { return getUpdateSummaryWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().single().body(); }
java
public UpdateSummaryInner getUpdateSummary(String deviceName, String resourceGroupName) { return getUpdateSummaryWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().single().body(); }
[ "public", "UpdateSummaryInner", "getUpdateSummary", "(", "String", "deviceName", ",", "String", "resourceGroupName", ")", "{", "return", "getUpdateSummaryWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", ")", ".", "toBlocking", "(", ")", ".", "sing...
Gets information about the availability of updates based on the last scan of the device. It also gets information about any ongoing download or install jobs on the device. @param deviceName The device name. @param resourceGroupName The resource group name. @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 UpdateSummaryInner object if successful.
[ "Gets", "information", "about", "the", "availability", "of", "updates", "based", "on", "the", "last", "scan", "of", "the", "device", ".", "It", "also", "gets", "information", "about", "any", "ongoing", "download", "or", "install", "jobs", "on", "the", "devic...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L2011-L2013
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java
JournalSet.getInputStream
public static EditLogInputStream getInputStream(JournalManager jm, long txid) throws IOException { List<EditLogInputStream> streams = new ArrayList<EditLogInputStream>(); jm.selectInputStreams(streams, txid, true, false); if (streams.size() < 1) { throw new IOException("Cannot obtain stream for txid: " + txid); } Collections.sort(streams, JournalSet.EDIT_LOG_INPUT_STREAM_COMPARATOR); // we want the "oldest" available stream if (txid == HdfsConstants.INVALID_TXID) { return streams.get(0); } // we want a specific stream for (EditLogInputStream elis : streams) { if (elis.getFirstTxId() == txid) { return elis; } } // we cannot obtain the stream throw new IOException("Cannot obtain stream for txid: " + txid); }
java
public static EditLogInputStream getInputStream(JournalManager jm, long txid) throws IOException { List<EditLogInputStream> streams = new ArrayList<EditLogInputStream>(); jm.selectInputStreams(streams, txid, true, false); if (streams.size() < 1) { throw new IOException("Cannot obtain stream for txid: " + txid); } Collections.sort(streams, JournalSet.EDIT_LOG_INPUT_STREAM_COMPARATOR); // we want the "oldest" available stream if (txid == HdfsConstants.INVALID_TXID) { return streams.get(0); } // we want a specific stream for (EditLogInputStream elis : streams) { if (elis.getFirstTxId() == txid) { return elis; } } // we cannot obtain the stream throw new IOException("Cannot obtain stream for txid: " + txid); }
[ "public", "static", "EditLogInputStream", "getInputStream", "(", "JournalManager", "jm", ",", "long", "txid", ")", "throws", "IOException", "{", "List", "<", "EditLogInputStream", ">", "streams", "=", "new", "ArrayList", "<", "EditLogInputStream", ">", "(", ")", ...
Get input stream from the given journal starting at txid. Does not perform validation of the streams. This should only be used for tailing inprogress streams!!!
[ "Get", "input", "stream", "from", "the", "given", "journal", "starting", "at", "txid", ".", "Does", "not", "perform", "validation", "of", "the", "streams", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JournalSet.java#L1004-L1026
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/io/ModbusRTUTransport.java
ModbusRTUTransport.readRequestData
private void readRequestData(int byteCount, BytesOutputStream out) throws IOException { byteCount += 2; byte inpBuf[] = new byte[byteCount]; readBytes(inpBuf, byteCount); out.write(inpBuf, 0, byteCount); }
java
private void readRequestData(int byteCount, BytesOutputStream out) throws IOException { byteCount += 2; byte inpBuf[] = new byte[byteCount]; readBytes(inpBuf, byteCount); out.write(inpBuf, 0, byteCount); }
[ "private", "void", "readRequestData", "(", "int", "byteCount", ",", "BytesOutputStream", "out", ")", "throws", "IOException", "{", "byteCount", "+=", "2", ";", "byte", "inpBuf", "[", "]", "=", "new", "byte", "[", "byteCount", "]", ";", "readBytes", "(", "i...
Read the data for a request of a given fixed size @param byteCount Byte count excluding the 2 byte CRC @param out Output buffer to populate @throws IOException If data cannot be read from the port
[ "Read", "the", "data", "for", "a", "request", "of", "a", "given", "fixed", "size" ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/io/ModbusRTUTransport.java#L56-L61
cdk/cdk
tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAtomTypeMatcher.java
MmffAtomTypeMatcher.assignHydrogenTypes
private void assignHydrogenTypes(IAtomContainer container, String[] symbs, int[][] graph) { for (int v = 0; v < graph.length; v++) { if (container.getAtom(v).getSymbol().equals("H") && graph[v].length == 1) { int w = graph[v][0]; symbs[v] = this.hydrogenMap.get(symbs[w]); } } }
java
private void assignHydrogenTypes(IAtomContainer container, String[] symbs, int[][] graph) { for (int v = 0; v < graph.length; v++) { if (container.getAtom(v).getSymbol().equals("H") && graph[v].length == 1) { int w = graph[v][0]; symbs[v] = this.hydrogenMap.get(symbs[w]); } } }
[ "private", "void", "assignHydrogenTypes", "(", "IAtomContainer", "container", ",", "String", "[", "]", "symbs", ",", "int", "[", "]", "[", "]", "graph", ")", "{", "for", "(", "int", "v", "=", "0", ";", "v", "<", "graph", ".", "length", ";", "v", "+...
Hydrogen types, assigned based on the MMFFHDEF.PAR parent associations. @param container input structure representation @param symbs symbolic atom types @param graph adjacency list graph
[ "Hydrogen", "types", "assigned", "based", "on", "the", "MMFFHDEF", ".", "PAR", "parent", "associations", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/forcefield/src/main/java/org/openscience/cdk/forcefield/mmff/MmffAtomTypeMatcher.java#L187-L194
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/storage/repository/FindOption.java
FindOption.get
public T get(@Nullable Map<FindOption<?>, ?> options) { if (options == null) { return defaultValue(); } @SuppressWarnings("unchecked") final T value = (T) options.get(this); if (value == null) { return defaultValue(); } return value; }
java
public T get(@Nullable Map<FindOption<?>, ?> options) { if (options == null) { return defaultValue(); } @SuppressWarnings("unchecked") final T value = (T) options.get(this); if (value == null) { return defaultValue(); } return value; }
[ "public", "T", "get", "(", "@", "Nullable", "Map", "<", "FindOption", "<", "?", ">", ",", "?", ">", "options", ")", "{", "if", "(", "options", "==", "null", ")", "{", "return", "defaultValue", "(", ")", ";", "}", "@", "SuppressWarnings", "(", "\"un...
Returns the value if this option exists in the specified {@code options} map. Otherwise, the default value would be returned.
[ "Returns", "the", "value", "if", "this", "option", "exists", "in", "the", "specified", "{" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/storage/repository/FindOption.java#L83-L95
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.transformEntry
public static boolean transformEntry(File zip, String path, ZipEntryTransformer transformer, File destZip) { if(zip.equals(destZip)){throw new IllegalArgumentException("Input (" +zip.getAbsolutePath()+ ") is the same as the destination!" + "Please use the transformEntry method without destination for in-place transformation." );} return transformEntry(zip, new ZipEntryTransformerEntry(path, transformer), destZip); }
java
public static boolean transformEntry(File zip, String path, ZipEntryTransformer transformer, File destZip) { if(zip.equals(destZip)){throw new IllegalArgumentException("Input (" +zip.getAbsolutePath()+ ") is the same as the destination!" + "Please use the transformEntry method without destination for in-place transformation." );} return transformEntry(zip, new ZipEntryTransformerEntry(path, transformer), destZip); }
[ "public", "static", "boolean", "transformEntry", "(", "File", "zip", ",", "String", "path", ",", "ZipEntryTransformer", "transformer", ",", "File", "destZip", ")", "{", "if", "(", "zip", ".", "equals", "(", "destZip", ")", ")", "{", "throw", "new", "Illega...
Copies an existing ZIP file and transforms a given entry in it. @param zip an existing ZIP file (only read). @param path new ZIP entry path. @param transformer transformer for the given ZIP entry. @param destZip new ZIP file created. @throws IllegalArgumentException if the destination is the same as the location @return <code>true</code> if the entry was replaced.
[ "Copies", "an", "existing", "ZIP", "file", "and", "transforms", "a", "given", "entry", "in", "it", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2777-L2781
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.getFlippedCopy
public Image getFlippedCopy(boolean flipHorizontal, boolean flipVertical) { init(); Image image = copy(); if (flipHorizontal) { image.textureOffsetX = textureOffsetX + textureWidth; image.textureWidth = -textureWidth; } if (flipVertical) { image.textureOffsetY = textureOffsetY + textureHeight; image.textureHeight = -textureHeight; } return image; }
java
public Image getFlippedCopy(boolean flipHorizontal, boolean flipVertical) { init(); Image image = copy(); if (flipHorizontal) { image.textureOffsetX = textureOffsetX + textureWidth; image.textureWidth = -textureWidth; } if (flipVertical) { image.textureOffsetY = textureOffsetY + textureHeight; image.textureHeight = -textureHeight; } return image; }
[ "public", "Image", "getFlippedCopy", "(", "boolean", "flipHorizontal", ",", "boolean", "flipVertical", ")", "{", "init", "(", ")", ";", "Image", "image", "=", "copy", "(", ")", ";", "if", "(", "flipHorizontal", ")", "{", "image", ".", "textureOffsetX", "="...
Get a copy image flipped on potentially two axis @param flipHorizontal True if we want to flip the image horizontally @param flipVertical True if we want to flip the image vertically @return The flipped image instance @see {{@link #getScaledCopy(int, int)} for caveats on scaled images
[ "Get", "a", "copy", "image", "flipped", "on", "potentially", "two", "axis" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L1270-L1284
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/PowerFormsApi.java
PowerFormsApi.listPowerFormSenders
public PowerFormSendersResponse listPowerFormSenders(String accountId, PowerFormsApi.ListPowerFormSendersOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listPowerFormSenders"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/powerforms/senders".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<PowerFormSendersResponse> localVarReturnType = new GenericType<PowerFormSendersResponse>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
java
public PowerFormSendersResponse listPowerFormSenders(String accountId, PowerFormsApi.ListPowerFormSendersOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listPowerFormSenders"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/powerforms/senders".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<PowerFormSendersResponse> localVarReturnType = new GenericType<PowerFormSendersResponse>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
[ "public", "PowerFormSendersResponse", "listPowerFormSenders", "(", "String", "accountId", ",", "PowerFormsApi", ".", "ListPowerFormSendersOptions", "options", ")", "throws", "ApiException", "{", "Object", "localVarPostBody", "=", "\"{}\"", ";", "// verify the required paramet...
Returns the list of PowerForms available to the user. @param accountId The external account number (int) or account ID Guid. (required) @param options for modifying the method behavior. @return PowerFormSendersResponse @throws ApiException if fails to make API call
[ "Returns", "the", "list", "of", "PowerForms", "available", "to", "the", "user", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/PowerFormsApi.java#L367-L403
antopen/alipay-sdk-java
src/main/java/com/alipay/api/internal/util/XmlUtils.java
XmlUtils.getRootElementFromString
public static Element getRootElementFromString(String payload) throws AlipayApiException { if (payload == null || payload.trim().length() < 1) { throw new AlipayApiException("XML_PAYLOAD_EMPTY"); } byte[] bytes = null; try { payload = StringUtils.stripNonValidXMLCharacters(payload); String encodeString = getEncoding(payload); bytes = payload.getBytes(encodeString); } catch (UnsupportedEncodingException e) { throw new AlipayApiException("XML_ENCODE_ERROR", e); } InputStream in = new ByteArrayInputStream(bytes); return getDocument(in).getDocumentElement(); }
java
public static Element getRootElementFromString(String payload) throws AlipayApiException { if (payload == null || payload.trim().length() < 1) { throw new AlipayApiException("XML_PAYLOAD_EMPTY"); } byte[] bytes = null; try { payload = StringUtils.stripNonValidXMLCharacters(payload); String encodeString = getEncoding(payload); bytes = payload.getBytes(encodeString); } catch (UnsupportedEncodingException e) { throw new AlipayApiException("XML_ENCODE_ERROR", e); } InputStream in = new ByteArrayInputStream(bytes); return getDocument(in).getDocumentElement(); }
[ "public", "static", "Element", "getRootElementFromString", "(", "String", "payload", ")", "throws", "AlipayApiException", "{", "if", "(", "payload", "==", "null", "||", "payload", ".", "trim", "(", ")", ".", "length", "(", ")", "<", "1", ")", "{", "throw",...
Gets the root element from the given XML payload. @param payload the XML payload representing the XML file. @return the root element of parsed document @throws ApiException problem parsing the XML payload
[ "Gets", "the", "root", "element", "from", "the", "given", "XML", "payload", "." ]
train
https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L198-L216
structurizr/java
structurizr-core/src/com/structurizr/documentation/Arc42DocumentationTemplate.java
Arc42DocumentationTemplate.addSolutionStrategySection
public Section addSolutionStrategySection(SoftwareSystem softwareSystem, File... files) throws IOException { return addSection(softwareSystem, "Solution Strategy", files); }
java
public Section addSolutionStrategySection(SoftwareSystem softwareSystem, File... files) throws IOException { return addSection(softwareSystem, "Solution Strategy", files); }
[ "public", "Section", "addSolutionStrategySection", "(", "SoftwareSystem", "softwareSystem", ",", "File", "...", "files", ")", "throws", "IOException", "{", "return", "addSection", "(", "softwareSystem", ",", "\"Solution Strategy\"", ",", "files", ")", ";", "}" ]
Adds a "Solution Strategy" section relating to a {@link SoftwareSystem} from one or more files. @param softwareSystem the {@link SoftwareSystem} the documentation content relates to @param files one or more File objects that point to the documentation content @return a documentation {@link Section} @throws IOException if there is an error reading the files
[ "Adds", "a", "Solution", "Strategy", "section", "relating", "to", "a", "{", "@link", "SoftwareSystem", "}", "from", "one", "or", "more", "files", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/Arc42DocumentationTemplate.java#L121-L123
knowm/Sundial
src/main/java/org/knowm/sundial/SundialJobScheduler.java
SundialJobScheduler.stopJob
public static void stopJob(String jobName) throws SundialSchedulerException { try { List<JobExecutionContext> currentlyExecutingJobs = getScheduler().getCurrentlyExecutingJobs(); for (JobExecutionContext jobExecutionContext : currentlyExecutingJobs) { String currentlyExecutingJobName = jobExecutionContext.getJobDetail().getName(); if (currentlyExecutingJobName.equals(jobName)) { logger.debug("Matching Job found. Now Stopping!"); if (jobExecutionContext.getJobInstance() instanceof Job) { ((Job) jobExecutionContext.getJobInstance()).interrupt(); } else { logger.warn("CANNOT STOP NON-INTERRUPTABLE JOB!!!"); } } else { logger.debug("Non-matching Job found. Not Stopping!"); } } } catch (SchedulerException e) { throw new SundialSchedulerException("ERROR STOPPING JOB!!!", e); } }
java
public static void stopJob(String jobName) throws SundialSchedulerException { try { List<JobExecutionContext> currentlyExecutingJobs = getScheduler().getCurrentlyExecutingJobs(); for (JobExecutionContext jobExecutionContext : currentlyExecutingJobs) { String currentlyExecutingJobName = jobExecutionContext.getJobDetail().getName(); if (currentlyExecutingJobName.equals(jobName)) { logger.debug("Matching Job found. Now Stopping!"); if (jobExecutionContext.getJobInstance() instanceof Job) { ((Job) jobExecutionContext.getJobInstance()).interrupt(); } else { logger.warn("CANNOT STOP NON-INTERRUPTABLE JOB!!!"); } } else { logger.debug("Non-matching Job found. Not Stopping!"); } } } catch (SchedulerException e) { throw new SundialSchedulerException("ERROR STOPPING JOB!!!", e); } }
[ "public", "static", "void", "stopJob", "(", "String", "jobName", ")", "throws", "SundialSchedulerException", "{", "try", "{", "List", "<", "JobExecutionContext", ">", "currentlyExecutingJobs", "=", "getScheduler", "(", ")", ".", "getCurrentlyExecutingJobs", "(", ")"...
Triggers a Job interrupt on all Jobs matching the given Job Name. The Job termination mechanism works by setting a flag that the Job should be terminated, but it is up to the logic in the Job to decide at what point termination should occur. Therefore, in any long-running job that you anticipate the need to terminate, put the method call checkTerminated() at an appropriate location. @param jobName The job name
[ "Triggers", "a", "Job", "interrupt", "on", "all", "Jobs", "matching", "the", "given", "Job", "Name", ".", "The", "Job", "termination", "mechanism", "works", "by", "setting", "a", "flag", "that", "the", "Job", "should", "be", "terminated", "but", "it", "is"...
train
https://github.com/knowm/Sundial/blob/0d61549fdfb8d6f884a1f2eed7e32ad39e2f4c62/src/main/java/org/knowm/sundial/SundialJobScheduler.java#L325-L345
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetFiltersInner.java
AssetFiltersInner.updateAsync
public Observable<AssetFilterInner> updateAsync(String resourceGroupName, String accountName, String assetName, String filterName, AssetFilterInner parameters) { return updateWithServiceResponseAsync(resourceGroupName, accountName, assetName, filterName, parameters).map(new Func1<ServiceResponse<AssetFilterInner>, AssetFilterInner>() { @Override public AssetFilterInner call(ServiceResponse<AssetFilterInner> response) { return response.body(); } }); }
java
public Observable<AssetFilterInner> updateAsync(String resourceGroupName, String accountName, String assetName, String filterName, AssetFilterInner parameters) { return updateWithServiceResponseAsync(resourceGroupName, accountName, assetName, filterName, parameters).map(new Func1<ServiceResponse<AssetFilterInner>, AssetFilterInner>() { @Override public AssetFilterInner call(ServiceResponse<AssetFilterInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AssetFilterInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "assetName", ",", "String", "filterName", ",", "AssetFilterInner", "parameters", ")", "{", "return", "updateWithServic...
Update an Asset Filter. Updates an existing Asset Filter associated with the specified Asset. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param assetName The Asset name. @param filterName The Asset Filter name @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AssetFilterInner object
[ "Update", "an", "Asset", "Filter", ".", "Updates", "an", "existing", "Asset", "Filter", "associated", "with", "the", "specified", "Asset", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/AssetFiltersInner.java#L596-L603
allure-framework/allure-java
allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java
AllureLifecycle.startFixture
private void startFixture(final String uuid, final FixtureResult result) { storage.put(uuid, result); result.setStage(Stage.RUNNING); result.setStart(System.currentTimeMillis()); threadContext.clear(); threadContext.start(uuid); }
java
private void startFixture(final String uuid, final FixtureResult result) { storage.put(uuid, result); result.setStage(Stage.RUNNING); result.setStart(System.currentTimeMillis()); threadContext.clear(); threadContext.start(uuid); }
[ "private", "void", "startFixture", "(", "final", "String", "uuid", ",", "final", "FixtureResult", "result", ")", "{", "storage", ".", "put", "(", "uuid", ",", "result", ")", ";", "result", ".", "setStage", "(", "Stage", ".", "RUNNING", ")", ";", "result"...
Start a new fixture with given uuid. @param uuid the uuid of fixture. @param result the test fixture.
[ "Start", "a", "new", "fixture", "with", "given", "uuid", "." ]
train
https://github.com/allure-framework/allure-java/blob/64015ca2b789aa6f7b19c793f1512e2f11d0174e/allure-java-commons/src/main/java/io/qameta/allure/AllureLifecycle.java#L219-L225
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java
ProfileSummaryBuilder.getInstance
public static ProfileSummaryBuilder getInstance(Context context, Profile profile, ProfileSummaryWriter profileWriter) { return new ProfileSummaryBuilder(context, profile, profileWriter); }
java
public static ProfileSummaryBuilder getInstance(Context context, Profile profile, ProfileSummaryWriter profileWriter) { return new ProfileSummaryBuilder(context, profile, profileWriter); }
[ "public", "static", "ProfileSummaryBuilder", "getInstance", "(", "Context", "context", ",", "Profile", "profile", ",", "ProfileSummaryWriter", "profileWriter", ")", "{", "return", "new", "ProfileSummaryBuilder", "(", "context", ",", "profile", ",", "profileWriter", ")...
Construct a new ProfileSummaryBuilder. @param context the build context. @param profile the profile being documented. @param profileWriter the doclet specific writer that will output the result. @return an instance of a ProfileSummaryBuilder.
[ "Construct", "a", "new", "ProfileSummaryBuilder", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java#L96-L99
google/closure-templates
java/src/com/google/template/soy/base/internal/BaseUtils.java
BaseUtils.trimStackTraceTo
public static void trimStackTraceTo(Throwable t, Class<?> cls) { StackTraceElement[] ste = t.getStackTrace(); String name = cls.getName(); for (int i = 0; i < ste.length; i++) { if (ste[i].getClassName().equals(name)) { t.setStackTrace(Arrays.copyOf(ste, i)); return; } } }
java
public static void trimStackTraceTo(Throwable t, Class<?> cls) { StackTraceElement[] ste = t.getStackTrace(); String name = cls.getName(); for (int i = 0; i < ste.length; i++) { if (ste[i].getClassName().equals(name)) { t.setStackTrace(Arrays.copyOf(ste, i)); return; } } }
[ "public", "static", "void", "trimStackTraceTo", "(", "Throwable", "t", ",", "Class", "<", "?", ">", "cls", ")", "{", "StackTraceElement", "[", "]", "ste", "=", "t", ".", "getStackTrace", "(", ")", ";", "String", "name", "=", "cls", ".", "getName", "(",...
Trims the stack trace of the throwable such that the top item points at {@code cls}.
[ "Trims", "the", "stack", "trace", "of", "the", "throwable", "such", "that", "the", "top", "item", "points", "at", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/base/internal/BaseUtils.java#L275-L284
Nordstrom/JUnit-Foundation
src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java
LifecycleHooks.describeChild
public static Description describeChild(Object target, Object child) { Object runner = getRunnerForTarget(target); return invoke(runner, "describeChild", child); }
java
public static Description describeChild(Object target, Object child) { Object runner = getRunnerForTarget(target); return invoke(runner, "describeChild", child); }
[ "public", "static", "Description", "describeChild", "(", "Object", "target", ",", "Object", "child", ")", "{", "Object", "runner", "=", "getRunnerForTarget", "(", "target", ")", ";", "return", "invoke", "(", "runner", ",", "\"describeChild\"", ",", "child", ")...
Get the description of the indicated child object from the runner for the specified test class instance. @param target test class instance @param child child object @return {@link Description} object for the indicated child
[ "Get", "the", "description", "of", "the", "indicated", "child", "object", "from", "the", "runner", "for", "the", "specified", "test", "class", "instance", "." ]
train
https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java#L208-L211
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/schemamanager/MongoDBSchemaManager.java
MongoDBSchemaManager.initiateClient
protected boolean initiateClient() { for (String host : hosts) { if (host == null || !StringUtils.isNumeric(port) || port.isEmpty()) { logger.error("Host or port should not be null / port should be numeric"); throw new IllegalArgumentException("Host or port should not be null / port should be numeric"); } List<MongoCredential> credentials = MongoDBUtils.fetchCredentials(puMetadata.getProperties(), externalProperties); ServerAddress addr; try { addr = new ServerAddress(host, Integer.parseInt(port)); } catch (NumberFormatException ex) { throw new SchemaGenerationException(ex); } mongo = new MongoClient(addr, credentials); db = mongo.getDB(databaseName); return true; } return false; }
java
protected boolean initiateClient() { for (String host : hosts) { if (host == null || !StringUtils.isNumeric(port) || port.isEmpty()) { logger.error("Host or port should not be null / port should be numeric"); throw new IllegalArgumentException("Host or port should not be null / port should be numeric"); } List<MongoCredential> credentials = MongoDBUtils.fetchCredentials(puMetadata.getProperties(), externalProperties); ServerAddress addr; try { addr = new ServerAddress(host, Integer.parseInt(port)); } catch (NumberFormatException ex) { throw new SchemaGenerationException(ex); } mongo = new MongoClient(addr, credentials); db = mongo.getDB(databaseName); return true; } return false; }
[ "protected", "boolean", "initiateClient", "(", ")", "{", "for", "(", "String", "host", ":", "hosts", ")", "{", "if", "(", "host", "==", "null", "||", "!", "StringUtils", ".", "isNumeric", "(", "port", ")", "||", "port", ".", "isEmpty", "(", ")", ")",...
initiate client method initiates the client. @return boolean value ie client started or not.
[ "initiate", "client", "method", "initiates", "the", "client", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/schemamanager/MongoDBSchemaManager.java#L303-L330
ronmamo/reflections
src/main/java/org/reflections/Store.java
Store.getAll
public Iterable<String> getAll(String index, String key) { return getAllIncluding(index, get(index, key), new IterableChain<String>()); }
java
public Iterable<String> getAll(String index, String key) { return getAllIncluding(index, get(index, key), new IterableChain<String>()); }
[ "public", "Iterable", "<", "String", ">", "getAll", "(", "String", "index", ",", "String", "key", ")", "{", "return", "getAllIncluding", "(", "index", ",", "get", "(", "index", ",", "key", ")", ",", "new", "IterableChain", "<", "String", ">", "(", ")",...
recursively get the values stored for the given {@code index} and {@code keys}, not including keys
[ "recursively", "get", "the", "values", "stored", "for", "the", "given", "{" ]
train
https://github.com/ronmamo/reflections/blob/084cf4a759a06d88e88753ac00397478c2e0ed52/src/main/java/org/reflections/Store.java#L91-L93
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java
SparkUtils.writeObjectToFile
public static void writeObjectToFile(String path, Object toWrite, JavaSparkContext sc) throws IOException { writeObjectToFile(path, toWrite, sc.sc()); }
java
public static void writeObjectToFile(String path, Object toWrite, JavaSparkContext sc) throws IOException { writeObjectToFile(path, toWrite, sc.sc()); }
[ "public", "static", "void", "writeObjectToFile", "(", "String", "path", ",", "Object", "toWrite", ",", "JavaSparkContext", "sc", ")", "throws", "IOException", "{", "writeObjectToFile", "(", "path", ",", "toWrite", ",", "sc", ".", "sc", "(", ")", ")", ";", ...
Write an object to HDFS (or local) using default Java object serialization @param path Path to write the object to @param toWrite Object to write @param sc Spark context
[ "Write", "an", "object", "to", "HDFS", "(", "or", "local", ")", "using", "default", "Java", "object", "serialization" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java#L144-L146
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/route/RouteClient.java
RouteClient.getRoute
public GetRouteResponse getRoute(String routeTableId, String vpcId) { GetRouteRequest request = new GetRouteRequest(); if (Strings.isNullOrEmpty(vpcId) && Strings.isNullOrEmpty(routeTableId)) { throw new IllegalArgumentException("routeTableId and vpcId should not be empty at the same time"); } else if (!Strings.isNullOrEmpty(routeTableId)) { request.withRouteTableId(routeTableId); } else if (!Strings.isNullOrEmpty(vpcId)) { request.withVpcId(vpcId); } return getRoutes(request); }
java
public GetRouteResponse getRoute(String routeTableId, String vpcId) { GetRouteRequest request = new GetRouteRequest(); if (Strings.isNullOrEmpty(vpcId) && Strings.isNullOrEmpty(routeTableId)) { throw new IllegalArgumentException("routeTableId and vpcId should not be empty at the same time"); } else if (!Strings.isNullOrEmpty(routeTableId)) { request.withRouteTableId(routeTableId); } else if (!Strings.isNullOrEmpty(vpcId)) { request.withVpcId(vpcId); } return getRoutes(request); }
[ "public", "GetRouteResponse", "getRoute", "(", "String", "routeTableId", ",", "String", "vpcId", ")", "{", "GetRouteRequest", "request", "=", "new", "GetRouteRequest", "(", ")", ";", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "vpcId", ")", "&&", "Strings...
Get the detail information of route table for specific route table or/and vpc @param routeTableId id of route table, routeTableId and vpcId cannot be empty at the same time @param vpcId vpcId, routeTableId and vpcId cannot be empty at the same time @return A route table detail model for the specific route table or/and vpc
[ "Get", "the", "detail", "information", "of", "route", "table", "for", "specific", "route", "table", "or", "/", "and", "vpc" ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/route/RouteClient.java#L176-L188
cloudendpoints/endpoints-management-java
endpoints-control/src/main/java/com/google/api/control/model/PathTemplate.java
PathTemplate.validate
public void validate(String path, String exceptionMessagePrefix) { if (!matches(path)) { throw new ValidationException( String.format( "%s: Parameter \"%s\" must be in the form \"%s\"", exceptionMessagePrefix, path, this.toString())); } }
java
public void validate(String path, String exceptionMessagePrefix) { if (!matches(path)) { throw new ValidationException( String.format( "%s: Parameter \"%s\" must be in the form \"%s\"", exceptionMessagePrefix, path, this.toString())); } }
[ "public", "void", "validate", "(", "String", "path", ",", "String", "exceptionMessagePrefix", ")", "{", "if", "(", "!", "matches", "(", "path", ")", ")", "{", "throw", "new", "ValidationException", "(", "String", ".", "format", "(", "\"%s: Parameter \\\"%s\\\"...
Throws a ValidationException if the template doesn't match the path. The exceptionMessagePrefix parameter will be prepended to the ValidationException message.
[ "Throws", "a", "ValidationException", "if", "the", "template", "doesn", "t", "match", "the", "path", ".", "The", "exceptionMessagePrefix", "parameter", "will", "be", "prepended", "to", "the", "ValidationException", "message", "." ]
train
https://github.com/cloudendpoints/endpoints-management-java/blob/5bbf20ddadbbd51b890049e3c338c28abe2c9f94/endpoints-control/src/main/java/com/google/api/control/model/PathTemplate.java#L375-L382
lightblue-platform/lightblue-migrator
migrator/src/main/java/com/redhat/lightblue/migrator/ConsistencyCheckerController.java
ConsistencyCheckerController.getEndDate
public Date getEndDate(Date startDate, long period) { long now = getNow().getTime(); long endDate = startDate.getTime() + period; if (now - period > endDate) { return new Date(endDate); } else { return null; } }
java
public Date getEndDate(Date startDate, long period) { long now = getNow().getTime(); long endDate = startDate.getTime() + period; if (now - period > endDate) { return new Date(endDate); } else { return null; } }
[ "public", "Date", "getEndDate", "(", "Date", "startDate", ",", "long", "period", ")", "{", "long", "now", "=", "getNow", "(", ")", ".", "getTime", "(", ")", ";", "long", "endDate", "=", "startDate", ".", "getTime", "(", ")", "+", "period", ";", "if",...
Returns the end date given the start date end the period. The end date is startDate+period, but only if endDate is at least one period ago. That is, we always leave the last incomplete period unprocessed. Override this to control the job generation algorithm
[ "Returns", "the", "end", "date", "given", "the", "start", "date", "end", "the", "period", ".", "The", "end", "date", "is", "startDate", "+", "period", "but", "only", "if", "endDate", "is", "at", "least", "one", "period", "ago", ".", "That", "is", "we",...
train
https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/migrator/src/main/java/com/redhat/lightblue/migrator/ConsistencyCheckerController.java#L68-L76
xm-online/xm-commons
xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/inspector/kafka/PrivilegeEventProducer.java
PrivilegeEventProducer.sendEvent
@Deprecated public void sendEvent(String eventId, String ymlPrivileges) { SystemEvent event = buildSystemEvent(eventId, ymlPrivileges); serializeEvent(event).ifPresent(this::send); }
java
@Deprecated public void sendEvent(String eventId, String ymlPrivileges) { SystemEvent event = buildSystemEvent(eventId, ymlPrivileges); serializeEvent(event).ifPresent(this::send); }
[ "@", "Deprecated", "public", "void", "sendEvent", "(", "String", "eventId", ",", "String", "ymlPrivileges", ")", "{", "SystemEvent", "event", "=", "buildSystemEvent", "(", "eventId", ",", "ymlPrivileges", ")", ";", "serializeEvent", "(", "event", ")", ".", "if...
Build message for kafka's event and send it. @param eventId the event id @param ymlPrivileges the content @deprecated left only for backward compatibility, use {@link #sendEvent(String, Set)}
[ "Build", "message", "for", "kafka", "s", "event", "and", "send", "it", "." ]
train
https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-permission/src/main/java/com/icthh/xm/commons/permission/inspector/kafka/PrivilegeEventProducer.java#L48-L52
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/corpus/spi/ColumnBasedFormat.java
ColumnBasedFormat.createDocument
final Document createDocument(List<String> row, DocumentFactory documentFactory) { String id = StringUtils.EMPTY; String content = StringUtils.EMPTY; Language language = documentFactory.getDefaultLanguage(); Map<AttributeType, Object> attributeMap = new HashMap<>(); String idField = Config.get(configProperty, "idField").asString("ID").toUpperCase(); String contentField = Config.get(configProperty, "contentField").asString("CONTENT").toUpperCase(); String languageField = Config.get(configProperty, "languageField").asString("LANGUAGE").toUpperCase(); Index<String> fields = getFieldNames(); for (int i = 0; i < row.size() && i < fieldNames.size(); i++) { String field = row.get(i); String fieldName = fields.get(i); if (idField.equalsIgnoreCase(fieldName)) { id = field; } else if (contentField.equalsIgnoreCase(fieldName)) { content = field; } else if (languageField.equalsIgnoreCase(fieldName)) { language = Language.fromString(field); } else { AttributeType attributeType = AttributeType.create(fieldName); attributeMap.put(attributeType, attributeType.getValueType().decode(field)); } } return documentFactory.create(id, content, language, attributeMap); }
java
final Document createDocument(List<String> row, DocumentFactory documentFactory) { String id = StringUtils.EMPTY; String content = StringUtils.EMPTY; Language language = documentFactory.getDefaultLanguage(); Map<AttributeType, Object> attributeMap = new HashMap<>(); String idField = Config.get(configProperty, "idField").asString("ID").toUpperCase(); String contentField = Config.get(configProperty, "contentField").asString("CONTENT").toUpperCase(); String languageField = Config.get(configProperty, "languageField").asString("LANGUAGE").toUpperCase(); Index<String> fields = getFieldNames(); for (int i = 0; i < row.size() && i < fieldNames.size(); i++) { String field = row.get(i); String fieldName = fields.get(i); if (idField.equalsIgnoreCase(fieldName)) { id = field; } else if (contentField.equalsIgnoreCase(fieldName)) { content = field; } else if (languageField.equalsIgnoreCase(fieldName)) { language = Language.fromString(field); } else { AttributeType attributeType = AttributeType.create(fieldName); attributeMap.put(attributeType, attributeType.getValueType().decode(field)); } } return documentFactory.create(id, content, language, attributeMap); }
[ "final", "Document", "createDocument", "(", "List", "<", "String", ">", "row", ",", "DocumentFactory", "documentFactory", ")", "{", "String", "id", "=", "StringUtils", ".", "EMPTY", ";", "String", "content", "=", "StringUtils", ".", "EMPTY", ";", "Language", ...
Create document document. @param row the row @param documentFactory the document factory @return the document
[ "Create", "document", "document", "." ]
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/corpus/spi/ColumnBasedFormat.java#L65-L91
palatable/lambda
src/main/java/com/jnape/palatable/lambda/adt/Either.java
Either.flatMap
@Override @SuppressWarnings("RedundantTypeArguments") public <R2> Either<L, R2> flatMap(Function<? super R, ? extends Monad<R2, Either<L, ?>>> rightFn) { return match(Either::left, rightFn.andThen(Monad<R2, Either<L, ?>>::coerce)); }
java
@Override @SuppressWarnings("RedundantTypeArguments") public <R2> Either<L, R2> flatMap(Function<? super R, ? extends Monad<R2, Either<L, ?>>> rightFn) { return match(Either::left, rightFn.andThen(Monad<R2, Either<L, ?>>::coerce)); }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"RedundantTypeArguments\"", ")", "public", "<", "R2", ">", "Either", "<", "L", ",", "R2", ">", "flatMap", "(", "Function", "<", "?", "super", "R", ",", "?", "extends", "Monad", "<", "R2", ",", "Either", ...
If a right value, unwrap it and apply it to <code>rightFn</code>, returning the resulting <code>Either&lt;L ,R&gt;</code>. Otherwise, return the left value. <p> Note that because this monadic form of <code>flatMap</code> only supports mapping over a theoretical right value, the resulting <code>Either</code> must be invariant on the same left value to flatten properly. @param rightFn the function to apply to a right value @param <R2> the new right parameter type @return the Either resulting from applying rightFn to this right value, or this left value if left
[ "If", "a", "right", "value", "unwrap", "it", "and", "apply", "it", "to", "<code", ">", "rightFn<", "/", "code", ">", "returning", "the", "resulting", "<code", ">", "Either&lt", ";", "L", "R&gt", ";", "<", "/", "code", ">", ".", "Otherwise", "return", ...
train
https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/adt/Either.java#L131-L135
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java
StyleSet.setBackgroundColor
public StyleSet setBackgroundColor(IndexedColors backgroundColor, boolean withHeadCell) { if (withHeadCell) { StyleUtil.setColor(this.headCellStyle, backgroundColor, FillPatternType.SOLID_FOREGROUND); } StyleUtil.setColor(this.cellStyle, backgroundColor, FillPatternType.SOLID_FOREGROUND); StyleUtil.setColor(this.cellStyleForNumber, backgroundColor, FillPatternType.SOLID_FOREGROUND); StyleUtil.setColor(this.cellStyleForDate, backgroundColor, FillPatternType.SOLID_FOREGROUND); return this; }
java
public StyleSet setBackgroundColor(IndexedColors backgroundColor, boolean withHeadCell) { if (withHeadCell) { StyleUtil.setColor(this.headCellStyle, backgroundColor, FillPatternType.SOLID_FOREGROUND); } StyleUtil.setColor(this.cellStyle, backgroundColor, FillPatternType.SOLID_FOREGROUND); StyleUtil.setColor(this.cellStyleForNumber, backgroundColor, FillPatternType.SOLID_FOREGROUND); StyleUtil.setColor(this.cellStyleForDate, backgroundColor, FillPatternType.SOLID_FOREGROUND); return this; }
[ "public", "StyleSet", "setBackgroundColor", "(", "IndexedColors", "backgroundColor", ",", "boolean", "withHeadCell", ")", "{", "if", "(", "withHeadCell", ")", "{", "StyleUtil", ".", "setColor", "(", "this", ".", "headCellStyle", ",", "backgroundColor", ",", "FillP...
设置单元格背景样式 @param backgroundColor 背景色 @param withHeadCell 是否也定义头部样式 @return this @since 4.0.0
[ "设置单元格背景样式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/StyleSet.java#L130-L138
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.mergeReleased
private void mergeReleased(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { for (int i = 0; i < segments.size(); i++) { mergeReleasedEntries(segments.get(i), predicates.get(i), compactSegment); } }
java
private void mergeReleased(List<Segment> segments, List<OffsetPredicate> predicates, Segment compactSegment) { for (int i = 0; i < segments.size(); i++) { mergeReleasedEntries(segments.get(i), predicates.get(i), compactSegment); } }
[ "private", "void", "mergeReleased", "(", "List", "<", "Segment", ">", "segments", ",", "List", "<", "OffsetPredicate", ">", "predicates", ",", "Segment", "compactSegment", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "segments", ".", "size"...
Updates the new compact segment with entries that were released during compaction.
[ "Updates", "the", "new", "compact", "segment", "with", "entries", "that", "were", "released", "during", "compaction", "." ]
train
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L297-L301
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/pipes/Submitter.java
Submitter.setIfUnset
private static void setIfUnset(JobConf conf, String key, String value) { if (conf.get(key) == null) { conf.set(key, value); } }
java
private static void setIfUnset(JobConf conf, String key, String value) { if (conf.get(key) == null) { conf.set(key, value); } }
[ "private", "static", "void", "setIfUnset", "(", "JobConf", "conf", ",", "String", "key", ",", "String", "value", ")", "{", "if", "(", "conf", ".", "get", "(", "key", ")", "==", "null", ")", "{", "conf", ".", "set", "(", "key", ",", "value", ")", ...
Set the configuration, if it doesn't already have a value for the given key. @param conf the configuration to modify @param key the key to set @param value the new "default" value to set
[ "Set", "the", "configuration", "if", "it", "doesn", "t", "already", "have", "a", "value", "for", "the", "given", "key", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/pipes/Submitter.java#L177-L181
GCRC/nunaliit
nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java
SubmissionUtils.getApprovedDocumentFromSubmission
static public JSONObject getApprovedDocumentFromSubmission(JSONObject submissionDoc) throws Exception { JSONObject submissionInfo = submissionDoc.getJSONObject("nunaliit_submission"); // Check if an approved version of the document is available JSONObject doc = submissionInfo.optJSONObject("approved_doc"); if( null != doc ) { JSONObject reserved = submissionInfo.optJSONObject("approved_reserved"); return recreateDocumentFromDocAndReserved(doc, reserved); } else { // Use submission doc = submissionInfo.getJSONObject("submitted_doc"); JSONObject reserved = submissionInfo.optJSONObject("submitted_reserved"); return recreateDocumentFromDocAndReserved(doc, reserved); } }
java
static public JSONObject getApprovedDocumentFromSubmission(JSONObject submissionDoc) throws Exception { JSONObject submissionInfo = submissionDoc.getJSONObject("nunaliit_submission"); // Check if an approved version of the document is available JSONObject doc = submissionInfo.optJSONObject("approved_doc"); if( null != doc ) { JSONObject reserved = submissionInfo.optJSONObject("approved_reserved"); return recreateDocumentFromDocAndReserved(doc, reserved); } else { // Use submission doc = submissionInfo.getJSONObject("submitted_doc"); JSONObject reserved = submissionInfo.optJSONObject("submitted_reserved"); return recreateDocumentFromDocAndReserved(doc, reserved); } }
[ "static", "public", "JSONObject", "getApprovedDocumentFromSubmission", "(", "JSONObject", "submissionDoc", ")", "throws", "Exception", "{", "JSONObject", "submissionInfo", "=", "submissionDoc", ".", "getJSONObject", "(", "\"nunaliit_submission\"", ")", ";", "// Check if an ...
Re-creates the approved document submitted by the client from the submission document. @param submissionDoc Submission document from the submission database @return Document submitted by user for update
[ "Re", "-", "creates", "the", "approved", "document", "submitted", "by", "the", "client", "from", "the", "submission", "document", "." ]
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-couch-utils/src/main/java/ca/carleton/gcrc/couch/utils/SubmissionUtils.java#L75-L89
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoMessageBuilder.java
OmemoMessageBuilder.addRecipient
public void addRecipient(OmemoDevice contactsDevice) throws NoIdentityKeyException, CorruptedOmemoKeyException, UndecidedOmemoIdentityException, UntrustedOmemoIdentityException { OmemoFingerprint fingerprint; fingerprint = OmemoService.getInstance().getOmemoStoreBackend().getFingerprint(userDevice, contactsDevice); switch (trustCallback.getTrust(contactsDevice, fingerprint)) { case undecided: throw new UndecidedOmemoIdentityException(contactsDevice); case trusted: CiphertextTuple encryptedKey = ratchet.doubleRatchetEncrypt(contactsDevice, messageKey); keys.add(new OmemoKeyElement(encryptedKey.getCiphertext(), contactsDevice.getDeviceId(), encryptedKey.isPreKeyMessage())); break; case untrusted: throw new UntrustedOmemoIdentityException(contactsDevice, fingerprint); } }
java
public void addRecipient(OmemoDevice contactsDevice) throws NoIdentityKeyException, CorruptedOmemoKeyException, UndecidedOmemoIdentityException, UntrustedOmemoIdentityException { OmemoFingerprint fingerprint; fingerprint = OmemoService.getInstance().getOmemoStoreBackend().getFingerprint(userDevice, contactsDevice); switch (trustCallback.getTrust(contactsDevice, fingerprint)) { case undecided: throw new UndecidedOmemoIdentityException(contactsDevice); case trusted: CiphertextTuple encryptedKey = ratchet.doubleRatchetEncrypt(contactsDevice, messageKey); keys.add(new OmemoKeyElement(encryptedKey.getCiphertext(), contactsDevice.getDeviceId(), encryptedKey.isPreKeyMessage())); break; case untrusted: throw new UntrustedOmemoIdentityException(contactsDevice, fingerprint); } }
[ "public", "void", "addRecipient", "(", "OmemoDevice", "contactsDevice", ")", "throws", "NoIdentityKeyException", ",", "CorruptedOmemoKeyException", ",", "UndecidedOmemoIdentityException", ",", "UntrustedOmemoIdentityException", "{", "OmemoFingerprint", "fingerprint", ";", "fing...
Add a new recipient device to the message. @param contactsDevice device of the recipient @throws NoIdentityKeyException if we have no identityKey of that device. Can be fixed by fetching and processing the devices bundle. @throws CorruptedOmemoKeyException if the identityKey of that device is corrupted. @throws UndecidedOmemoIdentityException if the user hasn't yet decided whether to trust that device or not. @throws UntrustedOmemoIdentityException if the user has decided not to trust that device.
[ "Add", "a", "new", "recipient", "device", "to", "the", "message", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/util/OmemoMessageBuilder.java#L222-L243
Wikidata/Wikidata-Toolkit
wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/values/TimeValueConverter.java
TimeValueConverter.getTimeLiteral
private static Literal getTimeLiteral(TimeValue value, RdfWriter rdfWriter) { long year = value.getYear(); //Year normalization if (year == 0 || (year < 0 && value.getPrecision() >= TimeValue.PREC_YEAR)) { year--; } String timestamp = String.format("%04d-%02d-%02dT%02d:%02d:%02dZ", year, value.getMonth(), value.getDay(), value.getHour(), value.getMinute(), value.getSecond()); return rdfWriter.getLiteral(timestamp, RdfWriter.XSD_DATETIME); }
java
private static Literal getTimeLiteral(TimeValue value, RdfWriter rdfWriter) { long year = value.getYear(); //Year normalization if (year == 0 || (year < 0 && value.getPrecision() >= TimeValue.PREC_YEAR)) { year--; } String timestamp = String.format("%04d-%02d-%02dT%02d:%02d:%02dZ", year, value.getMonth(), value.getDay(), value.getHour(), value.getMinute(), value.getSecond()); return rdfWriter.getLiteral(timestamp, RdfWriter.XSD_DATETIME); }
[ "private", "static", "Literal", "getTimeLiteral", "(", "TimeValue", "value", ",", "RdfWriter", "rdfWriter", ")", "{", "long", "year", "=", "value", ".", "getYear", "(", ")", ";", "//Year normalization", "if", "(", "year", "==", "0", "||", "(", "year", "<",...
Returns the RDF literal to encode the time component of a given time value. <p> Times with limited precision are encoded using limited-precision XML Schema datatypes, such as gYear, if available. Wikidata encodes the year 1BCE as 0000, while XML Schema, even in version 2, does not allow 0000 and interprets -0001 as 1BCE. Thus all negative years must be shifted by 1, but we only do this if the year is precise. @param value the value to convert @param rdfWriter the object to use for creating the literal @return the RDF literal
[ "Returns", "the", "RDF", "literal", "to", "encode", "the", "time", "component", "of", "a", "given", "time", "value", ".", "<p", ">", "Times", "with", "limited", "precision", "are", "encoded", "using", "limited", "-", "precision", "XML", "Schema", "datatypes"...
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-rdf/src/main/java/org/wikidata/wdtk/rdf/values/TimeValueConverter.java#L113-L125
landawn/AbacusUtil
src/com/landawn/abacus/util/DateUtil.java
DateUtil.setDays
public static <T extends java.util.Date> T setDays(final T date, final int amount) { return set(date, Calendar.DAY_OF_MONTH, amount); }
java
public static <T extends java.util.Date> T setDays(final T date, final int amount) { return set(date, Calendar.DAY_OF_MONTH, amount); }
[ "public", "static", "<", "T", "extends", "java", ".", "util", ".", "Date", ">", "T", "setDays", "(", "final", "T", "date", ",", "final", "int", "amount", ")", "{", "return", "set", "(", "date", ",", "Calendar", ".", "DAY_OF_MONTH", ",", "amount", ")"...
Copied from Apache Commons Lang under Apache License v2. <br /> Sets the day of month field to a date returning a new object. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to set @return a new {@code Date} set with the specified value @throws IllegalArgumentException if the date is null @since 2.4
[ "Copied", "from", "Apache", "Commons", "Lang", "under", "Apache", "License", "v2", ".", "<br", "/", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/DateUtil.java#L732-L734
jpaoletti/java-presentation-manager
modules/jpm-core/src/main/java/jpaoletti/jpm/validator/ValidatorSupport.java
ValidatorSupport.get
public String get (String name, String def) { if (properties != null) { Object obj = properties.get (name); if (obj instanceof String) return obj.toString(); } return def; }
java
public String get (String name, String def) { if (properties != null) { Object obj = properties.get (name); if (obj instanceof String) return obj.toString(); } return def; }
[ "public", "String", "get", "(", "String", "name", ",", "String", "def", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "Object", "obj", "=", "properties", ".", "get", "(", "name", ")", ";", "if", "(", "obj", "instanceof", "String", ")", ...
Helper for a property @param name Property name @param def Default value @return Property value
[ "Helper", "for", "a", "property" ]
train
https://github.com/jpaoletti/java-presentation-manager/blob/d5aab55638383695db244744b4bfe27c5200e04f/modules/jpm-core/src/main/java/jpaoletti/jpm/validator/ValidatorSupport.java#L30-L37
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Single.java
Single.fromObservable
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> fromObservable(ObservableSource<? extends T> observableSource) { ObjectHelper.requireNonNull(observableSource, "observableSource is null"); return RxJavaPlugins.onAssembly(new ObservableSingleSingle<T>(observableSource, null)); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.NONE) public static <T> Single<T> fromObservable(ObservableSource<? extends T> observableSource) { ObjectHelper.requireNonNull(observableSource, "observableSource is null"); return RxJavaPlugins.onAssembly(new ObservableSingleSingle<T>(observableSource, null)); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "static", "<", "T", ">", "Single", "<", "T", ">", "fromObservable", "(", "ObservableSource", "<", "?", "extends", "T", ">", "observableSource", ")", "{", "...
Wraps a specific ObservableSource into a Single and signals its single element or error. <p>If the ObservableSource is empty, a NoSuchElementException is signalled. If the source has more than one element, an IndexOutOfBoundsException is signalled. <p> <img width="640" height="343" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Single.fromObservable.png" alt=""> <dl> <dt><b>Scheduler:</b></dt> <dd>{@code fromObservable} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param observableSource the source Observable, not null @param <T> the type of the item emitted by the {@link Single}. @return the new Single instance
[ "Wraps", "a", "specific", "ObservableSource", "into", "a", "Single", "and", "signals", "its", "single", "element", "or", "error", ".", "<p", ">", "If", "the", "ObservableSource", "is", "empty", "a", "NoSuchElementException", "is", "signalled", ".", "If", "the"...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Single.java#L788-L793
prestodb/presto
presto-spi/src/main/java/com/facebook/presto/spi/block/BlockUtil.java
BlockUtil.compactSlice
static Slice compactSlice(Slice slice, int index, int length) { if (slice.isCompact() && index == 0 && length == slice.length()) { return slice; } return Slices.copyOf(slice, index, length); }
java
static Slice compactSlice(Slice slice, int index, int length) { if (slice.isCompact() && index == 0 && length == slice.length()) { return slice; } return Slices.copyOf(slice, index, length); }
[ "static", "Slice", "compactSlice", "(", "Slice", "slice", ",", "int", "index", ",", "int", "length", ")", "{", "if", "(", "slice", ".", "isCompact", "(", ")", "&&", "index", "==", "0", "&&", "length", "==", "slice", ".", "length", "(", ")", ")", "{...
Returns a slice containing values in the specified range of the specified slice. If the range matches the entire slice, the input slice will be returned. Otherwise, a copy will be returned.
[ "Returns", "a", "slice", "containing", "values", "in", "the", "specified", "range", "of", "the", "specified", "slice", ".", "If", "the", "range", "matches", "the", "entire", "slice", "the", "input", "slice", "will", "be", "returned", ".", "Otherwise", "a", ...
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-spi/src/main/java/com/facebook/presto/spi/block/BlockUtil.java#L131-L137
alkacon/opencms-core
src/org/opencms/ui/apps/dbmanager/CmsResourceTypeStatResultList.java
CmsResourceTypeStatResultList.setVerticalLayout
public void setVerticalLayout(VerticalLayout layout, boolean addAll) { if (m_results.size() > 0) { if (addAll) { for (CmsResourceTypeStatResult result : m_results) { layout.addComponent(getLayoutFromResult(result), 0); } } else { CmsResourceTypeStatResult statResult = m_results.get(m_results.size() - 1); if (m_updated) { removeRow(layout, statResult); } layout.addComponent(getLayoutFromResult(statResult), 0); } } }
java
public void setVerticalLayout(VerticalLayout layout, boolean addAll) { if (m_results.size() > 0) { if (addAll) { for (CmsResourceTypeStatResult result : m_results) { layout.addComponent(getLayoutFromResult(result), 0); } } else { CmsResourceTypeStatResult statResult = m_results.get(m_results.size() - 1); if (m_updated) { removeRow(layout, statResult); } layout.addComponent(getLayoutFromResult(statResult), 0); } } }
[ "public", "void", "setVerticalLayout", "(", "VerticalLayout", "layout", ",", "boolean", "addAll", ")", "{", "if", "(", "m_results", ".", "size", "(", ")", ">", "0", ")", "{", "if", "(", "addAll", ")", "{", "for", "(", "CmsResourceTypeStatResult", "result",...
Sets the layout.<p> @param layout to display the result in @param addAll indicates if the whole list should be added or just the last item
[ "Sets", "the", "layout", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/dbmanager/CmsResourceTypeStatResultList.java#L132-L148