repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
JOML-CI/JOML
src/org/joml/Quaterniond.java
Quaterniond.rotationYXZ
public Quaterniond rotationYXZ(double angleY, double angleX, double angleZ) { double sx = Math.sin(angleX * 0.5); double cx = Math.cosFromSin(sx, angleX * 0.5); double sy = Math.sin(angleY * 0.5); double cy = Math.cosFromSin(sy, angleY * 0.5); double sz = Math.sin(angleZ * 0.5); double cz = Math.cosFromSin(sz, angleZ * 0.5); double x = cy * sx; double y = sy * cx; double z = sy * sx; double w = cy * cx; this.x = x * cz + y * sz; this.y = y * cz - x * sz; this.z = w * sz - z * cz; this.w = w * cz + z * sz; return this; }
java
public Quaterniond rotationYXZ(double angleY, double angleX, double angleZ) { double sx = Math.sin(angleX * 0.5); double cx = Math.cosFromSin(sx, angleX * 0.5); double sy = Math.sin(angleY * 0.5); double cy = Math.cosFromSin(sy, angleY * 0.5); double sz = Math.sin(angleZ * 0.5); double cz = Math.cosFromSin(sz, angleZ * 0.5); double x = cy * sx; double y = sy * cx; double z = sy * sx; double w = cy * cx; this.x = x * cz + y * sz; this.y = y * cz - x * sz; this.z = w * sz - z * cz; this.w = w * cz + z * sz; return this; }
[ "public", "Quaterniond", "rotationYXZ", "(", "double", "angleY", ",", "double", "angleX", ",", "double", "angleZ", ")", "{", "double", "sx", "=", "Math", ".", "sin", "(", "angleX", "*", "0.5", ")", ";", "double", "cx", "=", "Math", ".", "cosFromSin", "...
Set this quaternion from the supplied euler angles (in radians) with rotation order YXZ. <p> This method is equivalent to calling: <code>rotationY(angleY).rotateX(angleX).rotateZ(angleZ)</code> <p> Reference: <a href="https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles">https://en.wikipedia.org</a> @param angleY the angle in radians to rotate about y @param angleX the angle in radians to rotate about x @param angleZ the angle in radians to rotate about z @return this
[ "Set", "this", "quaternion", "from", "the", "supplied", "euler", "angles", "(", "in", "radians", ")", "with", "rotation", "order", "YXZ", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", ":", "<code", ">", "rotationY", "(", "angleY", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Quaterniond.java#L1279-L1297
casmi/casmi
src/main/java/casmi/graphics/element/Curve.java
Curve.setNode
public void setNode(int number, double x, double y) { if (number <= 0) number = 0; if (number >= 3) number = 3; this.points[number * 3] = (float)x; this.points[number * 3 + 1] = (float)y; this.points[number * 3 + 2] = 0; set(); }
java
public void setNode(int number, double x, double y) { if (number <= 0) number = 0; if (number >= 3) number = 3; this.points[number * 3] = (float)x; this.points[number * 3 + 1] = (float)y; this.points[number * 3 + 2] = 0; set(); }
[ "public", "void", "setNode", "(", "int", "number", ",", "double", "x", ",", "double", "y", ")", "{", "if", "(", "number", "<=", "0", ")", "number", "=", "0", ";", "if", "(", "number", ">=", "3", ")", "number", "=", "3", ";", "this", ".", "point...
Sets x,y,z-coordinate of nodes of this Curve. @param number The number of a node. The node whose number is 0 or 3 is a anchor point, and the node whose number is 1 or 2 is a control point. @param x The x-coordinate of this node. @param y The y-coordinate of this node.
[ "Sets", "x", "y", "z", "-", "coordinate", "of", "nodes", "of", "this", "Curve", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Curve.java#L348-L355
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/compiler/Type.java
Type.preserveType
public static Type preserveType(Type currentType, Type newType) { Type result = newType; if (newType != null && currentType != null && currentType.getObjectClass() == newType.getObjectClass()) { if (newType.getGenericType().getGenericType() instanceof Class && !(currentType.getGenericType().getGenericType() instanceof Class)) { if (newType.isNonNull() && !currentType.isNonNull()) { result = currentType.toNonNull(); } else if (!newType.isNonNull() && currentType.isNonNull()) { result = currentType.toNullable(); } } } return result; }
java
public static Type preserveType(Type currentType, Type newType) { Type result = newType; if (newType != null && currentType != null && currentType.getObjectClass() == newType.getObjectClass()) { if (newType.getGenericType().getGenericType() instanceof Class && !(currentType.getGenericType().getGenericType() instanceof Class)) { if (newType.isNonNull() && !currentType.isNonNull()) { result = currentType.toNonNull(); } else if (!newType.isNonNull() && currentType.isNonNull()) { result = currentType.toNullable(); } } } return result; }
[ "public", "static", "Type", "preserveType", "(", "Type", "currentType", ",", "Type", "newType", ")", "{", "Type", "result", "=", "newType", ";", "if", "(", "newType", "!=", "null", "&&", "currentType", "!=", "null", "&&", "currentType", ".", "getObjectClass"...
Preserve the current type's generic information with the specified new type if they have the same class.
[ "Preserve", "the", "current", "type", "s", "generic", "information", "with", "the", "specified", "new", "type", "if", "they", "have", "the", "same", "class", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/compiler/Type.java#L803-L819
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/table/Rows.java
Rows.copyRowsToTable
@SuppressWarnings({"rawtypes","unchecked"}) public static void copyRowsToTable(Selection rows, Table oldTable, Table newTable) { for (int columnIndex = 0; columnIndex < oldTable.columnCount(); columnIndex++) { Column oldColumn = oldTable.column(columnIndex); int r = 0; for (int i : rows) { newTable.column(columnIndex).set(r, oldColumn, i); r++; } } }
java
@SuppressWarnings({"rawtypes","unchecked"}) public static void copyRowsToTable(Selection rows, Table oldTable, Table newTable) { for (int columnIndex = 0; columnIndex < oldTable.columnCount(); columnIndex++) { Column oldColumn = oldTable.column(columnIndex); int r = 0; for (int i : rows) { newTable.column(columnIndex).set(r, oldColumn, i); r++; } } }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "void", "copyRowsToTable", "(", "Selection", "rows", ",", "Table", "oldTable", ",", "Table", "newTable", ")", "{", "for", "(", "int", "columnIndex", "=", "...
Copies the rows indicated by the row index values in the given selection from oldTable to newTable
[ "Copies", "the", "rows", "indicated", "by", "the", "row", "index", "values", "in", "the", "given", "selection", "from", "oldTable", "to", "newTable" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/table/Rows.java#L37-L48
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFolder.java
BoxApiFolder.getRenameRequest
public BoxRequestsFolder.UpdateFolder getRenameRequest(String id, String newName) { BoxRequestsFolder.UpdateFolder request = new BoxRequestsFolder.UpdateFolder(id, getFolderInfoUrl(id), mSession) .setName(newName); return request; }
java
public BoxRequestsFolder.UpdateFolder getRenameRequest(String id, String newName) { BoxRequestsFolder.UpdateFolder request = new BoxRequestsFolder.UpdateFolder(id, getFolderInfoUrl(id), mSession) .setName(newName); return request; }
[ "public", "BoxRequestsFolder", ".", "UpdateFolder", "getRenameRequest", "(", "String", "id", ",", "String", "newName", ")", "{", "BoxRequestsFolder", ".", "UpdateFolder", "request", "=", "new", "BoxRequestsFolder", ".", "UpdateFolder", "(", "id", ",", "getFolderInfo...
Gets a request that renames a folder @param id id of folder to rename @param newName id of folder to retrieve info on @return request to rename a folder
[ "Gets", "a", "request", "that", "renames", "a", "folder" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFolder.java#L144-L148
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java
FacesImpl.findSimilar
public List<SimilarFace> findSimilar(UUID faceId, FindSimilarOptionalParameter findSimilarOptionalParameter) { return findSimilarWithServiceResponseAsync(faceId, findSimilarOptionalParameter).toBlocking().single().body(); }
java
public List<SimilarFace> findSimilar(UUID faceId, FindSimilarOptionalParameter findSimilarOptionalParameter) { return findSimilarWithServiceResponseAsync(faceId, findSimilarOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "SimilarFace", ">", "findSimilar", "(", "UUID", "faceId", ",", "FindSimilarOptionalParameter", "findSimilarOptionalParameter", ")", "{", "return", "findSimilarWithServiceResponseAsync", "(", "faceId", ",", "findSimilarOptionalParameter", ")", ".", "...
Given query face's faceId, find the similar-looking faces from a faceId array or a faceListId. @param faceId FaceId of the query face. User needs to call Face - Detect first to get a valid faceId. Note that this faceId is not persisted and will expire 24 hours after the detection call @param findSimilarOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws APIErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;SimilarFace&gt; object if successful.
[ "Given", "query", "face", "s", "faceId", "find", "the", "similar", "-", "looking", "faces", "from", "a", "faceId", "array", "or", "a", "faceListId", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java#L120-L122
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/merge/VariantMerger.java
VariantMerger.updateDefaultKeys
public boolean updateDefaultKeys(String from, String to) { if (null == from) { return false; } if (null == to) { return false; } if (StringUtils.equals(from, to)) { return false; } String value = this.defaultValues.remove(from); if (null == value) { return false; } this.defaultValues.put(to, value); return true; }
java
public boolean updateDefaultKeys(String from, String to) { if (null == from) { return false; } if (null == to) { return false; } if (StringUtils.equals(from, to)) { return false; } String value = this.defaultValues.remove(from); if (null == value) { return false; } this.defaultValues.put(to, value); return true; }
[ "public", "boolean", "updateDefaultKeys", "(", "String", "from", ",", "String", "to", ")", "{", "if", "(", "null", "==", "from", ")", "{", "return", "false", ";", "}", "if", "(", "null", "==", "to", ")", "{", "return", "false", ";", "}", "if", "(",...
Update a key @param from @param to @return true if there was a value to be moved.
[ "Update", "a", "key" ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/merge/VariantMerger.java#L165-L181
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ColumnList.java
ColumnList.addForeignKey
private void addForeignKey(String schema, String table, String column, int stepDepth, String alias, String[] foreignKeyParts) { Column c = add(schema, table, column, stepDepth, alias); c.isForeignKey = true; if (foreignKeyParts.length == 3) { Map<String, PropertyType> properties = this.filteredAllTables.get(foreignKeyParts[0] + "." + Topology.VERTEX_PREFIX + foreignKeyParts[1]); if (foreignKeyParts[2].endsWith(Topology.IN_VERTEX_COLUMN_END)) { c.propertyType = properties.get(foreignKeyParts[2].substring(0, foreignKeyParts[2].length() - Topology.IN_VERTEX_COLUMN_END.length())); c.foreignKeyDirection = Direction.IN; c.foreignSchemaTable = SchemaTable.of(foreignKeyParts[0], foreignKeyParts[1]); c.foreignKeyProperty = foreignKeyParts[2]; } else { c.propertyType = properties.get(foreignKeyParts[2].substring(0, foreignKeyParts[2].length() - Topology.OUT_VERTEX_COLUMN_END.length())); c.foreignKeyDirection = Direction.OUT; c.foreignSchemaTable = SchemaTable.of(foreignKeyParts[0], foreignKeyParts[1]); c.foreignKeyProperty = foreignKeyParts[2]; } } else { c.propertyType = PropertyType.LONG; c.foreignKeyDirection = (column.endsWith(Topology.IN_VERTEX_COLUMN_END) ? Direction.IN : Direction.OUT); c.foreignSchemaTable = SchemaTable.of(foreignKeyParts[0], foreignKeyParts[1].substring(0, foreignKeyParts[1].length() - Topology.IN_VERTEX_COLUMN_END.length())); c.foreignKeyProperty = null; } }
java
private void addForeignKey(String schema, String table, String column, int stepDepth, String alias, String[] foreignKeyParts) { Column c = add(schema, table, column, stepDepth, alias); c.isForeignKey = true; if (foreignKeyParts.length == 3) { Map<String, PropertyType> properties = this.filteredAllTables.get(foreignKeyParts[0] + "." + Topology.VERTEX_PREFIX + foreignKeyParts[1]); if (foreignKeyParts[2].endsWith(Topology.IN_VERTEX_COLUMN_END)) { c.propertyType = properties.get(foreignKeyParts[2].substring(0, foreignKeyParts[2].length() - Topology.IN_VERTEX_COLUMN_END.length())); c.foreignKeyDirection = Direction.IN; c.foreignSchemaTable = SchemaTable.of(foreignKeyParts[0], foreignKeyParts[1]); c.foreignKeyProperty = foreignKeyParts[2]; } else { c.propertyType = properties.get(foreignKeyParts[2].substring(0, foreignKeyParts[2].length() - Topology.OUT_VERTEX_COLUMN_END.length())); c.foreignKeyDirection = Direction.OUT; c.foreignSchemaTable = SchemaTable.of(foreignKeyParts[0], foreignKeyParts[1]); c.foreignKeyProperty = foreignKeyParts[2]; } } else { c.propertyType = PropertyType.LONG; c.foreignKeyDirection = (column.endsWith(Topology.IN_VERTEX_COLUMN_END) ? Direction.IN : Direction.OUT); c.foreignSchemaTable = SchemaTable.of(foreignKeyParts[0], foreignKeyParts[1].substring(0, foreignKeyParts[1].length() - Topology.IN_VERTEX_COLUMN_END.length())); c.foreignKeyProperty = null; } }
[ "private", "void", "addForeignKey", "(", "String", "schema", ",", "String", "table", ",", "String", "column", ",", "int", "stepDepth", ",", "String", "alias", ",", "String", "[", "]", "foreignKeyParts", ")", "{", "Column", "c", "=", "add", "(", "schema", ...
add a new column @param schema The column's schema @param table The column's table @param column The column @param stepDepth The column's step depth. @param alias The column's alias. @param foreignKeyParts The foreign key column broken up into its parts. schema, table and for user supplied identifiers the property name.
[ "add", "a", "new", "column" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ColumnList.java#L91-L113
alkacon/opencms-core
src/org/opencms/ugc/CmsUgcSession.java
CmsUgcSession.checkEditResourceNotSet
private void checkEditResourceNotSet() throws CmsUgcException { if (m_editResource != null) { String message = Messages.get().container(Messages.ERR_CANT_EDIT_MULTIPLE_CONTENTS_IN_SESSION_0).key( getCmsObject().getRequestContext().getLocale()); throw new CmsUgcException(CmsUgcConstants.ErrorCode.errInvalidAction, message); } }
java
private void checkEditResourceNotSet() throws CmsUgcException { if (m_editResource != null) { String message = Messages.get().container(Messages.ERR_CANT_EDIT_MULTIPLE_CONTENTS_IN_SESSION_0).key( getCmsObject().getRequestContext().getLocale()); throw new CmsUgcException(CmsUgcConstants.ErrorCode.errInvalidAction, message); } }
[ "private", "void", "checkEditResourceNotSet", "(", ")", "throws", "CmsUgcException", "{", "if", "(", "m_editResource", "!=", "null", ")", "{", "String", "message", "=", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_CANT_EDIT_MU...
Throws an error if the edit resource is already set.<p> @throws CmsUgcException if the edit resource is already set
[ "Throws", "an", "error", "if", "the", "edit", "resource", "is", "already", "set", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSession.java#L673-L681
graphhopper/graphhopper
api/src/main/java/com/graphhopper/util/AngleCalc.java
AngleCalc.alignOrientation
public double alignOrientation(double baseOrientation, double orientation) { double resultOrientation; if (baseOrientation >= 0) { if (orientation < -Math.PI + baseOrientation) resultOrientation = orientation + 2 * Math.PI; else resultOrientation = orientation; } else if (orientation > +Math.PI + baseOrientation) resultOrientation = orientation - 2 * Math.PI; else resultOrientation = orientation; return resultOrientation; }
java
public double alignOrientation(double baseOrientation, double orientation) { double resultOrientation; if (baseOrientation >= 0) { if (orientation < -Math.PI + baseOrientation) resultOrientation = orientation + 2 * Math.PI; else resultOrientation = orientation; } else if (orientation > +Math.PI + baseOrientation) resultOrientation = orientation - 2 * Math.PI; else resultOrientation = orientation; return resultOrientation; }
[ "public", "double", "alignOrientation", "(", "double", "baseOrientation", ",", "double", "orientation", ")", "{", "double", "resultOrientation", ";", "if", "(", "baseOrientation", ">=", "0", ")", "{", "if", "(", "orientation", "<", "-", "Math", ".", "PI", "+...
Change the representation of an orientation, so the difference to the given baseOrientation will be smaller or equal to PI (180 degree). This is achieved by adding or subtracting a 2*PI, so the direction of the orientation will not be changed
[ "Change", "the", "representation", "of", "an", "orientation", "so", "the", "difference", "to", "the", "given", "baseOrientation", "will", "be", "smaller", "or", "equal", "to", "PI", "(", "180", "degree", ")", ".", "This", "is", "achieved", "by", "adding", ...
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/api/src/main/java/com/graphhopper/util/AngleCalc.java#L94-L107
alkacon/opencms-core
src/org/opencms/workplace/CmsLoginUserAgreement.java
CmsLoginUserAgreement.dialogButtonsHtml
@Override protected void dialogButtonsHtml(StringBuffer result, int button, String attribute) { attribute = appendDelimiter(attribute); switch (button) { case BUTTON_OK: result.append("<input name=\"ok\" value=\""); result.append(getConfigurationContentStringValue(NODE_BUTTON_ACCEPT)); result.append("\""); if (attribute.toLowerCase().indexOf("onclick") == -1) { result.append(" type=\"submit\""); } else { result.append(" type=\"button\""); } result.append(" class=\"dialogbutton\""); result.append(attribute); result.append(">\n"); break; case BUTTON_CANCEL: result.append("<input name=\"cancel\" type=\"button\" value=\""); result.append(getConfigurationContentStringValue(NODE_BUTTON_DECLINE)); result.append("\""); if (attribute.toLowerCase().indexOf("onclick") == -1) { result.append(" onclick=\"submitAction('" + DIALOG_CANCEL + "', form);\""); } result.append(" class=\"dialogbutton\""); result.append(attribute); result.append(">\n"); break; default: // other buttons are not overridden, call super implementation super.dialogButtonsHtml(result, button, attribute); } }
java
@Override protected void dialogButtonsHtml(StringBuffer result, int button, String attribute) { attribute = appendDelimiter(attribute); switch (button) { case BUTTON_OK: result.append("<input name=\"ok\" value=\""); result.append(getConfigurationContentStringValue(NODE_BUTTON_ACCEPT)); result.append("\""); if (attribute.toLowerCase().indexOf("onclick") == -1) { result.append(" type=\"submit\""); } else { result.append(" type=\"button\""); } result.append(" class=\"dialogbutton\""); result.append(attribute); result.append(">\n"); break; case BUTTON_CANCEL: result.append("<input name=\"cancel\" type=\"button\" value=\""); result.append(getConfigurationContentStringValue(NODE_BUTTON_DECLINE)); result.append("\""); if (attribute.toLowerCase().indexOf("onclick") == -1) { result.append(" onclick=\"submitAction('" + DIALOG_CANCEL + "', form);\""); } result.append(" class=\"dialogbutton\""); result.append(attribute); result.append(">\n"); break; default: // other buttons are not overridden, call super implementation super.dialogButtonsHtml(result, button, attribute); } }
[ "@", "Override", "protected", "void", "dialogButtonsHtml", "(", "StringBuffer", "result", ",", "int", "button", ",", "String", "attribute", ")", "{", "attribute", "=", "appendDelimiter", "(", "attribute", ")", ";", "switch", "(", "button", ")", "{", "case", ...
The standard "OK" and "Cancel" buttons are overridden to show other labels.<p> See also {@link CmsDialog#dialogButtonsHtml(StringBuffer, int, String)} @param result a string buffer where the rendered HTML gets appended to @param button a integer key to identify the button @param attribute an optional string with possible tag attributes, or null
[ "The", "standard", "OK", "and", "Cancel", "buttons", "are", "overridden", "to", "show", "other", "labels", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsLoginUserAgreement.java#L413-L447
watchrabbit/rabbit-executor
src/main/java/com/watchrabbit/executor/command/ExecutorCommand.java
ExecutorCommand.observe
public <V> void observe(Callable<V> callable, CheckedConsumer<V> onSuccess) { service.executeAsynchronously(wrap(callable, onSuccess), config); }
java
public <V> void observe(Callable<V> callable, CheckedConsumer<V> onSuccess) { service.executeAsynchronously(wrap(callable, onSuccess), config); }
[ "public", "<", "V", ">", "void", "observe", "(", "Callable", "<", "V", ">", "callable", ",", "CheckedConsumer", "<", "V", ">", "onSuccess", ")", "{", "service", ".", "executeAsynchronously", "(", "wrap", "(", "callable", ",", "onSuccess", ")", ",", "conf...
Invokes runnable asynchronously with respecting circuit logic and cache logic if configured. If callable completed with success then the {@code onSuccess} method is called. @param <V> type of returned value by callable @param callable method fired by executor @param onSuccess method fired if callable is completed with success
[ "Invokes", "runnable", "asynchronously", "with", "respecting", "circuit", "logic", "and", "cache", "logic", "if", "configured", ".", "If", "callable", "completed", "with", "success", "then", "the", "{", "@code", "onSuccess", "}", "method", "is", "called", "." ]
train
https://github.com/watchrabbit/rabbit-executor/blob/fe6674b78e6ab464babcecb6e1f100edec3c9966/src/main/java/com/watchrabbit/executor/command/ExecutorCommand.java#L159-L161
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
DatabaseUtils.cursorLongToContentValues
public static void cursorLongToContentValues(Cursor cursor, String field, ContentValues values) { cursorLongToContentValues(cursor, field, values, field); }
java
public static void cursorLongToContentValues(Cursor cursor, String field, ContentValues values) { cursorLongToContentValues(cursor, field, values, field); }
[ "public", "static", "void", "cursorLongToContentValues", "(", "Cursor", "cursor", ",", "String", "field", ",", "ContentValues", "values", ")", "{", "cursorLongToContentValues", "(", "cursor", ",", "field", ",", "values", ",", "field", ")", ";", "}" ]
Reads a Long out of a field in a Cursor and writes it to a Map. @param cursor The cursor to read from @param field The INTEGER field to read @param values The {@link ContentValues} to put the value into, with the field as the key
[ "Reads", "a", "Long", "out", "of", "a", "field", "in", "a", "Cursor", "and", "writes", "it", "to", "a", "Map", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L675-L678
ow2-chameleon/fuchsia
importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java
ZWaveController.increaseLevel
public void increaseLevel(int nodeId, int endpoint) { ZWaveNode node = this.getNode(nodeId); SerialMessage serialMessage = null; ZWaveMultiLevelSwitchCommandClass zwaveCommandClass = (ZWaveMultiLevelSwitchCommandClass)node.resolveCommandClass(ZWaveCommandClass.CommandClass.SWITCH_MULTILEVEL, endpoint); if (zwaveCommandClass == null) { logger.error("No Command Class found on node {}, instance/endpoint {} to request level.", nodeId, endpoint); return; } serialMessage = node.encapsulate(zwaveCommandClass.increaseLevelMessage(), zwaveCommandClass, endpoint); if (serialMessage != null) { this.sendData(serialMessage); ZWaveEvent zEvent = new ZWaveEvent(ZWaveEventType.DIMMER_EVENT, nodeId, endpoint, zwaveCommandClass.getLevel()); this.notifyEventListeners(zEvent); } }
java
public void increaseLevel(int nodeId, int endpoint) { ZWaveNode node = this.getNode(nodeId); SerialMessage serialMessage = null; ZWaveMultiLevelSwitchCommandClass zwaveCommandClass = (ZWaveMultiLevelSwitchCommandClass)node.resolveCommandClass(ZWaveCommandClass.CommandClass.SWITCH_MULTILEVEL, endpoint); if (zwaveCommandClass == null) { logger.error("No Command Class found on node {}, instance/endpoint {} to request level.", nodeId, endpoint); return; } serialMessage = node.encapsulate(zwaveCommandClass.increaseLevelMessage(), zwaveCommandClass, endpoint); if (serialMessage != null) { this.sendData(serialMessage); ZWaveEvent zEvent = new ZWaveEvent(ZWaveEventType.DIMMER_EVENT, nodeId, endpoint, zwaveCommandClass.getLevel()); this.notifyEventListeners(zEvent); } }
[ "public", "void", "increaseLevel", "(", "int", "nodeId", ",", "int", "endpoint", ")", "{", "ZWaveNode", "node", "=", "this", ".", "getNode", "(", "nodeId", ")", ";", "SerialMessage", "serialMessage", "=", "null", ";", "ZWaveMultiLevelSwitchCommandClass", "zwaveC...
increase level on the node / endpoint. The level is increased. Only dimmers support this. @param nodeId the node id to increase the level for. @param endpoint the endpoint to increase the level for.
[ "increase", "level", "on", "the", "node", "/", "endpoint", ".", "The", "level", "is", "increased", ".", "Only", "dimmers", "support", "this", "." ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L904-L924
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByThumbnailUrl
public Iterable<DUser> queryByThumbnailUrl(java.lang.String thumbnailUrl) { return queryByField(null, DUserMapper.Field.THUMBNAILURL.getFieldName(), thumbnailUrl); }
java
public Iterable<DUser> queryByThumbnailUrl(java.lang.String thumbnailUrl) { return queryByField(null, DUserMapper.Field.THUMBNAILURL.getFieldName(), thumbnailUrl); }
[ "public", "Iterable", "<", "DUser", ">", "queryByThumbnailUrl", "(", "java", ".", "lang", ".", "String", "thumbnailUrl", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "THUMBNAILURL", ".", "getFieldName", "(", ")", ",...
query-by method for field thumbnailUrl @param thumbnailUrl the specified attribute @return an Iterable of DUsers for the specified thumbnailUrl
[ "query", "-", "by", "method", "for", "field", "thumbnailUrl" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L241-L243
datasalt/pangool
core/src/main/java/com/datasalt/pangool/io/Mutator.java
Mutator.subSetOf
public static Schema subSetOf(Schema schema, String... subSetFields) { return subSetOf("subSetSchema" + (COUNTER++), schema, subSetFields); }
java
public static Schema subSetOf(Schema schema, String... subSetFields) { return subSetOf("subSetSchema" + (COUNTER++), schema, subSetFields); }
[ "public", "static", "Schema", "subSetOf", "(", "Schema", "schema", ",", "String", "...", "subSetFields", ")", "{", "return", "subSetOf", "(", "\"subSetSchema\"", "+", "(", "COUNTER", "++", ")", ",", "schema", ",", "subSetFields", ")", ";", "}" ]
Creates a subset of the input Schema exactly with the fields whose names are specified. The name of the schema is auto-generated with a static counter.
[ "Creates", "a", "subset", "of", "the", "input", "Schema", "exactly", "with", "the", "fields", "whose", "names", "are", "specified", ".", "The", "name", "of", "the", "schema", "is", "auto", "-", "generated", "with", "a", "static", "counter", "." ]
train
https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/io/Mutator.java#L52-L54
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/tools/BTools.java
BTools.getSDbl
public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign, int StringLength ) { // String Info = ""; // String SDbl = getSDbl( Value, DecPrec, ShowPlusSign ); // if ( SDbl.length() >= StringLength ) return SDbl; // // String SpacesS = " "; String SpacesS = getSpaces( StringLength ); // Info = SpacesS.substring( 0, StringLength - SDbl.length() ) + SDbl; // return Info; }
java
public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign, int StringLength ) { // String Info = ""; // String SDbl = getSDbl( Value, DecPrec, ShowPlusSign ); // if ( SDbl.length() >= StringLength ) return SDbl; // // String SpacesS = " "; String SpacesS = getSpaces( StringLength ); // Info = SpacesS.substring( 0, StringLength - SDbl.length() ) + SDbl; // return Info; }
[ "public", "static", "String", "getSDbl", "(", "double", "Value", ",", "int", "DecPrec", ",", "boolean", "ShowPlusSign", ",", "int", "StringLength", ")", "{", "//", "String", "Info", "=", "\"\"", ";", "//", "String", "SDbl", "=", "getSDbl", "(", "Value", ...
<b>getSDbl</b><br> public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign, int StringLength )<br> Returns double converted to string.<br> If Value is Double.NaN returns "NaN".<br> If DecPrec is < 0 is DecPrec set 0.<br> If ShowPlusSign is true:<br> - If Value is > 0 sign is '+'.<br> - If Value is 0 sign is ' '.<br> If StringLength is > base double string length<br> before base double string adds relevant spaces.<br> If StringLength is <= base double string length<br> returns base double string.<br> @param Value - value @param DecPrec - decimal precision @param ShowPlusSign - show plus sign @param StringLength - string length @return double as string
[ "<b", ">", "getSDbl<", "/", "b", ">", "<br", ">", "public", "static", "String", "getSDbl", "(", "double", "Value", "int", "DecPrec", "boolean", "ShowPlusSign", "int", "StringLength", ")", "<br", ">", "Returns", "double", "converted", "to", "string", ".", "...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/tools/BTools.java#L222-L236
santhosh-tekuri/jlibs
xmldog/src/main/java/jlibs/xml/sax/dog/path/LocationPathAnalyzer.java
LocationPathAnalyzer.compressAnywhere
private static LocationPath compressAnywhere(LocationPath path){ int noOfNulls = 0; Step steps[] = path.steps; Step prevStep = steps[0]; for(int i=1, len=steps.length; i<len; i++){ Step curStep = steps[i]; if(!curStep.predicateSet.hasPosition && prevStep.predicateSet.getPredicate()==null){ if(prevStep.axis==Axis.DESCENDANT_OR_SELF && prevStep.constraint.id==Constraint.ID_NODE){ if(curStep.axis==Axis.CHILD){ steps[i-1] = null; Step newStep = new Step(Axis.DESCENDANT, curStep.constraint); newStep.setPredicate(curStep); steps[i] = curStep = newStep; noOfNulls++; } } } prevStep = curStep; } return noOfNulls>0 ? removeNullSteps(path, noOfNulls) : path; }
java
private static LocationPath compressAnywhere(LocationPath path){ int noOfNulls = 0; Step steps[] = path.steps; Step prevStep = steps[0]; for(int i=1, len=steps.length; i<len; i++){ Step curStep = steps[i]; if(!curStep.predicateSet.hasPosition && prevStep.predicateSet.getPredicate()==null){ if(prevStep.axis==Axis.DESCENDANT_OR_SELF && prevStep.constraint.id==Constraint.ID_NODE){ if(curStep.axis==Axis.CHILD){ steps[i-1] = null; Step newStep = new Step(Axis.DESCENDANT, curStep.constraint); newStep.setPredicate(curStep); steps[i] = curStep = newStep; noOfNulls++; } } } prevStep = curStep; } return noOfNulls>0 ? removeNullSteps(path, noOfNulls) : path; }
[ "private", "static", "LocationPath", "compressAnywhere", "(", "LocationPath", "path", ")", "{", "int", "noOfNulls", "=", "0", ";", "Step", "steps", "[", "]", "=", "path", ".", "steps", ";", "Step", "prevStep", "=", "steps", "[", "0", "]", ";", "for", "...
"/descendant::book" if there are no predicates on first two steps
[ "/", "descendant", "::", "book", "if", "there", "are", "no", "predicates", "on", "first", "two", "steps" ]
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/xmldog/src/main/java/jlibs/xml/sax/dog/path/LocationPathAnalyzer.java#L108-L130
micronaut-projects/micronaut-core
core/src/main/java/io/micronaut/core/util/ArgumentUtils.java
ArgumentUtils.requireNonNull
public static <T> T requireNonNull(String name, T value) { Objects.requireNonNull(value, "Argument [" + name + "] cannot be null"); return value; }
java
public static <T> T requireNonNull(String name, T value) { Objects.requireNonNull(value, "Argument [" + name + "] cannot be null"); return value; }
[ "public", "static", "<", "T", ">", "T", "requireNonNull", "(", "String", "name", ",", "T", "value", ")", "{", "Objects", ".", "requireNonNull", "(", "value", ",", "\"Argument [\"", "+", "name", "+", "\"] cannot be null\"", ")", ";", "return", "value", ";",...
Adds a check that the given number is positive. @param name The name of the argument @param value The value @param <T> The generic type @throws IllegalArgumentException if the argument is not positive @return The value
[ "Adds", "a", "check", "that", "the", "given", "number", "is", "positive", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/core/src/main/java/io/micronaut/core/util/ArgumentUtils.java#L52-L55
threerings/nenya
core/src/main/java/com/threerings/resource/ResourceManager.java
ResourceManager.checkBundle
public boolean checkBundle (String path) { File bfile = getResourceFile(path); return (bfile == null) ? false : new FileResourceBundle(bfile, true, _unpack).isUnpacked(); }
java
public boolean checkBundle (String path) { File bfile = getResourceFile(path); return (bfile == null) ? false : new FileResourceBundle(bfile, true, _unpack).isUnpacked(); }
[ "public", "boolean", "checkBundle", "(", "String", "path", ")", "{", "File", "bfile", "=", "getResourceFile", "(", "path", ")", ";", "return", "(", "bfile", "==", "null", ")", "?", "false", ":", "new", "FileResourceBundle", "(", "bfile", ",", "true", ","...
Checks to see if the specified bundle exists, is unpacked and is ready to be used.
[ "Checks", "to", "see", "if", "the", "specified", "bundle", "exists", "is", "unpacked", "and", "is", "ready", "to", "be", "used", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/resource/ResourceManager.java#L458-L462
libgdx/ashley
ashley/src/com/badlogic/ashley/core/Engine.java
Engine.addEntityListener
public void addEntityListener (Family family, int priority, EntityListener listener) { familyManager.addEntityListener(family, priority, listener); }
java
public void addEntityListener (Family family, int priority, EntityListener listener) { familyManager.addEntityListener(family, priority, listener); }
[ "public", "void", "addEntityListener", "(", "Family", "family", ",", "int", "priority", ",", "EntityListener", "listener", ")", "{", "familyManager", ".", "addEntityListener", "(", "family", ",", "priority", ",", "listener", ")", ";", "}" ]
Adds an {@link EntityListener} for a specific {@link Family}. The listener will be notified every time an entity is added/removed to/from the given family. The priority determines in which order the entity listeners will be called. Lower value means it will get executed first.
[ "Adds", "an", "{" ]
train
https://github.com/libgdx/ashley/blob/d53addc965d8a298336636943a157c04d12d583c/ashley/src/com/badlogic/ashley/core/Engine.java#L213-L215
kumuluz/kumuluzee
components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java
ConfigBundleInterceptor.getKeyName
private String getKeyName(Class targetClass, String setter, String keyPrefix) throws Exception { StringBuilder key = new StringBuilder(); key.append(keyPrefix); if (!key.toString().isEmpty()) { key.append("."); } // get ConfigValue Field field = targetClass.getDeclaredField(setterToField(setter)); ConfigValue fieldAnnotation = null; if (field != null) { fieldAnnotation = field.getAnnotation(ConfigValue.class); } if (fieldAnnotation != null && !fieldAnnotation.value().isEmpty()) { key.append(StringUtils.camelCaseToHyphenCase(fieldAnnotation.value())); } else { key.append(StringUtils.camelCaseToHyphenCase(setter.substring(3))); } return key.toString(); }
java
private String getKeyName(Class targetClass, String setter, String keyPrefix) throws Exception { StringBuilder key = new StringBuilder(); key.append(keyPrefix); if (!key.toString().isEmpty()) { key.append("."); } // get ConfigValue Field field = targetClass.getDeclaredField(setterToField(setter)); ConfigValue fieldAnnotation = null; if (field != null) { fieldAnnotation = field.getAnnotation(ConfigValue.class); } if (fieldAnnotation != null && !fieldAnnotation.value().isEmpty()) { key.append(StringUtils.camelCaseToHyphenCase(fieldAnnotation.value())); } else { key.append(StringUtils.camelCaseToHyphenCase(setter.substring(3))); } return key.toString(); }
[ "private", "String", "getKeyName", "(", "Class", "targetClass", ",", "String", "setter", ",", "String", "keyPrefix", ")", "throws", "Exception", "{", "StringBuilder", "key", "=", "new", "StringBuilder", "(", ")", ";", "key", ".", "append", "(", "keyPrefix", ...
Construct key name from prefix and field name or ConfigValue value (if present) @param targetClass target class @param setter name of the setter method @param keyPrefix prefix used for generation of a configuration key @return key in format prefix.key-name
[ "Construct", "key", "name", "from", "prefix", "and", "field", "name", "or", "ConfigValue", "value", "(", "if", "present", ")" ]
train
https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/components/cdi/weld/src/main/java/com/kumuluz/ee/configuration/cdi/interceptors/ConfigBundleInterceptor.java#L261-L285
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/engine/Sequence.java
Sequence.computeFrameRate
private void computeFrameRate(Timing updateFpsTimer, long lastTime, long currentTime) { if (updateFpsTimer.elapsed(Constant.ONE_SECOND_IN_MILLI)) { currentFrameRate = (int) Math.round(Constant.ONE_SECOND_IN_NANO / (double) (currentTime - lastTime)); updateFpsTimer.restart(); } }
java
private void computeFrameRate(Timing updateFpsTimer, long lastTime, long currentTime) { if (updateFpsTimer.elapsed(Constant.ONE_SECOND_IN_MILLI)) { currentFrameRate = (int) Math.round(Constant.ONE_SECOND_IN_NANO / (double) (currentTime - lastTime)); updateFpsTimer.restart(); } }
[ "private", "void", "computeFrameRate", "(", "Timing", "updateFpsTimer", ",", "long", "lastTime", ",", "long", "currentTime", ")", "{", "if", "(", "updateFpsTimer", ".", "elapsed", "(", "Constant", ".", "ONE_SECOND_IN_MILLI", ")", ")", "{", "currentFrameRate", "=...
Compute the frame rate depending of the game loop speed. @param updateFpsTimer The update timing @param lastTime The last time value before game loop in nano. @param currentTime The current time after game loop in nano (must be superior or equal to lastTime).
[ "Compute", "the", "frame", "rate", "depending", "of", "the", "game", "loop", "speed", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/engine/Sequence.java#L190-L197
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java
DateFunctions.millisToZone
public static Expression millisToZone(String expression, String timeZoneName, String format) { return millisToZone(x(expression), timeZoneName, format); }
java
public static Expression millisToZone(String expression, String timeZoneName, String format) { return millisToZone(x(expression), timeZoneName, format); }
[ "public", "static", "Expression", "millisToZone", "(", "String", "expression", ",", "String", "timeZoneName", ",", "String", "format", ")", "{", "return", "millisToZone", "(", "x", "(", "expression", ")", ",", "timeZoneName", ",", "format", ")", ";", "}" ]
Returned expression results in a convertion of the UNIX time stamp to a string in the named time zone.
[ "Returned", "expression", "results", "in", "a", "convertion", "of", "the", "UNIX", "time", "stamp", "to", "a", "string", "in", "the", "named", "time", "zone", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/DateFunctions.java#L280-L282
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.createImagesFromData
public ImageCreateSummary createImagesFromData(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) { return createImagesFromDataWithServiceResponseAsync(projectId, imageData, createImagesFromDataOptionalParameter).toBlocking().single().body(); }
java
public ImageCreateSummary createImagesFromData(UUID projectId, byte[] imageData, CreateImagesFromDataOptionalParameter createImagesFromDataOptionalParameter) { return createImagesFromDataWithServiceResponseAsync(projectId, imageData, createImagesFromDataOptionalParameter).toBlocking().single().body(); }
[ "public", "ImageCreateSummary", "createImagesFromData", "(", "UUID", "projectId", ",", "byte", "[", "]", "imageData", ",", "CreateImagesFromDataOptionalParameter", "createImagesFromDataOptionalParameter", ")", "{", "return", "createImagesFromDataWithServiceResponseAsync", "(", ...
Add the provided images to the set of training images. This API accepts body content as multipart/form-data and application/octet-stream. When using multipart multiple image files can be sent at once, with a maximum of 64 files. @param projectId The project id @param imageData the InputStream value @param createImagesFromDataOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ImageCreateSummary object if successful.
[ "Add", "the", "provided", "images", "to", "the", "set", "of", "training", "images", ".", "This", "API", "accepts", "body", "content", "as", "multipart", "/", "form", "-", "data", "and", "application", "/", "octet", "-", "stream", ".", "When", "using", "m...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L4103-L4105
shrinkwrap/resolver
maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/plugins/Validate.java
Validate.notNullAndNoNullValues
public static void notNullAndNoNullValues(final Object[] objects, final String message) { notNull(objects, message); for (Object object : objects) { notNull(object, message); } }
java
public static void notNullAndNoNullValues(final Object[] objects, final String message) { notNull(objects, message); for (Object object : objects) { notNull(object, message); } }
[ "public", "static", "void", "notNullAndNoNullValues", "(", "final", "Object", "[", "]", "objects", ",", "final", "String", "message", ")", "{", "notNull", "(", "objects", ",", "message", ")", ";", "for", "(", "Object", "object", ":", "objects", ")", "{", ...
Checks that the specified array is not null or contain any null values. @param objects The object to check @param message The exception message
[ "Checks", "that", "the", "specified", "array", "is", "not", "null", "or", "contain", "any", "null", "values", "." ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/plugins/Validate.java#L170-L175
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java
Jdt2Ecore.getJvmOperation
private JvmOperation getJvmOperation(IMethod method, JvmType context) throws JavaModelException { if (context instanceof JvmDeclaredType) { final JvmDeclaredType declaredType = (JvmDeclaredType) context; final ActionParameterTypes jdtSignature = this.actionPrototypeProvider.createParameterTypes( Flags.isVarargs(method.getFlags()), getFormalParameterProvider(method)); for (final JvmOperation jvmOperation : declaredType.getDeclaredOperations()) { final ActionParameterTypes jvmSignature = this.actionPrototypeProvider.createParameterTypesFromJvmModel( jvmOperation.isVarArgs(), jvmOperation.getParameters()); if (jvmSignature.equals(jdtSignature)) { return jvmOperation; } } } return null; }
java
private JvmOperation getJvmOperation(IMethod method, JvmType context) throws JavaModelException { if (context instanceof JvmDeclaredType) { final JvmDeclaredType declaredType = (JvmDeclaredType) context; final ActionParameterTypes jdtSignature = this.actionPrototypeProvider.createParameterTypes( Flags.isVarargs(method.getFlags()), getFormalParameterProvider(method)); for (final JvmOperation jvmOperation : declaredType.getDeclaredOperations()) { final ActionParameterTypes jvmSignature = this.actionPrototypeProvider.createParameterTypesFromJvmModel( jvmOperation.isVarArgs(), jvmOperation.getParameters()); if (jvmSignature.equals(jdtSignature)) { return jvmOperation; } } } return null; }
[ "private", "JvmOperation", "getJvmOperation", "(", "IMethod", "method", ",", "JvmType", "context", ")", "throws", "JavaModelException", "{", "if", "(", "context", "instanceof", "JvmDeclaredType", ")", "{", "final", "JvmDeclaredType", "declaredType", "=", "(", "JvmDe...
Create the JvmOperation for the given JDT method. @param method the JDT method. @param context the context of the constructor. @return the JvmOperation @throws JavaModelException if the Java model is invalid.
[ "Create", "the", "JvmOperation", "for", "the", "given", "JDT", "method", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java#L414-L431
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java
P3DatabaseReader.defineField
private static void defineField(Map<String, FieldType> container, String name, FieldType type) { defineField(container, name, type, null); }
java
private static void defineField(Map<String, FieldType> container, String name, FieldType type) { defineField(container, name, type, null); }
[ "private", "static", "void", "defineField", "(", "Map", "<", "String", ",", "FieldType", ">", "container", ",", "String", "name", ",", "FieldType", "type", ")", "{", "defineField", "(", "container", ",", "name", ",", "type", ",", "null", ")", ";", "}" ]
Configure the mapping between a database column and a field. @param container column to field map @param name column name @param type field type
[ "Configure", "the", "mapping", "between", "a", "database", "column", "and", "a", "field", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/P3DatabaseReader.java#L605-L608
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java
ImageModerationsImpl.oCRUrlInputAsync
public Observable<OCR> oCRUrlInputAsync(String language, String contentType, BodyModelModel imageUrl, OCRUrlInputOptionalParameter oCRUrlInputOptionalParameter) { return oCRUrlInputWithServiceResponseAsync(language, contentType, imageUrl, oCRUrlInputOptionalParameter).map(new Func1<ServiceResponse<OCR>, OCR>() { @Override public OCR call(ServiceResponse<OCR> response) { return response.body(); } }); }
java
public Observable<OCR> oCRUrlInputAsync(String language, String contentType, BodyModelModel imageUrl, OCRUrlInputOptionalParameter oCRUrlInputOptionalParameter) { return oCRUrlInputWithServiceResponseAsync(language, contentType, imageUrl, oCRUrlInputOptionalParameter).map(new Func1<ServiceResponse<OCR>, OCR>() { @Override public OCR call(ServiceResponse<OCR> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OCR", ">", "oCRUrlInputAsync", "(", "String", "language", ",", "String", "contentType", ",", "BodyModelModel", "imageUrl", ",", "OCRUrlInputOptionalParameter", "oCRUrlInputOptionalParameter", ")", "{", "return", "oCRUrlInputWithServiceResponseA...
Returns any text found in the image for the language specified. If no language is specified in input then the detection defaults to English. @param language Language of the terms. @param contentType The content type. @param imageUrl The image url. @param oCRUrlInputOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OCR object
[ "Returns", "any", "text", "found", "in", "the", "image", "for", "the", "language", "specified", ".", "If", "no", "language", "is", "specified", "in", "input", "then", "the", "detection", "defaults", "to", "English", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ImageModerationsImpl.java#L1076-L1083
SahaginOrg/sahagin-java
src/main/java/org/sahagin/runlib/runresultsgen/RunResultsGenerateHookSetter.java
RunResultsGenerateHookSetter.afterHookInsertLine
private int afterHookInsertLine(TestMethod method, int codeLineIndex) { // if multiple statements exist in one line, afterHook is inserted only after the last statement, // since when multi-line statements are like: // method(1);method( // 2); // insertion to the middle of the statement causes problem if (!isLineLastStament(method, codeLineIndex)) { return -1; } // insert hook to the next line of the codeLine // since insertAt method inserts code just before the specified line CodeLine codeLine = method.getCodeBody().get(codeLineIndex); return codeLine.getEndLine() + 1; }
java
private int afterHookInsertLine(TestMethod method, int codeLineIndex) { // if multiple statements exist in one line, afterHook is inserted only after the last statement, // since when multi-line statements are like: // method(1);method( // 2); // insertion to the middle of the statement causes problem if (!isLineLastStament(method, codeLineIndex)) { return -1; } // insert hook to the next line of the codeLine // since insertAt method inserts code just before the specified line CodeLine codeLine = method.getCodeBody().get(codeLineIndex); return codeLine.getEndLine() + 1; }
[ "private", "int", "afterHookInsertLine", "(", "TestMethod", "method", ",", "int", "codeLineIndex", ")", "{", "// if multiple statements exist in one line, afterHook is inserted only after the last statement,", "// since when multi-line statements are like:", "// method(1);method(", "// ...
Returns -1 if afterHook for the codeLineIndex should not be inserted
[ "Returns", "-", "1", "if", "afterHook", "for", "the", "codeLineIndex", "should", "not", "be", "inserted" ]
train
https://github.com/SahaginOrg/sahagin-java/blob/7ace428adebe3466ceb5826bc9681f8e3d52be68/src/main/java/org/sahagin/runlib/runresultsgen/RunResultsGenerateHookSetter.java#L149-L162
alkacon/opencms-core
src/org/opencms/main/CmsShellCommands.java
CmsShellCommands.writeProperty
public void writeProperty(String resourceName, String propertyName, String value) throws CmsException { m_cms.lockResource(resourceName); m_cms.writePropertyObject(resourceName, new CmsProperty(propertyName, value, null)); }
java
public void writeProperty(String resourceName, String propertyName, String value) throws CmsException { m_cms.lockResource(resourceName); m_cms.writePropertyObject(resourceName, new CmsProperty(propertyName, value, null)); }
[ "public", "void", "writeProperty", "(", "String", "resourceName", ",", "String", "propertyName", ",", "String", "value", ")", "throws", "CmsException", "{", "m_cms", ".", "lockResource", "(", "resourceName", ")", ";", "m_cms", ".", "writePropertyObject", "(", "r...
Writes the given property to the resource as structure value.<p> @param resourceName the resource to write the value to @param propertyName the property to write the value to @param value the value to write @throws CmsException if something goes wrong
[ "Writes", "the", "given", "property", "to", "the", "resource", "as", "structure", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L1815-L1819
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/ReflectionUtil.java
ReflectionUtil.forName
@Pure @Inline(value = "ReflectionUtil.forName(($1), true, ($2))", imported = {ReflectionUtil.class}) public static Class<?> forName(String name, ClassLoader loader) throws ClassNotFoundException { return forName(name, true, loader); }
java
@Pure @Inline(value = "ReflectionUtil.forName(($1), true, ($2))", imported = {ReflectionUtil.class}) public static Class<?> forName(String name, ClassLoader loader) throws ClassNotFoundException { return forName(name, true, loader); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"ReflectionUtil.forName(($1), true, ($2))\"", ",", "imported", "=", "{", "ReflectionUtil", ".", "class", "}", ")", "public", "static", "Class", "<", "?", ">", "forName", "(", "String", "name", ",", "ClassLoader"...
Replies the type that corresponds to the specified class. If the name corresponds to a primitive type, the low-level type will be replied. This method extends {@link Class#forName(String)} with autoboxing support. @param name is the name of the class to load. @param loader is the class loader to use. @return the loaded class @throws ClassNotFoundException if name names an unknown class or primitive
[ "Replies", "the", "type", "that", "corresponds", "to", "the", "specified", "class", ".", "If", "the", "name", "corresponds", "to", "a", "primitive", "type", "the", "low", "-", "level", "type", "will", "be", "replied", ".", "This", "method", "extends", "{",...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/ReflectionUtil.java#L245-L249
threerings/narya
core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java
ChatDirector.deliverChat
protected String deliverChat (SpeakService speakSvc, String message, byte mode) { // run the message through our mogrification process message = mogrifyChat(message, mode, true, mode != ChatCodes.EMOTE_MODE); // mogrification may result in something being turned into a slash command, in which case // we have to run everything through again from the start if (message.startsWith("/")) { return requestChat(speakSvc, message, false); } // make sure this client is not restricted from performing this chat message for some // reason or other String errmsg = checkCanChat(speakSvc, message, mode); if (errmsg != null) { return errmsg; } // speak on the specified service requestSpeak(speakSvc, message, mode); return ChatCodes.SUCCESS; }
java
protected String deliverChat (SpeakService speakSvc, String message, byte mode) { // run the message through our mogrification process message = mogrifyChat(message, mode, true, mode != ChatCodes.EMOTE_MODE); // mogrification may result in something being turned into a slash command, in which case // we have to run everything through again from the start if (message.startsWith("/")) { return requestChat(speakSvc, message, false); } // make sure this client is not restricted from performing this chat message for some // reason or other String errmsg = checkCanChat(speakSvc, message, mode); if (errmsg != null) { return errmsg; } // speak on the specified service requestSpeak(speakSvc, message, mode); return ChatCodes.SUCCESS; }
[ "protected", "String", "deliverChat", "(", "SpeakService", "speakSvc", ",", "String", "message", ",", "byte", "mode", ")", "{", "// run the message through our mogrification process", "message", "=", "mogrifyChat", "(", "message", ",", "mode", ",", "true", ",", "mod...
Delivers a plain chat message (not a slash command) on the specified speak service in the specified mode. The message will be mogrified and filtered prior to delivery. @return {@link ChatCodes#SUCCESS} if the message was delivered or a string indicating why it failed.
[ "Delivers", "a", "plain", "chat", "message", "(", "not", "a", "slash", "command", ")", "on", "the", "specified", "speak", "service", "in", "the", "specified", "mode", ".", "The", "message", "will", "be", "mogrified", "and", "filtered", "prior", "to", "deli...
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/chat/client/ChatDirector.java#L826-L848
Harium/keel
src/main/java/com/harium/keel/catalano/core/IntPoint.java
IntPoint.Subtract
public static IntPoint Subtract(IntPoint point1, IntPoint point2) { IntPoint result = new IntPoint(point1); result.Subtract(point2); return result; }
java
public static IntPoint Subtract(IntPoint point1, IntPoint point2) { IntPoint result = new IntPoint(point1); result.Subtract(point2); return result; }
[ "public", "static", "IntPoint", "Subtract", "(", "IntPoint", "point1", ",", "IntPoint", "point2", ")", "{", "IntPoint", "result", "=", "new", "IntPoint", "(", "point1", ")", ";", "result", ".", "Subtract", "(", "point2", ")", ";", "return", "result", ";", ...
Subtract values of two points. @param point1 IntPoint. @param point2 IntPoint. @return IntPoint that contains X and Y axis coordinate.
[ "Subtract", "values", "of", "two", "points", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/IntPoint.java#L172-L176
Azure/azure-sdk-for-java
keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java
VaultsInner.purgeDeleted
public void purgeDeleted(String vaultName, String location) { purgeDeletedWithServiceResponseAsync(vaultName, location).toBlocking().last().body(); }
java
public void purgeDeleted(String vaultName, String location) { purgeDeletedWithServiceResponseAsync(vaultName, location).toBlocking().last().body(); }
[ "public", "void", "purgeDeleted", "(", "String", "vaultName", ",", "String", "location", ")", "{", "purgeDeletedWithServiceResponseAsync", "(", "vaultName", ",", "location", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";",...
Permanently deletes the specified vault. aka Purges the deleted Azure key vault. @param vaultName The name of the soft-deleted vault. @param location The location of the soft-deleted vault. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Permanently", "deletes", "the", "specified", "vault", ".", "aka", "Purges", "the", "deleted", "Azure", "key", "vault", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java#L1253-L1255
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.addAlias
public void addAlias(CmsDbContext dbc, CmsProject project, CmsAlias alias) throws CmsException { I_CmsVfsDriver vfsDriver = getVfsDriver(dbc); vfsDriver.insertAlias(dbc, project, alias); }
java
public void addAlias(CmsDbContext dbc, CmsProject project, CmsAlias alias) throws CmsException { I_CmsVfsDriver vfsDriver = getVfsDriver(dbc); vfsDriver.insertAlias(dbc, project, alias); }
[ "public", "void", "addAlias", "(", "CmsDbContext", "dbc", ",", "CmsProject", "project", ",", "CmsAlias", "alias", ")", "throws", "CmsException", "{", "I_CmsVfsDriver", "vfsDriver", "=", "getVfsDriver", "(", "dbc", ")", ";", "vfsDriver", ".", "insertAlias", "(", ...
Adds an alias entry.<p> @param dbc the database context @param project the current project @param alias the alias to add @throws CmsException if something goes wrong
[ "Adds", "an", "alias", "entry", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L559-L563
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUEUnit.java
CLIQUEUnit.containsRightNeighbor
protected boolean containsRightNeighbor(CLIQUEUnit unit, int d) { final int e = dims.length - 1; return checkDimensions(unit, e) && bounds[e << 1] == unit.bounds[(e << 1) + 1]; }
java
protected boolean containsRightNeighbor(CLIQUEUnit unit, int d) { final int e = dims.length - 1; return checkDimensions(unit, e) && bounds[e << 1] == unit.bounds[(e << 1) + 1]; }
[ "protected", "boolean", "containsRightNeighbor", "(", "CLIQUEUnit", "unit", ",", "int", "d", ")", "{", "final", "int", "e", "=", "dims", ".", "length", "-", "1", ";", "return", "checkDimensions", "(", "unit", ",", "e", ")", "&&", "bounds", "[", "e", "<...
Returns true if this unit is the right neighbor of the given unit. @param unit Reference unit @param d Current dimension @return true if this unit is the right neighbor of the given unit
[ "Returns", "true", "if", "this", "unit", "is", "the", "right", "neighbor", "of", "the", "given", "unit", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUEUnit.java#L186-L189
duracloud/duracloud
durastore/src/main/java/org/duracloud/durastore/rest/TaskRest.java
TaskRest.getSupportedTasks
@GET public Response getSupportedTasks(@QueryParam("storeID") String storeID) { String msg = "getting suppported tasks(" + storeID + ")"; try { TaskProvider taskProvider = taskProviderFactory.getTaskProvider(storeID); List<String> supportedTasks = taskProvider.getSupportedTasks(); String responseText = SerializationUtil.serializeList(supportedTasks); return responseOkXml(msg, responseText); } catch (Exception e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } }
java
@GET public Response getSupportedTasks(@QueryParam("storeID") String storeID) { String msg = "getting suppported tasks(" + storeID + ")"; try { TaskProvider taskProvider = taskProviderFactory.getTaskProvider(storeID); List<String> supportedTasks = taskProvider.getSupportedTasks(); String responseText = SerializationUtil.serializeList(supportedTasks); return responseOkXml(msg, responseText); } catch (Exception e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } }
[ "@", "GET", "public", "Response", "getSupportedTasks", "(", "@", "QueryParam", "(", "\"storeID\"", ")", "String", "storeID", ")", "{", "String", "msg", "=", "\"getting suppported tasks(\"", "+", "storeID", "+", "\")\"", ";", "try", "{", "TaskProvider", "taskProv...
Gets a listing of supported tasks for a given provider @return 200 on success
[ "Gets", "a", "listing", "of", "supported", "tasks", "for", "a", "given", "provider" ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/TaskRest.java#L68-L83
OpenBEL/openbel-framework
org.openbel.framework.common/src/main/java/org/openbel/framework/common/util/ValidationUtilities.java
ValidationUtilities.isValid
public static boolean isValid(AnnotationDefinition annoDef, String value) throws PatternSyntaxException { if (annoDef == null) { throw new InvalidArgument("annoDef", annoDef); } if (annoDef.getType() == null) { return false; } switch (annoDef.getType()) { case ENUMERATION: return validateEnumeration(annoDef.getEnums(), value); case REGULAR_EXPRESSION: return validateRegExp(annoDef.getValue(), value); default: return false; } }
java
public static boolean isValid(AnnotationDefinition annoDef, String value) throws PatternSyntaxException { if (annoDef == null) { throw new InvalidArgument("annoDef", annoDef); } if (annoDef.getType() == null) { return false; } switch (annoDef.getType()) { case ENUMERATION: return validateEnumeration(annoDef.getEnums(), value); case REGULAR_EXPRESSION: return validateRegExp(annoDef.getValue(), value); default: return false; } }
[ "public", "static", "boolean", "isValid", "(", "AnnotationDefinition", "annoDef", ",", "String", "value", ")", "throws", "PatternSyntaxException", "{", "if", "(", "annoDef", "==", "null", ")", "{", "throw", "new", "InvalidArgument", "(", "\"annoDef\"", ",", "ann...
Determine if the given value is valid as defined by the specified {@link AnnotationDefinition}. A valid value is one that is valid for the specified domain of the {@link AnnotationDefinition}. @param annoDef a <code>non-null</code> {@link AnnotationDefinition}. Although the {@link AnnotationType} of the annoDef may be null, this method will always evaluate to <code>false</code> in such a case. @param value the value to validate, possibly <code>null</code> @return whether the given value is valid as defined by the given {@link AnnotationDefinition} @throws PatternSyntaxException if the {@link AnnotationDefinition} used by the {@link Annotation} is of type {@value AnnotationType#REGULAR_EXPRESSION} and the specified pattern is invalid. @throws InvalidArgument Thrown if the <tt>annoDef</tt> argument isnull
[ "Determine", "if", "the", "given", "value", "is", "valid", "as", "defined", "by", "the", "specified", "{", "@link", "AnnotationDefinition", "}", ".", "A", "valid", "value", "is", "one", "that", "is", "valid", "for", "the", "specified", "domain", "of", "the...
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/util/ValidationUtilities.java#L105-L121
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java
SimpleFormatterImpl.formatCompiledPattern
public static String formatCompiledPattern(String compiledPattern, CharSequence... values) { return formatAndAppend(compiledPattern, new StringBuilder(), null, values).toString(); }
java
public static String formatCompiledPattern(String compiledPattern, CharSequence... values) { return formatAndAppend(compiledPattern, new StringBuilder(), null, values).toString(); }
[ "public", "static", "String", "formatCompiledPattern", "(", "String", "compiledPattern", ",", "CharSequence", "...", "values", ")", "{", "return", "formatAndAppend", "(", "compiledPattern", ",", "new", "StringBuilder", "(", ")", ",", "null", ",", "values", ")", ...
Formats the given values. @param compiledPattern Compiled form of a pattern string.
[ "Formats", "the", "given", "values", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java#L189-L191
detro/browsermob-proxy-client
src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java
BMPCProxy.newHar
public JsonObject newHar(String initialPageRef, boolean captureHeaders, boolean captureContent, boolean captureBinaryContent) { try { // Request BMP to create a new HAR for this Proxy HttpPut request = new HttpPut(requestURIBuilder() .setPath(proxyURIPath() + "/har") .build()); // Add form parameters to the request applyFormParamsToHttpRequest(request, new BasicNameValuePair("initialPageRef", initialPageRef), new BasicNameValuePair("captureHeaders", Boolean.toString(captureHeaders)), new BasicNameValuePair("captureContent", Boolean.toString(captureContent)), new BasicNameValuePair("captureBinaryContent", Boolean.toString(captureBinaryContent))); // Execute request CloseableHttpResponse response = HTTPclient.execute(request); // Parse response into JSON JsonObject previousHar = httpResponseToJsonObject(response); // Close HTTP Response response.close(); return previousHar; } catch (Exception e) { throw new BMPCUnableToCreateHarException(e); } }
java
public JsonObject newHar(String initialPageRef, boolean captureHeaders, boolean captureContent, boolean captureBinaryContent) { try { // Request BMP to create a new HAR for this Proxy HttpPut request = new HttpPut(requestURIBuilder() .setPath(proxyURIPath() + "/har") .build()); // Add form parameters to the request applyFormParamsToHttpRequest(request, new BasicNameValuePair("initialPageRef", initialPageRef), new BasicNameValuePair("captureHeaders", Boolean.toString(captureHeaders)), new BasicNameValuePair("captureContent", Boolean.toString(captureContent)), new BasicNameValuePair("captureBinaryContent", Boolean.toString(captureBinaryContent))); // Execute request CloseableHttpResponse response = HTTPclient.execute(request); // Parse response into JSON JsonObject previousHar = httpResponseToJsonObject(response); // Close HTTP Response response.close(); return previousHar; } catch (Exception e) { throw new BMPCUnableToCreateHarException(e); } }
[ "public", "JsonObject", "newHar", "(", "String", "initialPageRef", ",", "boolean", "captureHeaders", ",", "boolean", "captureContent", ",", "boolean", "captureBinaryContent", ")", "{", "try", "{", "// Request BMP to create a new HAR for this Proxy", "HttpPut", "request", ...
Creates a new HAR attached to the proxy. @param initialPageRef Name of the first pageRef that should be used by the HAR. If "null", default to "Page 1" @param captureHeaders Enables capturing of HTTP Headers @param captureContent Enables capturing of HTTP Response Content (body) @param captureBinaryContent Enabled capturing of HTTP Response Binary Content (in bse64 encoding) @return JsonObject HAR response if this proxy was previously collecting another HAR, effectively considering that concluded. "null" otherwise.
[ "Creates", "a", "new", "HAR", "attached", "to", "the", "proxy", "." ]
train
https://github.com/detro/browsermob-proxy-client/blob/da03deff8211b7e1153e36100c5ba60acd470a4f/src/main/java/com/github/detro/browsermobproxyclient/BMPCProxy.java#L277-L306
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.createMockAndExpectNew
public static synchronized <T> T createMockAndExpectNew(Class<T> type, Object... arguments) throws Exception { T mock = createMock(type); expectNew(type, arguments).andReturn(mock); return mock; }
java
public static synchronized <T> T createMockAndExpectNew(Class<T> type, Object... arguments) throws Exception { T mock = createMock(type); expectNew(type, arguments).andReturn(mock); return mock; }
[ "public", "static", "synchronized", "<", "T", ">", "T", "createMockAndExpectNew", "(", "Class", "<", "T", ">", "type", ",", "Object", "...", "arguments", ")", "throws", "Exception", "{", "T", "mock", "=", "createMock", "(", "type", ")", ";", "expectNew", ...
Convenience method for createMock followed by expectNew. @param type The class that should be mocked. @param arguments The constructor arguments. @return A mock object of the same type as the mock. @throws Exception
[ "Convenience", "method", "for", "createMock", "followed", "by", "expectNew", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L1504-L1508
liferay/com-liferay-commerce
commerce-shipping-engine-fixed-service/src/main/java/com/liferay/commerce/shipping/engine/fixed/service/persistence/impl/CommerceShippingFixedOptionPersistenceImpl.java
CommerceShippingFixedOptionPersistenceImpl.findAll
@Override public List<CommerceShippingFixedOption> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceShippingFixedOption> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceShippingFixedOption", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce shipping fixed options. @return the commerce shipping fixed options
[ "Returns", "all", "the", "commerce", "shipping", "fixed", "options", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-shipping-engine-fixed-service/src/main/java/com/liferay/commerce/shipping/engine/fixed/service/persistence/impl/CommerceShippingFixedOptionPersistenceImpl.java#L1146-L1149
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/Strings.java
Strings.splitToInt
public static Integer[] splitToInt(final String ids) { if (isEmpty(ids)) return new Integer[0]; else return transformToInt(split(ids, ',')); }
java
public static Integer[] splitToInt(final String ids) { if (isEmpty(ids)) return new Integer[0]; else return transformToInt(split(ids, ',')); }
[ "public", "static", "Integer", "[", "]", "splitToInt", "(", "final", "String", "ids", ")", "{", "if", "(", "isEmpty", "(", "ids", ")", ")", "return", "new", "Integer", "[", "0", "]", ";", "else", "return", "transformToInt", "(", "split", "(", "ids", ...
<p> splitToInt. </p> @param ids a {@link java.lang.String} object. @return an array of {@link java.lang.Integer} objects.
[ "<p", ">", "splitToInt", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L940-L943
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingPropagator.java
VectorPackingPropagator.filterLoadInf
protected boolean filterLoadInf(int dim, int bin, int newLoadInf) throws ContradictionException { int delta = newLoadInf - loads[dim][bin].getLB(); if (delta <= 0) return false; loads[dim][bin].updateLowerBound(newLoadInf, this); if (sumISizes[dim] < sumLoadInf[dim].add(delta)) fails(); return true; }
java
protected boolean filterLoadInf(int dim, int bin, int newLoadInf) throws ContradictionException { int delta = newLoadInf - loads[dim][bin].getLB(); if (delta <= 0) return false; loads[dim][bin].updateLowerBound(newLoadInf, this); if (sumISizes[dim] < sumLoadInf[dim].add(delta)) fails(); return true; }
[ "protected", "boolean", "filterLoadInf", "(", "int", "dim", ",", "int", "bin", ",", "int", "newLoadInf", ")", "throws", "ContradictionException", "{", "int", "delta", "=", "newLoadInf", "-", "loads", "[", "dim", "]", "[", "bin", "]", ".", "getLB", "(", "...
update the inf(binLoad) and sumLoadInf accordingly @param dim the dimension @param bin the bin @param newLoadInf the new lower bound value @return if the lower bound has actually been updated @throws ContradictionException if the domain of the bin load variable becomes empty
[ "update", "the", "inf", "(", "binLoad", ")", "and", "sumLoadInf", "accordingly" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingPropagator.java#L267-L275
facebook/fresco
imagepipeline/src/main/java/com/facebook/imagepipeline/memory/MemoryChunkUtil.java
MemoryChunkUtil.adjustByteCount
static int adjustByteCount(final int offset, final int count, final int memorySize) { final int available = Math.max(0, memorySize - offset); return Math.min(available, count); }
java
static int adjustByteCount(final int offset, final int count, final int memorySize) { final int available = Math.max(0, memorySize - offset); return Math.min(available, count); }
[ "static", "int", "adjustByteCount", "(", "final", "int", "offset", ",", "final", "int", "count", ",", "final", "int", "memorySize", ")", "{", "final", "int", "available", "=", "Math", ".", "max", "(", "0", ",", "memorySize", "-", "offset", ")", ";", "r...
Computes number of bytes that can be safely read/written starting at given offset, but no more than count.
[ "Computes", "number", "of", "bytes", "that", "can", "be", "safely", "read", "/", "written", "starting", "at", "given", "offset", "but", "no", "more", "than", "count", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline/src/main/java/com/facebook/imagepipeline/memory/MemoryChunkUtil.java#L17-L20
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/extension/InvokerExtensionProcessor.java
InvokerExtensionProcessor.handleRequest
public void handleRequest(ServletRequest req, ServletResponse res) throws Exception { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME,"handleRequest", "should not enter invoker extension processor to handle request"); } //even though we should have just called getServletWrapper, this time we pass true to do the error handling. //Before we passed it false in case the filters are invoked and give us a new url-pattern. IServletWrapper s = getServletWrapper(req, res,true); if (s!=null){ s.handleRequest(req, res); } else if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME,"handleRequest", "unable to find servlet wrapper to handle request"); } return; }
java
public void handleRequest(ServletRequest req, ServletResponse res) throws Exception { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME,"handleRequest", "should not enter invoker extension processor to handle request"); } //even though we should have just called getServletWrapper, this time we pass true to do the error handling. //Before we passed it false in case the filters are invoked and give us a new url-pattern. IServletWrapper s = getServletWrapper(req, res,true); if (s!=null){ s.handleRequest(req, res); } else if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)){ logger.logp(Level.FINE, CLASS_NAME,"handleRequest", "unable to find servlet wrapper to handle request"); } return; }
[ "public", "void", "handleRequest", "(", "ServletRequest", "req", ",", "ServletResponse", "res", ")", "throws", "Exception", "{", "if", "(", "com", ".", "ibm", ".", "ejs", ".", "ras", ".", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "logger"...
This method will only get invoked if (1) This is the first request to the target servlet to be served by classname/name (2) The request is an include/forward and matched /servlet/*
[ "This", "method", "will", "only", "get", "invoked", "if", "(", "1", ")", "This", "is", "the", "first", "request", "to", "the", "target", "servlet", "to", "be", "served", "by", "classname", "/", "name", "(", "2", ")", "The", "request", "is", "an", "in...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/extension/InvokerExtensionProcessor.java#L134-L150
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.parseCommonContentLine
protected CommonContent parseCommonContentLine(final ParserData parserData, final String line, int lineNumber) throws ParsingException { // Read in the variables inside of the brackets final HashMap<ParserType, String[]> variableMap = getLineVariables(parserData, line, lineNumber, '[', ']', ',', false); if (!variableMap.containsKey(ParserType.NONE)) { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_TOPIC_FORMAT_MSG, lineNumber, line)); } // Get the title final String title = ProcessorUtilities.replaceEscapeChars(getTitle(line, '[')); // Create the common content final CommonContent commonContent = new CommonContent(title, lineNumber, line); commonContent.setUniqueId("L" + lineNumber + "-CommonContent"); // Check that no attributes were defined final String[] baseAttributes = variableMap.get(ParserType.NONE); if (baseAttributes.length > 1) { log.warn(format(ProcessorConstants.WARN_IGNORE_COMMON_CONTENT_ATTRIBUTES_MSG, lineNumber, line)); } // Throw an error for relationships variableMap.remove(ParserType.NONE); if (variableMap.size() > 0) { throw new ParsingException(format(ProcessorConstants.ERROR_COMMON_CONTENT_CONTAINS_ILLEGAL_CONTENT, lineNumber, line)); } return commonContent; }
java
protected CommonContent parseCommonContentLine(final ParserData parserData, final String line, int lineNumber) throws ParsingException { // Read in the variables inside of the brackets final HashMap<ParserType, String[]> variableMap = getLineVariables(parserData, line, lineNumber, '[', ']', ',', false); if (!variableMap.containsKey(ParserType.NONE)) { throw new ParsingException(format(ProcessorConstants.ERROR_INVALID_TOPIC_FORMAT_MSG, lineNumber, line)); } // Get the title final String title = ProcessorUtilities.replaceEscapeChars(getTitle(line, '[')); // Create the common content final CommonContent commonContent = new CommonContent(title, lineNumber, line); commonContent.setUniqueId("L" + lineNumber + "-CommonContent"); // Check that no attributes were defined final String[] baseAttributes = variableMap.get(ParserType.NONE); if (baseAttributes.length > 1) { log.warn(format(ProcessorConstants.WARN_IGNORE_COMMON_CONTENT_ATTRIBUTES_MSG, lineNumber, line)); } // Throw an error for relationships variableMap.remove(ParserType.NONE); if (variableMap.size() > 0) { throw new ParsingException(format(ProcessorConstants.ERROR_COMMON_CONTENT_CONTAINS_ILLEGAL_CONTENT, lineNumber, line)); } return commonContent; }
[ "protected", "CommonContent", "parseCommonContentLine", "(", "final", "ParserData", "parserData", ",", "final", "String", "line", ",", "int", "lineNumber", ")", "throws", "ParsingException", "{", "// Read in the variables inside of the brackets", "final", "HashMap", "<", ...
Processes the input to create a new common content node. @param parserData @param line The line of input to be processed @return A common contents object initialised with the data from the input line. @throws ParsingException Thrown if the line can't be parsed as a Common Content node, due to incorrect syntax.
[ "Processes", "the", "input", "to", "create", "a", "new", "common", "content", "node", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L959-L986
JavaMoney/jsr354-ri-bp
src/main/java/org/javamoney/moneta/function/ScaleRoundedOperator.java
ScaleRoundedOperator.of
public static ScaleRoundedOperator of(int scale, RoundingMode roundingMode) { Objects.requireNonNull(roundingMode); if(RoundingMode.UNNECESSARY.equals(roundingMode)) { throw new IllegalStateException("To create the ScaleRoundedOperator you cannot use the RoundingMode.UNNECESSARY"); } return new ScaleRoundedOperator(scale, roundingMode); }
java
public static ScaleRoundedOperator of(int scale, RoundingMode roundingMode) { Objects.requireNonNull(roundingMode); if(RoundingMode.UNNECESSARY.equals(roundingMode)) { throw new IllegalStateException("To create the ScaleRoundedOperator you cannot use the RoundingMode.UNNECESSARY"); } return new ScaleRoundedOperator(scale, roundingMode); }
[ "public", "static", "ScaleRoundedOperator", "of", "(", "int", "scale", ",", "RoundingMode", "roundingMode", ")", "{", "Objects", ".", "requireNonNull", "(", "roundingMode", ")", ";", "if", "(", "RoundingMode", ".", "UNNECESSARY", ".", "equals", "(", "roundingMod...
Creates the rounded Operator from scale and roundingMode @param scale the scale to be used @param roundingMode the rounding mode to be used @return the {@link MonetaryOperator} using the scale and {@link RoundingMode} used in parameter @throws NullPointerException when the {@link MathContext} is null @see RoundingMode
[ "Creates", "the", "rounded", "Operator", "from", "scale", "and", "roundingMode" ]
train
https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/function/ScaleRoundedOperator.java#L67-L75
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/DefaultCommandManager.java
DefaultCommandManager.createCommandGroup
@Override public CommandGroup createCommandGroup(String groupId, Object[] members) { return createCommandGroup(groupId, members, false, null); }
java
@Override public CommandGroup createCommandGroup(String groupId, Object[] members) { return createCommandGroup(groupId, members, false, null); }
[ "@", "Override", "public", "CommandGroup", "createCommandGroup", "(", "String", "groupId", ",", "Object", "[", "]", "members", ")", "{", "return", "createCommandGroup", "(", "groupId", ",", "members", ",", "false", ",", "null", ")", ";", "}" ]
Create a command group which holds all the given members. @param groupId the id to configure the group. @param members members to add to the group. @return a {@link CommandGroup} which contains all the members.
[ "Create", "a", "command", "group", "which", "holds", "all", "the", "given", "members", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/DefaultCommandManager.java#L292-L295
jaxio/celerio
celerio-engine/src/main/java/com/jaxio/celerio/factory/RelationCollisionUtil.java
RelationCollisionUtil.getManyToManyNamer
public Namer getManyToManyNamer(Namer fromEntityNamer, ColumnConfig pointsOnToEntity, Namer toEntityNamer) { // new configuration Namer result = getManyToManyNamerFromConf(pointsOnToEntity.getManyToManyConfig(), toEntityNamer); // fallback if (result == null) { result = getManyToManyNamerFallBack(fromEntityNamer, pointsOnToEntity, toEntityNamer); } return result; }
java
public Namer getManyToManyNamer(Namer fromEntityNamer, ColumnConfig pointsOnToEntity, Namer toEntityNamer) { // new configuration Namer result = getManyToManyNamerFromConf(pointsOnToEntity.getManyToManyConfig(), toEntityNamer); // fallback if (result == null) { result = getManyToManyNamerFallBack(fromEntityNamer, pointsOnToEntity, toEntityNamer); } return result; }
[ "public", "Namer", "getManyToManyNamer", "(", "Namer", "fromEntityNamer", ",", "ColumnConfig", "pointsOnToEntity", ",", "Namer", "toEntityNamer", ")", "{", "// new configuration", "Namer", "result", "=", "getManyToManyNamerFromConf", "(", "pointsOnToEntity", ".", "getMany...
Compute the appropriate namer for the Java field marked by @ManyToMany
[ "Compute", "the", "appropriate", "namer", "for", "the", "Java", "field", "marked", "by" ]
train
https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/factory/RelationCollisionUtil.java#L89-L100
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.putObject
public void putObject(String bucketName, String objectName, String fileName) throws InvalidBucketNameException, NoSuchAlgorithmException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, InsufficientDataException { putObject(bucketName, objectName, fileName, null); }
java
public void putObject(String bucketName, String objectName, String fileName) throws InvalidBucketNameException, NoSuchAlgorithmException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException, InvalidArgumentException, InsufficientDataException { putObject(bucketName, objectName, fileName, null); }
[ "public", "void", "putObject", "(", "String", "bucketName", ",", "String", "objectName", ",", "String", "fileName", ")", "throws", "InvalidBucketNameException", ",", "NoSuchAlgorithmException", ",", "IOException", ",", "InvalidKeyException", ",", "NoResponseException", ...
Uploads given file as object in given bucket. <p> If the object is larger than 5MB, the client will automatically use a multipart session. </p> <p> If the session fails, the user may attempt to re-upload the object by attempting to create the exact same object again. </p> <p> If the multipart session fails, we abort all the uploaded content. </p> @param bucketName Bucket name. @param objectName Object name to create in the bucket. @param fileName File name to upload. @throws InvalidBucketNameException upon invalid bucket name is given @throws NoSuchAlgorithmException upon requested algorithm was not found during signature calculation @throws IOException upon connection error @throws InvalidKeyException upon an invalid access key or secret key @throws NoResponseException upon no response from server @throws XmlPullParserException upon parsing response xml @throws ErrorResponseException upon unsuccessful execution @throws InternalException upon internal library error @throws InvalidArgumentException upon invalid value is passed to a method. @throws InsufficientDataException upon getting EOFException while reading given
[ "Uploads", "given", "file", "as", "object", "in", "given", "bucket", ".", "<p", ">", "If", "the", "object", "is", "larger", "than", "5MB", "the", "client", "will", "automatically", "use", "a", "multipart", "session", ".", "<", "/", "p", ">", "<p", ">",...
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L3506-L3512
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java
NetUtil.getInputStreamHttpPost
public static InputStream getInputStreamHttpPost(URL pURL, Map pPostData, Properties pProperties, boolean pFollowRedirects, int pTimeout) throws IOException { // Open the connection, and get the stream HttpURLConnection conn = createHttpURLConnection(pURL, pProperties, pFollowRedirects, pTimeout); // HTTP POST method conn.setRequestMethod(HTTP_POST); // Iterate over and create post data string StringBuilder postStr = new StringBuilder(); if (pPostData != null) { Iterator data = pPostData.entrySet().iterator(); while (data.hasNext()) { Map.Entry entry = (Map.Entry) data.next(); // Properties key/values can be safely cast to strings // Encode the string postStr.append(URLEncoder.encode((String) entry.getKey(), "UTF-8")); postStr.append('='); postStr.append(URLEncoder.encode(entry.getValue().toString(), "UTF-8")); if (data.hasNext()) { postStr.append('&'); } } } // Set entity headers String encoding = conn.getRequestProperty("Content-Encoding"); if (StringUtil.isEmpty(encoding)) { encoding = "UTF-8"; } conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-Length", String.valueOf(postStr.length())); conn.setRequestProperty("Content-Encoding", encoding); // Get outputstream (this is where the connect actually happens) OutputStream os = conn.getOutputStream(); OutputStreamWriter writer = new OutputStreamWriter(os, encoding); // Write post data to the stream writer.write(postStr.toString()); writer.write("\r\n"); writer.close(); // Does this close the underlying stream? // Get the inputstream InputStream is = conn.getInputStream(); // We only accept the 200 OK message // TODO: Accept all 200 messages, like ACCEPTED, CREATED or NO_CONTENT? if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) { throw new IOException("The request gave the response: " + conn.getResponseCode() + ": " + conn.getResponseMessage()); } return is; }
java
public static InputStream getInputStreamHttpPost(URL pURL, Map pPostData, Properties pProperties, boolean pFollowRedirects, int pTimeout) throws IOException { // Open the connection, and get the stream HttpURLConnection conn = createHttpURLConnection(pURL, pProperties, pFollowRedirects, pTimeout); // HTTP POST method conn.setRequestMethod(HTTP_POST); // Iterate over and create post data string StringBuilder postStr = new StringBuilder(); if (pPostData != null) { Iterator data = pPostData.entrySet().iterator(); while (data.hasNext()) { Map.Entry entry = (Map.Entry) data.next(); // Properties key/values can be safely cast to strings // Encode the string postStr.append(URLEncoder.encode((String) entry.getKey(), "UTF-8")); postStr.append('='); postStr.append(URLEncoder.encode(entry.getValue().toString(), "UTF-8")); if (data.hasNext()) { postStr.append('&'); } } } // Set entity headers String encoding = conn.getRequestProperty("Content-Encoding"); if (StringUtil.isEmpty(encoding)) { encoding = "UTF-8"; } conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-Length", String.valueOf(postStr.length())); conn.setRequestProperty("Content-Encoding", encoding); // Get outputstream (this is where the connect actually happens) OutputStream os = conn.getOutputStream(); OutputStreamWriter writer = new OutputStreamWriter(os, encoding); // Write post data to the stream writer.write(postStr.toString()); writer.write("\r\n"); writer.close(); // Does this close the underlying stream? // Get the inputstream InputStream is = conn.getInputStream(); // We only accept the 200 OK message // TODO: Accept all 200 messages, like ACCEPTED, CREATED or NO_CONTENT? if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) { throw new IOException("The request gave the response: " + conn.getResponseCode() + ": " + conn.getResponseMessage()); } return is; }
[ "public", "static", "InputStream", "getInputStreamHttpPost", "(", "URL", "pURL", ",", "Map", "pPostData", ",", "Properties", "pProperties", ",", "boolean", "pFollowRedirects", ",", "int", "pTimeout", ")", "throws", "IOException", "{", "// Open the connection, and get th...
Gets the InputStream from a given URL, with the given timeout. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout. Supports basic HTTP authentication, using a URL string similar to most browsers. <P/> <SMALL>Implementation note: If the timeout parameter is greater than 0, this method uses my own implementation of java.net.HttpURLConnection, that uses plain sockets, to create an HTTP connection to the given URL. The {@code read} methods called on the returned InputStream, will block only for the specified timeout. If the timeout expires, a java.io.InterruptedIOException is raised. This might happen BEFORE OR AFTER this method returns, as the HTTP headers will be read and parsed from the InputStream before this method returns, while further read operations on the returned InputStream might be performed at a later stage. <BR/> </SMALL> @param pURL the URL to get. @param pPostData the post data. @param pProperties the request header properties. @param pFollowRedirects specifying wether redirects should be followed. @param pTimeout the specified timeout, in milliseconds. @return an input stream that reads from the socket connection, created from the given URL. @throws UnknownHostException if the IP address for the given URL cannot be resolved. @throws FileNotFoundException if there is no file at the given URL. @throws IOException if an error occurs during transfer.
[ "Gets", "the", "InputStream", "from", "a", "given", "URL", "with", "the", "given", "timeout", ".", "The", "timeout", "must", "be", ">", "0", ".", "A", "timeout", "of", "zero", "is", "interpreted", "as", "an", "infinite", "timeout", ".", "Supports", "basi...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java#L800-L856
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java
WebConfigParamUtils.getStringInitParameter
public static String getStringInitParameter(ExternalContext context, String name, String defaultValue) { if (name == null) { throw new NullPointerException(); } String param = context.getInitParameter(name); if (param == null) { return defaultValue; } param = param.trim(); if (param.length() == 0) { return defaultValue; } return param; }
java
public static String getStringInitParameter(ExternalContext context, String name, String defaultValue) { if (name == null) { throw new NullPointerException(); } String param = context.getInitParameter(name); if (param == null) { return defaultValue; } param = param.trim(); if (param.length() == 0) { return defaultValue; } return param; }
[ "public", "static", "String", "getStringInitParameter", "(", "ExternalContext", "context", ",", "String", "name", ",", "String", "defaultValue", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", ...
Gets the String init parameter value from the specified context. If the parameter is an empty String or a String containing only white space, this method returns <code>null</code> @param context the application's external context @param name the init parameter's name @param defaultValue the value by default if null or empty @return the parameter if it was specified and was not empty, <code>null</code> otherwise @throws NullPointerException if context or name is <code>null</code>
[ "Gets", "the", "String", "init", "parameter", "value", "from", "the", "specified", "context", ".", "If", "the", "parameter", "is", "an", "empty", "String", "or", "a", "String", "containing", "only", "white", "space", "this", "method", "returns", "<code", ">"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java#L69-L90
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java
PdfFileSpecification.addDescription
public void addDescription(String description, boolean unicode) { put(PdfName.DESC, new PdfString(description, unicode ? PdfObject.TEXT_UNICODE : PdfObject.TEXT_PDFDOCENCODING)); }
java
public void addDescription(String description, boolean unicode) { put(PdfName.DESC, new PdfString(description, unicode ? PdfObject.TEXT_UNICODE : PdfObject.TEXT_PDFDOCENCODING)); }
[ "public", "void", "addDescription", "(", "String", "description", ",", "boolean", "unicode", ")", "{", "put", "(", "PdfName", ".", "DESC", ",", "new", "PdfString", "(", "description", ",", "unicode", "?", "PdfObject", ".", "TEXT_UNICODE", ":", "PdfObject", "...
Adds a description for the file that is specified here. @param description some text @param unicode if true, the text is added as a unicode string
[ "Adds", "a", "description", "for", "the", "file", "that", "is", "specified", "here", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfFileSpecification.java#L288-L290
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleQueryFactory.java
RuleQueryFactory.createRuleSearchQuery
public RuleQuery createRuleSearchQuery(DbSession dbSession, Request request) { RuleQuery query = createRuleQuery(dbSession, request); query.setIncludeExternal(request.mandatoryParamAsBoolean(PARAM_INCLUDE_EXTERNAL)); return query; }
java
public RuleQuery createRuleSearchQuery(DbSession dbSession, Request request) { RuleQuery query = createRuleQuery(dbSession, request); query.setIncludeExternal(request.mandatoryParamAsBoolean(PARAM_INCLUDE_EXTERNAL)); return query; }
[ "public", "RuleQuery", "createRuleSearchQuery", "(", "DbSession", "dbSession", ",", "Request", "request", ")", "{", "RuleQuery", "query", "=", "createRuleQuery", "(", "dbSession", ",", "request", ")", ";", "query", ".", "setIncludeExternal", "(", "request", ".", ...
Similar to {@link #createRuleQuery(DbSession, Request)} but sets additional fields which are only used for the rule search WS.
[ "Similar", "to", "{" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/rule/ws/RuleQueryFactory.java#L73-L77
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java
JobOperations.patchJob
public void patchJob(String jobId, PoolInformation poolInfo) throws BatchErrorException, IOException { patchJob(jobId, poolInfo, null, null, null, null, null); }
java
public void patchJob(String jobId, PoolInformation poolInfo) throws BatchErrorException, IOException { patchJob(jobId, poolInfo, null, null, null, null, null); }
[ "public", "void", "patchJob", "(", "String", "jobId", ",", "PoolInformation", "poolInfo", ")", "throws", "BatchErrorException", ",", "IOException", "{", "patchJob", "(", "jobId", ",", "poolInfo", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null...
Updates the specified job. This method only replaces the properties specified with non-null values. @param jobId The ID of the job. @param poolInfo The pool on which the Batch service runs the job's tasks. You may change the pool for a job only when the job is disabled. If you specify an autoPoolSpecification specification in the poolInfo, only the keepAlive property can be updated, and then only if the auto pool has a poolLifetimeOption of job. If null, the job continues to run on its current pool. @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.
[ "Updates", "the", "specified", "job", ".", "This", "method", "only", "replaces", "the", "properties", "specified", "with", "non", "-", "null", "values", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L504-L506
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java
MarvinImage.fillRect
public void fillRect(int x, int y, int w, int h, Color c) { int color = c.getRGB(); for (int i = x; i < x + w; i++) { for (int j = y; j < y + h; j++) { setIntColor(i, j, color); } } }
java
public void fillRect(int x, int y, int w, int h, Color c) { int color = c.getRGB(); for (int i = x; i < x + w; i++) { for (int j = y; j < y + h; j++) { setIntColor(i, j, color); } } }
[ "public", "void", "fillRect", "(", "int", "x", ",", "int", "y", ",", "int", "w", ",", "int", "h", ",", "Color", "c", ")", "{", "int", "color", "=", "c", ".", "getRGB", "(", ")", ";", "for", "(", "int", "i", "=", "x", ";", "i", "<", "x", "...
Fills a rectangle in the image. @param x rect�s start position in x-axis @param y rect�s start positioj in y-axis @param w rect�s width @param h rect�s height @param c rect�s color
[ "Fills", "a", "rectangle", "in", "the", "image", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/marvin/image/MarvinImage.java#L707-L714
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/EnvelopesApi.java
EnvelopesApi.getPages
public PageImages getPages(String accountId, String envelopeId, String documentId) throws ApiException { return getPages(accountId, envelopeId, documentId, null); }
java
public PageImages getPages(String accountId, String envelopeId, String documentId) throws ApiException { return getPages(accountId, envelopeId, documentId, null); }
[ "public", "PageImages", "getPages", "(", "String", "accountId", ",", "String", "envelopeId", ",", "String", "documentId", ")", "throws", "ApiException", "{", "return", "getPages", "(", "accountId", ",", "envelopeId", ",", "documentId", ",", "null", ")", ";", "...
Returns document page image(s) based on input. @param accountId The external account number (int) or account ID Guid. (required) @param envelopeId The envelopeId Guid of the envelope being accessed. (required) @param documentId The ID of the document being accessed. (required) @return PageImages
[ "Returns", "document", "page", "image", "(", "s", ")", "based", "on", "input", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L3064-L3066
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceRequestMap.java
InstanceRequestMap.setMaximumNumberOfInstances
public void setMaximumNumberOfInstances(final InstanceType instanceType, final int number) { this.maximumMap.put(instanceType, Integer.valueOf(number)); }
java
public void setMaximumNumberOfInstances(final InstanceType instanceType, final int number) { this.maximumMap.put(instanceType, Integer.valueOf(number)); }
[ "public", "void", "setMaximumNumberOfInstances", "(", "final", "InstanceType", "instanceType", ",", "final", "int", "number", ")", "{", "this", ".", "maximumMap", ".", "put", "(", "instanceType", ",", "Integer", ".", "valueOf", "(", "number", ")", ")", ";", ...
Sets the maximum number of instances to be requested from the given instance type. @param instanceType the type of instance to request @param number the maximum number of instances to request
[ "Sets", "the", "maximum", "number", "of", "instances", "to", "be", "requested", "from", "the", "given", "instance", "type", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/instance/InstanceRequestMap.java#L66-L69
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.feed_publishStoryToUser
public boolean feed_publishStoryToUser(CharSequence title, CharSequence body, Collection<IFeedImage> images, Integer priority) throws FacebookException, IOException { return feedHandler(FacebookMethod.FEED_PUBLISH_STORY_TO_USER, title, body, images, priority); }
java
public boolean feed_publishStoryToUser(CharSequence title, CharSequence body, Collection<IFeedImage> images, Integer priority) throws FacebookException, IOException { return feedHandler(FacebookMethod.FEED_PUBLISH_STORY_TO_USER, title, body, images, priority); }
[ "public", "boolean", "feed_publishStoryToUser", "(", "CharSequence", "title", ",", "CharSequence", "body", ",", "Collection", "<", "IFeedImage", ">", "images", ",", "Integer", "priority", ")", "throws", "FacebookException", ",", "IOException", "{", "return", "feedHa...
Publish a story to the logged-in user's newsfeed. @param title the title of the feed story @param body the body of the feed story @param images (optional) up to four pairs of image URLs and (possibly null) link URLs @param priority @return whether the story was successfully published; false in case of permission error @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishStoryToUser"> Developers Wiki: Feed.publishStoryToUser</a>
[ "Publish", "a", "story", "to", "the", "logged", "-", "in", "user", "s", "newsfeed", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L365-L369
gtrght/jtuples
src/main/java/com/othelle/jtuples/serialize/JacksonConverter.java
JacksonConverter.getTupleMapperModule
public static SimpleModule getTupleMapperModule() { SimpleModule module = new SimpleModule("1", Version.unknownVersion()); SimpleAbstractTypeResolver resolver = getTupleTypeResolver(); module.setAbstractTypes(resolver); module.setKeyDeserializers(new SimpleKeyDeserializers()); return module; }
java
public static SimpleModule getTupleMapperModule() { SimpleModule module = new SimpleModule("1", Version.unknownVersion()); SimpleAbstractTypeResolver resolver = getTupleTypeResolver(); module.setAbstractTypes(resolver); module.setKeyDeserializers(new SimpleKeyDeserializers()); return module; }
[ "public", "static", "SimpleModule", "getTupleMapperModule", "(", ")", "{", "SimpleModule", "module", "=", "new", "SimpleModule", "(", "\"1\"", ",", "Version", ".", "unknownVersion", "(", ")", ")", ";", "SimpleAbstractTypeResolver", "resolver", "=", "getTupleTypeReso...
Returns the default mapping for all the possible TupleN @return
[ "Returns", "the", "default", "mapping", "for", "all", "the", "possible", "TupleN" ]
train
https://github.com/gtrght/jtuples/blob/f76a6c710cc7b8360130fc4f83be4e5a1bb2de6e/src/main/java/com/othelle/jtuples/serialize/JacksonConverter.java#L28-L35
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java
ArabicShaping.normalize
private int normalize(char[] dest, int start, int length) { int lacount = 0; for (int i = start, e = i + length; i < e; ++i) { char ch = dest[i]; if (ch >= '\uFE70' && ch <= '\uFEFC') { if (isLamAlefChar(ch)) { ++lacount; } dest[i] = (char)convertFEto06[ch - '\uFE70']; } } return lacount; }
java
private int normalize(char[] dest, int start, int length) { int lacount = 0; for (int i = start, e = i + length; i < e; ++i) { char ch = dest[i]; if (ch >= '\uFE70' && ch <= '\uFEFC') { if (isLamAlefChar(ch)) { ++lacount; } dest[i] = (char)convertFEto06[ch - '\uFE70']; } } return lacount; }
[ "private", "int", "normalize", "(", "char", "[", "]", "dest", ",", "int", "start", ",", "int", "length", ")", "{", "int", "lacount", "=", "0", ";", "for", "(", "int", "i", "=", "start", ",", "e", "=", "i", "+", "length", ";", "i", "<", "e", "...
/* Convert the input buffer from FExx Range into 06xx Range to put all characters into the 06xx range even the lamalef is converted to the special region in the 06xx range. Return the number of lamalef chars found.
[ "/", "*", "Convert", "the", "input", "buffer", "from", "FExx", "Range", "into", "06xx", "Range", "to", "put", "all", "characters", "into", "the", "06xx", "range", "even", "the", "lamalef", "is", "converted", "to", "the", "special", "region", "in", "the", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ArabicShaping.java#L1564-L1576
gaixie/jibu-core
src/main/java/org/gaixie/jibu/utils/BeanConverter.java
BeanConverter.mapToBean
public static <T> T mapToBean(Class<T> cls, Map map) throws JibuException { try { T bean = cls.newInstance(); BeanInfo beanInfo = Introspector.getBeanInfo(cls); PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); for( PropertyDescriptor pd : pds ){ Object obj = map.get(pd.getName()); // 如果map中有相同的属性名 if( null != obj ) { Class type = pd.getPropertyType(); Object value = getBeanValue(type, obj); if (null != value ) { pd.getWriteMethod().invoke(bean,value); } } } return bean; } catch (Exception e) { throw new JibuException(e.getMessage()); } }
java
public static <T> T mapToBean(Class<T> cls, Map map) throws JibuException { try { T bean = cls.newInstance(); BeanInfo beanInfo = Introspector.getBeanInfo(cls); PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); for( PropertyDescriptor pd : pds ){ Object obj = map.get(pd.getName()); // 如果map中有相同的属性名 if( null != obj ) { Class type = pd.getPropertyType(); Object value = getBeanValue(type, obj); if (null != value ) { pd.getWriteMethod().invoke(bean,value); } } } return bean; } catch (Exception e) { throw new JibuException(e.getMessage()); } }
[ "public", "static", "<", "T", ">", "T", "mapToBean", "(", "Class", "<", "T", ">", "cls", ",", "Map", "map", ")", "throws", "JibuException", "{", "try", "{", "T", "bean", "=", "cls", ".", "newInstance", "(", ")", ";", "BeanInfo", "beanInfo", "=", "I...
通过 Map 对Javabean 进行实例化并赋值。 <p> Map 对象的格式必须为 key/value 。如果 map 中的 key 与 javabean 中的属性名称一致,并且值可以被转化,则进行赋值。</p> <p> Map 中的 value 不能为数组类型,也就是说不能用 request.getParameterValues() 来获取 value。</p> @param <T> 必须给定 bean 的 class 类型 @param cls 被处理 bean 的 Class @param map 由 bean 属性名做 key 的 Map @return 实例化,并赋值完成的 Bean @exception JibuException 转化失败时抛出
[ "通过", "Map", "对Javabean", "进行实例化并赋值。", "<p", ">", "Map", "对象的格式必须为", "key", "/", "value", "。如果", "map", "中的", "key", "与", "javabean", "中的属性名称一致,并且值可以被转化,则进行赋值。<", "/", "p", ">", "<p", ">", "Map", "中的", "value", "不能为数组类型,也就是说不能用", "request", ".", "getParamete...
train
https://github.com/gaixie/jibu-core/blob/d5462f2883321c82d898c8752b7e5eba4b7dc184/src/main/java/org/gaixie/jibu/utils/BeanConverter.java#L54-L75
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.binary
public static void binary(Image srcImage, ImageOutputStream destImageStream, String imageType) throws IORuntimeException { write(binary(srcImage), imageType, destImageStream); }
java
public static void binary(Image srcImage, ImageOutputStream destImageStream, String imageType) throws IORuntimeException { write(binary(srcImage), imageType, destImageStream); }
[ "public", "static", "void", "binary", "(", "Image", "srcImage", ",", "ImageOutputStream", "destImageStream", ",", "String", "imageType", ")", "throws", "IORuntimeException", "{", "write", "(", "binary", "(", "srcImage", ")", ",", "imageType", ",", "destImageStream...
彩色转为黑白二值化图片<br> 此方法并不关闭流,输出JPG格式 @param srcImage 源图像流 @param destImageStream 目标图像流 @param imageType 图片格式(扩展名) @since 4.0.5 @throws IORuntimeException IO异常
[ "彩色转为黑白二值化图片<br", ">", "此方法并不关闭流,输出JPG格式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L726-L728
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WNumberField.java
WNumberField.handleRequestValue
protected void handleRequestValue(final BigDecimal value, final boolean valid, final String text) { // As setData() clears the text value (if valid), this must be called first so it can be set after setData(value); NumberFieldModel model = getOrCreateComponentModel(); model.validNumber = valid; model.text = text; }
java
protected void handleRequestValue(final BigDecimal value, final boolean valid, final String text) { // As setData() clears the text value (if valid), this must be called first so it can be set after setData(value); NumberFieldModel model = getOrCreateComponentModel(); model.validNumber = valid; model.text = text; }
[ "protected", "void", "handleRequestValue", "(", "final", "BigDecimal", "value", ",", "final", "boolean", "valid", ",", "final", "String", "text", ")", "{", "// As setData() clears the text value (if valid), this must be called first so it can be set after", "setData", "(", "v...
Set the request value. @param value the number value @param valid true if valid value @param text the user text
[ "Set", "the", "request", "value", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WNumberField.java#L85-L91
tiesebarrell/process-assertions
process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/MessageLogger.java
MessageLogger.logTrace
public final void logTrace(final Logger logger, final String messageKey, final Object... objects) { logger.trace(getMessage(messageKey, objects)); }
java
public final void logTrace(final Logger logger, final String messageKey, final Object... objects) { logger.trace(getMessage(messageKey, objects)); }
[ "public", "final", "void", "logTrace", "(", "final", "Logger", "logger", ",", "final", "String", "messageKey", ",", "final", "Object", "...", "objects", ")", "{", "logger", ".", "trace", "(", "getMessage", "(", "messageKey", ",", "objects", ")", ")", ";", ...
Logs a message by the provided key to the provided {@link Logger} at trace level after substituting the parameters in the message by the provided objects. @param logger the logger to log to @param messageKey the key of the message in the bundle @param objects the substitution parameters
[ "Logs", "a", "message", "by", "the", "provided", "key", "to", "the", "provided", "{" ]
train
https://github.com/tiesebarrell/process-assertions/blob/932a8443982e356cdf5a230165a35c725d9306ab/process-assertions-api/src/main/java/org/toxos/processassertions/api/internal/MessageLogger.java#L58-L60
aws/aws-sdk-java
aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/GetLoggerDefinitionResult.java
GetLoggerDefinitionResult.withTags
public GetLoggerDefinitionResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public GetLoggerDefinitionResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "GetLoggerDefinitionResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
The tags for the definition. @param tags The tags for the definition. @return Returns a reference to this object so that method calls can be chained together.
[ "The", "tags", "for", "the", "definition", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/GetLoggerDefinitionResult.java#L310-L313
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/ConcurrencyTools.java
ConcurrencyTools.shutdownAndAwaitTermination
public static void shutdownAndAwaitTermination() { shutdown(); if (pool != null) { try { // wait a while for existing tasks to terminate if (!pool.awaitTermination(60L, TimeUnit.SECONDS)) { pool.shutdownNow(); // cancel currently executing tasks // wait a while for tasks to respond to being canceled if (!pool.awaitTermination(60L, TimeUnit.SECONDS)) { logger.warn("BioJava ConcurrencyTools thread pool did not terminate"); } } } catch (InterruptedException ie) { pool.shutdownNow(); // (re-)cancel if current thread also interrupted Thread.currentThread().interrupt(); // preserve interrupt status } } }
java
public static void shutdownAndAwaitTermination() { shutdown(); if (pool != null) { try { // wait a while for existing tasks to terminate if (!pool.awaitTermination(60L, TimeUnit.SECONDS)) { pool.shutdownNow(); // cancel currently executing tasks // wait a while for tasks to respond to being canceled if (!pool.awaitTermination(60L, TimeUnit.SECONDS)) { logger.warn("BioJava ConcurrencyTools thread pool did not terminate"); } } } catch (InterruptedException ie) { pool.shutdownNow(); // (re-)cancel if current thread also interrupted Thread.currentThread().interrupt(); // preserve interrupt status } } }
[ "public", "static", "void", "shutdownAndAwaitTermination", "(", ")", "{", "shutdown", "(", ")", ";", "if", "(", "pool", "!=", "null", ")", "{", "try", "{", "// wait a while for existing tasks to terminate", "if", "(", "!", "pool", ".", "awaitTermination", "(", ...
Closes the thread pool. Waits 1 minute for a clean exit; if necessary, waits another minute for cancellation.
[ "Closes", "the", "thread", "pool", ".", "Waits", "1", "minute", "for", "a", "clean", "exit", ";", "if", "necessary", "waits", "another", "minute", "for", "cancellation", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/ConcurrencyTools.java#L126-L143
ACRA/acra
acra-core/src/main/java/org/acra/attachment/AcraContentProvider.java
AcraContentProvider.getUriForFile
@SuppressWarnings("WeakerAccess") @NonNull public static Uri getUriForFile(@NonNull Context context, @NonNull Directory directory, @NonNull String relativePath) { final Uri.Builder builder = new Uri.Builder() .scheme(ContentResolver.SCHEME_CONTENT) .authority(getAuthority(context)) .appendPath(directory.name().toLowerCase()); for (String segment : relativePath.split(Pattern.quote(File.separator))) { if (segment.length() > 0) { builder.appendPath(segment); } } return builder.build(); }
java
@SuppressWarnings("WeakerAccess") @NonNull public static Uri getUriForFile(@NonNull Context context, @NonNull Directory directory, @NonNull String relativePath) { final Uri.Builder builder = new Uri.Builder() .scheme(ContentResolver.SCHEME_CONTENT) .authority(getAuthority(context)) .appendPath(directory.name().toLowerCase()); for (String segment : relativePath.split(Pattern.quote(File.separator))) { if (segment.length() > 0) { builder.appendPath(segment); } } return builder.build(); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "@", "NonNull", "public", "static", "Uri", "getUriForFile", "(", "@", "NonNull", "Context", "context", ",", "@", "NonNull", "Directory", "directory", ",", "@", "NonNull", "String", "relativePath", ")", "{", ...
Get an uri for this content provider for the given file @param context a context @param directory the directory, to with the path is relative @param relativePath the file path @return the uri
[ "Get", "an", "uri", "for", "this", "content", "provider", "for", "the", "given", "file" ]
train
https://github.com/ACRA/acra/blob/bfa3235ab110328c5ab2f792ddf8ee87be4a32d1/acra-core/src/main/java/org/acra/attachment/AcraContentProvider.java#L222-L235
astrapi69/jaulp-wicket
jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/ajax/modal/ModalDialogFragmentPanel.java
ModalDialogFragmentPanel.newModalWindow
protected ModalWindow newModalWindow(final String id, final IModel<T> model) { final ModalWindow modal = new ModalWindow(id, model); return modal; }
java
protected ModalWindow newModalWindow(final String id, final IModel<T> model) { final ModalWindow modal = new ModalWindow(id, model); return modal; }
[ "protected", "ModalWindow", "newModalWindow", "(", "final", "String", "id", ",", "final", "IModel", "<", "T", ">", "model", ")", "{", "final", "ModalWindow", "modal", "=", "new", "ModalWindow", "(", "id", ",", "model", ")", ";", "return", "modal", ";", "...
Factory method for creating a new {@link ModalWindow}. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link ModalWindow}. @param id the wicket id @param model the model @return the new {@link ModalWindow}.
[ "Factory", "method", "for", "creating", "a", "new", "{", "@link", "ModalWindow", "}", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provide", ...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-dialogs/src/main/java/de/alpharogroup/wicket/dialogs/ajax/modal/ModalDialogFragmentPanel.java#L124-L128
wcm-io/wcm-io-config
core/src/main/java/io/wcm/config/core/management/impl/override/ParameterOverrideInfoLookup.java
ParameterOverrideInfoLookup.getOverrideForce
public String getOverrideForce(String configurationId, String parameterName) { Map<String, String> overrideForceScopeMapEntry = overrideForceScopeMap.get(configurationId); if (overrideForceScopeMapEntry != null) { return overrideForceScopeMapEntry.get(parameterName); } return null; }
java
public String getOverrideForce(String configurationId, String parameterName) { Map<String, String> overrideForceScopeMapEntry = overrideForceScopeMap.get(configurationId); if (overrideForceScopeMapEntry != null) { return overrideForceScopeMapEntry.get(parameterName); } return null; }
[ "public", "String", "getOverrideForce", "(", "String", "configurationId", ",", "String", "parameterName", ")", "{", "Map", "<", "String", ",", "String", ">", "overrideForceScopeMapEntry", "=", "overrideForceScopeMap", ".", "get", "(", "configurationId", ")", ";", ...
Lookup force override for given configuration Id. @param parameterName Parameter name @return Override value or null
[ "Lookup", "force", "override", "for", "given", "configuration", "Id", "." ]
train
https://github.com/wcm-io/wcm-io-config/blob/9a03d72a4314163a171c7ef815fb6a1eba181828/core/src/main/java/io/wcm/config/core/management/impl/override/ParameterOverrideInfoLookup.java#L144-L150
sstrickx/yahoofinance-api
src/main/java/yahoofinance/quotes/query1v7/QuotesRequest.java
QuotesRequest.getResult
public List<T> getResult() throws IOException { List<T> result = new ArrayList<T>(); Map<String, String> params = new LinkedHashMap<String, String>(); params.put("symbols", this.symbols); String url = YahooFinance.QUOTES_QUERY1V7_BASE_URL + "?" + Utils.getURLParameters(params); // Get JSON from Yahoo log.info("Sending request: " + url); URL request = new URL(url); RedirectableRequest redirectableRequest = new RedirectableRequest(request, 5); redirectableRequest.setConnectTimeout(YahooFinance.CONNECTION_TIMEOUT); redirectableRequest.setReadTimeout(YahooFinance.CONNECTION_TIMEOUT); URLConnection connection = redirectableRequest.openConnection(); InputStreamReader is = new InputStreamReader(connection.getInputStream()); JsonNode node = objectMapper.readTree(is); if(node.has("quoteResponse") && node.get("quoteResponse").has("result")) { node = node.get("quoteResponse").get("result"); for(int i = 0; i < node.size(); i++) { result.add(this.parseJson(node.get(i))); } } else { throw new IOException("Invalid response"); } return result; }
java
public List<T> getResult() throws IOException { List<T> result = new ArrayList<T>(); Map<String, String> params = new LinkedHashMap<String, String>(); params.put("symbols", this.symbols); String url = YahooFinance.QUOTES_QUERY1V7_BASE_URL + "?" + Utils.getURLParameters(params); // Get JSON from Yahoo log.info("Sending request: " + url); URL request = new URL(url); RedirectableRequest redirectableRequest = new RedirectableRequest(request, 5); redirectableRequest.setConnectTimeout(YahooFinance.CONNECTION_TIMEOUT); redirectableRequest.setReadTimeout(YahooFinance.CONNECTION_TIMEOUT); URLConnection connection = redirectableRequest.openConnection(); InputStreamReader is = new InputStreamReader(connection.getInputStream()); JsonNode node = objectMapper.readTree(is); if(node.has("quoteResponse") && node.get("quoteResponse").has("result")) { node = node.get("quoteResponse").get("result"); for(int i = 0; i < node.size(); i++) { result.add(this.parseJson(node.get(i))); } } else { throw new IOException("Invalid response"); } return result; }
[ "public", "List", "<", "T", ">", "getResult", "(", ")", "throws", "IOException", "{", "List", "<", "T", ">", "result", "=", "new", "ArrayList", "<", "T", ">", "(", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "LinkedHas...
Sends the request to Yahoo Finance and parses the result @return List of parsed objects resulting from the Yahoo Finance request @throws IOException when there's a connection problem or the request is incorrect
[ "Sends", "the", "request", "to", "Yahoo", "Finance", "and", "parses", "the", "result" ]
train
https://github.com/sstrickx/yahoofinance-api/blob/2766ba52fc5cccf9b4da5c06423d68059cf0a6e6/src/main/java/yahoofinance/quotes/query1v7/QuotesRequest.java#L57-L86
onepf/OpenIAB
library/src/main/java/org/onepf/oms/SkuManager.java
SkuManager.getSku
@NotNull public String getSku(@NotNull String appstoreName, @NotNull String storeSku) { checkSkuMappingParams(appstoreName, storeSku); Map<String, String> skuMap = storeSku2skuMappings.get(appstoreName); if (skuMap != null && skuMap.containsKey(storeSku)) { final String s = skuMap.get(storeSku); Logger.d("getSku() restore sku from storeSku: ", storeSku, " -> ", s); return s; } return storeSku; }
java
@NotNull public String getSku(@NotNull String appstoreName, @NotNull String storeSku) { checkSkuMappingParams(appstoreName, storeSku); Map<String, String> skuMap = storeSku2skuMappings.get(appstoreName); if (skuMap != null && skuMap.containsKey(storeSku)) { final String s = skuMap.get(storeSku); Logger.d("getSku() restore sku from storeSku: ", storeSku, " -> ", s); return s; } return storeSku; }
[ "@", "NotNull", "public", "String", "getSku", "(", "@", "NotNull", "String", "appstoreName", ",", "@", "NotNull", "String", "storeSku", ")", "{", "checkSkuMappingParams", "(", "appstoreName", ",", "storeSku", ")", ";", "Map", "<", "String", ",", "String", ">...
Returns a base internal SKU by a store-specific SKU. @throws java.lang.IllegalArgumentException If the store name or a store SKU is empty or null. @see #mapSku(String, String, String)
[ "Returns", "a", "base", "internal", "SKU", "by", "a", "store", "-", "specific", "SKU", "." ]
train
https://github.com/onepf/OpenIAB/blob/90552d53c5303b322940d96a0c4b7cb797d78760/library/src/main/java/org/onepf/oms/SkuManager.java#L184-L195
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java
SparkComputationGraph.evaluateROCMDS
public <T extends ROC> T evaluateROCMDS(JavaRDD<MultiDataSet> data, int rocThresholdNumSteps, int minibatchSize) { return (T)doEvaluationMDS(data, minibatchSize, new org.deeplearning4j.eval.ROC(rocThresholdNumSteps))[0]; }
java
public <T extends ROC> T evaluateROCMDS(JavaRDD<MultiDataSet> data, int rocThresholdNumSteps, int minibatchSize) { return (T)doEvaluationMDS(data, minibatchSize, new org.deeplearning4j.eval.ROC(rocThresholdNumSteps))[0]; }
[ "public", "<", "T", "extends", "ROC", ">", "T", "evaluateROCMDS", "(", "JavaRDD", "<", "MultiDataSet", ">", "data", ",", "int", "rocThresholdNumSteps", ",", "int", "minibatchSize", ")", "{", "return", "(", "T", ")", "doEvaluationMDS", "(", "data", ",", "mi...
Perform ROC analysis/evaluation on the given DataSet in a distributed manner, using the specified number of steps and minibatch size @param data Test set data (to evaluate on) @param rocThresholdNumSteps See {@link ROC} for details @param minibatchSize Minibatch size for evaluation @return ROC for the entire data set
[ "Perform", "ROC", "analysis", "/", "evaluation", "on", "the", "given", "DataSet", "in", "a", "distributed", "manner", "using", "the", "specified", "number", "of", "steps", "and", "minibatch", "size" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/graph/SparkComputationGraph.java#L778-L780
hdecarne/java-default
src/main/java/de/carne/util/validation/StringValidator.java
StringValidator.checkNotEmpty
public static StringValidator checkNotEmpty(@Nullable String input, ValidationMessage message) throws ValidationException { if (input == null || input.length() == 0) { throw new ValidationException(message.format(input)); } return new StringValidator(input); }
java
public static StringValidator checkNotEmpty(@Nullable String input, ValidationMessage message) throws ValidationException { if (input == null || input.length() == 0) { throw new ValidationException(message.format(input)); } return new StringValidator(input); }
[ "public", "static", "StringValidator", "checkNotEmpty", "(", "@", "Nullable", "String", "input", ",", "ValidationMessage", "message", ")", "throws", "ValidationException", "{", "if", "(", "input", "==", "null", "||", "input", ".", "length", "(", ")", "==", "0"...
Checks that an input value is not empty. @param input the input value to check. @param message the validation message to create in case the validation fails. @return a new {@linkplain StringValidator} instance for further validation steps. @throws ValidationException if the validation fails.
[ "Checks", "that", "an", "input", "value", "is", "not", "empty", "." ]
train
https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/validation/StringValidator.java#L39-L45
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java
AStar.replaceSegment
@Pure protected ST replaceSegment(int index, ST segment) { ST rep = null; if (this.segmentReplacer != null) { rep = this.segmentReplacer.replaceSegment(index, segment); } if (rep == null) { rep = segment; } return rep; }
java
@Pure protected ST replaceSegment(int index, ST segment) { ST rep = null; if (this.segmentReplacer != null) { rep = this.segmentReplacer.replaceSegment(index, segment); } if (rep == null) { rep = segment; } return rep; }
[ "@", "Pure", "protected", "ST", "replaceSegment", "(", "int", "index", ",", "ST", "segment", ")", "{", "ST", "rep", "=", "null", ";", "if", "(", "this", ".", "segmentReplacer", "!=", "null", ")", "{", "rep", "=", "this", ".", "segmentReplacer", ".", ...
Invoked to replace a segment before adding it to the shortest path. <p>* By default, this function invoked the {@link AStarSegmentReplacer} associated to this AStar algorithm. @param index is the position of the segment in the path. @param segment is the segment to replace. @return the replacement segment or the {@code segment} itself.
[ "Invoked", "to", "replace", "a", "segment", "before", "adding", "it", "to", "the", "shortest", "path", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L676-L686
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java
TreeUtil.moveList
public static <T> void moveList(List<T> fromList, List<T> toList) { for (Iterator<T> iter = fromList.iterator(); iter.hasNext(); ) { T elem = iter.next(); iter.remove(); toList.add(elem); } }
java
public static <T> void moveList(List<T> fromList, List<T> toList) { for (Iterator<T> iter = fromList.iterator(); iter.hasNext(); ) { T elem = iter.next(); iter.remove(); toList.add(elem); } }
[ "public", "static", "<", "T", ">", "void", "moveList", "(", "List", "<", "T", ">", "fromList", ",", "List", "<", "T", ">", "toList", ")", "{", "for", "(", "Iterator", "<", "T", ">", "iter", "=", "fromList", ".", "iterator", "(", ")", ";", "iter",...
Moves nodes from one list to another, ensuring that they are not double-parented in the process.
[ "Moves", "nodes", "from", "one", "list", "to", "another", "ensuring", "that", "they", "are", "not", "double", "-", "parented", "in", "the", "process", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java#L64-L70
mozilla/rhino
src/org/mozilla/javascript/ScriptableObject.java
ScriptableObject.getGetterOrSetter
public Object getGetterOrSetter(String name, int index, boolean isSetter) { if (name != null && index != 0) throw new IllegalArgumentException(name); Slot slot = slotMap.query(name, index); if (slot == null) return null; if (slot instanceof GetterSlot) { GetterSlot gslot = (GetterSlot)slot; Object result = isSetter ? gslot.setter : gslot.getter; return result != null ? result : Undefined.instance; } return Undefined.instance; }
java
public Object getGetterOrSetter(String name, int index, boolean isSetter) { if (name != null && index != 0) throw new IllegalArgumentException(name); Slot slot = slotMap.query(name, index); if (slot == null) return null; if (slot instanceof GetterSlot) { GetterSlot gslot = (GetterSlot)slot; Object result = isSetter ? gslot.setter : gslot.getter; return result != null ? result : Undefined.instance; } return Undefined.instance; }
[ "public", "Object", "getGetterOrSetter", "(", "String", "name", ",", "int", "index", ",", "boolean", "isSetter", ")", "{", "if", "(", "name", "!=", "null", "&&", "index", "!=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "name", ")", ";", ...
Get the getter or setter for a given property. Used by __lookupGetter__ and __lookupSetter__. @param name Name of the object. If nonnull, index must be 0. @param index Index of the object. If nonzero, name must be null. @param isSetter If true, return the setter, otherwise return the getter. @exception IllegalArgumentException if both name and index are nonnull and nonzero respectively. @return Null if the property does not exist. Otherwise returns either the getter or the setter for the property, depending on the value of isSetter (may be undefined if unset).
[ "Get", "the", "getter", "or", "setter", "for", "a", "given", "property", ".", "Used", "by", "__lookupGetter__", "and", "__lookupSetter__", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L864-L877
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/ChatApi.java
ChatApi.sendUrlData
public ApiSuccessResponse sendUrlData(String id, AcceptData2 acceptData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = sendUrlDataWithHttpInfo(id, acceptData); return resp.getData(); }
java
public ApiSuccessResponse sendUrlData(String id, AcceptData2 acceptData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = sendUrlDataWithHttpInfo(id, acceptData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "sendUrlData", "(", "String", "id", ",", "AcceptData2", "acceptData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "sendUrlDataWithHttpInfo", "(", "id", ",", "acceptData", ")", ";", ...
Send a URL Send a URL to participants in the specified chat. @param id The ID of the chat interaction. (required) @param acceptData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Send", "a", "URL", "Send", "a", "URL", "to", "participants", "in", "the", "specified", "chat", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/ChatApi.java#L2080-L2083
fcrepo4/fcrepo4
fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java
WebACRolesProvider.getEffectiveAcl
static Optional<ACLHandle> getEffectiveAcl(final FedoraResource resource, final boolean ancestorAcl, final SessionFactory sessionFactory) { try { final FedoraResource aclResource = resource.getAcl(); if (aclResource != null) { final List<WebACAuthorization> authorizations = getAuthorizations(aclResource, ancestorAcl, sessionFactory); if (authorizations.size() > 0) { return Optional.of( new ACLHandle(resource, authorizations)); } } if (getJcrNode(resource).getDepth() == 0) { LOGGER.debug("No ACLs defined on this node or in parent hierarchy"); return Optional.empty(); } else { LOGGER.trace("Checking parent resource for ACL. No ACL found at {}", resource.getPath()); return getEffectiveAcl(resource.getContainer(), true, sessionFactory); } } catch (final RepositoryException ex) { LOGGER.debug("Exception finding effective ACL: {}", ex.getMessage()); return Optional.empty(); } }
java
static Optional<ACLHandle> getEffectiveAcl(final FedoraResource resource, final boolean ancestorAcl, final SessionFactory sessionFactory) { try { final FedoraResource aclResource = resource.getAcl(); if (aclResource != null) { final List<WebACAuthorization> authorizations = getAuthorizations(aclResource, ancestorAcl, sessionFactory); if (authorizations.size() > 0) { return Optional.of( new ACLHandle(resource, authorizations)); } } if (getJcrNode(resource).getDepth() == 0) { LOGGER.debug("No ACLs defined on this node or in parent hierarchy"); return Optional.empty(); } else { LOGGER.trace("Checking parent resource for ACL. No ACL found at {}", resource.getPath()); return getEffectiveAcl(resource.getContainer(), true, sessionFactory); } } catch (final RepositoryException ex) { LOGGER.debug("Exception finding effective ACL: {}", ex.getMessage()); return Optional.empty(); } }
[ "static", "Optional", "<", "ACLHandle", ">", "getEffectiveAcl", "(", "final", "FedoraResource", "resource", ",", "final", "boolean", "ancestorAcl", ",", "final", "SessionFactory", "sessionFactory", ")", "{", "try", "{", "final", "FedoraResource", "aclResource", "=",...
Recursively find the effective ACL as a URI along with the FedoraResource that points to it. This way, if the effective ACL is pointed to from a parent resource, the child will inherit any permissions that correspond to access to that parent. This ACL resource may or may not exist, and it may be external to the fedora repository. @param resource the Fedora resource @param ancestorAcl the flag for looking up ACL from ancestor hierarchy resources @param sessionFactory session factory
[ "Recursively", "find", "the", "effective", "ACL", "as", "a", "URI", "along", "with", "the", "FedoraResource", "that", "points", "to", "it", ".", "This", "way", "if", "the", "effective", "ACL", "is", "pointed", "to", "from", "a", "parent", "resource", "the"...
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-auth-webac/src/main/java/org/fcrepo/auth/webac/WebACRolesProvider.java#L395-L421
dropwizard/dropwizard
dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java
ServletEnvironment.addFilter
public FilterRegistration.Dynamic addFilter(String name, Class<? extends Filter> klass) { return addFilter(name, new FilterHolder(requireNonNull(klass))); }
java
public FilterRegistration.Dynamic addFilter(String name, Class<? extends Filter> klass) { return addFilter(name, new FilterHolder(requireNonNull(klass))); }
[ "public", "FilterRegistration", ".", "Dynamic", "addFilter", "(", "String", "name", ",", "Class", "<", "?", "extends", "Filter", ">", "klass", ")", "{", "return", "addFilter", "(", "name", ",", "new", "FilterHolder", "(", "requireNonNull", "(", "klass", ")",...
Add a filter class. @param name the filter's name @param klass the filter class @return a {@link javax.servlet.FilterRegistration.Dynamic} instance allowing for further configuration
[ "Add", "a", "filter", "class", "." ]
train
https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jetty/src/main/java/io/dropwizard/jetty/setup/ServletEnvironment.java#L93-L95
JodaOrg/joda-time
src/main/java/org/joda/time/format/FormatUtils.java
FormatUtils.writeUnpaddedInteger
public static void writeUnpaddedInteger(Writer out, long value) throws IOException { int intValue = (int)value; if (intValue == value) { writeUnpaddedInteger(out, intValue); } else { out.write(Long.toString(value)); } }
java
public static void writeUnpaddedInteger(Writer out, long value) throws IOException { int intValue = (int)value; if (intValue == value) { writeUnpaddedInteger(out, intValue); } else { out.write(Long.toString(value)); } }
[ "public", "static", "void", "writeUnpaddedInteger", "(", "Writer", "out", ",", "long", "value", ")", "throws", "IOException", "{", "int", "intValue", "=", "(", "int", ")", "value", ";", "if", "(", "intValue", "==", "value", ")", "{", "writeUnpaddedInteger", ...
Converts an integer to a string, and writes it to the given writer. <p>This method is optimized for converting small values to strings. @param out receives integer converted to a string @param value value to convert to a string
[ "Converts", "an", "integer", "to", "a", "string", "and", "writes", "it", "to", "the", "given", "writer", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/FormatUtils.java#L391-L400
wildfly/wildfly-core
domain-management/src/main/java/org/jboss/as/domain/management/security/PropertiesFileLoader.java
PropertiesFileLoader.persistProperties
public synchronized void persistProperties() throws IOException { beginPersistence(); // Read the properties file into memory // Shouldn't be so bad - it's a small file List<String> content = readFile(propertiesFile); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(propertiesFile), StandardCharsets.UTF_8)); try { for (String line : content) { String trimmed = line.trim(); if (trimmed.length() == 0) { bw.newLine(); } else { Matcher matcher = PROPERTY_PATTERN.matcher(trimmed); if (matcher.matches()) { final String key = cleanKey(matcher.group(1)); if (toSave.containsKey(key) || toSave.containsKey(key + DISABLE_SUFFIX_KEY)) { writeProperty(bw, key, matcher.group(2)); toSave.remove(key); toSave.remove(key + DISABLE_SUFFIX_KEY); } else if (trimmed.startsWith(COMMENT_PREFIX)) { // disabled user write(bw, line, true); } } else { write(bw, line, true); } } } endPersistence(bw); } finally { safeClose(bw); } }
java
public synchronized void persistProperties() throws IOException { beginPersistence(); // Read the properties file into memory // Shouldn't be so bad - it's a small file List<String> content = readFile(propertiesFile); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(propertiesFile), StandardCharsets.UTF_8)); try { for (String line : content) { String trimmed = line.trim(); if (trimmed.length() == 0) { bw.newLine(); } else { Matcher matcher = PROPERTY_PATTERN.matcher(trimmed); if (matcher.matches()) { final String key = cleanKey(matcher.group(1)); if (toSave.containsKey(key) || toSave.containsKey(key + DISABLE_SUFFIX_KEY)) { writeProperty(bw, key, matcher.group(2)); toSave.remove(key); toSave.remove(key + DISABLE_SUFFIX_KEY); } else if (trimmed.startsWith(COMMENT_PREFIX)) { // disabled user write(bw, line, true); } } else { write(bw, line, true); } } } endPersistence(bw); } finally { safeClose(bw); } }
[ "public", "synchronized", "void", "persistProperties", "(", ")", "throws", "IOException", "{", "beginPersistence", "(", ")", ";", "// Read the properties file into memory", "// Shouldn't be so bad - it's a small file", "List", "<", "String", ">", "content", "=", "readFile",...
Saves changes in properties file. It reads the property file into memory, modifies it and saves it back to the file. @throws IOException
[ "Saves", "changes", "in", "properties", "file", ".", "It", "reads", "the", "property", "file", "into", "memory", "modifies", "it", "and", "saves", "it", "back", "to", "the", "file", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/domain-management/src/main/java/org/jboss/as/domain/management/security/PropertiesFileLoader.java#L216-L252
jtmelton/appsensor
analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java
AggregateEventAnalysisEngine.getNotifications
protected LinkedList<Notification> getNotifications(Event triggerEvent, Rule rule) { LinkedList<Notification> notificationQueue = new LinkedList<Notification>(); Collection<Event> events = getApplicableEvents(triggerEvent, rule); Collection<DetectionPoint> detectionPoints = rule.getAllDetectionPoints(); for (DetectionPoint detectionPoint : detectionPoints) { Queue<Event> eventQueue = new LinkedList<Event>(); for (Event event : events) { if (event.getDetectionPoint().typeAndThresholdMatches(detectionPoint)) { eventQueue.add(event); if (isThresholdViolated(eventQueue, event, detectionPoint.getThreshold())) { int queueDuration = (int)getQueueInterval(eventQueue, event).toMillis(); DateTime start = DateUtils.fromString(eventQueue.peek().getTimestamp()); Notification notification = new Notification(queueDuration, "milliseconds", start, detectionPoint); notificationQueue.add(notification); } if (eventQueue.size() >= detectionPoint.getThreshold().getCount()) { eventQueue.poll(); } } } } Collections.sort(notificationQueue, Notification.getEndTimeAscendingComparator()); return notificationQueue; }
java
protected LinkedList<Notification> getNotifications(Event triggerEvent, Rule rule) { LinkedList<Notification> notificationQueue = new LinkedList<Notification>(); Collection<Event> events = getApplicableEvents(triggerEvent, rule); Collection<DetectionPoint> detectionPoints = rule.getAllDetectionPoints(); for (DetectionPoint detectionPoint : detectionPoints) { Queue<Event> eventQueue = new LinkedList<Event>(); for (Event event : events) { if (event.getDetectionPoint().typeAndThresholdMatches(detectionPoint)) { eventQueue.add(event); if (isThresholdViolated(eventQueue, event, detectionPoint.getThreshold())) { int queueDuration = (int)getQueueInterval(eventQueue, event).toMillis(); DateTime start = DateUtils.fromString(eventQueue.peek().getTimestamp()); Notification notification = new Notification(queueDuration, "milliseconds", start, detectionPoint); notificationQueue.add(notification); } if (eventQueue.size() >= detectionPoint.getThreshold().getCount()) { eventQueue.poll(); } } } } Collections.sort(notificationQueue, Notification.getEndTimeAscendingComparator()); return notificationQueue; }
[ "protected", "LinkedList", "<", "Notification", ">", "getNotifications", "(", "Event", "triggerEvent", ",", "Rule", "rule", ")", "{", "LinkedList", "<", "Notification", ">", "notificationQueue", "=", "new", "LinkedList", "<", "Notification", ">", "(", ")", ";", ...
Builds a queue of all {@link Notification}s from the events relating to the current {@link Rule}. The {@link Notification}s are ordered in the Queue by start time. @param triggerEvent the {@link Event} that triggered analysis @param rule the {@link Rule} being evaluated @return a queue of {@link TriggerEvents}
[ "Builds", "a", "queue", "of", "all", "{", "@link", "Notification", "}", "s", "from", "the", "events", "relating", "to", "the", "current", "{", "@link", "Rule", "}", ".", "The", "{", "@link", "Notification", "}", "s", "are", "ordered", "in", "the", "Que...
train
https://github.com/jtmelton/appsensor/blob/c3b4e9ada50fdee974e0d618ec4bdfabc2163798/analysis-engines/appsensor-analysis-rules/src/main/java/org/owasp/appsensor/analysis/AggregateEventAnalysisEngine.java#L178-L208
vst/commons-math-extensions
src/main/java/com/vsthost/rnd/commons/math/ext/linear/EMatrixUtils.java
EMatrixUtils.shuffleRows
public static RealMatrix shuffleRows (RealMatrix matrix, RandomGenerator randomGenerator) { // Create an index vector to be shuffled: int[] index = MathArrays.sequence(matrix.getRowDimension(), 0, 1); MathArrays.shuffle(index, randomGenerator); // Create a new matrix: RealMatrix retval = MatrixUtils.createRealMatrix(matrix.getRowDimension(), matrix.getColumnDimension()); // Populate: for (int row = 0; row < index.length; row++) { retval.setRowVector(row, matrix.getRowVector(index[row])); } // Done, return: return retval; }
java
public static RealMatrix shuffleRows (RealMatrix matrix, RandomGenerator randomGenerator) { // Create an index vector to be shuffled: int[] index = MathArrays.sequence(matrix.getRowDimension(), 0, 1); MathArrays.shuffle(index, randomGenerator); // Create a new matrix: RealMatrix retval = MatrixUtils.createRealMatrix(matrix.getRowDimension(), matrix.getColumnDimension()); // Populate: for (int row = 0; row < index.length; row++) { retval.setRowVector(row, matrix.getRowVector(index[row])); } // Done, return: return retval; }
[ "public", "static", "RealMatrix", "shuffleRows", "(", "RealMatrix", "matrix", ",", "RandomGenerator", "randomGenerator", ")", "{", "// Create an index vector to be shuffled:", "int", "[", "]", "index", "=", "MathArrays", ".", "sequence", "(", "matrix", ".", "getRowDim...
Shuffles rows of a matrix using the provided random number generator. @param matrix The matrix of which the rows will be shuffled. @param randomGenerator The random number generator to be used. @return The new shuffled matrix.
[ "Shuffles", "rows", "of", "a", "matrix", "using", "the", "provided", "random", "number", "generator", "." ]
train
https://github.com/vst/commons-math-extensions/blob/a11ee78ffe53ab7c016062be93c5af07aa8e1823/src/main/java/com/vsthost/rnd/commons/math/ext/linear/EMatrixUtils.java#L306-L321
twitter/hraven
hraven-core/src/main/java/com/twitter/hraven/rest/ObjectMapperProvider.java
ObjectMapperProvider.writeFlowDetails
@SuppressWarnings("deprecation") public static void writeFlowDetails(JsonGenerator jsonGenerator, Flow aFlow, DetailLevel selectedSerialization, Predicate<String> includeFilter) throws JsonGenerationException, IOException { jsonGenerator.writeStartObject(); // serialize the FlowKey object filteredWrite("flowKey", includeFilter, aFlow.getFlowKey(), jsonGenerator); // serialize individual members of this class filteredWrite("flowName", includeFilter, aFlow.getFlowName(), jsonGenerator); filteredWrite("userName", includeFilter, aFlow.getUserName(), jsonGenerator); filteredWrite("jobCount", includeFilter, aFlow.getJobCount(), jsonGenerator); filteredWrite("totalMaps", includeFilter, aFlow.getTotalMaps(), jsonGenerator); filteredWrite("totalReduces", includeFilter, aFlow.getTotalReduces(), jsonGenerator); filteredWrite("mapFileBytesRead", includeFilter, aFlow.getMapFileBytesRead(), jsonGenerator); filteredWrite("mapFileBytesWritten", includeFilter, aFlow.getMapFileBytesWritten(), jsonGenerator); filteredWrite("reduceFileBytesRead", includeFilter, aFlow.getReduceFileBytesRead(), jsonGenerator); filteredWrite("hdfsBytesRead", includeFilter, aFlow.getHdfsBytesRead(), jsonGenerator); filteredWrite("hdfsBytesWritten", includeFilter, aFlow.getHdfsBytesWritten(), jsonGenerator); filteredWrite("mapSlotMillis", includeFilter, aFlow.getMapSlotMillis(), jsonGenerator); filteredWrite("reduceSlotMillis", includeFilter, aFlow.getReduceSlotMillis(), jsonGenerator); filteredWrite("megabyteMillis", includeFilter, aFlow.getMegabyteMillis(), jsonGenerator); filteredWrite("cost", includeFilter, aFlow.getCost(), jsonGenerator); filteredWrite("reduceShuffleBytes", includeFilter, aFlow.getReduceShuffleBytes(), jsonGenerator); filteredWrite("duration", includeFilter, aFlow.getDuration(), jsonGenerator); filteredWrite("wallClockTime", includeFilter, aFlow.getWallClockTime(), jsonGenerator); filteredWrite("cluster", includeFilter, aFlow.getCluster(), jsonGenerator); filteredWrite("appId", includeFilter, aFlow.getAppId(), jsonGenerator); filteredWrite("runId", includeFilter, aFlow.getRunId(), jsonGenerator); filteredWrite("version", includeFilter, aFlow.getVersion(), jsonGenerator); filteredWrite("hadoopVersion", includeFilter, aFlow.getHadoopVersion(), jsonGenerator); if (selectedSerialization == SerializationContext.DetailLevel.EVERYTHING) { filteredWrite("submitTime", includeFilter, aFlow.getSubmitTime(), jsonGenerator); filteredWrite("launchTime", includeFilter, aFlow.getLaunchTime(), jsonGenerator); filteredWrite("finishTime", includeFilter, aFlow.getFinishTime(), jsonGenerator); } filteredWrite(Constants.HRAVEN_QUEUE, includeFilter, aFlow.getQueue(), jsonGenerator); filteredWrite("counters", includeFilter, aFlow.getCounters(), jsonGenerator); filteredWrite("mapCounters", includeFilter, aFlow.getMapCounters(), jsonGenerator); filteredWrite("reduceCounters", includeFilter, aFlow.getReduceCounters(), jsonGenerator); // if flag, include job details if ((selectedSerialization == SerializationContext.DetailLevel.FLOW_SUMMARY_STATS_WITH_JOB_STATS) || (selectedSerialization == SerializationContext.DetailLevel.EVERYTHING)) { jsonGenerator.writeFieldName("jobs"); jsonGenerator.writeObject(aFlow.getJobs()); } jsonGenerator.writeEndObject(); }
java
@SuppressWarnings("deprecation") public static void writeFlowDetails(JsonGenerator jsonGenerator, Flow aFlow, DetailLevel selectedSerialization, Predicate<String> includeFilter) throws JsonGenerationException, IOException { jsonGenerator.writeStartObject(); // serialize the FlowKey object filteredWrite("flowKey", includeFilter, aFlow.getFlowKey(), jsonGenerator); // serialize individual members of this class filteredWrite("flowName", includeFilter, aFlow.getFlowName(), jsonGenerator); filteredWrite("userName", includeFilter, aFlow.getUserName(), jsonGenerator); filteredWrite("jobCount", includeFilter, aFlow.getJobCount(), jsonGenerator); filteredWrite("totalMaps", includeFilter, aFlow.getTotalMaps(), jsonGenerator); filteredWrite("totalReduces", includeFilter, aFlow.getTotalReduces(), jsonGenerator); filteredWrite("mapFileBytesRead", includeFilter, aFlow.getMapFileBytesRead(), jsonGenerator); filteredWrite("mapFileBytesWritten", includeFilter, aFlow.getMapFileBytesWritten(), jsonGenerator); filteredWrite("reduceFileBytesRead", includeFilter, aFlow.getReduceFileBytesRead(), jsonGenerator); filteredWrite("hdfsBytesRead", includeFilter, aFlow.getHdfsBytesRead(), jsonGenerator); filteredWrite("hdfsBytesWritten", includeFilter, aFlow.getHdfsBytesWritten(), jsonGenerator); filteredWrite("mapSlotMillis", includeFilter, aFlow.getMapSlotMillis(), jsonGenerator); filteredWrite("reduceSlotMillis", includeFilter, aFlow.getReduceSlotMillis(), jsonGenerator); filteredWrite("megabyteMillis", includeFilter, aFlow.getMegabyteMillis(), jsonGenerator); filteredWrite("cost", includeFilter, aFlow.getCost(), jsonGenerator); filteredWrite("reduceShuffleBytes", includeFilter, aFlow.getReduceShuffleBytes(), jsonGenerator); filteredWrite("duration", includeFilter, aFlow.getDuration(), jsonGenerator); filteredWrite("wallClockTime", includeFilter, aFlow.getWallClockTime(), jsonGenerator); filteredWrite("cluster", includeFilter, aFlow.getCluster(), jsonGenerator); filteredWrite("appId", includeFilter, aFlow.getAppId(), jsonGenerator); filteredWrite("runId", includeFilter, aFlow.getRunId(), jsonGenerator); filteredWrite("version", includeFilter, aFlow.getVersion(), jsonGenerator); filteredWrite("hadoopVersion", includeFilter, aFlow.getHadoopVersion(), jsonGenerator); if (selectedSerialization == SerializationContext.DetailLevel.EVERYTHING) { filteredWrite("submitTime", includeFilter, aFlow.getSubmitTime(), jsonGenerator); filteredWrite("launchTime", includeFilter, aFlow.getLaunchTime(), jsonGenerator); filteredWrite("finishTime", includeFilter, aFlow.getFinishTime(), jsonGenerator); } filteredWrite(Constants.HRAVEN_QUEUE, includeFilter, aFlow.getQueue(), jsonGenerator); filteredWrite("counters", includeFilter, aFlow.getCounters(), jsonGenerator); filteredWrite("mapCounters", includeFilter, aFlow.getMapCounters(), jsonGenerator); filteredWrite("reduceCounters", includeFilter, aFlow.getReduceCounters(), jsonGenerator); // if flag, include job details if ((selectedSerialization == SerializationContext.DetailLevel.FLOW_SUMMARY_STATS_WITH_JOB_STATS) || (selectedSerialization == SerializationContext.DetailLevel.EVERYTHING)) { jsonGenerator.writeFieldName("jobs"); jsonGenerator.writeObject(aFlow.getJobs()); } jsonGenerator.writeEndObject(); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "void", "writeFlowDetails", "(", "JsonGenerator", "jsonGenerator", ",", "Flow", "aFlow", ",", "DetailLevel", "selectedSerialization", ",", "Predicate", "<", "String", ">", "includeFilter", ")", ...
Writes out the flow object @param jsonGenerator @param aFlow @param selectedSerialization @param includeFilter @throws JsonGenerationException @throws IOException
[ "Writes", "out", "the", "flow", "object" ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-core/src/main/java/com/twitter/hraven/rest/ObjectMapperProvider.java#L572-L621
pressgang-ccms/PressGangCCMSDatasourceProviders
provider-commons/src/main/java/org/jboss/pressgang/ccms/provider/DataProviderFactory.java
DataProviderFactory.findClass
private static Class<?> findClass(String className, ClassLoader classLoader) throws ClassNotFoundException { try { Class<?> spiClass; if (classLoader == null) { spiClass = Class.forName(className); } else { try { spiClass = Class.forName(className, false, classLoader); } catch (ClassNotFoundException ex) { spiClass = Class.forName(className); } } return spiClass; } catch (ClassNotFoundException x) { throw x; } catch (Exception x) { throw new ClassNotFoundException("Factory " + className + " could not be instantiated: " + x, x); } }
java
private static Class<?> findClass(String className, ClassLoader classLoader) throws ClassNotFoundException { try { Class<?> spiClass; if (classLoader == null) { spiClass = Class.forName(className); } else { try { spiClass = Class.forName(className, false, classLoader); } catch (ClassNotFoundException ex) { spiClass = Class.forName(className); } } return spiClass; } catch (ClassNotFoundException x) { throw x; } catch (Exception x) { throw new ClassNotFoundException("Factory " + className + " could not be instantiated: " + x, x); } }
[ "private", "static", "Class", "<", "?", ">", "findClass", "(", "String", "className", ",", "ClassLoader", "classLoader", ")", "throws", "ClassNotFoundException", "{", "try", "{", "Class", "<", "?", ">", "spiClass", ";", "if", "(", "classLoader", "==", "null"...
Creates an instance of the specified class using the specified <code>ClassLoader</code> object. @throws ClassNotFoundException if the given class could not be found or could not be instantiated
[ "Creates", "an", "instance", "of", "the", "specified", "class", "using", "the", "specified", "<code", ">", "ClassLoader<", "/", "code", ">", "object", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSDatasourceProviders/blob/e47588adad0dcd55608b197b37825a512bc8fd25/provider-commons/src/main/java/org/jboss/pressgang/ccms/provider/DataProviderFactory.java#L149-L167
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractLinear.java
AbstractLinear.create_FRAME_Image
protected BufferedImage create_FRAME_Image(final int WIDTH, final int HEIGHT) { return FRAME_FACTORY.createLinearFrame(WIDTH, HEIGHT, getFrameDesign(), getCustomFrameDesign(), getFrameEffect()); }
java
protected BufferedImage create_FRAME_Image(final int WIDTH, final int HEIGHT) { return FRAME_FACTORY.createLinearFrame(WIDTH, HEIGHT, getFrameDesign(), getCustomFrameDesign(), getFrameEffect()); }
[ "protected", "BufferedImage", "create_FRAME_Image", "(", "final", "int", "WIDTH", ",", "final", "int", "HEIGHT", ")", "{", "return", "FRAME_FACTORY", ".", "createLinearFrame", "(", "WIDTH", ",", "HEIGHT", ",", "getFrameDesign", "(", ")", ",", "getCustomFrameDesign...
Returns the frame image with the currently active framedesign with the given with and height. @param WIDTH @param HEIGHT @return buffered image containing the frame in the active frame design
[ "Returns", "the", "frame", "image", "with", "the", "currently", "active", "framedesign", "with", "the", "given", "with", "and", "height", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractLinear.java#L882-L884
bazaarvoice/emodb
mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/HadoopDataStoreManager.java
HadoopDataStoreManager.createDataStoreWithUrl
private CloseableDataStore createDataStoreWithUrl(URI location, String apiKey, MetricRegistry metricRegistry) { // Reuse the same base classes as when using host discovery, ignoring unused fields as needed. String ignore = "ignore"; MultiThreadedServiceFactory<AuthDataStore> secureDataStoreFactory = createDataStoreServiceFactory(ignore, metricRegistry); URI baseUri = LocationUtil.getBaseUriForLocation(location); Payload payload = new Payload(baseUri, URI.create("http://adminUrl.not.used.but.required")); ServiceEndPoint endPoint = new ServiceEndPointBuilder() .withId(ignore) .withServiceName(ignore) .withPayload(payload.toString()) .build(); AuthDataStore authDataStore = secureDataStoreFactory.create(endPoint); DataStore dataStore = DataStoreAuthenticator.proxied(authDataStore).usingCredentials(apiKey); // No operations required when closing the DataStore, so use absent. return asCloseableDataStore(dataStore, Optional.<Runnable>absent()); }
java
private CloseableDataStore createDataStoreWithUrl(URI location, String apiKey, MetricRegistry metricRegistry) { // Reuse the same base classes as when using host discovery, ignoring unused fields as needed. String ignore = "ignore"; MultiThreadedServiceFactory<AuthDataStore> secureDataStoreFactory = createDataStoreServiceFactory(ignore, metricRegistry); URI baseUri = LocationUtil.getBaseUriForLocation(location); Payload payload = new Payload(baseUri, URI.create("http://adminUrl.not.used.but.required")); ServiceEndPoint endPoint = new ServiceEndPointBuilder() .withId(ignore) .withServiceName(ignore) .withPayload(payload.toString()) .build(); AuthDataStore authDataStore = secureDataStoreFactory.create(endPoint); DataStore dataStore = DataStoreAuthenticator.proxied(authDataStore).usingCredentials(apiKey); // No operations required when closing the DataStore, so use absent. return asCloseableDataStore(dataStore, Optional.<Runnable>absent()); }
[ "private", "CloseableDataStore", "createDataStoreWithUrl", "(", "URI", "location", ",", "String", "apiKey", ",", "MetricRegistry", "metricRegistry", ")", "{", "// Reuse the same base classes as when using host discovery, ignoring unused fields as needed.", "String", "ignore", "=", ...
Creates a DataStore using a URL (e.g: "https://emodb-ci.dev.us-east-1.nexus.bazaarvoice.com").
[ "Creates", "a", "DataStore", "using", "a", "URL", "(", "e", ".", "g", ":", "https", ":", "//", "emodb", "-", "ci", ".", "dev", ".", "us", "-", "east", "-", "1", ".", "nexus", ".", "bazaarvoice", ".", "com", ")", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/mapreduce/sor-hadoop/src/main/java/com/bazaarvoice/emodb/hadoop/io/HadoopDataStoreManager.java#L140-L159
pac4j/pac4j
pac4j-core/src/main/java/org/pac4j/core/profile/ProfileHelper.java
ProfileHelper.isTypedIdOf
public static boolean isTypedIdOf(final String id, final Class<? extends CommonProfile> clazz) { if (id != null && clazz != null) { return id.startsWith(clazz.getName() + CommonProfile.SEPARATOR); } return false; }
java
public static boolean isTypedIdOf(final String id, final Class<? extends CommonProfile> clazz) { if (id != null && clazz != null) { return id.startsWith(clazz.getName() + CommonProfile.SEPARATOR); } return false; }
[ "public", "static", "boolean", "isTypedIdOf", "(", "final", "String", "id", ",", "final", "Class", "<", "?", "extends", "CommonProfile", ">", "clazz", ")", "{", "if", "(", "id", "!=", "null", "&&", "clazz", "!=", "null", ")", "{", "return", "id", ".", ...
Indicate if the user identifier matches this kind of profile. @param id user identifier @param clazz profile class @return if the user identifier matches this kind of profile
[ "Indicate", "if", "the", "user", "identifier", "matches", "this", "kind", "of", "profile", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/profile/ProfileHelper.java#L34-L39
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/HeaderHandler.java
HeaderHandler.addElement
private void addElement(String key, String value) { this.num_items++; List<String> vals = this.values.get(key); if (null == vals) { vals = new LinkedList<String>(); } if (null == value) { vals.add("\"\""); } else { vals.add(value); } this.values.put(key, vals); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "addElement: " + key + "=" + value + " num: " + this.num_items); } }
java
private void addElement(String key, String value) { this.num_items++; List<String> vals = this.values.get(key); if (null == vals) { vals = new LinkedList<String>(); } if (null == value) { vals.add("\"\""); } else { vals.add(value); } this.values.put(key, vals); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "addElement: " + key + "=" + value + " num: " + this.num_items); } }
[ "private", "void", "addElement", "(", "String", "key", ",", "String", "value", ")", "{", "this", ".", "num_items", "++", ";", "List", "<", "String", ">", "vals", "=", "this", ".", "values", ".", "get", "(", "key", ")", ";", "if", "(", "null", "==",...
Add the given key=value pair into storage. Both key and value must be in lowercase form. If this key already exists, then this value will be appended to the existing values. @param key @param value - if null then an empty string value is stored
[ "Add", "the", "given", "key", "=", "value", "pair", "into", "storage", ".", "Both", "key", "and", "value", "must", "be", "in", "lowercase", "form", ".", "If", "this", "key", "already", "exists", "then", "this", "value", "will", "be", "appended", "to", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/genericbnf/internal/HeaderHandler.java#L113-L128
knightliao/disconf
disconf-client/src/main/java/com/baidu/disconf/client/addons/properties/ReloadingPropertyPlaceholderConfigurer.java
ReloadingPropertyPlaceholderConfigurer.parseStringValue
protected String parseStringValue(String strVal, Properties props, Set visitedPlaceholders) throws BeanDefinitionStoreException { DynamicProperty dynamic = null; // replace reloading prefix and suffix by "normal" prefix and suffix. // remember all the "dynamic" placeholders encountered. StringBuffer buf = new StringBuffer(strVal); int startIndex = strVal.indexOf(this.placeholderPrefix); while (startIndex != -1) { int endIndex = buf.toString().indexOf(this.placeholderSuffix, startIndex + this.placeholderPrefix.length()); if (endIndex != -1) { if (currentBeanName != null && currentPropertyName != null) { String placeholder = buf.substring(startIndex + this.placeholderPrefix.length(), endIndex); placeholder = getPlaceholder(placeholder); if (dynamic == null) { dynamic = getDynamic(currentBeanName, currentPropertyName, strVal); } addDependency(dynamic, placeholder); } else { logger.debug("dynamic property outside bean property value - ignored: " + strVal); } startIndex = endIndex - this.placeholderPrefix.length() + this.placeholderPrefix.length() + this.placeholderSuffix.length(); startIndex = strVal.indexOf(this.placeholderPrefix, startIndex); } else { startIndex = -1; } } // then, business as usual. no recursive reloading placeholders please. return super.parseStringValue(buf.toString(), props, visitedPlaceholders); }
java
protected String parseStringValue(String strVal, Properties props, Set visitedPlaceholders) throws BeanDefinitionStoreException { DynamicProperty dynamic = null; // replace reloading prefix and suffix by "normal" prefix and suffix. // remember all the "dynamic" placeholders encountered. StringBuffer buf = new StringBuffer(strVal); int startIndex = strVal.indexOf(this.placeholderPrefix); while (startIndex != -1) { int endIndex = buf.toString().indexOf(this.placeholderSuffix, startIndex + this.placeholderPrefix.length()); if (endIndex != -1) { if (currentBeanName != null && currentPropertyName != null) { String placeholder = buf.substring(startIndex + this.placeholderPrefix.length(), endIndex); placeholder = getPlaceholder(placeholder); if (dynamic == null) { dynamic = getDynamic(currentBeanName, currentPropertyName, strVal); } addDependency(dynamic, placeholder); } else { logger.debug("dynamic property outside bean property value - ignored: " + strVal); } startIndex = endIndex - this.placeholderPrefix.length() + this.placeholderPrefix.length() + this.placeholderSuffix.length(); startIndex = strVal.indexOf(this.placeholderPrefix, startIndex); } else { startIndex = -1; } } // then, business as usual. no recursive reloading placeholders please. return super.parseStringValue(buf.toString(), props, visitedPlaceholders); }
[ "protected", "String", "parseStringValue", "(", "String", "strVal", ",", "Properties", "props", ",", "Set", "visitedPlaceholders", ")", "throws", "BeanDefinitionStoreException", "{", "DynamicProperty", "dynamic", "=", "null", ";", "// replace reloading prefix and suffix by ...
对于被标记为动态的,进行 构造 property dependency 非动态的,则由原来的spring进行处理 @param strVal @param props @param visitedPlaceholders @return @throws BeanDefinitionStoreException
[ "对于被标记为动态的,进行", "构造", "property", "dependency", "非动态的,则由原来的spring进行处理" ]
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-client/src/main/java/com/baidu/disconf/client/addons/properties/ReloadingPropertyPlaceholderConfigurer.java#L67-L98
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/bucket/ReplicaReader.java
ReplicaReader.assembleRequests
private static Observable<BinaryRequest> assembleRequests(final ClusterFacade core, final String id, final ReplicaMode type, final String bucket) { if (type != ReplicaMode.ALL) { return Observable.just((BinaryRequest) new ReplicaGetRequest(id, bucket, (short) type.ordinal())); } return Observable.defer(new Func0<Observable<GetClusterConfigResponse>>() { @Override public Observable<GetClusterConfigResponse> call() { return core.send(new GetClusterConfigRequest()); } }) .map(new Func1<GetClusterConfigResponse, Integer>() { @Override public Integer call(GetClusterConfigResponse response) { CouchbaseBucketConfig conf = (CouchbaseBucketConfig) response.config().bucketConfig(bucket); return conf.numberOfReplicas(); } }) .flatMap(new Func1<Integer, Observable<BinaryRequest>>() { @Override public Observable<BinaryRequest> call(Integer max) { List<BinaryRequest> requests = new ArrayList<BinaryRequest>(); requests.add(new GetRequest(id, bucket)); for (int i = 0; i < max; i++) { requests.add(new ReplicaGetRequest(id, bucket, (short) (i + 1))); } return Observable.from(requests); } }); }
java
private static Observable<BinaryRequest> assembleRequests(final ClusterFacade core, final String id, final ReplicaMode type, final String bucket) { if (type != ReplicaMode.ALL) { return Observable.just((BinaryRequest) new ReplicaGetRequest(id, bucket, (short) type.ordinal())); } return Observable.defer(new Func0<Observable<GetClusterConfigResponse>>() { @Override public Observable<GetClusterConfigResponse> call() { return core.send(new GetClusterConfigRequest()); } }) .map(new Func1<GetClusterConfigResponse, Integer>() { @Override public Integer call(GetClusterConfigResponse response) { CouchbaseBucketConfig conf = (CouchbaseBucketConfig) response.config().bucketConfig(bucket); return conf.numberOfReplicas(); } }) .flatMap(new Func1<Integer, Observable<BinaryRequest>>() { @Override public Observable<BinaryRequest> call(Integer max) { List<BinaryRequest> requests = new ArrayList<BinaryRequest>(); requests.add(new GetRequest(id, bucket)); for (int i = 0; i < max; i++) { requests.add(new ReplicaGetRequest(id, bucket, (short) (i + 1))); } return Observable.from(requests); } }); }
[ "private", "static", "Observable", "<", "BinaryRequest", ">", "assembleRequests", "(", "final", "ClusterFacade", "core", ",", "final", "String", "id", ",", "final", "ReplicaMode", "type", ",", "final", "String", "bucket", ")", "{", "if", "(", "type", "!=", "...
Helper method to assemble all possible/needed replica get requests. The number of configured replicas is also loaded on demand for each request. In the future, this can be maybe optimized. @param core the core reference. @param id the id of the document to load from the replicas. @param type the replica mode type. @param bucket the name of the bucket to load it from. @return a list of requests to perform (both regular and replica get).
[ "Helper", "method", "to", "assemble", "all", "possible", "/", "needed", "replica", "get", "requests", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/bucket/ReplicaReader.java#L159-L189
RestComm/sip-servlets
sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouterParser.java
DefaultApplicationRouterParser.parseSipApplicationRouterInfos
private List<? extends SipApplicationRouterInfo> parseSipApplicationRouterInfos(String sipApplicationRouterInfosStringified) throws ParseException { List<DefaultSipApplicationRouterInfo> sipApplicationRouterInfos = new ArrayList<DefaultSipApplicationRouterInfo>(); while (sipApplicationRouterInfosStringified.indexOf("(") != -1) { int indexOfLeftParenthesis = sipApplicationRouterInfosStringified.indexOf("("); int indexOfRightParenthesis = sipApplicationRouterInfosStringified.indexOf(")"); if (indexOfLeftParenthesis == -1 || indexOfRightParenthesis == -1) { throw new ParseException( "Parenthesis expectected. Cannot parse the following string from the default application router file" + sipApplicationRouterInfosStringified, 0); } String sipApplicationRouterInfoStringified = sipApplicationRouterInfosStringified.substring(indexOfLeftParenthesis, indexOfRightParenthesis + 1); DefaultSipApplicationRouterInfo sipApplicationRouterInfo = parseSipApplicationRouterInfo(sipApplicationRouterInfoStringified); // get the index order from the default application router properties file sipApplicationRouterInfos.add(sipApplicationRouterInfo); sipApplicationRouterInfosStringified = sipApplicationRouterInfosStringified.substring(indexOfRightParenthesis + 1); } // Sort based on the app number Collections.sort(sipApplicationRouterInfos, new Comparator<DefaultSipApplicationRouterInfo>() { public int compare(DefaultSipApplicationRouterInfo arg0, DefaultSipApplicationRouterInfo arg1) { if (arg0.getOrder() == arg1.getOrder()) return 0; if (arg0.getOrder() > arg1.getOrder()) return 1; return -1; } }); return sipApplicationRouterInfos; }
java
private List<? extends SipApplicationRouterInfo> parseSipApplicationRouterInfos(String sipApplicationRouterInfosStringified) throws ParseException { List<DefaultSipApplicationRouterInfo> sipApplicationRouterInfos = new ArrayList<DefaultSipApplicationRouterInfo>(); while (sipApplicationRouterInfosStringified.indexOf("(") != -1) { int indexOfLeftParenthesis = sipApplicationRouterInfosStringified.indexOf("("); int indexOfRightParenthesis = sipApplicationRouterInfosStringified.indexOf(")"); if (indexOfLeftParenthesis == -1 || indexOfRightParenthesis == -1) { throw new ParseException( "Parenthesis expectected. Cannot parse the following string from the default application router file" + sipApplicationRouterInfosStringified, 0); } String sipApplicationRouterInfoStringified = sipApplicationRouterInfosStringified.substring(indexOfLeftParenthesis, indexOfRightParenthesis + 1); DefaultSipApplicationRouterInfo sipApplicationRouterInfo = parseSipApplicationRouterInfo(sipApplicationRouterInfoStringified); // get the index order from the default application router properties file sipApplicationRouterInfos.add(sipApplicationRouterInfo); sipApplicationRouterInfosStringified = sipApplicationRouterInfosStringified.substring(indexOfRightParenthesis + 1); } // Sort based on the app number Collections.sort(sipApplicationRouterInfos, new Comparator<DefaultSipApplicationRouterInfo>() { public int compare(DefaultSipApplicationRouterInfo arg0, DefaultSipApplicationRouterInfo arg1) { if (arg0.getOrder() == arg1.getOrder()) return 0; if (arg0.getOrder() > arg1.getOrder()) return 1; return -1; } }); return sipApplicationRouterInfos; }
[ "private", "List", "<", "?", "extends", "SipApplicationRouterInfo", ">", "parseSipApplicationRouterInfos", "(", "String", "sipApplicationRouterInfosStringified", ")", "throws", "ParseException", "{", "List", "<", "DefaultSipApplicationRouterInfo", ">", "sipApplicationRouterInfo...
Parse a string corresponding to one or more definition of SipApplicationRouterInfo ex : ("SimpleSipServlet", "DAR:From", "ORIGINATING", "", "NO_ROUTE", "0"), ("SimpleSipServlet", "DAR:To", "TERMINATING", "", "NO_ROUTE", "1") and return the corresponding object list @param sipApplicationRouterInfosStringified the stringified list of SipApplicationRouterInfo @return a list of SipApplicationRouterInfo @throws ParseException if anything goes wrong during the parsing
[ "Parse", "a", "string", "corresponding", "to", "one", "or", "more", "definition", "of", "SipApplicationRouterInfo", "ex", ":", "(", "SimpleSipServlet", "DAR", ":", "From", "ORIGINATING", "NO_ROUTE", "0", ")", "(", "SimpleSipServlet", "DAR", ":", "To", "TERMINATI...
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-application-router/src/main/java/org/mobicents/servlet/sip/router/DefaultApplicationRouterParser.java#L186-L219
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/calib/CalibrationDetectorCircleHexagonalGrid.java
CalibrationDetectorCircleHexagonalGrid.createLayout
public static List<Point2D_F64> createLayout( int numRows , int numCols , double centerDistance ) { List<Point2D_F64> ret = new ArrayList<>(); double spaceX = centerDistance/2.0; double spaceY = centerDistance*Math.sin(UtilAngle.radian(60)); double width = (numCols-1)*spaceX; double height = (numRows-1)*spaceY; for (int row = 0; row < numRows; row++) { double y = row*spaceY - height/2; for (int col = row%2; col < numCols; col += 2) { double x = col*spaceX - width/2; ret.add( new Point2D_F64(x,y)); } } return ret; }
java
public static List<Point2D_F64> createLayout( int numRows , int numCols , double centerDistance ) { List<Point2D_F64> ret = new ArrayList<>(); double spaceX = centerDistance/2.0; double spaceY = centerDistance*Math.sin(UtilAngle.radian(60)); double width = (numCols-1)*spaceX; double height = (numRows-1)*spaceY; for (int row = 0; row < numRows; row++) { double y = row*spaceY - height/2; for (int col = row%2; col < numCols; col += 2) { double x = col*spaceX - width/2; ret.add( new Point2D_F64(x,y)); } } return ret; }
[ "public", "static", "List", "<", "Point2D_F64", ">", "createLayout", "(", "int", "numRows", ",", "int", "numCols", ",", "double", "centerDistance", ")", "{", "List", "<", "Point2D_F64", ">", "ret", "=", "new", "ArrayList", "<>", "(", ")", ";", "double", ...
Specifies the physical location of each point on the 2D calibration plane. The fiducial is centered on the coordinate system @param numRows Number of rows @param numCols Number of columns @param centerDistance Space between each circle's center along x and y axis @return 2D locations
[ "Specifies", "the", "physical", "location", "of", "each", "point", "on", "the", "2D", "calibration", "plane", ".", "The", "fiducial", "is", "centered", "on", "the", "coordinate", "system" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/abst/fiducial/calib/CalibrationDetectorCircleHexagonalGrid.java#L146-L165
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/builder/AbstractActivityContextBuilder.java
AbstractActivityContextBuilder.createActivityContext
protected ActivityContext createActivityContext(ContextRuleAssistant assistant) throws BeanReferenceException, IllegalRuleException { initContextEnvironment(assistant); AspectranActivityContext activityContext = new AspectranActivityContext(assistant.getContextEnvironment()); AspectRuleRegistry aspectRuleRegistry = assistant.getAspectRuleRegistry(); BeanRuleRegistry beanRuleRegistry = assistant.getBeanRuleRegistry(); beanRuleRegistry.postProcess(assistant); BeanReferenceInspector beanReferenceInspector = assistant.getBeanReferenceInspector(); beanReferenceInspector.inspect(beanRuleRegistry); initAspectRuleRegistry(assistant); BeanProxifierType beanProxifierType = BeanProxifierType.resolve((String)assistant.getSetting(DefaultSettingType.BEAN_PROXIFIER)); ContextBeanRegistry contextBeanRegistry = new ContextBeanRegistry(activityContext, beanRuleRegistry, beanProxifierType); TemplateRuleRegistry templateRuleRegistry = assistant.getTemplateRuleRegistry(); ContextTemplateRenderer contextTemplateRenderer = new ContextTemplateRenderer(activityContext, templateRuleRegistry); ScheduleRuleRegistry scheduleRuleRegistry = assistant.getScheduleRuleRegistry(); TransletRuleRegistry transletRuleRegistry = assistant.getTransletRuleRegistry(); activityContext.setAspectRuleRegistry(aspectRuleRegistry); activityContext.setContextBeanRegistry(contextBeanRegistry); activityContext.setScheduleRuleRegistry(scheduleRuleRegistry); activityContext.setContextTemplateRenderer(contextTemplateRenderer); activityContext.setTransletRuleRegistry(transletRuleRegistry); activityContext.setDescription(assistant.getAssistantLocal().getDescription()); return activityContext; }
java
protected ActivityContext createActivityContext(ContextRuleAssistant assistant) throws BeanReferenceException, IllegalRuleException { initContextEnvironment(assistant); AspectranActivityContext activityContext = new AspectranActivityContext(assistant.getContextEnvironment()); AspectRuleRegistry aspectRuleRegistry = assistant.getAspectRuleRegistry(); BeanRuleRegistry beanRuleRegistry = assistant.getBeanRuleRegistry(); beanRuleRegistry.postProcess(assistant); BeanReferenceInspector beanReferenceInspector = assistant.getBeanReferenceInspector(); beanReferenceInspector.inspect(beanRuleRegistry); initAspectRuleRegistry(assistant); BeanProxifierType beanProxifierType = BeanProxifierType.resolve((String)assistant.getSetting(DefaultSettingType.BEAN_PROXIFIER)); ContextBeanRegistry contextBeanRegistry = new ContextBeanRegistry(activityContext, beanRuleRegistry, beanProxifierType); TemplateRuleRegistry templateRuleRegistry = assistant.getTemplateRuleRegistry(); ContextTemplateRenderer contextTemplateRenderer = new ContextTemplateRenderer(activityContext, templateRuleRegistry); ScheduleRuleRegistry scheduleRuleRegistry = assistant.getScheduleRuleRegistry(); TransletRuleRegistry transletRuleRegistry = assistant.getTransletRuleRegistry(); activityContext.setAspectRuleRegistry(aspectRuleRegistry); activityContext.setContextBeanRegistry(contextBeanRegistry); activityContext.setScheduleRuleRegistry(scheduleRuleRegistry); activityContext.setContextTemplateRenderer(contextTemplateRenderer); activityContext.setTransletRuleRegistry(transletRuleRegistry); activityContext.setDescription(assistant.getAssistantLocal().getDescription()); return activityContext; }
[ "protected", "ActivityContext", "createActivityContext", "(", "ContextRuleAssistant", "assistant", ")", "throws", "BeanReferenceException", ",", "IllegalRuleException", "{", "initContextEnvironment", "(", "assistant", ")", ";", "AspectranActivityContext", "activityContext", "="...
Returns a new instance of ActivityContext. @param assistant the context rule assistant @return the activity context @throws BeanReferenceException will be thrown when cannot resolve reference to bean @throws IllegalRuleException if an illegal rule is found
[ "Returns", "a", "new", "instance", "of", "ActivityContext", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/builder/AbstractActivityContextBuilder.java#L340-L373
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/cli/BaseTool.java
BaseTool.optionDisplayString
protected String optionDisplayString(final String opt, boolean extended) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("-").append(opt); Option option = getOption(opt); if(null!=option) { if (option.getLongOpt() != null) { stringBuffer.append("/--"); stringBuffer.append(option.getLongOpt()); } if(option.getArgName()!=null && extended){ stringBuffer.append(" <"); stringBuffer.append(option.getArgName()); stringBuffer.append(">"); } } return stringBuffer.toString(); }
java
protected String optionDisplayString(final String opt, boolean extended) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("-").append(opt); Option option = getOption(opt); if(null!=option) { if (option.getLongOpt() != null) { stringBuffer.append("/--"); stringBuffer.append(option.getLongOpt()); } if(option.getArgName()!=null && extended){ stringBuffer.append(" <"); stringBuffer.append(option.getArgName()); stringBuffer.append(">"); } } return stringBuffer.toString(); }
[ "protected", "String", "optionDisplayString", "(", "final", "String", "opt", ",", "boolean", "extended", ")", "{", "StringBuffer", "stringBuffer", "=", "new", "StringBuffer", "(", ")", ";", "stringBuffer", ".", "append", "(", "\"-\"", ")", ".", "append", "(", ...
Return a string to display the specified option in help text @param extended if true, include full argument descriptor @param opt opt name @return display string
[ "Return", "a", "string", "to", "display", "the", "specified", "option", "in", "help", "text" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/cli/BaseTool.java#L111-L127
EdwardRaff/JSAT
JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java
OnlineLDAsvi.expandPsiMinusPsiSum
private void expandPsiMinusPsiSum(Vec input, double sum, Vec output) { double psiSum = FastMath.digamma(sum); for(int i = 0; i < input.length(); i++) output.set(i, FastMath.digamma(input.get(i))-psiSum); }
java
private void expandPsiMinusPsiSum(Vec input, double sum, Vec output) { double psiSum = FastMath.digamma(sum); for(int i = 0; i < input.length(); i++) output.set(i, FastMath.digamma(input.get(i))-psiSum); }
[ "private", "void", "expandPsiMinusPsiSum", "(", "Vec", "input", ",", "double", "sum", ",", "Vec", "output", ")", "{", "double", "psiSum", "=", "FastMath", ".", "digamma", "(", "sum", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "input",...
From the 2013 paper, see expectations in figure 5 on page 1323, and equation (27) on page 1325 See also equation 6 in the 2010 paper. 2013 paper figure 5 seems to be a typo @param input the vector to take the input values from @param sum the sum of the {@code input} vector @param output the vector to store the transformed inputs in
[ "From", "the", "2013", "paper", "see", "expectations", "in", "figure", "5", "on", "page", "1323", "and", "equation", "(", "27", ")", "on", "page", "1325", "See", "also", "equation", "6", "in", "the", "2010", "paper", ".", "2013", "paper", "figure", "5"...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/topicmodel/OnlineLDAsvi.java#L379-L384
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.cut
public static void cut(File srcImgFile, File destImgFile, Rectangle rectangle) { cut(read(srcImgFile), destImgFile, rectangle); }
java
public static void cut(File srcImgFile, File destImgFile, Rectangle rectangle) { cut(read(srcImgFile), destImgFile, rectangle); }
[ "public", "static", "void", "cut", "(", "File", "srcImgFile", ",", "File", "destImgFile", ",", "Rectangle", "rectangle", ")", "{", "cut", "(", "read", "(", "srcImgFile", ")", ",", "destImgFile", ",", "rectangle", ")", ";", "}" ]
图像切割(按指定起点坐标和宽高切割) @param srcImgFile 源图像文件 @param destImgFile 切片后的图像文件 @param rectangle 矩形对象,表示矩形区域的x,y,width,height @since 3.1.0
[ "图像切割", "(", "按指定起点坐标和宽高切割", ")" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L256-L258