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
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformPreview.java
WaveformPreview.segmentHeight
@SuppressWarnings("WeakerAccess") public int segmentHeight(final int segment, final boolean front) { final ByteBuffer bytes = getData(); if (isColor) { final int base = segment * 6; final int frontHeight = Util.unsign(bytes.get(base + 5)); if (front) { return frontHeight; } else { return Math.max(frontHeight, Math.max(Util.unsign(bytes.get(base + 3)), Util.unsign(bytes.get(base + 4)))); } } else { return getData().get(segment * 2) & 0x1f; } }
java
@SuppressWarnings("WeakerAccess") public int segmentHeight(final int segment, final boolean front) { final ByteBuffer bytes = getData(); if (isColor) { final int base = segment * 6; final int frontHeight = Util.unsign(bytes.get(base + 5)); if (front) { return frontHeight; } else { return Math.max(frontHeight, Math.max(Util.unsign(bytes.get(base + 3)), Util.unsign(bytes.get(base + 4)))); } } else { return getData().get(segment * 2) & 0x1f; } }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "int", "segmentHeight", "(", "final", "int", "segment", ",", "final", "boolean", "front", ")", "{", "final", "ByteBuffer", "bytes", "=", "getData", "(", ")", ";", "if", "(", "isColor", ")", "...
Determine the height of the preview given an index into it. @param segment the index of the waveform preview segment to examine @param front if {@code true} the height of the front (brighter) segment of a color waveform preview is returned, otherwise the height of the back (dimmer) segment is returned. Has no effect for blue previews. @return a value from 0 to 31 representing the height of the waveform at that segment, which may be an average of a number of values starting there, determined by the scale
[ "Determine", "the", "height", "of", "the", "preview", "given", "an", "index", "into", "it", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformPreview.java#L218-L232
BioPAX/Paxtools
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java
L3ToSBGNPDConverter.assignLocation
private void assignLocation(PhysicalEntity pe, Glyph g) { // Create compartment -- add this inside the compartment Glyph loc = getCompartment(pe); if (loc != null) { g.setCompartmentRef(loc); } }
java
private void assignLocation(PhysicalEntity pe, Glyph g) { // Create compartment -- add this inside the compartment Glyph loc = getCompartment(pe); if (loc != null) { g.setCompartmentRef(loc); } }
[ "private", "void", "assignLocation", "(", "PhysicalEntity", "pe", ",", "Glyph", "g", ")", "{", "// Create compartment -- add this inside the compartment", "Glyph", "loc", "=", "getCompartment", "(", "pe", ")", ";", "if", "(", "loc", "!=", "null", ")", "{", "g", ...
/* Assigns compartmentRef of the glyph. @param pe Related PhysicalEntity @param g the glyph
[ "/", "*", "Assigns", "compartmentRef", "of", "the", "glyph", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L445-L451
stephenc/java-iso-tools
iso9660-writer/src/main/java/com/github/stephenc/javaisotools/eltorito/impl/ElToritoConfig.java
ElToritoConfig.setGenBootInfoTable
public void setGenBootInfoTable(boolean genBootInfoTable) throws ConfigException { if (!genBootInfoTable || this.bootMediaType == ElToritoConfig.BOOT_MEDIA_TYPE_NO_EMU) { this.genBootInfoTable = genBootInfoTable; } else { throw new ConfigException(this, "Boot info table generation requires no-emulation image."); } }
java
public void setGenBootInfoTable(boolean genBootInfoTable) throws ConfigException { if (!genBootInfoTable || this.bootMediaType == ElToritoConfig.BOOT_MEDIA_TYPE_NO_EMU) { this.genBootInfoTable = genBootInfoTable; } else { throw new ConfigException(this, "Boot info table generation requires no-emulation image."); } }
[ "public", "void", "setGenBootInfoTable", "(", "boolean", "genBootInfoTable", ")", "throws", "ConfigException", "{", "if", "(", "!", "genBootInfoTable", "||", "this", ".", "bootMediaType", "==", "ElToritoConfig", ".", "BOOT_MEDIA_TYPE_NO_EMU", ")", "{", "this", ".", ...
Set Boot Info Table (only allowed for no-emulation images) @param genBootInfoTable Whether to generate a boot info table
[ "Set", "Boot", "Info", "Table", "(", "only", "allowed", "for", "no", "-", "emulation", "images", ")" ]
train
https://github.com/stephenc/java-iso-tools/blob/828c50b02eb311a14dde0dab43462a0d0c9dfb06/iso9660-writer/src/main/java/com/github/stephenc/javaisotools/eltorito/impl/ElToritoConfig.java#L114-L120
wuman/orientdb-android
commons/src/main/java/com/orientechnologies/common/collection/OMVRBTree.java
OMVRBTree.valEquals
final static boolean valEquals(final Object o1, final Object o2) { return (o1 == null ? o2 == null : o1.equals(o2)); }
java
final static boolean valEquals(final Object o1, final Object o2) { return (o1 == null ? o2 == null : o1.equals(o2)); }
[ "final", "static", "boolean", "valEquals", "(", "final", "Object", "o1", ",", "final", "Object", "o2", ")", "{", "return", "(", "o1", "==", "null", "?", "o2", "==", "null", ":", "o1", ".", "equals", "(", "o2", ")", ")", ";", "}" ]
Test two values for equality. Differs from o1.equals(o2) only in that it copes with <tt>null</tt> o1 properly.
[ "Test", "two", "values", "for", "equality", ".", "Differs", "from", "o1", ".", "equals", "(", "o2", ")", "only", "in", "that", "it", "copes", "with", "<tt", ">", "null<", "/", "tt", ">", "o1", "properly", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/collection/OMVRBTree.java#L1435-L1437
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java
SegmentsUtil.bitUnSet
public static void bitUnSet(MemorySegment[] segments, int baseOffset, int index) { if (segments.length == 1) { MemorySegment segment = segments[0]; int offset = baseOffset + ((index & BIT_BYTE_POSITION_MASK) >>> 3); byte current = segment.get(offset); current &= ~(1 << (index & BIT_BYTE_INDEX_MASK)); segment.put(offset, current); } else { bitUnSetMultiSegments(segments, baseOffset, index); } }
java
public static void bitUnSet(MemorySegment[] segments, int baseOffset, int index) { if (segments.length == 1) { MemorySegment segment = segments[0]; int offset = baseOffset + ((index & BIT_BYTE_POSITION_MASK) >>> 3); byte current = segment.get(offset); current &= ~(1 << (index & BIT_BYTE_INDEX_MASK)); segment.put(offset, current); } else { bitUnSetMultiSegments(segments, baseOffset, index); } }
[ "public", "static", "void", "bitUnSet", "(", "MemorySegment", "[", "]", "segments", ",", "int", "baseOffset", ",", "int", "index", ")", "{", "if", "(", "segments", ".", "length", "==", "1", ")", "{", "MemorySegment", "segment", "=", "segments", "[", "0",...
unset bit from segments. @param segments target segments. @param baseOffset bits base offset. @param index bit index from base offset.
[ "unset", "bit", "from", "segments", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/SegmentsUtil.java#L460-L470
fernandospr/javapns-jdk16
src/main/java/javapns/Push.java
Push.combined
public static PushedNotifications combined(String message, int badge, String sound, Object keystore, String password, boolean production, Object devices) throws CommunicationException, KeystoreException { return sendPayload(PushNotificationPayload.combined(message, badge, sound), keystore, password, production, devices); }
java
public static PushedNotifications combined(String message, int badge, String sound, Object keystore, String password, boolean production, Object devices) throws CommunicationException, KeystoreException { return sendPayload(PushNotificationPayload.combined(message, badge, sound), keystore, password, production, devices); }
[ "public", "static", "PushedNotifications", "combined", "(", "String", "message", ",", "int", "badge", ",", "String", "sound", ",", "Object", "keystore", ",", "String", "password", ",", "boolean", "production", ",", "Object", "devices", ")", "throws", "Communicat...
Push a notification combining an alert, a badge and a sound. @param message the alert message to push (set to null to skip). @param badge the badge number to push (set to -1 to skip). @param sound the sound name to push (set to null to skip). @param keystore a keystore containing your private key and the certificate signed by Apple ({@link java.io.File}, {@link java.io.InputStream}, byte[], {@link java.security.KeyStore} or {@link java.lang.String} for a file path) @param password the keystore's password. @param production true to use Apple's production servers, false to use the sandbox servers. @param devices a list or an array of tokens or devices: {@link java.lang.String String[]}, {@link java.util.List}<{@link java.lang.String}>, {@link javapns.devices.Device Device[]}, {@link java.util.List}<{@link javapns.devices.Device}>, {@link java.lang.String} or {@link javapns.devices.Device} @return a list of pushed notifications, each with details on transmission results and error (if any) @throws KeystoreException thrown if an error occurs when loading the keystore @throws CommunicationException thrown if an unrecoverable error occurs while trying to communicate with Apple servers
[ "Push", "a", "notification", "combining", "an", "alert", "a", "badge", "and", "a", "sound", "." ]
train
https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/Push.java#L99-L101
knowm/Yank
src/main/java/org/knowm/yank/Yank.java
Yank.queryScalarSQLKey
public static <T> T queryScalarSQLKey(String sqlKey, Class<T> scalarType, Object[] params) throws SQLStatementNotFoundException, YankSQLException { return queryScalarSQLKey(YankPoolManager.DEFAULT_POOL_NAME, sqlKey, scalarType, params); }
java
public static <T> T queryScalarSQLKey(String sqlKey, Class<T> scalarType, Object[] params) throws SQLStatementNotFoundException, YankSQLException { return queryScalarSQLKey(YankPoolManager.DEFAULT_POOL_NAME, sqlKey, scalarType, params); }
[ "public", "static", "<", "T", ">", "T", "queryScalarSQLKey", "(", "String", "sqlKey", ",", "Class", "<", "T", ">", "scalarType", ",", "Object", "[", "]", "params", ")", "throws", "SQLStatementNotFoundException", ",", "YankSQLException", "{", "return", "querySc...
Return just one scalar given a SQL Key using an SQL statement matching the sqlKey String in a properties file loaded via Yank.addSQLStatements(...) using the default connection pool. If more than one row match the query, only the first row is returned. @param sqlKey The SQL Key found in a properties file corresponding to the desired SQL statement value @param scalarType The Class of the desired return scalar matching the table @param params The replacement parameters @return The Object @throws SQLStatementNotFoundException if an SQL statement could not be found for the given sqlKey String
[ "Return", "just", "one", "scalar", "given", "a", "SQL", "Key", "using", "an", "SQL", "statement", "matching", "the", "sqlKey", "String", "in", "a", "properties", "file", "loaded", "via", "Yank", ".", "addSQLStatements", "(", "...", ")", "using", "the", "de...
train
https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L233-L237
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java
RestRequest.requestGetWithStatusAccepted
public Object requestGetWithStatusAccepted(String url, Class type) throws SDKException { url = this.pathUrl + "/" + url; return requestGetWithStatus(url, HttpURLConnection.HTTP_ACCEPTED, type); }
java
public Object requestGetWithStatusAccepted(String url, Class type) throws SDKException { url = this.pathUrl + "/" + url; return requestGetWithStatus(url, HttpURLConnection.HTTP_ACCEPTED, type); }
[ "public", "Object", "requestGetWithStatusAccepted", "(", "String", "url", ",", "Class", "type", ")", "throws", "SDKException", "{", "url", "=", "this", ".", "pathUrl", "+", "\"/\"", "+", "url", ";", "return", "requestGetWithStatus", "(", "url", ",", "HttpURLCo...
Executes a http get with to a given url, in contrast to the normal get it uses an http (accept) status check of the response @param url the url path used for the api request @param type the class of the requested entity @return a string containing the response content @throws SDKException if the request fails
[ "Executes", "a", "http", "get", "with", "to", "a", "given", "url", "in", "contrast", "to", "the", "normal", "get", "it", "uses", "an", "http", "(", "accept", ")", "status", "check", "of", "the", "response" ]
train
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java#L886-L889
fuinorg/utils4j
src/main/java/org/fuin/utils4j/JandexUtils.java
JandexUtils.indexJar
public static boolean indexJar(final Indexer indexer, final List<File> knownFiles, final File jarFile) { if (knownFiles.contains(jarFile)) { return false; } knownFiles.add(jarFile); try (final JarFile jar = new JarFile(jarFile)) { final Enumeration<JarEntry> entries = jar.entries(); while (entries.hasMoreElements()) { final JarEntry entry = entries.nextElement(); if (entry.getName().endsWith(".class")) { try (final InputStream stream = jar.getInputStream(entry)) { indexer.index(stream); } catch (final IOException ex) { throw new RuntimeException("Error indexing " + entry.getName() + " in " + jarFile, ex); } } } } catch (final IOException ex) { throw new RuntimeException("Error indexing " + jarFile, ex); } return true; }
java
public static boolean indexJar(final Indexer indexer, final List<File> knownFiles, final File jarFile) { if (knownFiles.contains(jarFile)) { return false; } knownFiles.add(jarFile); try (final JarFile jar = new JarFile(jarFile)) { final Enumeration<JarEntry> entries = jar.entries(); while (entries.hasMoreElements()) { final JarEntry entry = entries.nextElement(); if (entry.getName().endsWith(".class")) { try (final InputStream stream = jar.getInputStream(entry)) { indexer.index(stream); } catch (final IOException ex) { throw new RuntimeException("Error indexing " + entry.getName() + " in " + jarFile, ex); } } } } catch (final IOException ex) { throw new RuntimeException("Error indexing " + jarFile, ex); } return true; }
[ "public", "static", "boolean", "indexJar", "(", "final", "Indexer", "indexer", ",", "final", "List", "<", "File", ">", "knownFiles", ",", "final", "File", "jarFile", ")", "{", "if", "(", "knownFiles", ".", "contains", "(", "jarFile", ")", ")", "{", "retu...
Indexes a single JAR, except it was already analyzed. @param indexer Indexer to use. @param knownFiles List of files already analyzed. New files will be added within this method. @param jarFile JAR to analyze. @return TRUE if the JAR was indexed or FALSE if it was ignored.
[ "Indexes", "a", "single", "JAR", "except", "it", "was", "already", "analyzed", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/JandexUtils.java#L100-L125
Samsung/GearVRf
GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java
MFVec2f.setValue
public void setValue(int size, float[] newValue) { if ( ((newValue.length%2) == 0) && ((newValue.length/2) == size)) { try { for (int i = 0; i < size; i++) { value.set(i, new SFVec2f(newValue[i*3], newValue[i*3+1])); } } catch (IndexOutOfBoundsException e) { Log.e(TAG, "X3D MFVec2f setValue(size,newValue[]) out of bounds." + e); } catch (Exception e) { Log.e(TAG, "X3D MFVec2f setValue(size, newValue[]) exception " + e); } } else { Log.e(TAG, "X3D MFVec2f setValue() set with newValue[] length not multiple of 2, or equal to size parameter"); } }
java
public void setValue(int size, float[] newValue) { if ( ((newValue.length%2) == 0) && ((newValue.length/2) == size)) { try { for (int i = 0; i < size; i++) { value.set(i, new SFVec2f(newValue[i*3], newValue[i*3+1])); } } catch (IndexOutOfBoundsException e) { Log.e(TAG, "X3D MFVec2f setValue(size,newValue[]) out of bounds." + e); } catch (Exception e) { Log.e(TAG, "X3D MFVec2f setValue(size, newValue[]) exception " + e); } } else { Log.e(TAG, "X3D MFVec2f setValue() set with newValue[] length not multiple of 2, or equal to size parameter"); } }
[ "public", "void", "setValue", "(", "int", "size", ",", "float", "[", "]", "newValue", ")", "{", "if", "(", "(", "(", "newValue", ".", "length", "%", "2", ")", "==", "0", ")", "&&", "(", "(", "newValue", ".", "length", "/", "2", ")", "==", "size...
Assign an array subset to this field. @param size - number of new values @param newValue - array of the new x,y values, must be divisible by 2, in a single dimensional array
[ "Assign", "an", "array", "subset", "to", "this", "field", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/x3d/src/main/java/org/gearvrf/x3d/data_types/MFVec2f.java#L179-L196
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/BaseWorkflowExecutor.java
BaseWorkflowExecutor.workflowResult
protected static WorkflowStatusDataResult workflowResult( boolean status, String statusString, ControlBehavior behavior, WFSharedContext sharedContext ) { return new BaseWorkflowStatusResult(status, statusString, behavior, sharedContext); }
java
protected static WorkflowStatusDataResult workflowResult( boolean status, String statusString, ControlBehavior behavior, WFSharedContext sharedContext ) { return new BaseWorkflowStatusResult(status, statusString, behavior, sharedContext); }
[ "protected", "static", "WorkflowStatusDataResult", "workflowResult", "(", "boolean", "status", ",", "String", "statusString", ",", "ControlBehavior", "behavior", ",", "WFSharedContext", "sharedContext", ")", "{", "return", "new", "BaseWorkflowStatusResult", "(", "status",...
@param status success/failure @param statusString status string @param behavior control behavior @return result with the given input
[ "@param", "status", "success", "/", "failure", "@param", "statusString", "status", "string", "@param", "behavior", "control", "behavior" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/BaseWorkflowExecutor.java#L74-L82
osglworks/java-mvc
src/main/java/org/osgl/mvc/result/MethodNotAllowed.java
MethodNotAllowed.of
public static MethodNotAllowed of(int errorCode) { if (_localizedErrorMsg()) { return of(errorCode, defaultMessage(METHOD_NOT_ALLOWED)); } else { touchPayload().errorCode(errorCode); return _INSTANCE; } }
java
public static MethodNotAllowed of(int errorCode) { if (_localizedErrorMsg()) { return of(errorCode, defaultMessage(METHOD_NOT_ALLOWED)); } else { touchPayload().errorCode(errorCode); return _INSTANCE; } }
[ "public", "static", "MethodNotAllowed", "of", "(", "int", "errorCode", ")", "{", "if", "(", "_localizedErrorMsg", "(", ")", ")", "{", "return", "of", "(", "errorCode", ",", "defaultMessage", "(", "METHOD_NOT_ALLOWED", ")", ")", ";", "}", "else", "{", "touc...
Returns a static MethodNotAllowed instance and set the {@link #payload} thread local with error code and default message. When calling the instance on {@link #getMessage()} method, it will return whatever stored in the {@link #payload} thread local @param errorCode the app defined error code @return a static MethodNotAllowed instance as described above
[ "Returns", "a", "static", "MethodNotAllowed", "instance", "and", "set", "the", "{", "@link", "#payload", "}", "thread", "local", "with", "error", "code", "and", "default", "message", "." ]
train
https://github.com/osglworks/java-mvc/blob/4d2b2ec40498ac6ee7040c0424377cbeacab124b/src/main/java/org/osgl/mvc/result/MethodNotAllowed.java#L167-L174
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Clicker.java
Clicker.clickOn
public <T extends TextView> void clickOn(Class<T> viewClass, String nameRegex) { T viewToClick = (T) waiter.waitForText(viewClass, nameRegex, 0, Timeout.getSmallTimeout(), true, true, false); if (viewToClick != null) { clickOnScreen(viewToClick); } else { ArrayList <T> allTextViews = RobotiumUtils.removeInvisibleViews(viewFetcher.getCurrentViews(viewClass, true)); for (T view : allTextViews) { Log.d(LOG_TAG, "'" + nameRegex + "' not found. Have found: '" + view.getText() + "'"); } Assert.fail(viewClass.getSimpleName() + " with text: '" + nameRegex + "' is not found!"); } }
java
public <T extends TextView> void clickOn(Class<T> viewClass, String nameRegex) { T viewToClick = (T) waiter.waitForText(viewClass, nameRegex, 0, Timeout.getSmallTimeout(), true, true, false); if (viewToClick != null) { clickOnScreen(viewToClick); } else { ArrayList <T> allTextViews = RobotiumUtils.removeInvisibleViews(viewFetcher.getCurrentViews(viewClass, true)); for (T view : allTextViews) { Log.d(LOG_TAG, "'" + nameRegex + "' not found. Have found: '" + view.getText() + "'"); } Assert.fail(viewClass.getSimpleName() + " with text: '" + nameRegex + "' is not found!"); } }
[ "public", "<", "T", "extends", "TextView", ">", "void", "clickOn", "(", "Class", "<", "T", ">", "viewClass", ",", "String", "nameRegex", ")", "{", "T", "viewToClick", "=", "(", "T", ")", "waiter", ".", "waitForText", "(", "viewClass", ",", "nameRegex", ...
Clicks on a {@code View} of a specific class, with a given text. @param viewClass what kind of {@code View} to click, e.g. {@code Button.class} or {@code TextView.class} @param nameRegex the name of the view presented to the user. The parameter <strong>will</strong> be interpreted as a regular expression.
[ "Clicks", "on", "a", "{", "@code", "View", "}", "of", "a", "specific", "class", "with", "a", "given", "text", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Clicker.java#L472-L485
aws/aws-sdk-java
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddShapes.java
AddShapes.getDefaultTimeFormatIfNull
protected String getDefaultTimeFormatIfNull(Member c2jMemberDefinition, Map<String, Shape> allC2jShapes, String protocolString, Shape parentShape) { String timestampFormat = c2jMemberDefinition.getTimestampFormat(); if (!StringUtils.isNullOrEmpty(timestampFormat)) { failIfInCollection(c2jMemberDefinition, parentShape); return TimestampFormat.fromValue(timestampFormat).getFormat(); } String shapeName = c2jMemberDefinition.getShape(); Shape shape = allC2jShapes.get(shapeName); if (!StringUtils.isNullOrEmpty(shape.getTimestampFormat())) { failIfInCollection(c2jMemberDefinition, parentShape); return TimestampFormat.fromValue(shape.getTimestampFormat()).getFormat(); } String location = c2jMemberDefinition.getLocation(); if (Location.HEADER.toString().equals(location)) { return defaultHeaderTimestamp(); } if (Location.QUERY_STRING.toString().equals(location)) { return TimestampFormat.ISO_8601.getFormat(); } Protocol protocol = Protocol.fromValue(protocolString); switch (protocol) { case REST_XML: case QUERY: case EC2: case API_GATEWAY: return TimestampFormat.ISO_8601.getFormat(); case ION: case REST_JSON: case AWS_JSON: return TimestampFormat.UNIX_TIMESTAMP.getFormat(); case CBOR: return TimestampFormat.UNIX_TIMESTAMP_IN_MILLIS.getFormat(); } throw new RuntimeException("Cannot determine timestamp format for protocol " + protocol); }
java
protected String getDefaultTimeFormatIfNull(Member c2jMemberDefinition, Map<String, Shape> allC2jShapes, String protocolString, Shape parentShape) { String timestampFormat = c2jMemberDefinition.getTimestampFormat(); if (!StringUtils.isNullOrEmpty(timestampFormat)) { failIfInCollection(c2jMemberDefinition, parentShape); return TimestampFormat.fromValue(timestampFormat).getFormat(); } String shapeName = c2jMemberDefinition.getShape(); Shape shape = allC2jShapes.get(shapeName); if (!StringUtils.isNullOrEmpty(shape.getTimestampFormat())) { failIfInCollection(c2jMemberDefinition, parentShape); return TimestampFormat.fromValue(shape.getTimestampFormat()).getFormat(); } String location = c2jMemberDefinition.getLocation(); if (Location.HEADER.toString().equals(location)) { return defaultHeaderTimestamp(); } if (Location.QUERY_STRING.toString().equals(location)) { return TimestampFormat.ISO_8601.getFormat(); } Protocol protocol = Protocol.fromValue(protocolString); switch (protocol) { case REST_XML: case QUERY: case EC2: case API_GATEWAY: return TimestampFormat.ISO_8601.getFormat(); case ION: case REST_JSON: case AWS_JSON: return TimestampFormat.UNIX_TIMESTAMP.getFormat(); case CBOR: return TimestampFormat.UNIX_TIMESTAMP_IN_MILLIS.getFormat(); } throw new RuntimeException("Cannot determine timestamp format for protocol " + protocol); }
[ "protected", "String", "getDefaultTimeFormatIfNull", "(", "Member", "c2jMemberDefinition", ",", "Map", "<", "String", ",", "Shape", ">", "allC2jShapes", ",", "String", "protocolString", ",", "Shape", "parentShape", ")", "{", "String", "timestampFormat", "=", "c2jMem...
Get default timestamp format if the provided timestamp format is null or empty. - All timestamp values serialized in HTTP headers are formatted using rfc822 by default. - All timestamp values serialized in query strings are formatted using iso8601 by default. - The default timestamp formats per protocol for structured payload shapes are as follows: rest-json: unixTimestamp jsonrpc: unixTimestamp rest-xml: iso8601 query: iso8601 ec2: iso8601
[ "Get", "default", "timestamp", "format", "if", "the", "provided", "timestamp", "format", "is", "null", "or", "empty", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/AddShapes.java#L247-L289
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java
MyStringUtils.getContent
public static String getContent(String stringUrl) { if (stringUrl.equalsIgnoreCase("clipboard")) { try { return getFromClipboard(); } catch (Exception e) { //it's ok. } } return getContent(stringUrl, null); }
java
public static String getContent(String stringUrl) { if (stringUrl.equalsIgnoreCase("clipboard")) { try { return getFromClipboard(); } catch (Exception e) { //it's ok. } } return getContent(stringUrl, null); }
[ "public", "static", "String", "getContent", "(", "String", "stringUrl", ")", "{", "if", "(", "stringUrl", ".", "equalsIgnoreCase", "(", "\"clipboard\"", ")", ")", "{", "try", "{", "return", "getFromClipboard", "(", ")", ";", "}", "catch", "(", "Exception", ...
Returns content for the given URL @param stringUrl URL @return Response content
[ "Returns", "content", "for", "the", "given", "URL" ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyStringUtils.java#L987-L996
deephacks/confit
api-runtime/src/main/java/org/deephacks/confit/query/ConfigQueryBuilder.java
ConfigQueryBuilder.greaterThan
public static <A extends Comparable<A>> Restriction greaterThan(String property, A value) { return new GreaterThan<>(property, value); }
java
public static <A extends Comparable<A>> Restriction greaterThan(String property, A value) { return new GreaterThan<>(property, value); }
[ "public", "static", "<", "A", "extends", "Comparable", "<", "A", ">", ">", "Restriction", "greaterThan", "(", "String", "property", ",", "A", "value", ")", "{", "return", "new", "GreaterThan", "<>", "(", "property", ",", "value", ")", ";", "}" ]
Query which asserts that a property is greater than (but not equal to) a value. @param property field to query @param value value to query for @return restriction to be added to {@link ConfigQuery}.
[ "Query", "which", "asserts", "that", "a", "property", "is", "greater", "than", "(", "but", "not", "equal", "to", ")", "a", "value", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/api-runtime/src/main/java/org/deephacks/confit/query/ConfigQueryBuilder.java#L58-L60
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java
MethodBuilder.getInstance
public static MethodBuilder getInstance(Context context, ClassDoc classDoc, MethodWriter writer) { return new MethodBuilder(context, classDoc, writer); }
java
public static MethodBuilder getInstance(Context context, ClassDoc classDoc, MethodWriter writer) { return new MethodBuilder(context, classDoc, writer); }
[ "public", "static", "MethodBuilder", "getInstance", "(", "Context", "context", ",", "ClassDoc", "classDoc", ",", "MethodWriter", "writer", ")", "{", "return", "new", "MethodBuilder", "(", "context", ",", "classDoc", ",", "writer", ")", ";", "}" ]
Construct a new MethodBuilder. @param context the build context. @param classDoc the class whoses members are being documented. @param writer the doclet specific writer. @return an instance of a MethodBuilder.
[ "Construct", "a", "new", "MethodBuilder", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MethodBuilder.java#L109-L112
rubenlagus/TelegramBots
telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java
BaseAbilityBot.getUser
protected User getUser(int id) { User user = users().get(id); if (user == null) { throw new IllegalStateException(format("Could not find user corresponding to id [%d]", id)); } return user; }
java
protected User getUser(int id) { User user = users().get(id); if (user == null) { throw new IllegalStateException(format("Could not find user corresponding to id [%d]", id)); } return user; }
[ "protected", "User", "getUser", "(", "int", "id", ")", "{", "User", "user", "=", "users", "(", ")", ".", "get", "(", "id", ")", ";", "if", "(", "user", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "format", "(", "\"Could not ...
Gets the user with the specified ID. @param id the id of the required user @return the user
[ "Gets", "the", "user", "with", "the", "specified", "ID", "." ]
train
https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/BaseAbilityBot.java#L263-L270
transloadit/java-sdk
src/main/java/com/transloadit/sdk/Transloadit.java
Transloadit.updateTemplate
public Response updateTemplate(String id, Map<String, Object> options) throws RequestException, LocalOperationException { Request request = new Request(this); return new Response(request.put("/templates/" + id, options)); }
java
public Response updateTemplate(String id, Map<String, Object> options) throws RequestException, LocalOperationException { Request request = new Request(this); return new Response(request.put("/templates/" + id, options)); }
[ "public", "Response", "updateTemplate", "(", "String", "id", ",", "Map", "<", "String", ",", "Object", ">", "options", ")", "throws", "RequestException", ",", "LocalOperationException", "{", "Request", "request", "=", "new", "Request", "(", "this", ")", ";", ...
Updates the template with the specified id. @param id id of the template to update @param options a Map of options to update/add. @return {@link Response} @throws RequestException if request to transloadit server fails. @throws LocalOperationException if something goes wrong while running non-http operations.
[ "Updates", "the", "template", "with", "the", "specified", "id", "." ]
train
https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Transloadit.java#L210-L214
h2oai/h2o-2
src/main/java/water/fvec/Chunk.java
Chunk.set0
public final double set0(int idx, double d) { setWrite(); if( _chk2.set_impl(idx,d) ) return d; (_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,d); return d; }
java
public final double set0(int idx, double d) { setWrite(); if( _chk2.set_impl(idx,d) ) return d; (_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,d); return d; }
[ "public", "final", "double", "set0", "(", "int", "idx", ",", "double", "d", ")", "{", "setWrite", "(", ")", ";", "if", "(", "_chk2", ".", "set_impl", "(", "idx", ",", "d", ")", ")", "return", "d", ";", "(", "_chk2", "=", "inflate_impl", "(", "new...
Set a double element in a chunk given a 0-based chunk local index.
[ "Set", "a", "double", "element", "in", "a", "chunk", "given", "a", "0", "-", "based", "chunk", "local", "index", "." ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/Chunk.java#L137-L142
io7m/jaffirm
com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java
Invariants.checkInvariantL
public static long checkInvariantL( final long value, final boolean condition, final LongFunction<String> describer) { return innerCheckInvariantL(value, condition, describer); }
java
public static long checkInvariantL( final long value, final boolean condition, final LongFunction<String> describer) { return innerCheckInvariantL(value, condition, describer); }
[ "public", "static", "long", "checkInvariantL", "(", "final", "long", "value", ",", "final", "boolean", "condition", ",", "final", "LongFunction", "<", "String", ">", "describer", ")", "{", "return", "innerCheckInvariantL", "(", "value", ",", "condition", ",", ...
A {@code long} specialized version of {@link #checkInvariant(Object, Predicate, Function)} @param condition The predicate @param value The value @param describer The describer of the predicate @return value @throws InvariantViolationException If the predicate is false
[ "A", "{", "@code", "long", "}", "specialized", "version", "of", "{", "@link", "#checkInvariant", "(", "Object", "Predicate", "Function", ")", "}" ]
train
https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java#L480-L486
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java
Convert.utf2string
public static String utf2string(byte[] src, int sindex, int len) { char dst[] = new char[len]; int len1 = utf2chars(src, sindex, dst, 0, len); return new String(dst, 0, len1); }
java
public static String utf2string(byte[] src, int sindex, int len) { char dst[] = new char[len]; int len1 = utf2chars(src, sindex, dst, 0, len); return new String(dst, 0, len1); }
[ "public", "static", "String", "utf2string", "(", "byte", "[", "]", "src", ",", "int", "sindex", ",", "int", "len", ")", "{", "char", "dst", "[", "]", "=", "new", "char", "[", "len", "]", ";", "int", "len1", "=", "utf2chars", "(", "src", ",", "sin...
Return bytes in Utf8 representation as a string. @param src The array holding the bytes. @param sindex The start index from which bytes are converted. @param len The maximum number of bytes to convert.
[ "Return", "bytes", "in", "Utf8", "representation", "as", "a", "string", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java#L160-L164
davidcarboni/cryptolite-java
src/main/java/com/github/davidcarboni/cryptolite/KeyExchange.java
KeyExchange.encryptKey
public String encryptKey(SecretKey key, PublicKey destinationPublicKey) { // Basic null check if (key == null) { return null; } // Convert the input key to a byte array: byte[] bytes = key.getEncoded(); // Encrypt the bytes: byte[] encrypted; try { Cipher cipher = getCipher(destinationPublicKey); encrypted = cipher.doFinal(bytes); } catch (IllegalBlockSizeException e) { throw new IllegalArgumentException("Error encrypting SecretKey: " + IllegalBlockSizeException.class.getSimpleName(), e); } catch (BadPaddingException e) { throw new IllegalArgumentException("Error encrypting SecretKey: " + BadPaddingException.class.getSimpleName(), e); } return ByteArray.toBase64(encrypted); }
java
public String encryptKey(SecretKey key, PublicKey destinationPublicKey) { // Basic null check if (key == null) { return null; } // Convert the input key to a byte array: byte[] bytes = key.getEncoded(); // Encrypt the bytes: byte[] encrypted; try { Cipher cipher = getCipher(destinationPublicKey); encrypted = cipher.doFinal(bytes); } catch (IllegalBlockSizeException e) { throw new IllegalArgumentException("Error encrypting SecretKey: " + IllegalBlockSizeException.class.getSimpleName(), e); } catch (BadPaddingException e) { throw new IllegalArgumentException("Error encrypting SecretKey: " + BadPaddingException.class.getSimpleName(), e); } return ByteArray.toBase64(encrypted); }
[ "public", "String", "encryptKey", "(", "SecretKey", "key", ",", "PublicKey", "destinationPublicKey", ")", "{", "// Basic null check\r", "if", "(", "key", "==", "null", ")", "{", "return", "null", ";", "}", "// Convert the input key to a byte array:\r", "byte", "[", ...
This method encrypts the given {@link SecretKey} with the destination user's {@link PublicKey} so that it can be safely sent to them. @param key The {@link SecretKey} to be encrypted. @param destinationPublicKey The {@link PublicKey} of the user to whom you will be sending the {@link SecretKey}. This can be obtained via {@link Keys#newKeyPair()}. @return The encrypted key, as a base64-encoded String, suitable for passing to {@link #decryptKey(String, PrivateKey)}.
[ "This", "method", "encrypts", "the", "given", "{", "@link", "SecretKey", "}", "with", "the", "destination", "user", "s", "{", "@link", "PublicKey", "}", "so", "that", "it", "can", "be", "safely", "sent", "to", "them", "." ]
train
https://github.com/davidcarboni/cryptolite-java/blob/e67954181a04ffc9beb1d9abca1421195fcf9764/src/main/java/com/github/davidcarboni/cryptolite/KeyExchange.java#L94-L116
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/dos/dos_stats.java
dos_stats.get
public static dos_stats get(nitro_service service, options option) throws Exception{ dos_stats obj = new dos_stats(); dos_stats[] response = (dos_stats[])obj.stat_resources(service,option); return response[0]; }
java
public static dos_stats get(nitro_service service, options option) throws Exception{ dos_stats obj = new dos_stats(); dos_stats[] response = (dos_stats[])obj.stat_resources(service,option); return response[0]; }
[ "public", "static", "dos_stats", "get", "(", "nitro_service", "service", ",", "options", "option", ")", "throws", "Exception", "{", "dos_stats", "obj", "=", "new", "dos_stats", "(", ")", ";", "dos_stats", "[", "]", "response", "=", "(", "dos_stats", "[", "...
Use this API to fetch the statistics of all dos_stats resources that are configured on netscaler.
[ "Use", "this", "API", "to", "fetch", "the", "statistics", "of", "all", "dos_stats", "resources", "that", "are", "configured", "on", "netscaler", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/dos/dos_stats.java#L160-L164
maestrano/maestrano-java
src/main/java/com/maestrano/net/ConnecClient.java
ConnecClient.getCollectionEndpoint
public String getCollectionEndpoint(String entityName, String groupId) { return connec.getBasePath() + "/" + groupId + "/" + entityName; }
java
public String getCollectionEndpoint(String entityName, String groupId) { return connec.getBasePath() + "/" + groupId + "/" + entityName; }
[ "public", "String", "getCollectionEndpoint", "(", "String", "entityName", ",", "String", "groupId", ")", "{", "return", "connec", ".", "getBasePath", "(", ")", "+", "\"/\"", "+", "groupId", "+", "\"/\"", "+", "entityName", ";", "}" ]
Return the path to the entity collection endpoint @param entity name @param customer group id @return collection endpoint
[ "Return", "the", "path", "to", "the", "entity", "collection", "endpoint" ]
train
https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/net/ConnecClient.java#L65-L67
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/LocationInventoryUrl.java
LocationInventoryUrl.getLocationInventoryUrl
public static MozuUrl getLocationInventoryUrl(String locationCode, String productCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/locationinventory/{locationCode}/{productCode}?responseFields={responseFields}"); formatter.formatUrl("locationCode", locationCode); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getLocationInventoryUrl(String locationCode, String productCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/locationinventory/{locationCode}/{productCode}?responseFields={responseFields}"); formatter.formatUrl("locationCode", locationCode); formatter.formatUrl("productCode", productCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getLocationInventoryUrl", "(", "String", "locationCode", ",", "String", "productCode", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/locationinventory/{...
Get Resource Url for GetLocationInventory @param locationCode The unique, user-defined code that identifies a location. @param productCode The unique, user-defined product code of a product, used throughout to reference and associate to a product. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetLocationInventory" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/LocationInventoryUrl.java#L23-L30
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java
SQLiteDatabase.insertWithOnConflict
public long insertWithOnConflict(String table, String nullColumnHack, ContentValues initialValues, int conflictAlgorithm) { acquireReference(); try { StringBuilder sql = new StringBuilder(); sql.append("INSERT"); sql.append(CONFLICT_VALUES[conflictAlgorithm]); sql.append(" INTO "); sql.append(table); sql.append('('); Object[] bindArgs = null; int size = (initialValues != null && initialValues.size() > 0) ? initialValues.size() : 0; if (size > 0) { bindArgs = new Object[size]; int i = 0; for (String colName : initialValues.keySet()) { sql.append((i > 0) ? "," : ""); sql.append(colName); bindArgs[i++] = initialValues.get(colName); } sql.append(')'); sql.append(" VALUES ("); for (i = 0; i < size; i++) { sql.append((i > 0) ? ",?" : "?"); } } else { sql.append(nullColumnHack + ") VALUES (NULL"); } sql.append(')'); SQLiteStatement statement = new SQLiteStatement(this, sql.toString(), bindArgs); try { return statement.executeInsert(); } finally { statement.close(); } } finally { releaseReference(); } }
java
public long insertWithOnConflict(String table, String nullColumnHack, ContentValues initialValues, int conflictAlgorithm) { acquireReference(); try { StringBuilder sql = new StringBuilder(); sql.append("INSERT"); sql.append(CONFLICT_VALUES[conflictAlgorithm]); sql.append(" INTO "); sql.append(table); sql.append('('); Object[] bindArgs = null; int size = (initialValues != null && initialValues.size() > 0) ? initialValues.size() : 0; if (size > 0) { bindArgs = new Object[size]; int i = 0; for (String colName : initialValues.keySet()) { sql.append((i > 0) ? "," : ""); sql.append(colName); bindArgs[i++] = initialValues.get(colName); } sql.append(')'); sql.append(" VALUES ("); for (i = 0; i < size; i++) { sql.append((i > 0) ? ",?" : "?"); } } else { sql.append(nullColumnHack + ") VALUES (NULL"); } sql.append(')'); SQLiteStatement statement = new SQLiteStatement(this, sql.toString(), bindArgs); try { return statement.executeInsert(); } finally { statement.close(); } } finally { releaseReference(); } }
[ "public", "long", "insertWithOnConflict", "(", "String", "table", ",", "String", "nullColumnHack", ",", "ContentValues", "initialValues", ",", "int", "conflictAlgorithm", ")", "{", "acquireReference", "(", ")", ";", "try", "{", "StringBuilder", "sql", "=", "new", ...
General method for inserting a row into the database. @param table the table to insert the row into @param nullColumnHack optional; may be <code>null</code>. SQL doesn't allow inserting a completely empty row without naming at least one column name. If your provided <code>initialValues</code> is empty, no column names are known and an empty row can't be inserted. If not set to null, the <code>nullColumnHack</code> parameter provides the name of nullable column name to explicitly insert a NULL into in the case where your <code>initialValues</code> is empty. @param initialValues this map contains the initial column values for the row. The keys should be the column names and the values the column values @param conflictAlgorithm for insert conflict resolver @return the row ID of the newly inserted row OR <code>-1</code> if either the input parameter <code>conflictAlgorithm</code> = {@link #CONFLICT_IGNORE} or an error occurred.
[ "General", "method", "for", "inserting", "a", "row", "into", "the", "database", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L1442-L1483
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java
SqlBuilderHelper.generateLogForContentValues
public static void generateLogForContentValues(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { methodBuilder.addCode("\n// log for content values -- BEGIN\n"); methodBuilder.addStatement("$T<String, Object, $T> _contentValue", Triple.class, KriptonContentValues.ParamType.class); methodBuilder.beginControlFlow("for (int i = 0; i < _contentValues.size(); i++)"); methodBuilder.addStatement("_contentValue = _contentValues.get(i)"); methodBuilder.beginControlFlow("if (_contentValue.value1==null)"); methodBuilder.addStatement("$T.info(\"==> :%s = <null>\", _contentValue.value0)", Logger.class); methodBuilder.nextControlFlow("else"); methodBuilder.addStatement("$T.info(\"==> :%s = '%s' (%s)\", _contentValue.value0, $T.checkSize(_contentValue.value1), _contentValue.value1.getClass().getCanonicalName())", Logger.class, StringUtils.class); methodBuilder.endControlFlow(); methodBuilder.endControlFlow(); methodBuilder.addCode("// log for content values -- END\n"); }
java
public static void generateLogForContentValues(SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { methodBuilder.addCode("\n// log for content values -- BEGIN\n"); methodBuilder.addStatement("$T<String, Object, $T> _contentValue", Triple.class, KriptonContentValues.ParamType.class); methodBuilder.beginControlFlow("for (int i = 0; i < _contentValues.size(); i++)"); methodBuilder.addStatement("_contentValue = _contentValues.get(i)"); methodBuilder.beginControlFlow("if (_contentValue.value1==null)"); methodBuilder.addStatement("$T.info(\"==> :%s = <null>\", _contentValue.value0)", Logger.class); methodBuilder.nextControlFlow("else"); methodBuilder.addStatement("$T.info(\"==> :%s = '%s' (%s)\", _contentValue.value0, $T.checkSize(_contentValue.value1), _contentValue.value1.getClass().getCanonicalName())", Logger.class, StringUtils.class); methodBuilder.endControlFlow(); methodBuilder.endControlFlow(); methodBuilder.addCode("// log for content values -- END\n"); }
[ "public", "static", "void", "generateLogForContentValues", "(", "SQLiteModelMethod", "method", ",", "MethodSpec", ".", "Builder", "methodBuilder", ")", "{", "methodBuilder", ".", "addCode", "(", "\"\\n// log for content values -- BEGIN\\n\"", ")", ";", "methodBuilder", "....
<p> Generate log for content values </p> <h2>pre conditions</h2> <p> required variable are: </p> <ul> <li>contentValues</li> </ul> @param method the method @param methodBuilder the method builder
[ "<p", ">", "Generate", "log", "for", "content", "values", "<", "/", "p", ">" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlBuilderHelper.java#L231-L245
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/config/HpelConfigurator.java
HpelConfigurator.updateLog
public static synchronized void updateLog(Map<String, Object> newConfig) { if (newConfig == null) throw new NullPointerException("Updated config must not be null"); HpelTraceServiceConfig config = loggingConfig.get(); if (config != null) { config.updateLog(newConfig); config.getTrDelegate().update(config); } }
java
public static synchronized void updateLog(Map<String, Object> newConfig) { if (newConfig == null) throw new NullPointerException("Updated config must not be null"); HpelTraceServiceConfig config = loggingConfig.get(); if (config != null) { config.updateLog(newConfig); config.getTrDelegate().update(config); } }
[ "public", "static", "synchronized", "void", "updateLog", "(", "Map", "<", "String", ",", "Object", ">", "newConfig", ")", "{", "if", "(", "newConfig", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"Updated config must not be null\"", ")", ";"...
Update Log part of HPEL with new configuration values (based on injection via config admin). The parameter map should be modified to match actual values used (e.g. substitution in case of error). @param newConfig
[ "Update", "Log", "part", "of", "HPEL", "with", "new", "configuration", "values", "(", "based", "on", "injection", "via", "config", "admin", ")", ".", "The", "parameter", "map", "should", "be", "modified", "to", "match", "actual", "values", "used", "(", "e"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/config/HpelConfigurator.java#L42-L51
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/html/TableForm.java
TableForm.addFileField
public Input addFileField(String tag, String label) { Input i = new Input(Input.File,tag); addField(label,i); return i; }
java
public Input addFileField(String tag, String label) { Input i = new Input(Input.File,tag); addField(label,i); return i; }
[ "public", "Input", "addFileField", "(", "String", "tag", ",", "String", "label", ")", "{", "Input", "i", "=", "new", "Input", "(", "Input", ".", "File", ",", "tag", ")", ";", "addField", "(", "label", ",", "i", ")", ";", "return", "i", ";", "}" ]
Add a File Entry Field. @param tag The form name of the element @param label The label for the element in the table.
[ "Add", "a", "File", "Entry", "Field", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/html/TableForm.java#L101-L107
paymill/paymill-java
src/main/java/com/paymill/services/SubscriptionService.java
SubscriptionService.changeOfferChangeCaptureDateAndRefund
public Subscription changeOfferChangeCaptureDateAndRefund( String subscription, Offer offer ) { return changeOfferChangeCaptureDateAndRefund( new Subscription( subscription ), offer ); }
java
public Subscription changeOfferChangeCaptureDateAndRefund( String subscription, Offer offer ) { return changeOfferChangeCaptureDateAndRefund( new Subscription( subscription ), offer ); }
[ "public", "Subscription", "changeOfferChangeCaptureDateAndRefund", "(", "String", "subscription", ",", "Offer", "offer", ")", "{", "return", "changeOfferChangeCaptureDateAndRefund", "(", "new", "Subscription", "(", "subscription", ")", ",", "offer", ")", ";", "}" ]
Change the offer of a subscription.<br> <br> The plan will be changed immediately. The next_capture_at will change to the current date (immediately). A refund will be given if due.<br> If the new amount is higher than the old one, a pro-rata charge will occur. The next charge date is immediate i.e. the current date. If the new amount is less then the old one, a pro-rata refund will occur. The next charge date is immediate i.e. the current date.<br> <strong>IMPORTANT</strong><br> Permitted up only until one day (24 hours) before the next charge date.<br> @param subscription the subscription @param offer the new offer @return the updated subscription
[ "Change", "the", "offer", "of", "a", "subscription", ".", "<br", ">", "<br", ">", "The", "plan", "will", "be", "changed", "immediately", ".", "The", "next_capture_at", "will", "change", "to", "the", "current", "date", "(", "immediately", ")", ".", "A", "...
train
https://github.com/paymill/paymill-java/blob/17281a0d4376c76f1711af9f09bfc138c90ba65a/src/main/java/com/paymill/services/SubscriptionService.java#L420-L422
misberner/duzzt
processor/src/main/java/com/github/misberner/duzzt/automaton/DuzztState.java
DuzztState.addTransition
public void addTransition(DuzztAction action, DuzztState succ) { transitions.put(action, new DuzztTransition(action, succ)); }
java
public void addTransition(DuzztAction action, DuzztState succ) { transitions.put(action, new DuzztTransition(action, succ)); }
[ "public", "void", "addTransition", "(", "DuzztAction", "action", ",", "DuzztState", "succ", ")", "{", "transitions", ".", "put", "(", "action", ",", "new", "DuzztTransition", "(", "action", ",", "succ", ")", ")", ";", "}" ]
Adds a transition to this state. @param action the action on which to trigger this transition @param succ the successor state
[ "Adds", "a", "transition", "to", "this", "state", "." ]
train
https://github.com/misberner/duzzt/blob/3fb784c1a9142967141743587fe7ad3945d0ac28/processor/src/main/java/com/github/misberner/duzzt/automaton/DuzztState.java#L73-L75
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/ipc/Client.java
Client.wrapException
private IOException wrapException(InetSocketAddress addr, IOException exception) { if (exception instanceof ConnectException) { // connection refused; include the host:port in the error return (ConnectException) new ConnectException("Call to " + addr + " failed on connection exception: " + exception).initCause(exception); } else if (exception instanceof SocketTimeoutException) { return (SocketTimeoutException) new SocketTimeoutException("Call to " + addr + " failed on socket timeout exception: " + exception).initCause(exception); } else { return (IOException) new IOException("Call to " + addr + " failed on local exception: " + exception) .initCause(exception); } }
java
private IOException wrapException(InetSocketAddress addr, IOException exception) { if (exception instanceof ConnectException) { // connection refused; include the host:port in the error return (ConnectException) new ConnectException("Call to " + addr + " failed on connection exception: " + exception).initCause(exception); } else if (exception instanceof SocketTimeoutException) { return (SocketTimeoutException) new SocketTimeoutException("Call to " + addr + " failed on socket timeout exception: " + exception).initCause(exception); } else { return (IOException) new IOException("Call to " + addr + " failed on local exception: " + exception) .initCause(exception); } }
[ "private", "IOException", "wrapException", "(", "InetSocketAddress", "addr", ",", "IOException", "exception", ")", "{", "if", "(", "exception", "instanceof", "ConnectException", ")", "{", "// connection refused; include the host:port in the error", "return", "(", "ConnectEx...
Take an IOException and the address we were trying to connect to and return an IOException with the input exception as the cause. The new exception provides the stack trace of the place where the exception is thrown and some extra diagnostics information. If the exception is ConnectException or SocketTimeoutException, return a new one of the same type; Otherwise return an IOException. @param addr target address @param exception the relevant exception @return an exception to throw
[ "Take", "an", "IOException", "and", "the", "address", "we", "were", "trying", "to", "connect", "to", "and", "return", "an", "IOException", "with", "the", "input", "exception", "as", "the", "cause", ".", "The", "new", "exception", "provides", "the", "stack", ...
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/ipc/Client.java#L725-L738
real-logic/agrona
agrona/src/main/java/org/agrona/SystemUtil.java
SystemUtil.parseDuration
public static long parseDuration(final String propertyName, final String propertyValue) { final char lastCharacter = propertyValue.charAt(propertyValue.length() - 1); if (Character.isDigit(lastCharacter)) { return Long.valueOf(propertyValue); } if (lastCharacter != 's' && lastCharacter != 'S') { throw new NumberFormatException( propertyName + ": " + propertyValue + " should end with: s, ms, us, or ns."); } final char secondLastCharacter = propertyValue.charAt(propertyValue.length() - 2); if (Character.isDigit(secondLastCharacter)) { final long value = AsciiEncoding.parseLongAscii(propertyValue, 0, propertyValue.length() - 1); return TimeUnit.SECONDS.toNanos(value); } final long value = AsciiEncoding.parseLongAscii(propertyValue, 0, propertyValue.length() - 2); switch (secondLastCharacter) { case 'n': case 'N': return value; case 'u': case 'U': return TimeUnit.MICROSECONDS.toNanos(value); case 'm': case 'M': return TimeUnit.MILLISECONDS.toNanos(value); default: throw new NumberFormatException( propertyName + ": " + propertyValue + " should end with: s, ms, us, or ns."); } }
java
public static long parseDuration(final String propertyName, final String propertyValue) { final char lastCharacter = propertyValue.charAt(propertyValue.length() - 1); if (Character.isDigit(lastCharacter)) { return Long.valueOf(propertyValue); } if (lastCharacter != 's' && lastCharacter != 'S') { throw new NumberFormatException( propertyName + ": " + propertyValue + " should end with: s, ms, us, or ns."); } final char secondLastCharacter = propertyValue.charAt(propertyValue.length() - 2); if (Character.isDigit(secondLastCharacter)) { final long value = AsciiEncoding.parseLongAscii(propertyValue, 0, propertyValue.length() - 1); return TimeUnit.SECONDS.toNanos(value); } final long value = AsciiEncoding.parseLongAscii(propertyValue, 0, propertyValue.length() - 2); switch (secondLastCharacter) { case 'n': case 'N': return value; case 'u': case 'U': return TimeUnit.MICROSECONDS.toNanos(value); case 'm': case 'M': return TimeUnit.MILLISECONDS.toNanos(value); default: throw new NumberFormatException( propertyName + ": " + propertyValue + " should end with: s, ms, us, or ns."); } }
[ "public", "static", "long", "parseDuration", "(", "final", "String", "propertyName", ",", "final", "String", "propertyValue", ")", "{", "final", "char", "lastCharacter", "=", "propertyValue", ".", "charAt", "(", "propertyValue", ".", "length", "(", ")", "-", "...
Parse a string representation of a time duration with an optional suffix of 's', 'ms', 'us', or 'ns' to indicate seconds, milliseconds, microseconds, or nanoseconds respectively. <p> If the resulting duration is greater than {@link Long#MAX_VALUE} then {@link Long#MAX_VALUE} is used. @param propertyName associated with the duration value. @param propertyValue to be parsed. @return the long value. @throws NumberFormatException if the value is negative or malformed.
[ "Parse", "a", "string", "representation", "of", "a", "time", "duration", "with", "an", "optional", "suffix", "of", "s", "ms", "us", "or", "ns", "to", "indicate", "seconds", "milliseconds", "microseconds", "or", "nanoseconds", "respectively", ".", "<p", ">", ...
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/SystemUtil.java#L366-L407
wuman/JReadability
src/main/java/com/wuman/jreadability/Readability.java
Readability.scaleContentScore
private static Element scaleContentScore(Element node, float scale) { int contentScore = getContentScore(node); contentScore *= scale; node.attr(CONTENT_SCORE, Integer.toString(contentScore)); return node; }
java
private static Element scaleContentScore(Element node, float scale) { int contentScore = getContentScore(node); contentScore *= scale; node.attr(CONTENT_SCORE, Integer.toString(contentScore)); return node; }
[ "private", "static", "Element", "scaleContentScore", "(", "Element", "node", ",", "float", "scale", ")", "{", "int", "contentScore", "=", "getContentScore", "(", "node", ")", ";", "contentScore", "*=", "scale", ";", "node", ".", "attr", "(", "CONTENT_SCORE", ...
Scales the content score for an Element with a factor of scale. @param node @param scale @return
[ "Scales", "the", "content", "score", "for", "an", "Element", "with", "a", "factor", "of", "scale", "." ]
train
https://github.com/wuman/JReadability/blob/16c18c42402bd13c6e024c2fd3a86dd28ba53e74/src/main/java/com/wuman/jreadability/Readability.java#L864-L869
cdapio/tigon
tigon-queue/src/main/java/co/cask/tigon/data/transaction/queue/QueueEntryRow.java
QueueEntryRow.isQueueEntry
public static boolean isQueueEntry(byte[] queueRowPrefix, KeyValue keyValue) { return isQueueEntry(queueRowPrefix, keyValue.getBuffer(), keyValue.getRowOffset(), keyValue.getRowLength()); }
java
public static boolean isQueueEntry(byte[] queueRowPrefix, KeyValue keyValue) { return isQueueEntry(queueRowPrefix, keyValue.getBuffer(), keyValue.getRowOffset(), keyValue.getRowLength()); }
[ "public", "static", "boolean", "isQueueEntry", "(", "byte", "[", "]", "queueRowPrefix", ",", "KeyValue", "keyValue", ")", "{", "return", "isQueueEntry", "(", "queueRowPrefix", ",", "keyValue", ".", "getBuffer", "(", ")", ",", "keyValue", ".", "getRowOffset", "...
Returns true if the given KeyValue row is a queue entry of the given queue based on queue row prefix
[ "Returns", "true", "if", "the", "given", "KeyValue", "row", "is", "a", "queue", "entry", "of", "the", "given", "queue", "based", "on", "queue", "row", "prefix" ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-queue/src/main/java/co/cask/tigon/data/transaction/queue/QueueEntryRow.java#L134-L136
deeplearning4j/deeplearning4j
nd4j/nd4j-serde/nd4j-grpc/src/main/java/org/nd4j/graph/GraphInferenceGrpcClient.java
GraphInferenceGrpcClient.output
public INDArray[] output(long graphId, Pair<String, INDArray>... inputs) { val operands = new Operands(); for (val in:inputs) operands.addArgument(in.getFirst(), in.getSecond()); return output(graphId, operands).asArray(); }
java
public INDArray[] output(long graphId, Pair<String, INDArray>... inputs) { val operands = new Operands(); for (val in:inputs) operands.addArgument(in.getFirst(), in.getSecond()); return output(graphId, operands).asArray(); }
[ "public", "INDArray", "[", "]", "output", "(", "long", "graphId", ",", "Pair", "<", "String", ",", "INDArray", ">", "...", "inputs", ")", "{", "val", "operands", "=", "new", "Operands", "(", ")", ";", "for", "(", "val", "in", ":", "inputs", ")", "o...
This method sends inference request to the GraphServer instance, and returns result as array of INDArrays @param graphId id of the graph @param inputs graph inputs with their string ides @return
[ "This", "method", "sends", "inference", "request", "to", "the", "GraphServer", "instance", "and", "returns", "result", "as", "array", "of", "INDArrays" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-grpc/src/main/java/org/nd4j/graph/GraphInferenceGrpcClient.java#L183-L189
apache/incubator-shardingsphere
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/ShardingRule.java
ShardingRule.getActualDataSourceName
public String getActualDataSourceName(final String actualTableName) { Optional<TableRule> tableRule = findTableRuleByActualTable(actualTableName); if (tableRule.isPresent()) { return tableRule.get().getActualDatasourceNames().iterator().next(); } if (!Strings.isNullOrEmpty(shardingDataSourceNames.getDefaultDataSourceName())) { return shardingDataSourceNames.getDefaultDataSourceName(); } throw new ShardingException("Cannot found actual data source name of '%s' in sharding rule.", actualTableName); }
java
public String getActualDataSourceName(final String actualTableName) { Optional<TableRule> tableRule = findTableRuleByActualTable(actualTableName); if (tableRule.isPresent()) { return tableRule.get().getActualDatasourceNames().iterator().next(); } if (!Strings.isNullOrEmpty(shardingDataSourceNames.getDefaultDataSourceName())) { return shardingDataSourceNames.getDefaultDataSourceName(); } throw new ShardingException("Cannot found actual data source name of '%s' in sharding rule.", actualTableName); }
[ "public", "String", "getActualDataSourceName", "(", "final", "String", "actualTableName", ")", "{", "Optional", "<", "TableRule", ">", "tableRule", "=", "findTableRuleByActualTable", "(", "actualTableName", ")", ";", "if", "(", "tableRule", ".", "isPresent", "(", ...
Get actual data source name. @param actualTableName actual table name @return actual data source name
[ "Get", "actual", "data", "source", "name", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/ShardingRule.java#L471-L480
jayantk/jklol
src/com/jayantkrish/jklol/models/parametric/TensorSufficientStatistics.java
TensorSufficientStatistics.incrementFeatureByIndex
public void incrementFeatureByIndex(double amount, int... key) { if (isDense) { statistics.incrementEntry(amount, key); } else { Tensor increment = SparseTensor.singleElement(getTensorDimensions(), getTensorSizes(), key, amount); statisticsTensor = statisticsTensor.elementwiseAddition(increment); } }
java
public void incrementFeatureByIndex(double amount, int... key) { if (isDense) { statistics.incrementEntry(amount, key); } else { Tensor increment = SparseTensor.singleElement(getTensorDimensions(), getTensorSizes(), key, amount); statisticsTensor = statisticsTensor.elementwiseAddition(increment); } }
[ "public", "void", "incrementFeatureByIndex", "(", "double", "amount", ",", "int", "...", "key", ")", "{", "if", "(", "isDense", ")", "{", "statistics", ".", "incrementEntry", "(", "amount", ",", "key", ")", ";", "}", "else", "{", "Tensor", "increment", "...
Increments the value of {@code index} by {@code amount}. @param index @param amount
[ "Increments", "the", "value", "of", "{", "@code", "index", "}", "by", "{", "@code", "amount", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/parametric/TensorSufficientStatistics.java#L227-L235
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/stats/StatsInterface.java
StatsInterface.getPhotoStats
public Stats getPhotoStats(String photoId, Date date) throws FlickrException { return getStats(METHOD_GET_PHOTO_STATS, "photo_id", photoId, date); }
java
public Stats getPhotoStats(String photoId, Date date) throws FlickrException { return getStats(METHOD_GET_PHOTO_STATS, "photo_id", photoId, date); }
[ "public", "Stats", "getPhotoStats", "(", "String", "photoId", ",", "Date", "date", ")", "throws", "FlickrException", "{", "return", "getStats", "(", "METHOD_GET_PHOTO_STATS", ",", "\"photo_id\"", ",", "photoId", ",", "date", ")", ";", "}" ]
Get the number of views, comments and favorites on a photo for a given date. @param date (Required) Stats will be returned for this date. A day according to Flickr Stats starts at midnight GMT for all users, and timestamps will automatically be rounded down to the start of the day. @param photoId (Required) The id of the photo to get stats for. @see "http://www.flickr.com/services/api/flickr.stats.getPhotoStats.htm"
[ "Get", "the", "number", "of", "views", "comments", "and", "favorites", "on", "a", "photo", "for", "a", "given", "date", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/stats/StatsInterface.java#L202-L204
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java
JobScheduleOperations.disableJobSchedule
public void disableJobSchedule(String jobScheduleId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { JobScheduleDisableOptions options = new JobScheduleDisableOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); this.parentBatchClient.protocolLayer().jobSchedules().disable(jobScheduleId, options); }
java
public void disableJobSchedule(String jobScheduleId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { JobScheduleDisableOptions options = new JobScheduleDisableOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); this.parentBatchClient.protocolLayer().jobSchedules().disable(jobScheduleId, options); }
[ "public", "void", "disableJobSchedule", "(", "String", "jobScheduleId", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException", "{", "JobScheduleDisableOptions", "options", "=", "new", "JobSchedule...
Disables the specified job schedule. Disabled schedules do not create new jobs, but may be re-enabled later. @param jobScheduleId The ID of the job schedule. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Disables", "the", "specified", "job", "schedule", ".", "Disabled", "schedules", "do", "not", "create", "new", "jobs", "but", "may", "be", "re", "-", "enabled", "later", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobScheduleOperations.java#L293-L299
petrbouda/joyrest
joyrest-core/src/main/java/org/joyrest/routing/PathComparator.java
PathComparator.compareParts
private static boolean compareParts(RoutePart<?> routePart, String pathPart) { switch (routePart.getType()) { case PATH: return routePart.getValue().equals(pathPart); case PARAM: return routePart.getVariableType().isAssignableFromString(pathPart); default: return false; } }
java
private static boolean compareParts(RoutePart<?> routePart, String pathPart) { switch (routePart.getType()) { case PATH: return routePart.getValue().equals(pathPart); case PARAM: return routePart.getVariableType().isAssignableFromString(pathPart); default: return false; } }
[ "private", "static", "boolean", "compareParts", "(", "RoutePart", "<", "?", ">", "routePart", ",", "String", "pathPart", ")", "{", "switch", "(", "routePart", ".", "getType", "(", ")", ")", "{", "case", "PATH", ":", "return", "routePart", ".", "getValue", ...
Compares the route part (part which is configured) and the path part (part which is gained from the client). If it is just string path, so this method will compare the value of the strings. <p> If it is param path, so method will find out whether is possible to cast the object or not. @param routePart configured part @param pathPart path from a client's call @return returns true if the parts are equal @throws RestException is not possible to cast the param type
[ "Compares", "the", "route", "part", "(", "part", "which", "is", "configured", ")", "and", "the", "path", "part", "(", "part", "which", "is", "gained", "from", "the", "client", ")", "." ]
train
https://github.com/petrbouda/joyrest/blob/58903f06fb7f0b8fdf1ef91318fb48a88bf970e0/joyrest-core/src/main/java/org/joyrest/routing/PathComparator.java#L46-L55
Azure/azure-sdk-for-java
iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java
AppsInner.createOrUpdateAsync
public Observable<AppInner> createOrUpdateAsync(String resourceGroupName, String resourceName, AppInner app) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, app).map(new Func1<ServiceResponse<AppInner>, AppInner>() { @Override public AppInner call(ServiceResponse<AppInner> response) { return response.body(); } }); }
java
public Observable<AppInner> createOrUpdateAsync(String resourceGroupName, String resourceName, AppInner app) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, app).map(new Func1<ServiceResponse<AppInner>, AppInner>() { @Override public AppInner call(ServiceResponse<AppInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AppInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "AppInner", "app", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", "...
Create or update the metadata of an IoT Central application. The usual pattern to modify a property is to retrieve the IoT Central application metadata and security metadata, and then combine them with the modified values in a new body to update the IoT Central application. @param resourceGroupName The name of the resource group that contains the IoT Central application. @param resourceName The ARM resource name of the IoT Central application. @param app The IoT Central application metadata and security metadata. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "or", "update", "the", "metadata", "of", "an", "IoT", "Central", "application", ".", "The", "usual", "pattern", "to", "modify", "a", "property", "is", "to", "retrieve", "the", "IoT", "Central", "application", "metadata", "and", "security", "metadata"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iotcentral/resource-manager/v2017_07_01_privatepreview/src/main/java/com/microsoft/azure/management/iotcentral/v2017_07_01_privatepreview/implementation/AppsInner.java#L245-L252
apache/incubator-shardingsphere
sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategy.java
ShardingEncryptorStrategy.getShardingEncryptor
public Optional<ShardingEncryptor> getShardingEncryptor(final String logicTableName, final String columnName) { return Collections2.filter(columns, new Predicate<ColumnNode>() { @Override public boolean apply(final ColumnNode input) { return input.equals(new ColumnNode(logicTableName, columnName)); } }).isEmpty() ? Optional.<ShardingEncryptor>absent() : Optional.of(shardingEncryptor); }
java
public Optional<ShardingEncryptor> getShardingEncryptor(final String logicTableName, final String columnName) { return Collections2.filter(columns, new Predicate<ColumnNode>() { @Override public boolean apply(final ColumnNode input) { return input.equals(new ColumnNode(logicTableName, columnName)); } }).isEmpty() ? Optional.<ShardingEncryptor>absent() : Optional.of(shardingEncryptor); }
[ "public", "Optional", "<", "ShardingEncryptor", ">", "getShardingEncryptor", "(", "final", "String", "logicTableName", ",", "final", "String", "columnName", ")", "{", "return", "Collections2", ".", "filter", "(", "columns", ",", "new", "Predicate", "<", "ColumnNod...
Get sharding encryptor. @param logicTableName logic table name @param columnName column name @return optional of sharding encryptor
[ "Get", "sharding", "encryptor", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/strategy/encrypt/ShardingEncryptorStrategy.java#L74-L82
sothawo/mapjfx
src/main/java/com/sothawo/mapjfx/MapView.java
JavaConnector.processLabelClicked
private void processLabelClicked(final String name, final ClickType clickType) { if (logger.isTraceEnabled()) { logger.trace("JS reports label {} clicked {}", name, clickType); } synchronized (mapCoordinateElements) { if (mapCoordinateElements.containsKey(name)) { final MapCoordinateElement mapCoordinateElement = mapCoordinateElements.get(name).get(); if (mapCoordinateElement instanceof MapLabel) { EventType<MapLabelEvent> eventType = null; switch (clickType) { case LEFT: eventType = MapLabelEvent.MAPLABEL_CLICKED; break; case DOUBLE: eventType = MapLabelEvent.MAPLABEL_DOUBLECLICKED; break; case RIGHT: eventType = MapLabelEvent.MAPLABEL_RIGHTCLICKED; break; case MOUSEDOWN: eventType = MapLabelEvent.MAPLABEL_MOUSEDOWN; break; case MOUSEUP: eventType = MapLabelEvent.MAPLABEL_MOUSEUP; break; case ENTERED: eventType = MapLabelEvent.MAPLABEL_ENTERED; break; case EXITED: eventType = MapLabelEvent.MAPLABEL_EXITED; break; } fireEvent(new MapLabelEvent(eventType, (MapLabel) mapCoordinateElement)); } } } }
java
private void processLabelClicked(final String name, final ClickType clickType) { if (logger.isTraceEnabled()) { logger.trace("JS reports label {} clicked {}", name, clickType); } synchronized (mapCoordinateElements) { if (mapCoordinateElements.containsKey(name)) { final MapCoordinateElement mapCoordinateElement = mapCoordinateElements.get(name).get(); if (mapCoordinateElement instanceof MapLabel) { EventType<MapLabelEvent> eventType = null; switch (clickType) { case LEFT: eventType = MapLabelEvent.MAPLABEL_CLICKED; break; case DOUBLE: eventType = MapLabelEvent.MAPLABEL_DOUBLECLICKED; break; case RIGHT: eventType = MapLabelEvent.MAPLABEL_RIGHTCLICKED; break; case MOUSEDOWN: eventType = MapLabelEvent.MAPLABEL_MOUSEDOWN; break; case MOUSEUP: eventType = MapLabelEvent.MAPLABEL_MOUSEUP; break; case ENTERED: eventType = MapLabelEvent.MAPLABEL_ENTERED; break; case EXITED: eventType = MapLabelEvent.MAPLABEL_EXITED; break; } fireEvent(new MapLabelEvent(eventType, (MapLabel) mapCoordinateElement)); } } } }
[ "private", "void", "processLabelClicked", "(", "final", "String", "name", ",", "final", "ClickType", "clickType", ")", "{", "if", "(", "logger", ".", "isTraceEnabled", "(", ")", ")", "{", "logger", ".", "trace", "(", "\"JS reports label {} clicked {}\"", ",", ...
called when a label was clicked. @param name name of the lael @param clickType the type of click
[ "called", "when", "a", "label", "was", "clicked", "." ]
train
https://github.com/sothawo/mapjfx/blob/202091de492ab7a8b000c77efd833029f7f0ef92/src/main/java/com/sothawo/mapjfx/MapView.java#L1588-L1624
plume-lib/options
src/main/java/org/plumelib/options/Options.java
Options.maxOptionLength
private int maxOptionLength(List<OptionInfo> optList, boolean showUnpublicized) { int maxLength = 0; for (OptionInfo oi : optList) { if (oi.unpublicized && !showUnpublicized) { continue; } int len = oi.synopsis().length(); if (len > maxLength) { maxLength = len; } } return maxLength; }
java
private int maxOptionLength(List<OptionInfo> optList, boolean showUnpublicized) { int maxLength = 0; for (OptionInfo oi : optList) { if (oi.unpublicized && !showUnpublicized) { continue; } int len = oi.synopsis().length(); if (len > maxLength) { maxLength = len; } } return maxLength; }
[ "private", "int", "maxOptionLength", "(", "List", "<", "OptionInfo", ">", "optList", ",", "boolean", "showUnpublicized", ")", "{", "int", "maxLength", "=", "0", ";", "for", "(", "OptionInfo", "oi", ":", "optList", ")", "{", "if", "(", "oi", ".", "unpubli...
Return the length of the longest synopsis message in a list of options. Useful for aligning options in usage strings. @param optList the options whose synopsis messages to measure @param showUnpublicized if true, include unpublicized options in the computation @return the length of the longest synopsis message in a list of options
[ "Return", "the", "length", "of", "the", "longest", "synopsis", "message", "in", "a", "list", "of", "options", ".", "Useful", "for", "aligning", "options", "in", "usage", "strings", "." ]
train
https://github.com/plume-lib/options/blob/1bdd0ac7a1794bdf9dd373e279f69d43395154f0/src/main/java/org/plumelib/options/Options.java#L1230-L1242
MenoData/Time4J
base/src/main/java/net/time4j/range/Quarters.java
Quarters.between
public static Quarters between(CalendarQuarter q1, CalendarQuarter q2) { PlainDate d1 = q1.atDayOfQuarter(1); PlainDate d2 = q2.atDayOfQuarter(1); return Quarters.between(d1, d2); }
java
public static Quarters between(CalendarQuarter q1, CalendarQuarter q2) { PlainDate d1 = q1.atDayOfQuarter(1); PlainDate d2 = q2.atDayOfQuarter(1); return Quarters.between(d1, d2); }
[ "public", "static", "Quarters", "between", "(", "CalendarQuarter", "q1", ",", "CalendarQuarter", "q2", ")", "{", "PlainDate", "d1", "=", "q1", ".", "atDayOfQuarter", "(", "1", ")", ";", "PlainDate", "d2", "=", "q2", ".", "atDayOfQuarter", "(", "1", ")", ...
/*[deutsch] <p>Bestimmt die Differenz zwischen den angegebenen Quartalen. </p> @param q1 first quarter year @param q2 second quarter year @return difference in quarter years
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Bestimmt", "die", "Differenz", "zwischen", "den", "angegebenen", "Quartalen", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/Quarters.java#L139-L145
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.getAt
public static Object getAt(Matcher matcher, int idx) { try { int count = getCount(matcher); if (idx < -count || idx >= count) { throw new IndexOutOfBoundsException("index is out of range " + (-count) + ".." + (count - 1) + " (index = " + idx + ")"); } idx = normaliseIndex(idx, count); Iterator iter = iterator(matcher); Object result = null; for (int i = 0; i <= idx; i++) { result = iter.next(); } return result; } catch (IllegalStateException ex) { return null; } }
java
public static Object getAt(Matcher matcher, int idx) { try { int count = getCount(matcher); if (idx < -count || idx >= count) { throw new IndexOutOfBoundsException("index is out of range " + (-count) + ".." + (count - 1) + " (index = " + idx + ")"); } idx = normaliseIndex(idx, count); Iterator iter = iterator(matcher); Object result = null; for (int i = 0; i <= idx; i++) { result = iter.next(); } return result; } catch (IllegalStateException ex) { return null; } }
[ "public", "static", "Object", "getAt", "(", "Matcher", "matcher", ",", "int", "idx", ")", "{", "try", "{", "int", "count", "=", "getCount", "(", "matcher", ")", ";", "if", "(", "idx", "<", "-", "count", "||", "idx", ">=", "count", ")", "{", "throw"...
Support the subscript operator, e.g.&#160;matcher[index], for a regex Matcher. <p> For an example using no group match, <pre> def p = /ab[d|f]/ def m = "abcabdabeabf" =~ p assert 2 == m.count assert 2 == m.size() // synonym for m.getCount() assert ! m.hasGroup() assert 0 == m.groupCount() def matches = ["abd", "abf"] for (i in 0..&lt;m.count) { &#160;&#160;assert m[i] == matches[i] } </pre> <p> For an example using group matches, <pre> def p = /(?:ab([c|d|e|f]))/ def m = "abcabdabeabf" =~ p assert 4 == m.count assert m.hasGroup() assert 1 == m.groupCount() def matches = [["abc", "c"], ["abd", "d"], ["abe", "e"], ["abf", "f"]] for (i in 0..&lt;m.count) { &#160;&#160;assert m[i] == matches[i] } </pre> <p> For another example using group matches, <pre> def m = "abcabdabeabfabxyzabx" =~ /(?:ab([d|x-z]+))/ assert 3 == m.count assert m.hasGroup() assert 1 == m.groupCount() def matches = [["abd", "d"], ["abxyz", "xyz"], ["abx", "x"]] for (i in 0..&lt;m.count) { &#160;&#160;assert m[i] == matches[i] } </pre> @param matcher a Matcher @param idx an index @return object a matched String if no groups matched, list of matched groups otherwise. @since 1.0
[ "Support", "the", "subscript", "operator", "e", ".", "g", ".", "&#160", ";", "matcher", "[", "index", "]", "for", "a", "regex", "Matcher", ".", "<p", ">", "For", "an", "example", "using", "no", "group", "match", "<pre", ">", "def", "p", "=", "/", "...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L1376-L1394
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_easyHunting_serviceName_hunting_queue_POST
public OvhOvhPabxHuntingQueue billingAccount_easyHunting_serviceName_hunting_queue_POST(String billingAccount, String serviceName, OvhOvhPabxQueueActionEnum actionOnClosure, String actionOnClosureParam, OvhOvhPabxQueueActionEnum actionOnOverflow, String actionOnOverflowParam, Boolean askForRecordDisabling, String description, Long maxMember, Long maxWaitTime, Boolean record, OvhOvhPabxHuntingQueueRecordDisablingDigitEnum recordDisablingDigit, OvhOvhPabxHuntingQueueRecordDisablingLanguageEnum recordDisablingLanguage, Long soundOnHold, OvhOvhPabxHuntingQueueStrategyEnum strategy) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/queue"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "actionOnClosure", actionOnClosure); addBody(o, "actionOnClosureParam", actionOnClosureParam); addBody(o, "actionOnOverflow", actionOnOverflow); addBody(o, "actionOnOverflowParam", actionOnOverflowParam); addBody(o, "askForRecordDisabling", askForRecordDisabling); addBody(o, "description", description); addBody(o, "maxMember", maxMember); addBody(o, "maxWaitTime", maxWaitTime); addBody(o, "record", record); addBody(o, "recordDisablingDigit", recordDisablingDigit); addBody(o, "recordDisablingLanguage", recordDisablingLanguage); addBody(o, "soundOnHold", soundOnHold); addBody(o, "strategy", strategy); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOvhPabxHuntingQueue.class); }
java
public OvhOvhPabxHuntingQueue billingAccount_easyHunting_serviceName_hunting_queue_POST(String billingAccount, String serviceName, OvhOvhPabxQueueActionEnum actionOnClosure, String actionOnClosureParam, OvhOvhPabxQueueActionEnum actionOnOverflow, String actionOnOverflowParam, Boolean askForRecordDisabling, String description, Long maxMember, Long maxWaitTime, Boolean record, OvhOvhPabxHuntingQueueRecordDisablingDigitEnum recordDisablingDigit, OvhOvhPabxHuntingQueueRecordDisablingLanguageEnum recordDisablingLanguage, Long soundOnHold, OvhOvhPabxHuntingQueueStrategyEnum strategy) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/hunting/queue"; StringBuilder sb = path(qPath, billingAccount, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "actionOnClosure", actionOnClosure); addBody(o, "actionOnClosureParam", actionOnClosureParam); addBody(o, "actionOnOverflow", actionOnOverflow); addBody(o, "actionOnOverflowParam", actionOnOverflowParam); addBody(o, "askForRecordDisabling", askForRecordDisabling); addBody(o, "description", description); addBody(o, "maxMember", maxMember); addBody(o, "maxWaitTime", maxWaitTime); addBody(o, "record", record); addBody(o, "recordDisablingDigit", recordDisablingDigit); addBody(o, "recordDisablingLanguage", recordDisablingLanguage); addBody(o, "soundOnHold", soundOnHold); addBody(o, "strategy", strategy); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOvhPabxHuntingQueue.class); }
[ "public", "OvhOvhPabxHuntingQueue", "billingAccount_easyHunting_serviceName_hunting_queue_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhOvhPabxQueueActionEnum", "actionOnClosure", ",", "String", "actionOnClosureParam", ",", "OvhOvhPabxQueueActionEnum"...
Create a new queue REST: POST /telephony/{billingAccount}/easyHunting/{serviceName}/hunting/queue @param maxMember [required] The maximum of people waiting in the queue @param recordDisablingLanguage [required] Language of the sound played to the caller to inform that he can disable record @param description [required] The name of the queue @param strategy [required] The calls dispatching strategy @param askForRecordDisabling [required] Allow the caller to disable call record by pressing a key @param maxWaitTime [required] The maximum waiting time (in seconds) in the queue @param recordDisablingDigit [required] Key to press to disable record @param record [required] Enable record on calls in queue @param soundOnHold [required] The id of the OvhPabxSound played to caller when on hold @param actionOnOverflowParam [required] The additionnal parameter of the overflow action @param actionOnOverflow [required] Action executed when caller enters a full queue @param actionOnClosure [required] Action executed when there is no member in queue @param actionOnClosureParam [required] The additionnal parameter of the on closure action @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Create", "a", "new", "queue" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3187-L3206
TimeAndSpaceIO/SmoothieMap
src/main/java/net/openhft/smoothie/SmoothieMap.java
SmoothieMap.forEachWhile
@SuppressWarnings("unused") public final boolean forEachWhile(BiPredicate<? super K, ? super V> predicate) { Objects.requireNonNull(predicate); boolean interrupted = false; int mc = this.modCount; Segment<K, V> segment; for (long segmentIndex = 0; segmentIndex >= 0; segmentIndex = nextSegmentIndex(segmentIndex, segment)) { if (!(segment = segment(segmentIndex)).forEachWhile(predicate)) { interrupted = true; break; } } if (mc != modCount) throw new ConcurrentModificationException(); return !interrupted; }
java
@SuppressWarnings("unused") public final boolean forEachWhile(BiPredicate<? super K, ? super V> predicate) { Objects.requireNonNull(predicate); boolean interrupted = false; int mc = this.modCount; Segment<K, V> segment; for (long segmentIndex = 0; segmentIndex >= 0; segmentIndex = nextSegmentIndex(segmentIndex, segment)) { if (!(segment = segment(segmentIndex)).forEachWhile(predicate)) { interrupted = true; break; } } if (mc != modCount) throw new ConcurrentModificationException(); return !interrupted; }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "final", "boolean", "forEachWhile", "(", "BiPredicate", "<", "?", "super", "K", ",", "?", "super", "V", ">", "predicate", ")", "{", "Objects", ".", "requireNonNull", "(", "predicate", ")", ";", "bo...
Checks the given {@code predicate} on each entry in this map until all entries have been processed or the predicate returns false for some entry, or throws an Exception. Exceptions thrown by the predicate are relayed to the caller. <p>The entries will be processed in the same order as the entry set iterator, and {@link #forEach(BiConsumer)} order. <p>If the map is empty, this method returns {@code true} immediately. @param predicate the predicate to be checked for each entry @return {@code true} if the predicate returned {@code true} for all entries of the map, {@code false} if it returned {@code false} for some entry @throws NullPointerException if the given {@code predicate} is {@code null} @throws ConcurrentModificationException if any structural modification of the map (new entry insertion or an entry removal) is detected during iteration @see #forEach(BiConsumer)
[ "Checks", "the", "given", "{", "@code", "predicate", "}", "on", "each", "entry", "in", "this", "map", "until", "all", "entries", "have", "been", "processed", "or", "the", "predicate", "returns", "false", "for", "some", "entry", "or", "throws", "an", "Excep...
train
https://github.com/TimeAndSpaceIO/SmoothieMap/blob/c798f6cae1d377f6913e8821a1fcf5bf45ee0412/src/main/java/net/openhft/smoothie/SmoothieMap.java#L1079-L1095
kiegroup/jbpm
jbpm-services/jbpm-services-cdi/src/main/java/org/jbpm/services/cdi/impl/manager/InjectableRegisterableItemsFactory.java
InjectableRegisterableItemsFactory.getFactory
public static RegisterableItemsFactory getFactory(BeanManager beanManager, AbstractAuditLogger auditlogger) { InjectableRegisterableItemsFactory instance = getInstanceByType(beanManager, InjectableRegisterableItemsFactory.class, new Annotation[]{}); instance.setAuditlogger(auditlogger); return instance; }
java
public static RegisterableItemsFactory getFactory(BeanManager beanManager, AbstractAuditLogger auditlogger) { InjectableRegisterableItemsFactory instance = getInstanceByType(beanManager, InjectableRegisterableItemsFactory.class, new Annotation[]{}); instance.setAuditlogger(auditlogger); return instance; }
[ "public", "static", "RegisterableItemsFactory", "getFactory", "(", "BeanManager", "beanManager", ",", "AbstractAuditLogger", "auditlogger", ")", "{", "InjectableRegisterableItemsFactory", "instance", "=", "getInstanceByType", "(", "beanManager", ",", "InjectableRegisterableItem...
Allows us to create an instance of this class dynamically via <code>BeanManager</code>. This is useful in case multiple independent instances are required on runtime and that need cannot be satisfied with regular CDI practices. @param beanManager - bean manager instance of the container @param auditlogger - <code>AbstractAuditLogger</code> logger instance to be used, might be null @return new instance of the factory
[ "Allows", "us", "to", "create", "an", "instance", "of", "this", "class", "dynamically", "via", "<code", ">", "BeanManager<", "/", "code", ">", ".", "This", "is", "useful", "in", "case", "multiple", "independent", "instances", "are", "required", "on", "runtim...
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-services/jbpm-services-cdi/src/main/java/org/jbpm/services/cdi/impl/manager/InjectableRegisterableItemsFactory.java#L290-L294
to2mbn/JMCCC
jmccc-yggdrasil-authenticator/src/main/java/org/to2mbn/jmccc/auth/yggdrasil/YggdrasilAuthenticator.java
YggdrasilAuthenticator.refreshWithToken
public synchronized void refreshWithToken(String clientToken, String accessToken) throws AuthenticationException { authResult = authenticationService.refresh(Objects.requireNonNull(clientToken), Objects.requireNonNull(accessToken)); }
java
public synchronized void refreshWithToken(String clientToken, String accessToken) throws AuthenticationException { authResult = authenticationService.refresh(Objects.requireNonNull(clientToken), Objects.requireNonNull(accessToken)); }
[ "public", "synchronized", "void", "refreshWithToken", "(", "String", "clientToken", ",", "String", "accessToken", ")", "throws", "AuthenticationException", "{", "authResult", "=", "authenticationService", ".", "refresh", "(", "Objects", ".", "requireNonNull", "(", "cl...
Refreshes the current session manually using token. @param clientToken the client token @param accessToken the access token @throws AuthenticationException If an exception occurs during the authentication
[ "Refreshes", "the", "current", "session", "manually", "using", "token", "." ]
train
https://github.com/to2mbn/JMCCC/blob/17e5b1b56ff18255cfd60976dca1a24598946647/jmccc-yggdrasil-authenticator/src/main/java/org/to2mbn/jmccc/auth/yggdrasil/YggdrasilAuthenticator.java#L397-L399
Stratio/stratio-cassandra
src/java/org/apache/cassandra/repair/Differencer.java
Differencer.run
public void run() { // compare trees, and collect differences differences.addAll(MerkleTree.difference(r1.tree, r2.tree)); // choose a repair method based on the significance of the difference String format = String.format("[repair #%s] Endpoints %s and %s %%s for %s", desc.sessionId, r1.endpoint, r2.endpoint, desc.columnFamily); if (differences.isEmpty()) { logger.info(String.format(format, "are consistent")); // send back sync complete message MessagingService.instance().sendOneWay(new SyncComplete(desc, r1.endpoint, r2.endpoint, true).createMessage(), FBUtilities.getLocalAddress()); return; } // non-0 difference: perform streaming repair logger.info(String.format(format, "have " + differences.size() + " range(s) out of sync")); performStreamingRepair(); }
java
public void run() { // compare trees, and collect differences differences.addAll(MerkleTree.difference(r1.tree, r2.tree)); // choose a repair method based on the significance of the difference String format = String.format("[repair #%s] Endpoints %s and %s %%s for %s", desc.sessionId, r1.endpoint, r2.endpoint, desc.columnFamily); if (differences.isEmpty()) { logger.info(String.format(format, "are consistent")); // send back sync complete message MessagingService.instance().sendOneWay(new SyncComplete(desc, r1.endpoint, r2.endpoint, true).createMessage(), FBUtilities.getLocalAddress()); return; } // non-0 difference: perform streaming repair logger.info(String.format(format, "have " + differences.size() + " range(s) out of sync")); performStreamingRepair(); }
[ "public", "void", "run", "(", ")", "{", "// compare trees, and collect differences", "differences", ".", "addAll", "(", "MerkleTree", ".", "difference", "(", "r1", ".", "tree", ",", "r2", ".", "tree", ")", ")", ";", "// choose a repair method based on the significan...
Compares our trees, and triggers repairs for any ranges that mismatch.
[ "Compares", "our", "trees", "and", "triggers", "repairs", "for", "any", "ranges", "that", "mismatch", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/repair/Differencer.java#L58-L76
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java
CollationBuilder.findCommonNode
private int findCommonNode(int index, int strength) { assert(Collator.SECONDARY <= strength && strength <= Collator.TERTIARY); long node = nodes.elementAti(index); if(strengthFromNode(node) >= strength) { // The current node is no stronger. return index; } if(strength == Collator.SECONDARY ? !nodeHasBefore2(node) : !nodeHasBefore3(node)) { // The current node implies the strength-common weight. return index; } index = nextIndexFromNode(node); node = nodes.elementAti(index); assert(!isTailoredNode(node) && strengthFromNode(node) == strength && weight16FromNode(node) < Collation.COMMON_WEIGHT16); // Skip to the explicit common node. do { index = nextIndexFromNode(node); node = nodes.elementAti(index); assert(strengthFromNode(node) >= strength); } while(isTailoredNode(node) || strengthFromNode(node) > strength || weight16FromNode(node) < Collation.COMMON_WEIGHT16); assert(weight16FromNode(node) == Collation.COMMON_WEIGHT16); return index; }
java
private int findCommonNode(int index, int strength) { assert(Collator.SECONDARY <= strength && strength <= Collator.TERTIARY); long node = nodes.elementAti(index); if(strengthFromNode(node) >= strength) { // The current node is no stronger. return index; } if(strength == Collator.SECONDARY ? !nodeHasBefore2(node) : !nodeHasBefore3(node)) { // The current node implies the strength-common weight. return index; } index = nextIndexFromNode(node); node = nodes.elementAti(index); assert(!isTailoredNode(node) && strengthFromNode(node) == strength && weight16FromNode(node) < Collation.COMMON_WEIGHT16); // Skip to the explicit common node. do { index = nextIndexFromNode(node); node = nodes.elementAti(index); assert(strengthFromNode(node) >= strength); } while(isTailoredNode(node) || strengthFromNode(node) > strength || weight16FromNode(node) < Collation.COMMON_WEIGHT16); assert(weight16FromNode(node) == Collation.COMMON_WEIGHT16); return index; }
[ "private", "int", "findCommonNode", "(", "int", "index", ",", "int", "strength", ")", "{", "assert", "(", "Collator", ".", "SECONDARY", "<=", "strength", "&&", "strength", "<=", "Collator", ".", "TERTIARY", ")", ";", "long", "node", "=", "nodes", ".", "e...
Finds the node which implies or contains a common=05 weight of the given strength (secondary or tertiary), if the current node is stronger. Skips weaker nodes and tailored nodes if the current node is stronger and is followed by an explicit-common-weight node. Always returns the input index if that node is no stronger than the given strength.
[ "Finds", "the", "node", "which", "implies", "or", "contains", "a", "common", "=", "05", "weight", "of", "the", "given", "strength", "(", "secondary", "or", "tertiary", ")", "if", "the", "current", "node", "is", "stronger", ".", "Skips", "weaker", "nodes", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationBuilder.java#L754-L778
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java
CollectionExtensions.operator_remove
@Inline(value="$1.remove($2)") public static <E> boolean operator_remove(Collection<? super E> collection, E value) { return collection.remove(value); }
java
@Inline(value="$1.remove($2)") public static <E> boolean operator_remove(Collection<? super E> collection, E value) { return collection.remove(value); }
[ "@", "Inline", "(", "value", "=", "\"$1.remove($2)\"", ")", "public", "static", "<", "E", ">", "boolean", "operator_remove", "(", "Collection", "<", "?", "super", "E", ">", "collection", ",", "E", "value", ")", "{", "return", "collection", ".", "remove", ...
The operator mapping from {@code -=} to {@link Collection#remove(Object)}. Returns <code>true</code> if the collection changed due to this operation. @param collection the to-be-changed collection. May not be <code>null</code>. @param value the value that should be removed from the collection. @return <code>true</code> if the collection changed due to this operation. @see Collection#remove(Object) @since 2.4
[ "The", "operator", "mapping", "from", "{", "@code", "-", "=", "}", "to", "{", "@link", "Collection#remove", "(", "Object", ")", "}", ".", "Returns", "<code", ">", "true<", "/", "code", ">", "if", "the", "collection", "changed", "due", "to", "this", "op...
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java#L82-L85
codeprimate-software/cp-elements
src/main/java/org/cp/elements/text/FormatUtils.java
FormatUtils.messageFormat
protected static String messageFormat(String textPattern, Object... args) { return MessageFormat.format(textPattern, args); }
java
protected static String messageFormat(String textPattern, Object... args) { return MessageFormat.format(textPattern, args); }
[ "protected", "static", "String", "messageFormat", "(", "String", "textPattern", ",", "Object", "...", "args", ")", "{", "return", "MessageFormat", ".", "format", "(", "textPattern", ",", "args", ")", ";", "}" ]
Formats the given {@link String} of text using the {@link MessageFormat} class. @param textPattern {@link String} text pattern to format. @param args array of {@link Object} arguments to apply to the text pattern. @return a formatted {@link String} of text with the arguments applied to the text pattern using the {@link MessageFormat} class. @see java.text.MessageFormat @see java.lang.String
[ "Formats", "the", "given", "{", "@link", "String", "}", "of", "text", "using", "the", "{", "@link", "MessageFormat", "}", "class", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/text/FormatUtils.java#L56-L58
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java
AbstractFrameModelingVisitor.modelInstruction
public void modelInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced, Value pushValue) { if (frame.getStackDepth() < numWordsConsumed) { try { throw new IllegalArgumentException(" asked to pop " + numWordsConsumed + " stack elements but only " + frame.getStackDepth() + " elements remain in " + frame + " while processing " + ins); } catch (Exception e) { throw new IllegalArgumentException(" asked to pop " + numWordsConsumed + " stack elements but only " + frame.getStackDepth() + " elements remain while processing " + ins); } } try { while (numWordsConsumed-- > 0) { frame.popValue(); } } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException("Not enough values on the stack", e); } while (numWordsProduced-- > 0) { frame.pushValue(pushValue); } }
java
public void modelInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced, Value pushValue) { if (frame.getStackDepth() < numWordsConsumed) { try { throw new IllegalArgumentException(" asked to pop " + numWordsConsumed + " stack elements but only " + frame.getStackDepth() + " elements remain in " + frame + " while processing " + ins); } catch (Exception e) { throw new IllegalArgumentException(" asked to pop " + numWordsConsumed + " stack elements but only " + frame.getStackDepth() + " elements remain while processing " + ins); } } try { while (numWordsConsumed-- > 0) { frame.popValue(); } } catch (DataflowAnalysisException e) { throw new InvalidBytecodeException("Not enough values on the stack", e); } while (numWordsProduced-- > 0) { frame.pushValue(pushValue); } }
[ "public", "void", "modelInstruction", "(", "Instruction", "ins", ",", "int", "numWordsConsumed", ",", "int", "numWordsProduced", ",", "Value", "pushValue", ")", "{", "if", "(", "frame", ".", "getStackDepth", "(", ")", "<", "numWordsConsumed", ")", "{", "try", ...
Primitive to model the stack effect of a single instruction, explicitly specifying the value to be pushed on the stack. @param ins the Instruction to model @param numWordsConsumed number of stack words consumed @param numWordsProduced number of stack words produced @param pushValue value to push on the stack
[ "Primitive", "to", "model", "the", "stack", "effect", "of", "a", "single", "instruction", "explicitly", "specifying", "the", "value", "to", "be", "pushed", "on", "the", "stack", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java#L390-L411
banq/jdonframework
src/main/java/com/jdon/container/pico/JdonPicoContainer.java
JdonPicoContainer.registerComponentImplementation
public ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation, List parameters) throws PicoRegistrationException { Parameter[] parametersAsArray = (Parameter[]) parameters.toArray(new Parameter[parameters.size()]); return registerComponentImplementation(componentKey, componentImplementation, parametersAsArray); }
java
public ComponentAdapter registerComponentImplementation(Object componentKey, Class componentImplementation, List parameters) throws PicoRegistrationException { Parameter[] parametersAsArray = (Parameter[]) parameters.toArray(new Parameter[parameters.size()]); return registerComponentImplementation(componentKey, componentImplementation, parametersAsArray); }
[ "public", "ComponentAdapter", "registerComponentImplementation", "(", "Object", "componentKey", ",", "Class", "componentImplementation", ",", "List", "parameters", ")", "throws", "PicoRegistrationException", "{", "Parameter", "[", "]", "parametersAsArray", "=", "(", "Para...
Same as {@link #registerComponentImplementation(java.lang.Object, java.lang.Class, org.picocontainer.Parameter[])} but with parameters as a {@link List}. Makes it possible to use with Groovy arrays (which are actually Lists).
[ "Same", "as", "{" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/container/pico/JdonPicoContainer.java#L279-L283
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/Compound.java
Compound.out2field
public void out2field(Object from, String from_out, Object o) { out2field(from, from_out, o, from_out); }
java
public void out2field(Object from, String from_out, Object o) { out2field(from, from_out, o, from_out); }
[ "public", "void", "out2field", "(", "Object", "from", ",", "String", "from_out", ",", "Object", "o", ")", "{", "out2field", "(", "from", ",", "from_out", ",", "o", ",", "from_out", ")", ";", "}" ]
Maps a component Out field to an object's field. Both field have the same name. @param from the component @param from_out the component's Out field. @param o the object
[ "Maps", "a", "component", "Out", "field", "to", "an", "object", "s", "field", ".", "Both", "field", "have", "the", "same", "name", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Compound.java#L230-L232
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.iamin
public SDVariable iamin(String name, SDVariable in, int... dimensions) { return iamin(name, in, false, dimensions); }
java
public SDVariable iamin(String name, SDVariable in, int... dimensions) { return iamin(name, in, false, dimensions); }
[ "public", "SDVariable", "iamin", "(", "String", "name", ",", "SDVariable", "in", ",", "int", "...", "dimensions", ")", "{", "return", "iamin", "(", "name", ",", "in", ",", "false", ",", "dimensions", ")", ";", "}" ]
Index of the min absolute value: argmin(abs(in)) @see SameDiff#argmin(String, SDVariable, boolean, int...)
[ "Index", "of", "the", "min", "absolute", "value", ":", "argmin", "(", "abs", "(", "in", "))" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L1250-L1252
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201902/inventoryservice/GetAdUnitHierarchy.java
GetAdUnitHierarchy.buildAndDisplayAdUnitTree
private static void buildAndDisplayAdUnitTree(AdUnit root, List<AdUnit> adUnits) { Map<String, List<AdUnit>> treeMap = new HashMap<String, List<AdUnit>>(); for (AdUnit adUnit : adUnits) { if (adUnit.getParentId() != null) { if (treeMap.get(adUnit.getParentId()) == null) { treeMap.put(adUnit.getParentId(), new ArrayList<AdUnit>()); } treeMap.get(adUnit.getParentId()).add(adUnit); } } if (root != null) { displayInventoryTree(root, treeMap); } else { System.out.println("No root unit found."); } }
java
private static void buildAndDisplayAdUnitTree(AdUnit root, List<AdUnit> adUnits) { Map<String, List<AdUnit>> treeMap = new HashMap<String, List<AdUnit>>(); for (AdUnit adUnit : adUnits) { if (adUnit.getParentId() != null) { if (treeMap.get(adUnit.getParentId()) == null) { treeMap.put(adUnit.getParentId(), new ArrayList<AdUnit>()); } treeMap.get(adUnit.getParentId()).add(adUnit); } } if (root != null) { displayInventoryTree(root, treeMap); } else { System.out.println("No root unit found."); } }
[ "private", "static", "void", "buildAndDisplayAdUnitTree", "(", "AdUnit", "root", ",", "List", "<", "AdUnit", ">", "adUnits", ")", "{", "Map", "<", "String", ",", "List", "<", "AdUnit", ">", ">", "treeMap", "=", "new", "HashMap", "<", "String", ",", "List...
Builds and displays an ad unit tree from ad units underneath the root ad unit. @param root the root ad unit to build the tree under @param adUnits the ad units.
[ "Builds", "and", "displays", "an", "ad", "unit", "tree", "from", "ad", "units", "underneath", "the", "root", "ad", "unit", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/inventoryservice/GetAdUnitHierarchy.java#L128-L146
BlueBrain/bluima
modules/bluima_abbreviations/src/main/java/com/wcohen/ss/SoftTFIDF.java
SoftTFIDF.explainScore
public String explainScore(StringWrapper s, StringWrapper t) { BagOfTokens sBag = (BagOfTokens) s; BagOfTokens tBag = (BagOfTokens) t; StringBuilder buf = new StringBuilder(""); PrintfFormat fmt = new PrintfFormat("%.3f"); buf.append("Common tokens: "); for (Iterator<Token> i = sBag.tokenIterator(); i.hasNext();) { Token tok = i.next(); if (tBag.contains(tok)) { buf.append(" " + tok.getValue() + ": "); buf.append(fmt.sprintf(sBag.getWeight(tok))); buf.append("*"); buf.append(fmt.sprintf(tBag.getWeight(tok))); } else { // find best matching token double matchScore = tokenMatchThreshold; Token matchTok = null; for (Iterator<Token> j = tBag.tokenIterator(); j.hasNext();) { Token tokJ = j.next(); double distItoJ = tokenDistance.score(tok.getValue(), tokJ.getValue()); if (distItoJ >= matchScore) { matchTok = tokJ; matchScore = distItoJ; } } if (matchTok != null) { buf.append(" '" + tok.getValue() + "'~='" + matchTok.getValue() + "': "); buf.append(fmt.sprintf(sBag.getWeight(tok))); buf.append("*"); buf.append(fmt.sprintf(tBag.getWeight(matchTok))); buf.append("*"); buf.append(fmt.sprintf(matchScore)); } } } buf.append("\nscore = " + score(s, t)); return buf.toString(); }
java
public String explainScore(StringWrapper s, StringWrapper t) { BagOfTokens sBag = (BagOfTokens) s; BagOfTokens tBag = (BagOfTokens) t; StringBuilder buf = new StringBuilder(""); PrintfFormat fmt = new PrintfFormat("%.3f"); buf.append("Common tokens: "); for (Iterator<Token> i = sBag.tokenIterator(); i.hasNext();) { Token tok = i.next(); if (tBag.contains(tok)) { buf.append(" " + tok.getValue() + ": "); buf.append(fmt.sprintf(sBag.getWeight(tok))); buf.append("*"); buf.append(fmt.sprintf(tBag.getWeight(tok))); } else { // find best matching token double matchScore = tokenMatchThreshold; Token matchTok = null; for (Iterator<Token> j = tBag.tokenIterator(); j.hasNext();) { Token tokJ = j.next(); double distItoJ = tokenDistance.score(tok.getValue(), tokJ.getValue()); if (distItoJ >= matchScore) { matchTok = tokJ; matchScore = distItoJ; } } if (matchTok != null) { buf.append(" '" + tok.getValue() + "'~='" + matchTok.getValue() + "': "); buf.append(fmt.sprintf(sBag.getWeight(tok))); buf.append("*"); buf.append(fmt.sprintf(tBag.getWeight(matchTok))); buf.append("*"); buf.append(fmt.sprintf(matchScore)); } } } buf.append("\nscore = " + score(s, t)); return buf.toString(); }
[ "public", "String", "explainScore", "(", "StringWrapper", "s", ",", "StringWrapper", "t", ")", "{", "BagOfTokens", "sBag", "=", "(", "BagOfTokens", ")", "s", ";", "BagOfTokens", "tBag", "=", "(", "BagOfTokens", ")", "t", ";", "StringBuilder", "buf", "=", "...
Explain how the distance was computed. In the output, the tokens in S and T are listed, and the common tokens are marked with an asterisk.
[ "Explain", "how", "the", "distance", "was", "computed", ".", "In", "the", "output", "the", "tokens", "in", "S", "and", "T", "are", "listed", "and", "the", "common", "tokens", "are", "marked", "with", "an", "asterisk", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/SoftTFIDF.java#L128-L165
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/debug/LogMonitor.java
LogMonitor.startSession
public static void startSession(final Context context, final String appKey, final String appSignature) { dispatchOnConversationQueue(new DispatchTask() { @Override protected void execute() { try { startSessionGuarded(context, appKey, appSignature); } catch (Exception e) { ApptentiveLog.e(TROUBLESHOOT, e, "Unable to start Apptentive Log Monitor"); logException(e); } } }); }
java
public static void startSession(final Context context, final String appKey, final String appSignature) { dispatchOnConversationQueue(new DispatchTask() { @Override protected void execute() { try { startSessionGuarded(context, appKey, appSignature); } catch (Exception e) { ApptentiveLog.e(TROUBLESHOOT, e, "Unable to start Apptentive Log Monitor"); logException(e); } } }); }
[ "public", "static", "void", "startSession", "(", "final", "Context", "context", ",", "final", "String", "appKey", ",", "final", "String", "appSignature", ")", "{", "dispatchOnConversationQueue", "(", "new", "DispatchTask", "(", ")", "{", "@", "Override", "protec...
Attempts to start a new troubleshooting session. First the SDK will check if there is an existing session stored in the persistent storage and then check if the clipboard contains a valid access token. This call is async and returns immediately.
[ "Attempts", "to", "start", "a", "new", "troubleshooting", "session", ".", "First", "the", "SDK", "will", "check", "if", "there", "is", "an", "existing", "session", "stored", "in", "the", "persistent", "storage", "and", "then", "check", "if", "the", "clipboar...
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/debug/LogMonitor.java#L61-L73
mikepenz/Materialize
library/src/main/java/com/mikepenz/materialize/Materialize.java
Materialize.keyboardSupportEnabled
public void keyboardSupportEnabled(Activity activity, boolean enable) { if (getContent() != null && getContent().getChildCount() > 0) { if (mKeyboardUtil == null) { mKeyboardUtil = new KeyboardUtil(activity, getContent().getChildAt(0)); mKeyboardUtil.disable(); } if (enable) { mKeyboardUtil.enable(); } else { mKeyboardUtil.disable(); } } }
java
public void keyboardSupportEnabled(Activity activity, boolean enable) { if (getContent() != null && getContent().getChildCount() > 0) { if (mKeyboardUtil == null) { mKeyboardUtil = new KeyboardUtil(activity, getContent().getChildAt(0)); mKeyboardUtil.disable(); } if (enable) { mKeyboardUtil.enable(); } else { mKeyboardUtil.disable(); } } }
[ "public", "void", "keyboardSupportEnabled", "(", "Activity", "activity", ",", "boolean", "enable", ")", "{", "if", "(", "getContent", "(", ")", "!=", "null", "&&", "getContent", "(", ")", ".", "getChildCount", "(", ")", ">", "0", ")", "{", "if", "(", "...
a helper method to enable the keyboardUtil for a specific activity or disable it. note this will cause some frame drops because of the listener. @param activity @param enable
[ "a", "helper", "method", "to", "enable", "the", "keyboardUtil", "for", "a", "specific", "activity", "or", "disable", "it", ".", "note", "this", "will", "cause", "some", "frame", "drops", "because", "of", "the", "listener", "." ]
train
https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/Materialize.java#L99-L112
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PacketCapturesInner.java
PacketCapturesInner.beginStop
public void beginStop(String resourceGroupName, String networkWatcherName, String packetCaptureName) { beginStopWithServiceResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName).toBlocking().single().body(); }
java
public void beginStop(String resourceGroupName, String networkWatcherName, String packetCaptureName) { beginStopWithServiceResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName).toBlocking().single().body(); }
[ "public", "void", "beginStop", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "String", "packetCaptureName", ")", "{", "beginStopWithServiceResponseAsync", "(", "resourceGroupName", ",", "networkWatcherName", ",", "packetCaptureName", ")", "...
Stops a specified packet capture session. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param packetCaptureName The name of the packet capture session. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Stops", "a", "specified", "packet", "capture", "session", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PacketCapturesInner.java#L625-L627
liferay/com-liferay-commerce
commerce-notification-api/src/main/java/com/liferay/commerce/notification/service/persistence/CommerceNotificationTemplateUtil.java
CommerceNotificationTemplateUtil.countByG_T_E
public static int countByG_T_E(long groupId, String type, boolean enabled) { return getPersistence().countByG_T_E(groupId, type, enabled); }
java
public static int countByG_T_E(long groupId, String type, boolean enabled) { return getPersistence().countByG_T_E(groupId, type, enabled); }
[ "public", "static", "int", "countByG_T_E", "(", "long", "groupId", ",", "String", "type", ",", "boolean", "enabled", ")", "{", "return", "getPersistence", "(", ")", ".", "countByG_T_E", "(", "groupId", ",", "type", ",", "enabled", ")", ";", "}" ]
Returns the number of commerce notification templates where groupId = &#63; and type = &#63; and enabled = &#63;. @param groupId the group ID @param type the type @param enabled the enabled @return the number of matching commerce notification templates
[ "Returns", "the", "number", "of", "commerce", "notification", "templates", "where", "groupId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "and", "enabled", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-api/src/main/java/com/liferay/commerce/notification/service/persistence/CommerceNotificationTemplateUtil.java#L1284-L1286
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/Strings.java
Strings.join
public static String join(final String[] seq, final String delimiter) { if (null == seq || seq.length < 1) return ""; Assert.notNull(delimiter); StringBuilder aim = new StringBuilder(); for (int i = 0; i < seq.length; i++) { if (aim.length() > 0) aim.append(delimiter); aim.append(seq[i]); } return aim.toString(); }
java
public static String join(final String[] seq, final String delimiter) { if (null == seq || seq.length < 1) return ""; Assert.notNull(delimiter); StringBuilder aim = new StringBuilder(); for (int i = 0; i < seq.length; i++) { if (aim.length() > 0) aim.append(delimiter); aim.append(seq[i]); } return aim.toString(); }
[ "public", "static", "String", "join", "(", "final", "String", "[", "]", "seq", ",", "final", "String", "delimiter", ")", "{", "if", "(", "null", "==", "seq", "||", "seq", ".", "length", "<", "1", ")", "return", "\"\"", ";", "Assert", ".", "notNull", ...
将数组中的字符串,用delimiter串接起来.<br> 首尾不加delimiter @param seq an array of {@link java.lang.String} objects. @param delimiter a {@link java.lang.String} object. @return a {@link java.lang.String} object.
[ "将数组中的字符串,用delimiter串接起来", ".", "<br", ">", "首尾不加delimiter" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L462-L471
alkacon/opencms-core
src/org/opencms/widgets/CmsHtmlWidgetOption.java
CmsHtmlWidgetOption.getButtonName
protected String getButtonName(String barItem, Map<String, String> buttonNamesLookUp) { String result = barItem; if (buttonNamesLookUp != null) { String translatedName = buttonNamesLookUp.get(barItem); if (CmsStringUtil.isNotEmpty(translatedName)) { result = translatedName; } } return result; }
java
protected String getButtonName(String barItem, Map<String, String> buttonNamesLookUp) { String result = barItem; if (buttonNamesLookUp != null) { String translatedName = buttonNamesLookUp.get(barItem); if (CmsStringUtil.isNotEmpty(translatedName)) { result = translatedName; } } return result; }
[ "protected", "String", "getButtonName", "(", "String", "barItem", ",", "Map", "<", "String", ",", "String", ">", "buttonNamesLookUp", ")", "{", "String", "result", "=", "barItem", ";", "if", "(", "buttonNamesLookUp", "!=", "null", ")", "{", "String", "transl...
Returns the real button name matched with the look up map.<p> If no value is found in the look up map, the button name is returned unchanged.<p> @param barItem the button bar item name to look up @param buttonNamesLookUp the look up map containing the button names and/or separator name to use @return the translated button name
[ "Returns", "the", "real", "button", "name", "matched", "with", "the", "look", "up", "map", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/CmsHtmlWidgetOption.java#L1146-L1156
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java
JSVariant.box
JSchema box(Map context) { if (boxed != null) return boxed; // only do it once JSVariant subTop = new JSVariant(); subTop.cases = cases; subTop.boxedBy = this; boxed = (JSchema)context.get(subTop); if (boxed == null) { boxed = new JSchema(subTop, context); for (int i = 0; i < cases.length; i++) cases[i].parent = subTop; context.put(subTop, boxed); } return boxed; }
java
JSchema box(Map context) { if (boxed != null) return boxed; // only do it once JSVariant subTop = new JSVariant(); subTop.cases = cases; subTop.boxedBy = this; boxed = (JSchema)context.get(subTop); if (boxed == null) { boxed = new JSchema(subTop, context); for (int i = 0; i < cases.length; i++) cases[i].parent = subTop; context.put(subTop, boxed); } return boxed; }
[ "JSchema", "box", "(", "Map", "context", ")", "{", "if", "(", "boxed", "!=", "null", ")", "return", "boxed", ";", "// only do it once", "JSVariant", "subTop", "=", "new", "JSVariant", "(", ")", ";", "subTop", ".", "cases", "=", "cases", ";", "subTop", ...
includes a cyclic reference to a JSchema already under construction.
[ "includes", "a", "cyclic", "reference", "to", "a", "JSchema", "already", "under", "construction", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSVariant.java#L195-L209
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/GosuExceptionUtil.java
GosuExceptionUtil.findException
public static <T extends Throwable> T findException(Class<T> exceptionTypeToFind, Throwable t) { Throwable cause = t; while (cause != null) { if( exceptionTypeToFind.isAssignableFrom( cause.getClass() ) ) { //noinspection unchecked return (T)cause; } if( cause == cause.getCause() ) { return null; } cause = cause.getCause(); } return null; }
java
public static <T extends Throwable> T findException(Class<T> exceptionTypeToFind, Throwable t) { Throwable cause = t; while (cause != null) { if( exceptionTypeToFind.isAssignableFrom( cause.getClass() ) ) { //noinspection unchecked return (T)cause; } if( cause == cause.getCause() ) { return null; } cause = cause.getCause(); } return null; }
[ "public", "static", "<", "T", "extends", "Throwable", ">", "T", "findException", "(", "Class", "<", "T", ">", "exceptionTypeToFind", ",", "Throwable", "t", ")", "{", "Throwable", "cause", "=", "t", ";", "while", "(", "cause", "!=", "null", ")", "{", "i...
Given an Exception and an Exception type to look for, finds the exception of that type or returns null if none of that type exist.
[ "Given", "an", "Exception", "and", "an", "Exception", "type", "to", "look", "for", "finds", "the", "exception", "of", "that", "type", "or", "returns", "null", "if", "none", "of", "that", "type", "exist", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuExceptionUtil.java#L91-L110
strator-dev/greenpepper
greenpepper/core/src/main/java/com/greenpepper/interpreter/flow/dowith/EndRow.java
EndRow.interpret
@Override public void interpret(Specification table) { Example row = table.nextExample(); Statistics statistics = new Statistics(0, 0, 0, 0); if (table.hasMoreExamples()) { SyntaxException e = new SyntaxException("end", "This keyword should end the table"); statistics.exception(); CollectionUtil.first( keywordCells(row) ).annotate( Annotations.exception( e ) ); } if (row.at(0, 1) != null) { SyntaxException e = new SyntaxException("end", "This keyword doesn't take any argument"); statistics.exception(); CollectionUtil.first( keywordCells(row) ).annotate( Annotations.exception( e ) ); } table.exampleDone(statistics); }
java
@Override public void interpret(Specification table) { Example row = table.nextExample(); Statistics statistics = new Statistics(0, 0, 0, 0); if (table.hasMoreExamples()) { SyntaxException e = new SyntaxException("end", "This keyword should end the table"); statistics.exception(); CollectionUtil.first( keywordCells(row) ).annotate( Annotations.exception( e ) ); } if (row.at(0, 1) != null) { SyntaxException e = new SyntaxException("end", "This keyword doesn't take any argument"); statistics.exception(); CollectionUtil.first( keywordCells(row) ).annotate( Annotations.exception( e ) ); } table.exampleDone(statistics); }
[ "@", "Override", "public", "void", "interpret", "(", "Specification", "table", ")", "{", "Example", "row", "=", "table", ".", "nextExample", "(", ")", ";", "Statistics", "statistics", "=", "new", "Statistics", "(", "0", ",", "0", ",", "0", ",", "0", ")...
{@inheritDoc} Cases of failures : <ul> <li>this row is not the last row of the Specification table</li> <li>there is more than one cell in this row</li> </ul>
[ "{", "@inheritDoc", "}" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/core/src/main/java/com/greenpepper/interpreter/flow/dowith/EndRow.java#L41-L57
apache/spark
common/network-common/src/main/java/org/apache/spark/network/util/CryptoUtils.java
CryptoUtils.toCryptoConf
public static Properties toCryptoConf(String prefix, Iterable<Map.Entry<String, String>> conf) { Properties props = new Properties(); for (Map.Entry<String, String> e : conf) { String key = e.getKey(); if (key.startsWith(prefix)) { props.setProperty(COMMONS_CRYPTO_CONFIG_PREFIX + key.substring(prefix.length()), e.getValue()); } } return props; }
java
public static Properties toCryptoConf(String prefix, Iterable<Map.Entry<String, String>> conf) { Properties props = new Properties(); for (Map.Entry<String, String> e : conf) { String key = e.getKey(); if (key.startsWith(prefix)) { props.setProperty(COMMONS_CRYPTO_CONFIG_PREFIX + key.substring(prefix.length()), e.getValue()); } } return props; }
[ "public", "static", "Properties", "toCryptoConf", "(", "String", "prefix", ",", "Iterable", "<", "Map", ".", "Entry", "<", "String", ",", "String", ">", ">", "conf", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "for", "(", ...
Extract the commons-crypto configuration embedded in a list of config values. @param prefix Prefix in the given configuration that identifies the commons-crypto configs. @param conf List of configuration values.
[ "Extract", "the", "commons", "-", "crypto", "configuration", "embedded", "in", "a", "list", "of", "config", "values", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/util/CryptoUtils.java#L37-L47
googleapis/google-cloud-java
google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java
MetricsClient.updateLogMetric
public final LogMetric updateLogMetric(MetricName metricName, LogMetric metric) { UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder() .setMetricName(metricName == null ? null : metricName.toString()) .setMetric(metric) .build(); return updateLogMetric(request); }
java
public final LogMetric updateLogMetric(MetricName metricName, LogMetric metric) { UpdateLogMetricRequest request = UpdateLogMetricRequest.newBuilder() .setMetricName(metricName == null ? null : metricName.toString()) .setMetric(metric) .build(); return updateLogMetric(request); }
[ "public", "final", "LogMetric", "updateLogMetric", "(", "MetricName", "metricName", ",", "LogMetric", "metric", ")", "{", "UpdateLogMetricRequest", "request", "=", "UpdateLogMetricRequest", ".", "newBuilder", "(", ")", ".", "setMetricName", "(", "metricName", "==", ...
Creates or updates a logs-based metric. <p>Sample code: <pre><code> try (MetricsClient metricsClient = MetricsClient.create()) { MetricName metricName = ProjectMetricName.of("[PROJECT]", "[METRIC]"); LogMetric metric = LogMetric.newBuilder().build(); LogMetric response = metricsClient.updateLogMetric(metricName, metric); } </code></pre> @param metricName The resource name of the metric to update: <p>"projects/[PROJECT_ID]/metrics/[METRIC_ID]" <p>The updated metric must be provided in the request and it's `name` field must be the same as `[METRIC_ID]` If the metric does not exist in `[PROJECT_ID]`, then a new metric is created. @param metric The updated metric. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "or", "updates", "a", "logs", "-", "based", "metric", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/v2/MetricsClient.java#L520-L528
classgraph/classgraph
src/main/java/io/github/classgraph/ScanResultObject.java
ScanResultObject.loadClass
<T> Class<T> loadClass(final Class<T> superclassOrInterfaceType) { return loadClass(superclassOrInterfaceType, /* ignoreExceptions = */ false); }
java
<T> Class<T> loadClass(final Class<T> superclassOrInterfaceType) { return loadClass(superclassOrInterfaceType, /* ignoreExceptions = */ false); }
[ "<", "T", ">", "Class", "<", "T", ">", "loadClass", "(", "final", "Class", "<", "T", ">", "superclassOrInterfaceType", ")", "{", "return", "loadClass", "(", "superclassOrInterfaceType", ",", "/* ignoreExceptions = */", "false", ")", ";", "}" ]
Load the class named returned by {@link #getClassInfo()}, or if that returns null, the class named by {@link #getClassName()}. Returns a {@code Class<?>} reference for the class, cast to the requested superclass or interface type. @param <T> the superclass or interface type @param superclassOrInterfaceType The type to cast the resulting class reference to. @return The {@code Class<?>} reference for the referenced class, or null if the class could not be loaded (or casting failed) and ignoreExceptions is true. @throws IllegalArgumentException if the class could not be loaded or cast, and ignoreExceptions was false.
[ "Load", "the", "class", "named", "returned", "by", "{", "@link", "#getClassInfo", "()", "}", "or", "if", "that", "returns", "null", "the", "class", "named", "by", "{", "@link", "#getClassName", "()", "}", ".", "Returns", "a", "{", "@code", "Class<?", ">"...
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ScanResultObject.java#L171-L173
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/MachinetagsApi.java
MachinetagsApi.getValues
public Values getValues(String namespace, String predicate, int perPage, int page, boolean sign) throws JinxException { JinxUtils.validateParams(namespace, predicate); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.machinetags.getValues"); if (!JinxUtils.isNullOrEmpty(namespace)) { params.put("namespace", namespace); } if (!JinxUtils.isNullOrEmpty(predicate)) { params.put("predicate", predicate); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Values.class, sign); }
java
public Values getValues(String namespace, String predicate, int perPage, int page, boolean sign) throws JinxException { JinxUtils.validateParams(namespace, predicate); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.machinetags.getValues"); if (!JinxUtils.isNullOrEmpty(namespace)) { params.put("namespace", namespace); } if (!JinxUtils.isNullOrEmpty(predicate)) { params.put("predicate", predicate); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } if (page > 0) { params.put("page", Integer.toString(page)); } return jinx.flickrGet(params, Values.class, sign); }
[ "public", "Values", "getValues", "(", "String", "namespace", ",", "String", "predicate", ",", "int", "perPage", ",", "int", "page", ",", "boolean", "sign", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "namespace", ",", "predica...
Return a list of unique values for a namespace and predicate. <br> This method does not require authentication. @param namespace (Required) The namespace that all values should be restricted to. @param predicate (Required) The predicate that all values should be restricted to. @param perPage Number of photos to return per page. If this argument is less than 1, it defaults to 100. The maximum allowed value is 500. @param page The page of results to return. If this argument is less than 1, it defaults to 1. @param sign if true, the request will be signed. @return object containing a list of unique values for a namespace and predicate. @throws JinxException if required parameters are missing or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.machinetags.getValues.html">flickr.machinetags.getValues</a>
[ "Return", "a", "list", "of", "unique", "values", "for", "a", "namespace", "and", "predicate", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/MachinetagsApi.java#L186-L203
groovy/groovy-core
src/examples/org/codehaus/groovy/grails/compiler/injection/DefaultGrailsDomainClassInjector.java
DefaultGrailsDomainClassInjector.hasProperty
public static boolean hasProperty(ClassNode classNode, String propertyName) { if(classNode == null || propertyName == null || "".equals(propertyName.trim())) return false; List properties = classNode.getProperties(); for (Iterator i = properties.iterator(); i.hasNext();) { PropertyNode pn = (PropertyNode) i.next(); if(pn.getName().equals(propertyName)) return true; } return false; }
java
public static boolean hasProperty(ClassNode classNode, String propertyName) { if(classNode == null || propertyName == null || "".equals(propertyName.trim())) return false; List properties = classNode.getProperties(); for (Iterator i = properties.iterator(); i.hasNext();) { PropertyNode pn = (PropertyNode) i.next(); if(pn.getName().equals(propertyName)) return true; } return false; }
[ "public", "static", "boolean", "hasProperty", "(", "ClassNode", "classNode", ",", "String", "propertyName", ")", "{", "if", "(", "classNode", "==", "null", "||", "propertyName", "==", "null", "||", "\"\"", ".", "equals", "(", "propertyName", ".", "trim", "("...
Returns whether a classNode has the specified property or not @param classNode The ClassNode @param propertyName The name of the property @return True if the property exists in the ClassNode
[ "Returns", "whether", "a", "classNode", "has", "the", "specified", "property", "or", "not" ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/examples/org/codehaus/groovy/grails/compiler/injection/DefaultGrailsDomainClassInjector.java#L210-L221
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java
GoogleCloudStorageFileSystem.getParentPath
@Deprecated public static URI getParentPath(PathCodec pathCodec, URI path) { Preconditions.checkNotNull(path); // Root path has no parent. if (path.equals(GCS_ROOT)) { return null; } StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true); if (resourceId.isBucket()) { return GCS_ROOT; } int index; String objectName = resourceId.getObjectName(); if (FileInfo.objectHasDirectoryPath(objectName)) { index = objectName.lastIndexOf(PATH_DELIMITER, objectName.length() - 2); } else { index = objectName.lastIndexOf(PATH_DELIMITER); } return index < 0 ? pathCodec.getPath(resourceId.getBucketName(), null, true) : pathCodec.getPath(resourceId.getBucketName(), objectName.substring(0, index + 1), false); }
java
@Deprecated public static URI getParentPath(PathCodec pathCodec, URI path) { Preconditions.checkNotNull(path); // Root path has no parent. if (path.equals(GCS_ROOT)) { return null; } StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true); if (resourceId.isBucket()) { return GCS_ROOT; } int index; String objectName = resourceId.getObjectName(); if (FileInfo.objectHasDirectoryPath(objectName)) { index = objectName.lastIndexOf(PATH_DELIMITER, objectName.length() - 2); } else { index = objectName.lastIndexOf(PATH_DELIMITER); } return index < 0 ? pathCodec.getPath(resourceId.getBucketName(), null, true) : pathCodec.getPath(resourceId.getBucketName(), objectName.substring(0, index + 1), false); }
[ "@", "Deprecated", "public", "static", "URI", "getParentPath", "(", "PathCodec", "pathCodec", ",", "URI", "path", ")", "{", "Preconditions", ".", "checkNotNull", "(", "path", ")", ";", "// Root path has no parent.", "if", "(", "path", ".", "equals", "(", "GCS_...
Gets the parent directory of the given path. @deprecated This static method is included as a transitional utility and the instance method variant should be preferred. @param path Path to convert. @return Path of parent directory of the given item or null for root path.
[ "Gets", "the", "parent", "directory", "of", "the", "given", "path", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/GoogleCloudStorageFileSystem.java#L1583-L1608
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java
JSONHelpers.hasPoint
public static <P extends Enum<P>> boolean hasPoint(final JSONObject json, P e) { Object o = opt(json, e); return o != null && o != JSONObject.NULL && o instanceof JSONObject && isPoint((JSONObject) o); }
java
public static <P extends Enum<P>> boolean hasPoint(final JSONObject json, P e) { Object o = opt(json, e); return o != null && o != JSONObject.NULL && o instanceof JSONObject && isPoint((JSONObject) o); }
[ "public", "static", "<", "P", "extends", "Enum", "<", "P", ">", ">", "boolean", "hasPoint", "(", "final", "JSONObject", "json", ",", "P", "e", ")", "{", "Object", "o", "=", "opt", "(", "json", ",", "e", ")", ";", "return", "o", "!=", "null", "&&"...
Checks whether the value mapped by enum exists, is a {@link JSONObject}, has at least one field named either "x" or "y", and that if either field is present, it is a number. If at least one of the fields is present, it can be assumed that the missing field is defaulted to zero. If both are missing, it's ambiguous, at best, whether the object in question can reasonably be treated as a {@link Point}. This specification is permissive -- there can be other, non-{@code Point}, fields present. In that case, it can be considered that the object <em>extends</em> {@code Point}. @param json {@code JSONObject} to check @param e {@link Enum} labeling the data to check @return {@code True} if the mapping exists and meets the conditions above; {@code false} otherwise.
[ "Checks", "whether", "the", "value", "mapped", "by", "enum", "exists", "is", "a", "{", "@link", "JSONObject", "}", "has", "at", "least", "one", "field", "named", "either", "x", "or", "y", "and", "that", "if", "either", "field", "is", "present", "it", "...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/properties/JSONHelpers.java#L716-L720
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/util/SecurityHelper.java
SecurityHelper.getUserDisplayName
@Nullable public static String getUserDisplayName (@Nullable final String sUserID, @Nonnull final Locale aDisplayLocale) { if (StringHelper.hasNoText (sUserID)) return getGuestUserDisplayName (aDisplayLocale); final IUser aUser = PhotonSecurityManager.getUserMgr ().getUserOfID (sUserID); return aUser == null ? sUserID : getUserDisplayName (aUser, aDisplayLocale); }
java
@Nullable public static String getUserDisplayName (@Nullable final String sUserID, @Nonnull final Locale aDisplayLocale) { if (StringHelper.hasNoText (sUserID)) return getGuestUserDisplayName (aDisplayLocale); final IUser aUser = PhotonSecurityManager.getUserMgr ().getUserOfID (sUserID); return aUser == null ? sUserID : getUserDisplayName (aUser, aDisplayLocale); }
[ "@", "Nullable", "public", "static", "String", "getUserDisplayName", "(", "@", "Nullable", "final", "String", "sUserID", ",", "@", "Nonnull", "final", "Locale", "aDisplayLocale", ")", "{", "if", "(", "StringHelper", ".", "hasNoText", "(", "sUserID", ")", ")", ...
Get the display name of the user. @param sUserID User ID. May be <code>null</code>. @param aDisplayLocale The display locale to be used. @return The "guest" text if no user ID was provided, the display name of the user if a valid user ID was provided or the ID of the user if an invalid user was provided.
[ "Get", "the", "display", "name", "of", "the", "user", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/util/SecurityHelper.java#L164-L172
apache/spark
common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java
AuthEngine.checkSubArray
private void checkSubArray(byte[] test, byte[] data, int offset) { Preconditions.checkArgument(data.length >= test.length + offset); for (int i = 0; i < test.length; i++) { Preconditions.checkArgument(test[i] == data[i + offset]); } }
java
private void checkSubArray(byte[] test, byte[] data, int offset) { Preconditions.checkArgument(data.length >= test.length + offset); for (int i = 0; i < test.length; i++) { Preconditions.checkArgument(test[i] == data[i + offset]); } }
[ "private", "void", "checkSubArray", "(", "byte", "[", "]", "test", ",", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "Preconditions", ".", "checkArgument", "(", "data", ".", "length", ">=", "test", ".", "length", "+", "offset", ")", ";", ...
Checks that the "test" array is in the data array starting at the given offset.
[ "Checks", "that", "the", "test", "array", "is", "in", "the", "data", "array", "starting", "at", "the", "given", "offset", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java#L308-L313
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/http2/model/InputStreamContentProvider.java
InputStreamContentProvider.onRead
protected ByteBuffer onRead(byte[] buffer, int offset, int length) { if (length <= 0) return BufferUtils.EMPTY_BUFFER; return ByteBuffer.wrap(buffer, offset, length); }
java
protected ByteBuffer onRead(byte[] buffer, int offset, int length) { if (length <= 0) return BufferUtils.EMPTY_BUFFER; return ByteBuffer.wrap(buffer, offset, length); }
[ "protected", "ByteBuffer", "onRead", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "length", "<=", "0", ")", "return", "BufferUtils", ".", "EMPTY_BUFFER", ";", "return", "ByteBuffer", ".", "wrap", "(", ...
Callback method invoked just after having read from the stream, but before returning the iteration element (a {@link ByteBuffer} to the caller. <p> Subclasses may override this method to copy the content read from the stream to another location (a file, or in memory if the content is known to fit). @param buffer the byte array containing the bytes read @param offset the offset from where bytes should be read @param length the length of the bytes read @return a {@link ByteBuffer} wrapping the byte array
[ "Callback", "method", "invoked", "just", "after", "having", "read", "from", "the", "stream", "but", "before", "returning", "the", "iteration", "element", "(", "a", "{", "@link", "ByteBuffer", "}", "to", "the", "caller", ".", "<p", ">", "Subclasses", "may", ...
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/http2/model/InputStreamContentProvider.java#L76-L80
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonReaderDriver.java
GeoJsonReaderDriver.parseData
private void parseData() throws IOException, SQLException { FileInputStream fis = null; try { fis = new FileInputStream(fileName); try (JsonParser jp = jsFactory.createParser(fis)) { jp.nextToken();//START_OBJECT jp.nextToken(); // field_name (type) jp.nextToken(); // value_string (FeatureCollection) String geomType = jp.getText(); if (geomType.equalsIgnoreCase(GeoJsonField.FEATURECOLLECTION)) { parseFeatures(jp); } else { throw new SQLException("Malformed GeoJSON file. Expected 'FeatureCollection', found '" + geomType + "'"); } } //START_OBJECT } catch (FileNotFoundException ex) { throw new SQLException(ex); } finally { try { if (fis != null) { fis.close(); } } catch (IOException ex) { throw new SQLException(ex); } } }
java
private void parseData() throws IOException, SQLException { FileInputStream fis = null; try { fis = new FileInputStream(fileName); try (JsonParser jp = jsFactory.createParser(fis)) { jp.nextToken();//START_OBJECT jp.nextToken(); // field_name (type) jp.nextToken(); // value_string (FeatureCollection) String geomType = jp.getText(); if (geomType.equalsIgnoreCase(GeoJsonField.FEATURECOLLECTION)) { parseFeatures(jp); } else { throw new SQLException("Malformed GeoJSON file. Expected 'FeatureCollection', found '" + geomType + "'"); } } //START_OBJECT } catch (FileNotFoundException ex) { throw new SQLException(ex); } finally { try { if (fis != null) { fis.close(); } } catch (IOException ex) { throw new SQLException(ex); } } }
[ "private", "void", "parseData", "(", ")", "throws", "IOException", ",", "SQLException", "{", "FileInputStream", "fis", "=", "null", ";", "try", "{", "fis", "=", "new", "FileInputStream", "(", "fileName", ")", ";", "try", "(", "JsonParser", "jp", "=", "jsFa...
Parses the GeoJSON data and set the values to the table. @throws IOException @throws SQLException
[ "Parses", "the", "GeoJSON", "data", "and", "set", "the", "values", "to", "the", "table", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/geojson/GeoJsonReaderDriver.java#L1243-L1270
gallandarakhneorg/afc
core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d1/Transform1D.java
Transform1D.toTransform2D
@Pure public final Transform2D toTransform2D(Point2D<?, ?> startPoint, Point2D<?, ?> endPoint) { assert startPoint != null : AssertMessages.notNullParameter(0); assert endPoint != null : AssertMessages.notNullParameter(1); return toTransform2D(startPoint.getX(), startPoint.getY(), endPoint.getX(), endPoint.getY()); }
java
@Pure public final Transform2D toTransform2D(Point2D<?, ?> startPoint, Point2D<?, ?> endPoint) { assert startPoint != null : AssertMessages.notNullParameter(0); assert endPoint != null : AssertMessages.notNullParameter(1); return toTransform2D(startPoint.getX(), startPoint.getY(), endPoint.getX(), endPoint.getY()); }
[ "@", "Pure", "public", "final", "Transform2D", "toTransform2D", "(", "Point2D", "<", "?", ",", "?", ">", "startPoint", ",", "Point2D", "<", "?", ",", "?", ">", "endPoint", ")", "{", "assert", "startPoint", "!=", "null", ":", "AssertMessages", ".", "notNu...
Replies a 2D transformation that is corresponding to this transformation. @param startPoint is the 2D position of the start point of the segment. @param endPoint is the 2D position of the end point of the segment @return the 2D transformation.
[ "Replies", "a", "2D", "transformation", "that", "is", "corresponding", "to", "this", "transformation", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d1/Transform1D.java#L634-L639
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/daemon/supervisor/ShutdownWork.java
ShutdownWork.tryCleanupWorkerDir
public static void tryCleanupWorkerDir(Map conf, String workerId) { try { // delete heartbeat dir LOCAL_DIR/workers/workid/heartbeats PathUtils.rmr(StormConfig.worker_heartbeats_root(conf, workerId)); // delete pid dir, LOCAL_DIR/workers/workerid/pids PathUtils.rmr(StormConfig.worker_pids_root(conf, workerId)); // delete workerid dir, LOCAL_DIR/worker/workerid PathUtils.rmr(StormConfig.worker_root(conf, workerId)); } catch (Exception e) { LOG.warn(e + "Failed to cleanup worker " + workerId + ". Will retry later"); } }
java
public static void tryCleanupWorkerDir(Map conf, String workerId) { try { // delete heartbeat dir LOCAL_DIR/workers/workid/heartbeats PathUtils.rmr(StormConfig.worker_heartbeats_root(conf, workerId)); // delete pid dir, LOCAL_DIR/workers/workerid/pids PathUtils.rmr(StormConfig.worker_pids_root(conf, workerId)); // delete workerid dir, LOCAL_DIR/worker/workerid PathUtils.rmr(StormConfig.worker_root(conf, workerId)); } catch (Exception e) { LOG.warn(e + "Failed to cleanup worker " + workerId + ". Will retry later"); } }
[ "public", "static", "void", "tryCleanupWorkerDir", "(", "Map", "conf", ",", "String", "workerId", ")", "{", "try", "{", "// delete heartbeat dir LOCAL_DIR/workers/workid/heartbeats", "PathUtils", ".", "rmr", "(", "StormConfig", ".", "worker_heartbeats_root", "(", "conf"...
clean the directory , sub-directories of STORM-LOCAL-DIR/workers/workerId @param conf storm conf @param workerId worker id
[ "clean", "the", "directory", "sub", "-", "directories", "of", "STORM", "-", "LOCAL", "-", "DIR", "/", "workers", "/", "workerId" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/daemon/supervisor/ShutdownWork.java#L150-L161
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/datanode/VolumeMap.java
VolumeMap.copyOngoingCreates
void copyOngoingCreates(int namespaceId, Block block) throws CloneNotSupportedException { checkBlock(block); NamespaceMap nm = getNamespaceMap(namespaceId); if (nm != null) { nm.copyOngoingCreates(block); } }
java
void copyOngoingCreates(int namespaceId, Block block) throws CloneNotSupportedException { checkBlock(block); NamespaceMap nm = getNamespaceMap(namespaceId); if (nm != null) { nm.copyOngoingCreates(block); } }
[ "void", "copyOngoingCreates", "(", "int", "namespaceId", ",", "Block", "block", ")", "throws", "CloneNotSupportedException", "{", "checkBlock", "(", "block", ")", ";", "NamespaceMap", "nm", "=", "getNamespaceMap", "(", "namespaceId", ")", ";", "if", "(", "nm", ...
If there is an ActiveFile object for the block, create a copy of the old one and replace the old one. This is to make sure that the VisibleLength applied to the old object will have no impact to the local map. In that way, BlockReceiver can directly update visible length without holding the lock. @param namespaceId @param block @throws CloneNotSupportedException
[ "If", "there", "is", "an", "ActiveFile", "object", "for", "the", "block", "create", "a", "copy", "of", "the", "old", "one", "and", "replace", "the", "old", "one", ".", "This", "is", "to", "make", "sure", "that", "the", "VisibleLength", "applied", "to", ...
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/VolumeMap.java#L247-L253
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/searchindex/CmsDeleteFieldDialog.java
CmsDeleteFieldDialog.createDialogHtml
@Override protected String createDialogHtml(String dialog) { StringBuffer result = new StringBuffer(512); result.append(createWidgetTableStart()); // show error header once if there were validation errors result.append(createWidgetErrorHeader()); if (dialog.equals(PAGES[0])) { // create the widgets for the first dialog page result.append(dialogBlockStart(key(Messages.GUI_LIST_FIELD_ACTION_DELETE_NAME_0))); result.append(createWidgetTableStart()); result.append(key(Messages.GUI_LIST_FIELD_ACTION_DELETE_CONF_1, new Object[] {m_field.getName()})); result.append(createWidgetTableEnd()); result.append(dialogBlockEnd()); } result.append(createWidgetTableEnd()); // See CmsWidgetDialog.dialogButtonsCustom(): if no widgets are defined that are non-display-only widgets, // no dialog buttons (Ok, Cancel) will be visible.... result.append(dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[2])); return result.toString(); }
java
@Override protected String createDialogHtml(String dialog) { StringBuffer result = new StringBuffer(512); result.append(createWidgetTableStart()); // show error header once if there were validation errors result.append(createWidgetErrorHeader()); if (dialog.equals(PAGES[0])) { // create the widgets for the first dialog page result.append(dialogBlockStart(key(Messages.GUI_LIST_FIELD_ACTION_DELETE_NAME_0))); result.append(createWidgetTableStart()); result.append(key(Messages.GUI_LIST_FIELD_ACTION_DELETE_CONF_1, new Object[] {m_field.getName()})); result.append(createWidgetTableEnd()); result.append(dialogBlockEnd()); } result.append(createWidgetTableEnd()); // See CmsWidgetDialog.dialogButtonsCustom(): if no widgets are defined that are non-display-only widgets, // no dialog buttons (Ok, Cancel) will be visible.... result.append(dialogButtons(new int[] {BUTTON_OK, BUTTON_CANCEL}, new String[2])); return result.toString(); }
[ "@", "Override", "protected", "String", "createDialogHtml", "(", "String", "dialog", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "512", ")", ";", "result", ".", "append", "(", "createWidgetTableStart", "(", ")", ")", ";", "// show erro...
Creates the dialog HTML for all defined widgets of the named dialog (page).<p> This overwrites the method from the super class to create a layout variation for the widgets.<p> @param dialog the dialog (page) to get the HTML for @return the dialog HTML for all defined widgets of the named dialog (page)
[ "Creates", "the", "dialog", "HTML", "for", "all", "defined", "widgets", "of", "the", "named", "dialog", "(", "page", ")", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsDeleteFieldDialog.java#L107-L131
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SealedObject.java
SealedObject.getObject
public final Object getObject(Key key, String provider) throws IOException, ClassNotFoundException, NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException { if (key == null) { throw new NullPointerException("key is null"); } if (provider == null || provider.length() == 0) { throw new IllegalArgumentException("missing provider"); } try { return unseal(key, provider); } catch (IllegalBlockSizeException | BadPaddingException ex) { throw new InvalidKeyException(ex.getMessage()); } }
java
public final Object getObject(Key key, String provider) throws IOException, ClassNotFoundException, NoSuchAlgorithmException, NoSuchProviderException, InvalidKeyException { if (key == null) { throw new NullPointerException("key is null"); } if (provider == null || provider.length() == 0) { throw new IllegalArgumentException("missing provider"); } try { return unseal(key, provider); } catch (IllegalBlockSizeException | BadPaddingException ex) { throw new InvalidKeyException(ex.getMessage()); } }
[ "public", "final", "Object", "getObject", "(", "Key", "key", ",", "String", "provider", ")", "throws", "IOException", ",", "ClassNotFoundException", ",", "NoSuchAlgorithmException", ",", "NoSuchProviderException", ",", "InvalidKeyException", "{", "if", "(", "key", "...
Retrieves the original (encapsulated) object. <p>This method creates a cipher for the algorithm that had been used in the sealing operation, using an implementation of that algorithm from the given <code>provider</code>. The Cipher object is initialized for decryption, using the given <code>key</code> and the parameters (if any) that had been used in the sealing operation. <p>The encapsulated object is unsealed and de-serialized, before it is returned. @param key the key used to unseal the object. @param provider the name of the provider of the algorithm to unseal the object. @return the original object. @exception IllegalArgumentException if the given provider is null or empty. @exception IOException if an error occurs during de-serialiazation. @exception ClassNotFoundException if an error occurs during de-serialiazation. @exception NoSuchAlgorithmException if the algorithm to unseal the object is not available. @exception NoSuchProviderException if the given provider is not configured. @exception InvalidKeyException if the given key cannot be used to unseal the object (e.g., it has the wrong algorithm). @exception NullPointerException if <code>key</code> is null.
[ "Retrieves", "the", "original", "(", "encapsulated", ")", "object", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SealedObject.java#L341-L357
mediathekview/MLib
src/main/java/de/mediathekview/mlib/filmlisten/FilmlisteLesen.java
FilmlisteLesen.processFromFile
private void processFromFile(String source, ListeFilme listeFilme) { notifyProgress(source, PROGRESS_MAX); try (InputStream in = selectDecompressor(source, new FileInputStream(source)); JsonParser jp = new JsonFactory().createParser(in)) { readData(jp, listeFilme); } catch (FileNotFoundException ex) { Log.errorLog(894512369, "FilmListe existiert nicht: " + source); listeFilme.clear(); } catch (Exception ex) { Log.errorLog(945123641, ex, "FilmListe: " + source); listeFilme.clear(); } }
java
private void processFromFile(String source, ListeFilme listeFilme) { notifyProgress(source, PROGRESS_MAX); try (InputStream in = selectDecompressor(source, new FileInputStream(source)); JsonParser jp = new JsonFactory().createParser(in)) { readData(jp, listeFilme); } catch (FileNotFoundException ex) { Log.errorLog(894512369, "FilmListe existiert nicht: " + source); listeFilme.clear(); } catch (Exception ex) { Log.errorLog(945123641, ex, "FilmListe: " + source); listeFilme.clear(); } }
[ "private", "void", "processFromFile", "(", "String", "source", ",", "ListeFilme", "listeFilme", ")", "{", "notifyProgress", "(", "source", ",", "PROGRESS_MAX", ")", ";", "try", "(", "InputStream", "in", "=", "selectDecompressor", "(", "source", ",", "new", "Fi...
Read a locally available filmlist. @param source file path as string @param listeFilme the list to read to
[ "Read", "a", "locally", "available", "filmlist", "." ]
train
https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/filmlisten/FilmlisteLesen.java#L177-L189
mfornos/humanize
humanize-slim/src/main/java/humanize/Humanize.java
Humanize.naturalTime
public static String naturalTime(Date reference, Date duration) { return context.get().formatRelativeDate(reference, duration); }
java
public static String naturalTime(Date reference, Date duration) { return context.get().formatRelativeDate(reference, duration); }
[ "public", "static", "String", "naturalTime", "(", "Date", "reference", ",", "Date", "duration", ")", "{", "return", "context", ".", "get", "(", ")", ".", "formatRelativeDate", "(", "reference", ",", "duration", ")", ";", "}" ]
Computes both past and future relative dates. <p> E.g. 'one day ago', 'one day from now', '10 years ago', '3 minutes from now', 'right now' and so on. @param reference The reference @param duration The duration @return String representing the relative date
[ "Computes", "both", "past", "and", "future", "relative", "dates", "." ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L1558-L1561
line/armeria
core/src/main/java/com/linecorp/armeria/client/ClientFactoryBuilder.java
ClientFactoryBuilder.workerGroup
public ClientFactoryBuilder workerGroup(EventLoopGroup workerGroup, boolean shutdownOnClose) { this.workerGroup = requireNonNull(workerGroup, "workerGroup"); shutdownWorkerGroupOnClose = shutdownOnClose; return this; }
java
public ClientFactoryBuilder workerGroup(EventLoopGroup workerGroup, boolean shutdownOnClose) { this.workerGroup = requireNonNull(workerGroup, "workerGroup"); shutdownWorkerGroupOnClose = shutdownOnClose; return this; }
[ "public", "ClientFactoryBuilder", "workerGroup", "(", "EventLoopGroup", "workerGroup", ",", "boolean", "shutdownOnClose", ")", "{", "this", ".", "workerGroup", "=", "requireNonNull", "(", "workerGroup", ",", "\"workerGroup\"", ")", ";", "shutdownWorkerGroupOnClose", "="...
Sets the worker {@link EventLoopGroup} which is responsible for performing socket I/O and running {@link Client#execute(ClientRequestContext, Request)}. If not set, {@linkplain CommonPools#workerGroup() the common worker group} is used. @param shutdownOnClose whether to shut down the worker {@link EventLoopGroup} when the {@link ClientFactory} is closed
[ "Sets", "the", "worker", "{", "@link", "EventLoopGroup", "}", "which", "is", "responsible", "for", "performing", "socket", "I", "/", "O", "and", "running", "{", "@link", "Client#execute", "(", "ClientRequestContext", "Request", ")", "}", ".", "If", "not", "s...
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientFactoryBuilder.java#L130-L134
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.splitEachLine
public static <T> T splitEachLine(CharSequence self, Pattern pattern, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException { final List<String> list = readLines(self); T result = null; for (String line : list) { List vals = Arrays.asList(pattern.split(line)); result = closure.call(vals); } return result; }
java
public static <T> T splitEachLine(CharSequence self, Pattern pattern, @ClosureParams(value=FromString.class,options="List<String>") Closure<T> closure) throws IOException { final List<String> list = readLines(self); T result = null; for (String line : list) { List vals = Arrays.asList(pattern.split(line)); result = closure.call(vals); } return result; }
[ "public", "static", "<", "T", ">", "T", "splitEachLine", "(", "CharSequence", "self", ",", "Pattern", "pattern", ",", "@", "ClosureParams", "(", "value", "=", "FromString", ".", "class", ",", "options", "=", "\"List<String>\"", ")", "Closure", "<", "T", ">...
Iterates through the given CharSequence line by line, splitting each line using the given separator Pattern. The list of tokens for each line is then passed to the given closure. @param self a CharSequence @param pattern the regular expression Pattern for the delimiter @param closure a closure @return the last value returned by the closure @throws java.io.IOException if an error occurs @since 1.8.2
[ "Iterates", "through", "the", "given", "CharSequence", "line", "by", "line", "splitting", "each", "line", "using", "the", "given", "separator", "Pattern", ".", "The", "list", "of", "tokens", "for", "each", "line", "is", "then", "passed", "to", "the", "given"...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2901-L2909
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/id/impl/OgmTableGenerator.java
OgmTableGenerator.determineSegmentColumnName
protected String determineSegmentColumnName(Properties params, Dialect dialect) { ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER ); String name = ConfigurationHelper.getString( SEGMENT_COLUMN_PARAM, params, DEF_SEGMENT_COLUMN ); return normalizer.toDatabaseIdentifierText( name ); }
java
protected String determineSegmentColumnName(Properties params, Dialect dialect) { ObjectNameNormalizer normalizer = (ObjectNameNormalizer) params.get( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER ); String name = ConfigurationHelper.getString( SEGMENT_COLUMN_PARAM, params, DEF_SEGMENT_COLUMN ); return normalizer.toDatabaseIdentifierText( name ); }
[ "protected", "String", "determineSegmentColumnName", "(", "Properties", "params", ",", "Dialect", "dialect", ")", "{", "ObjectNameNormalizer", "normalizer", "=", "(", "ObjectNameNormalizer", ")", "params", ".", "get", "(", "PersistentIdentifierGenerator", ".", "IDENTIFI...
Determine the name of the column used to indicate the segment for each row. This column acts as the primary key. <p> Called during {@link #configure configuration}. @param params The params supplied in the generator config (plus some standard useful extras). @param dialect The dialect in effect @return The name of the segment column @see #getSegmentColumnName()
[ "Determine", "the", "name", "of", "the", "column", "used", "to", "indicate", "the", "segment", "for", "each", "row", ".", "This", "column", "acts", "as", "the", "primary", "key", ".", "<p", ">", "Called", "during", "{", "@link", "#configure", "configuratio...
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/id/impl/OgmTableGenerator.java#L219-L223
jaredrummler/AndroidShell
library/src/main/java/com/jaredrummler/android/shell/Shell.java
Shell.runWithEnv
@WorkerThread public static Process runWithEnv(@NonNull String command, @Nullable String[] environment) throws IOException { if (environment != null) { Map<String, String> newEnvironment = new HashMap<>(); newEnvironment.putAll(System.getenv()); int split; for (String entry : environment) { if ((split = entry.indexOf("=")) >= 0) { newEnvironment.put(entry.substring(0, split), entry.substring(split + 1)); } } int i = 0; environment = new String[newEnvironment.size()]; for (Map.Entry<String, String> entry : newEnvironment.entrySet()) { environment[i] = entry.getKey() + "=" + entry.getValue(); i++; } } return Runtime.getRuntime().exec(command, environment); }
java
@WorkerThread public static Process runWithEnv(@NonNull String command, @Nullable String[] environment) throws IOException { if (environment != null) { Map<String, String> newEnvironment = new HashMap<>(); newEnvironment.putAll(System.getenv()); int split; for (String entry : environment) { if ((split = entry.indexOf("=")) >= 0) { newEnvironment.put(entry.substring(0, split), entry.substring(split + 1)); } } int i = 0; environment = new String[newEnvironment.size()]; for (Map.Entry<String, String> entry : newEnvironment.entrySet()) { environment[i] = entry.getKey() + "=" + entry.getValue(); i++; } } return Runtime.getRuntime().exec(command, environment); }
[ "@", "WorkerThread", "public", "static", "Process", "runWithEnv", "(", "@", "NonNull", "String", "command", ",", "@", "Nullable", "String", "[", "]", "environment", ")", "throws", "IOException", "{", "if", "(", "environment", "!=", "null", ")", "{", "Map", ...
<p>This code is adapted from java.lang.ProcessBuilder.start().</p> <p>The problem is that Android doesn't allow us to modify the map returned by ProcessBuilder.environment(), even though the JavaDoc indicates that it should. This is because it simply returns the SystemEnvironment object that System.getenv() gives us. The relevant portion in the source code is marked as "// android changed", so presumably it's not the case in the original version of the Apache Harmony project.</p> @param command The name of the program to execute. E.g. "su" or "sh". @param environment List of all environment variables (in 'key=value' format) or null for defaults @return new {@link Process} instance. @throws IOException if the requested program could not be executed.
[ "<p", ">", "This", "code", "is", "adapted", "from", "java", ".", "lang", ".", "ProcessBuilder", ".", "start", "()", ".", "<", "/", "p", ">" ]
train
https://github.com/jaredrummler/AndroidShell/blob/0826b6f93c208b7bc95344dd20e2989d367a1e43/library/src/main/java/com/jaredrummler/android/shell/Shell.java#L166-L185
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java
AppServicePlansInner.listVnetsAsync
public Observable<List<VnetInfoInner>> listVnetsAsync(String resourceGroupName, String name) { return listVnetsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<VnetInfoInner>>, List<VnetInfoInner>>() { @Override public List<VnetInfoInner> call(ServiceResponse<List<VnetInfoInner>> response) { return response.body(); } }); }
java
public Observable<List<VnetInfoInner>> listVnetsAsync(String resourceGroupName, String name) { return listVnetsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<VnetInfoInner>>, List<VnetInfoInner>>() { @Override public List<VnetInfoInner> call(ServiceResponse<List<VnetInfoInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "VnetInfoInner", ">", ">", "listVnetsAsync", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "listVnetsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ".", "map", "(", ...
Get all Virtual Networks associated with an App Service plan. Get all Virtual Networks associated with an App Service plan. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service plan. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;VnetInfoInner&gt; object
[ "Get", "all", "Virtual", "Networks", "associated", "with", "an", "App", "Service", "plan", ".", "Get", "all", "Virtual", "Networks", "associated", "with", "an", "App", "Service", "plan", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3011-L3018
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java
DiskClient.resizeDisk
@BetaApi public final Operation resizeDisk(String disk, DisksResizeRequest disksResizeRequestResource) { ResizeDiskHttpRequest request = ResizeDiskHttpRequest.newBuilder() .setDisk(disk) .setDisksResizeRequestResource(disksResizeRequestResource) .build(); return resizeDisk(request); }
java
@BetaApi public final Operation resizeDisk(String disk, DisksResizeRequest disksResizeRequestResource) { ResizeDiskHttpRequest request = ResizeDiskHttpRequest.newBuilder() .setDisk(disk) .setDisksResizeRequestResource(disksResizeRequestResource) .build(); return resizeDisk(request); }
[ "@", "BetaApi", "public", "final", "Operation", "resizeDisk", "(", "String", "disk", ",", "DisksResizeRequest", "disksResizeRequestResource", ")", "{", "ResizeDiskHttpRequest", "request", "=", "ResizeDiskHttpRequest", ".", "newBuilder", "(", ")", ".", "setDisk", "(", ...
Resizes the specified persistent disk. You can only increase the size of the disk. <p>Sample code: <pre><code> try (DiskClient diskClient = DiskClient.create()) { ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]"); DisksResizeRequest disksResizeRequestResource = DisksResizeRequest.newBuilder().build(); Operation response = diskClient.resizeDisk(disk.toString(), disksResizeRequestResource); } </code></pre> @param disk The name of the persistent disk. @param disksResizeRequestResource @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Resizes", "the", "specified", "persistent", "disk", ".", "You", "can", "only", "increase", "the", "size", "of", "the", "disk", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskClient.java#L1020-L1029
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_pvec.java
DZcs_pvec.cs_pvec
public static boolean cs_pvec(int [] p, DZcsa b, DZcsa x, int n) { int k ; if (x == null || b == null) return (false) ; /* check inputs */ for (k = 0 ; k < n ; k++) x.set(k, b.get(p != null ? p [k] : k)) ; return (true) ; }
java
public static boolean cs_pvec(int [] p, DZcsa b, DZcsa x, int n) { int k ; if (x == null || b == null) return (false) ; /* check inputs */ for (k = 0 ; k < n ; k++) x.set(k, b.get(p != null ? p [k] : k)) ; return (true) ; }
[ "public", "static", "boolean", "cs_pvec", "(", "int", "[", "]", "p", ",", "DZcsa", "b", ",", "DZcsa", "x", ",", "int", "n", ")", "{", "int", "k", ";", "if", "(", "x", "==", "null", "||", "b", "==", "null", ")", "return", "(", "false", ")", ";...
Permutes a vector, x=P*b, for dense vectors x and b. @param p permutation vector, p=null denotes identity @param b input vector @param x output vector, x=P*b @param n length of p, b and x @return true if successful, false otherwise
[ "Permutes", "a", "vector", "x", "=", "P", "*", "b", "for", "dense", "vectors", "x", "and", "b", "." ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_pvec.java#L51-L57
pedrovgs/Nox
nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java
NoxItemCatalog.getImageLoaderListener
private ImageLoader.Listener getImageLoaderListener(final int position) { if (listeners[position] == null) { listeners[position] = new NoxItemCatalogImageLoaderListener(position, this); } return listeners[position]; }
java
private ImageLoader.Listener getImageLoaderListener(final int position) { if (listeners[position] == null) { listeners[position] = new NoxItemCatalogImageLoaderListener(position, this); } return listeners[position]; }
[ "private", "ImageLoader", ".", "Listener", "getImageLoaderListener", "(", "final", "int", "position", ")", "{", "if", "(", "listeners", "[", "position", "]", "==", "null", ")", "{", "listeners", "[", "position", "]", "=", "new", "NoxItemCatalogImageLoaderListene...
Returns the ImageLoader.Listener associated to a NoxItem given a position. If the ImageLoader.Listener wasn't previously created, creates a new instance.
[ "Returns", "the", "ImageLoader", ".", "Listener", "associated", "to", "a", "NoxItem", "given", "a", "position", ".", "If", "the", "ImageLoader", ".", "Listener", "wasn", "t", "previously", "created", "creates", "a", "new", "instance", "." ]
train
https://github.com/pedrovgs/Nox/blob/b4dfe37895e1b7bf2084d60139931dd4fb12f3f4/nox/src/main/java/com/github/pedrovgs/nox/NoxItemCatalog.java#L250-L255
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/struct/convolve/Kernel1D_S32.java
Kernel1D_S32.wrap
public static Kernel1D_S32 wrap(int data[], int width, int offset ) { Kernel1D_S32 ret = new Kernel1D_S32(); ret.data = data; ret.width = width; ret.offset = offset; return ret; }
java
public static Kernel1D_S32 wrap(int data[], int width, int offset ) { Kernel1D_S32 ret = new Kernel1D_S32(); ret.data = data; ret.width = width; ret.offset = offset; return ret; }
[ "public", "static", "Kernel1D_S32", "wrap", "(", "int", "data", "[", "]", ",", "int", "width", ",", "int", "offset", ")", "{", "Kernel1D_S32", "ret", "=", "new", "Kernel1D_S32", "(", ")", ";", "ret", ".", "data", "=", "data", ";", "ret", ".", "width"...
Creates a kernel whose elements are the specified data array and has the specified width. @param data The array who will be the kernel's data. Reference is saved. @param width The kernel's width. @param offset Location of the origin in the array @return A new kernel.
[ "Creates", "a", "kernel", "whose", "elements", "are", "the", "specified", "data", "array", "and", "has", "the", "specified", "width", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/convolve/Kernel1D_S32.java#L103-L110
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java
CodeBuilderUtil.definePrepareBridges
public static void definePrepareBridges(ClassFile cf, Class leaf) { for (Class c : gatherAllBridgeTypes(new HashSet<Class>(), leaf)) { if (c != Object.class) { definePrepareBridge(cf, leaf, c); } } }
java
public static void definePrepareBridges(ClassFile cf, Class leaf) { for (Class c : gatherAllBridgeTypes(new HashSet<Class>(), leaf)) { if (c != Object.class) { definePrepareBridge(cf, leaf, c); } } }
[ "public", "static", "void", "definePrepareBridges", "(", "ClassFile", "cf", ",", "Class", "leaf", ")", "{", "for", "(", "Class", "c", ":", "gatherAllBridgeTypes", "(", "new", "HashSet", "<", "Class", ">", "(", ")", ",", "leaf", ")", ")", "{", "if", "("...
Add prepare bridge methods for all classes/interfaces between the leaf (genericised class) and the root (genericised baseclass). @param cf file to which to add the prepare bridge @param leaf leaf class @since 1.2
[ "Add", "prepare", "bridge", "methods", "for", "all", "classes", "/", "interfaces", "between", "the", "leaf", "(", "genericised", "class", ")", "and", "the", "root", "(", "genericised", "baseclass", ")", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/CodeBuilderUtil.java#L262-L268
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigDecimalExtensions.java
BigDecimalExtensions.operator_divide
@Pure @Inline(value="$1.divide($2, $3.DECIMAL128)", imported=MathContext.class) public static BigDecimal operator_divide(BigDecimal a, BigDecimal b) { return a.divide(b, MathContext.DECIMAL128); }
java
@Pure @Inline(value="$1.divide($2, $3.DECIMAL128)", imported=MathContext.class) public static BigDecimal operator_divide(BigDecimal a, BigDecimal b) { return a.divide(b, MathContext.DECIMAL128); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"$1.divide($2, $3.DECIMAL128)\"", ",", "imported", "=", "MathContext", ".", "class", ")", "public", "static", "BigDecimal", "operator_divide", "(", "BigDecimal", "a", ",", "BigDecimal", "b", ")", "{", "return", ...
The binary <code>divide</code> operator. @param a a BigDecimal. May not be <code>null</code>. @param b a BigDecimal. May not be <code>null</code>. @return <code>a.divide(b, MathContext.DECIMAL128)</code> @throws NullPointerException if {@code a} or {@code b} is <code>null</code>.
[ "The", "binary", "<code", ">", "divide<", "/", "code", ">", "operator", "." ]
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigDecimalExtensions.java#L117-L121