repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java
JDBC4CallableStatement.getTime
@Override public Time getTime(int parameterIndex, Calendar cal) throws SQLException { """ Retrieves the value of the designated JDBC TIME parameter as a java.sql.Time object, using the given Calendar object to construct the time. """ checkClosed(); throw SQLError.noSupport(); }
java
@Override public Time getTime(int parameterIndex, Calendar cal) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "Time", "getTime", "(", "int", "parameterIndex", ",", "Calendar", "cal", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Retrieves the value of the designated JDBC TIME parameter as a java.sql.Time object, using the given Calendar object to construct the time.
[ "Retrieves", "the", "value", "of", "the", "designated", "JDBC", "TIME", "parameter", "as", "a", "java", ".", "sql", ".", "Time", "object", "using", "the", "given", "Calendar", "object", "to", "construct", "the", "time", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L447-L452
wirecardBrasil/moip-sdk-java
src/main/java/br/com/moip/api/request/RequestMaker.java
RequestMaker.logHeaders
private void logHeaders(Set<Map.Entry<String, List<String>>> entries) { """ This method is used to populate an {@code Map.Entry} with passed keys and values to charge the debug logger. @param entries {@code Map.Entry<String, List<String>>} """ for (Map.Entry<String, List<String>> header : entries) { if (header.getKey() != null) { LOGGER.debug("{}: {}", header.getKey(), header.getValue()); } } }
java
private void logHeaders(Set<Map.Entry<String, List<String>>> entries) { for (Map.Entry<String, List<String>> header : entries) { if (header.getKey() != null) { LOGGER.debug("{}: {}", header.getKey(), header.getValue()); } } }
[ "private", "void", "logHeaders", "(", "Set", "<", "Map", ".", "Entry", "<", "String", ",", "List", "<", "String", ">", ">", ">", "entries", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "List", "<", "String", ">", ">", "header", ":", "entries", ")", "{", "if", "(", "header", ".", "getKey", "(", ")", "!=", "null", ")", "{", "LOGGER", ".", "debug", "(", "\"{}: {}\"", ",", "header", ".", "getKey", "(", ")", ",", "header", ".", "getValue", "(", ")", ")", ";", "}", "}", "}" ]
This method is used to populate an {@code Map.Entry} with passed keys and values to charge the debug logger. @param entries {@code Map.Entry<String, List<String>>}
[ "This", "method", "is", "used", "to", "populate", "an", "{", "@code", "Map", ".", "Entry", "}", "with", "passed", "keys", "and", "values", "to", "charge", "the", "debug", "logger", "." ]
train
https://github.com/wirecardBrasil/moip-sdk-java/blob/5bee84fa9457d7becfd18954bf5105037f49829c/src/main/java/br/com/moip/api/request/RequestMaker.java#L265-L271
davetcc/tcMenu
tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java
MainWindowController.buildGrid
private int buildGrid(SubMenuItem subMenu, int inset, int gridPosition) { """ Here we go through all the menu items and populate a GridPane with controls to display and edit each item. We start at ROOT and through every item in all submenus. This is a recursive function that is repeatedly called on sub menu's until we've finished all items. """ // inset is the amount of offset to apply to the left, to make the tree look realistic // gridPosition is the row in the grid we populating. // while there are more menuitems in the current level for (MenuItem item : menuTree.getMenuItems(subMenu)) { if (item.hasChildren()) { // // for submenus, we make single label and call back on ourselves with the next level down // Label itemLbl = new Label("SubMenu " + item.getName()); itemLbl.setPadding(new Insets(12, 10, 12, inset)); itemLbl.setStyle("-fx-font-weight: bold; -fx-font-size: 120%;"); itemGrid.add(itemLbl, 0, gridPosition++, 2, 1); gridPosition = buildGrid(MenuItemHelper.asSubMenu(item), inset + 10, gridPosition); } else { // // otherwise for child items we create the controls that display the value and allow // editing. // Label itemLbl = new Label(item.getName()); itemLbl.setPadding(new Insets(3, 10, 3, inset)); itemGrid.add(itemLbl, 0, gridPosition); itemGrid.add(createUiControlForItem(item), 1, gridPosition); renderItemValue(item); gridPosition++; } } return gridPosition; }
java
private int buildGrid(SubMenuItem subMenu, int inset, int gridPosition) { // inset is the amount of offset to apply to the left, to make the tree look realistic // gridPosition is the row in the grid we populating. // while there are more menuitems in the current level for (MenuItem item : menuTree.getMenuItems(subMenu)) { if (item.hasChildren()) { // // for submenus, we make single label and call back on ourselves with the next level down // Label itemLbl = new Label("SubMenu " + item.getName()); itemLbl.setPadding(new Insets(12, 10, 12, inset)); itemLbl.setStyle("-fx-font-weight: bold; -fx-font-size: 120%;"); itemGrid.add(itemLbl, 0, gridPosition++, 2, 1); gridPosition = buildGrid(MenuItemHelper.asSubMenu(item), inset + 10, gridPosition); } else { // // otherwise for child items we create the controls that display the value and allow // editing. // Label itemLbl = new Label(item.getName()); itemLbl.setPadding(new Insets(3, 10, 3, inset)); itemGrid.add(itemLbl, 0, gridPosition); itemGrid.add(createUiControlForItem(item), 1, gridPosition); renderItemValue(item); gridPosition++; } } return gridPosition; }
[ "private", "int", "buildGrid", "(", "SubMenuItem", "subMenu", ",", "int", "inset", ",", "int", "gridPosition", ")", "{", "// inset is the amount of offset to apply to the left, to make the tree look realistic", "// gridPosition is the row in the grid we populating.", "// while there are more menuitems in the current level", "for", "(", "MenuItem", "item", ":", "menuTree", ".", "getMenuItems", "(", "subMenu", ")", ")", "{", "if", "(", "item", ".", "hasChildren", "(", ")", ")", "{", "//", "// for submenus, we make single label and call back on ourselves with the next level down", "//", "Label", "itemLbl", "=", "new", "Label", "(", "\"SubMenu \"", "+", "item", ".", "getName", "(", ")", ")", ";", "itemLbl", ".", "setPadding", "(", "new", "Insets", "(", "12", ",", "10", ",", "12", ",", "inset", ")", ")", ";", "itemLbl", ".", "setStyle", "(", "\"-fx-font-weight: bold; -fx-font-size: 120%;\"", ")", ";", "itemGrid", ".", "add", "(", "itemLbl", ",", "0", ",", "gridPosition", "++", ",", "2", ",", "1", ")", ";", "gridPosition", "=", "buildGrid", "(", "MenuItemHelper", ".", "asSubMenu", "(", "item", ")", ",", "inset", "+", "10", ",", "gridPosition", ")", ";", "}", "else", "{", "//", "// otherwise for child items we create the controls that display the value and allow", "// editing.", "//", "Label", "itemLbl", "=", "new", "Label", "(", "item", ".", "getName", "(", ")", ")", ";", "itemLbl", ".", "setPadding", "(", "new", "Insets", "(", "3", ",", "10", ",", "3", ",", "inset", ")", ")", ";", "itemGrid", ".", "add", "(", "itemLbl", ",", "0", ",", "gridPosition", ")", ";", "itemGrid", ".", "add", "(", "createUiControlForItem", "(", "item", ")", ",", "1", ",", "gridPosition", ")", ";", "renderItemValue", "(", "item", ")", ";", "gridPosition", "++", ";", "}", "}", "return", "gridPosition", ";", "}" ]
Here we go through all the menu items and populate a GridPane with controls to display and edit each item. We start at ROOT and through every item in all submenus. This is a recursive function that is repeatedly called on sub menu's until we've finished all items.
[ "Here", "we", "go", "through", "all", "the", "menu", "items", "and", "populate", "a", "GridPane", "with", "controls", "to", "display", "and", "edit", "each", "item", ".", "We", "start", "at", "ROOT", "and", "through", "every", "item", "in", "all", "submenus", ".", "This", "is", "a", "recursive", "function", "that", "is", "repeatedly", "called", "on", "sub", "menu", "s", "until", "we", "ve", "finished", "all", "items", "." ]
train
https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuExampleUI/src/main/java/com/thecoderscorner/menu/examples/simpleui/MainWindowController.java#L188-L219
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.newMap
@SuppressWarnings("unchecked") public static <T extends Map<?, ?>> T newMap(Type type) { """ Create new map of given type. @param type map type. @param <T> map type. @return newly created map. """ Class<?> implementation = MAPS.get(type); if(implementation == null) { throw new BugError("No registered implementation for map |%s|.", type); } return (T)newInstance(implementation); }
java
@SuppressWarnings("unchecked") public static <T extends Map<?, ?>> T newMap(Type type) { Class<?> implementation = MAPS.get(type); if(implementation == null) { throw new BugError("No registered implementation for map |%s|.", type); } return (T)newInstance(implementation); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Map", "<", "?", ",", "?", ">", ">", "T", "newMap", "(", "Type", "type", ")", "{", "Class", "<", "?", ">", "implementation", "=", "MAPS", ".", "get", "(", "type", ")", ";", "if", "(", "implementation", "==", "null", ")", "{", "throw", "new", "BugError", "(", "\"No registered implementation for map |%s|.\"", ",", "type", ")", ";", "}", "return", "(", "T", ")", "newInstance", "(", "implementation", ")", ";", "}" ]
Create new map of given type. @param type map type. @param <T> map type. @return newly created map.
[ "Create", "new", "map", "of", "given", "type", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1544-L1552
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.serviceName_pca_pcaServiceName_sessions_sessionId_restore_POST
public OvhTask serviceName_pca_pcaServiceName_sessions_sessionId_restore_POST(String serviceName, String pcaServiceName, String sessionId) throws IOException { """ Create a restore task for session REST: POST /cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/restore @param serviceName [required] The internal name of your public cloud passport @param pcaServiceName [required] The internal name of your PCA offer @param sessionId [required] Session ID @deprecated """ String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/restore"; StringBuilder sb = path(qPath, serviceName, pcaServiceName, sessionId); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhTask.class); }
java
public OvhTask serviceName_pca_pcaServiceName_sessions_sessionId_restore_POST(String serviceName, String pcaServiceName, String sessionId) throws IOException { String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/restore"; StringBuilder sb = path(qPath, serviceName, pcaServiceName, sessionId); String resp = exec(qPath, "POST", sb.toString(), null); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "serviceName_pca_pcaServiceName_sessions_sessionId_restore_POST", "(", "String", "serviceName", ",", "String", "pcaServiceName", ",", "String", "sessionId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/restore\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "pcaServiceName", ",", "sessionId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Create a restore task for session REST: POST /cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}/restore @param serviceName [required] The internal name of your public cloud passport @param pcaServiceName [required] The internal name of your PCA offer @param sessionId [required] Session ID @deprecated
[ "Create", "a", "restore", "task", "for", "session" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2450-L2455
Harium/keel
src/main/java/jdt/triangulation/GridIndex.java
GridIndex.getCellOf
private Vector2i getCellOf(Point3D coordinate) { """ Locates the grid cell point covering the given coordinate @param coordinate world coordinate to locate @return cell covering the coordinate """ int xCell = (int) ((coordinate.x - indexRegion.minX()) / x_size); int yCell = (int) ((coordinate.y - indexRegion.minY()) / y_size); return new Vector2i(xCell, yCell); }
java
private Vector2i getCellOf(Point3D coordinate) { int xCell = (int) ((coordinate.x - indexRegion.minX()) / x_size); int yCell = (int) ((coordinate.y - indexRegion.minY()) / y_size); return new Vector2i(xCell, yCell); }
[ "private", "Vector2i", "getCellOf", "(", "Point3D", "coordinate", ")", "{", "int", "xCell", "=", "(", "int", ")", "(", "(", "coordinate", ".", "x", "-", "indexRegion", ".", "minX", "(", ")", ")", "/", "x_size", ")", ";", "int", "yCell", "=", "(", "int", ")", "(", "(", "coordinate", ".", "y", "-", "indexRegion", ".", "minY", "(", ")", ")", "/", "y_size", ")", ";", "return", "new", "Vector2i", "(", "xCell", ",", "yCell", ")", ";", "}" ]
Locates the grid cell point covering the given coordinate @param coordinate world coordinate to locate @return cell covering the coordinate
[ "Locates", "the", "grid", "cell", "point", "covering", "the", "given", "coordinate" ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/jdt/triangulation/GridIndex.java#L217-L221
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Expression.java
Expression.lessThan
@NonNull public Expression lessThan(@NonNull Expression expression) { """ Create a less than expression that evaluates whether or not the current expression is less than the given expression. @param expression the expression to compare with the current expression. @return a less than expression. """ if (expression == null) { throw new IllegalArgumentException("expression cannot be null."); } return new BinaryExpression(this, expression, BinaryExpression.OpType.LessThan); }
java
@NonNull public Expression lessThan(@NonNull Expression expression) { if (expression == null) { throw new IllegalArgumentException("expression cannot be null."); } return new BinaryExpression(this, expression, BinaryExpression.OpType.LessThan); }
[ "@", "NonNull", "public", "Expression", "lessThan", "(", "@", "NonNull", "Expression", "expression", ")", "{", "if", "(", "expression", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"expression cannot be null.\"", ")", ";", "}", "return", "new", "BinaryExpression", "(", "this", ",", "expression", ",", "BinaryExpression", ".", "OpType", ".", "LessThan", ")", ";", "}" ]
Create a less than expression that evaluates whether or not the current expression is less than the given expression. @param expression the expression to compare with the current expression. @return a less than expression.
[ "Create", "a", "less", "than", "expression", "that", "evaluates", "whether", "or", "not", "the", "current", "expression", "is", "less", "than", "the", "given", "expression", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Expression.java#L615-L621
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.serviceName_virtualNumbers_number_GET
public OvhVirtualNumber serviceName_virtualNumbers_number_GET(String serviceName, String number) throws IOException { """ Get this object properties REST: GET /sms/{serviceName}/virtualNumbers/{number} @param serviceName [required] The internal name of your SMS offer @param number [required] The virtual number """ String qPath = "/sms/{serviceName}/virtualNumbers/{number}"; StringBuilder sb = path(qPath, serviceName, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVirtualNumber.class); }
java
public OvhVirtualNumber serviceName_virtualNumbers_number_GET(String serviceName, String number) throws IOException { String qPath = "/sms/{serviceName}/virtualNumbers/{number}"; StringBuilder sb = path(qPath, serviceName, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVirtualNumber.class); }
[ "public", "OvhVirtualNumber", "serviceName_virtualNumbers_number_GET", "(", "String", "serviceName", ",", "String", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/{serviceName}/virtualNumbers/{number}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "number", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhVirtualNumber", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /sms/{serviceName}/virtualNumbers/{number} @param serviceName [required] The internal name of your SMS offer @param number [required] The virtual number
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L457-L462
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/AlarmManager.java
AlarmManager.enableAlarmActions
public void enableAlarmActions(ManagedEntity entity, boolean enabled) throws RuntimeFault, RemoteException { """ Toggles alarms on the given managed entity. @param entity The {@link ManagedEntity} to toggle alarms on. @param enabled Whether to enable or disable alarms. @throws RuntimeFault if any unhandled runtime fault occurs @throws RemoteException @since 4.0 """ getVimService().enableAlarmActions(getMOR(), entity.getMOR(), enabled); }
java
public void enableAlarmActions(ManagedEntity entity, boolean enabled) throws RuntimeFault, RemoteException { getVimService().enableAlarmActions(getMOR(), entity.getMOR(), enabled); }
[ "public", "void", "enableAlarmActions", "(", "ManagedEntity", "entity", ",", "boolean", "enabled", ")", "throws", "RuntimeFault", ",", "RemoteException", "{", "getVimService", "(", ")", ".", "enableAlarmActions", "(", "getMOR", "(", ")", ",", "entity", ".", "getMOR", "(", ")", ",", "enabled", ")", ";", "}" ]
Toggles alarms on the given managed entity. @param entity The {@link ManagedEntity} to toggle alarms on. @param enabled Whether to enable or disable alarms. @throws RuntimeFault if any unhandled runtime fault occurs @throws RemoteException @since 4.0
[ "Toggles", "alarms", "on", "the", "given", "managed", "entity", "." ]
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/AlarmManager.java#L126-L128
EasyinnovaSL/Tiff-Library-4J
src/main/java/com/easyinnova/tiff/model/TagValue.java
TagValue.getBytesBigEndian
public int getBytesBigEndian(int i, int j) { """ Gets the bytes. @param i the i @param j the j @return the bytes """ int result = 0; for (int k = i; k < i + j; k++) { result += value.get(k).toUint(); if (k + 1 < i + j) result <<= 8; } return result; }
java
public int getBytesBigEndian(int i, int j) { int result = 0; for (int k = i; k < i + j; k++) { result += value.get(k).toUint(); if (k + 1 < i + j) result <<= 8; } return result; }
[ "public", "int", "getBytesBigEndian", "(", "int", "i", ",", "int", "j", ")", "{", "int", "result", "=", "0", ";", "for", "(", "int", "k", "=", "i", ";", "k", "<", "i", "+", "j", ";", "k", "++", ")", "{", "result", "+=", "value", ".", "get", "(", "k", ")", ".", "toUint", "(", ")", ";", "if", "(", "k", "+", "1", "<", "i", "+", "j", ")", "result", "<<=", "8", ";", "}", "return", "result", ";", "}" ]
Gets the bytes. @param i the i @param j the j @return the bytes
[ "Gets", "the", "bytes", "." ]
train
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/model/TagValue.java#L368-L376
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.rotateAffine
public Matrix4d rotateAffine(double ang, double x, double y, double z) { """ Apply rotation to this {@link #isAffine() affine} matrix by rotating the given amount of radians about the specified <code>(x, y, z)</code> axis. <p> This method assumes <code>this</code> to be {@link #isAffine() affine}. <p> The axis described by the three components needs to be a unit vector. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>M * R</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the rotation will be applied first! <p> In order to set the matrix to a rotation matrix without post-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotation(double, double, double, double) @param ang the angle in radians @param x the x component of the axis @param y the y component of the axis @param z the z component of the axis @return this """ return rotateAffine(ang, x, y, z, this); }
java
public Matrix4d rotateAffine(double ang, double x, double y, double z) { return rotateAffine(ang, x, y, z, this); }
[ "public", "Matrix4d", "rotateAffine", "(", "double", "ang", ",", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "return", "rotateAffine", "(", "ang", ",", "x", ",", "y", ",", "z", ",", "this", ")", ";", "}" ]
Apply rotation to this {@link #isAffine() affine} matrix by rotating the given amount of radians about the specified <code>(x, y, z)</code> axis. <p> This method assumes <code>this</code> to be {@link #isAffine() affine}. <p> The axis described by the three components needs to be a unit vector. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>M * R</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the rotation will be applied first! <p> In order to set the matrix to a rotation matrix without post-multiplying the rotation transformation, use {@link #rotation(double, double, double, double) rotation()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotation(double, double, double, double) @param ang the angle in radians @param x the x component of the axis @param y the y component of the axis @param z the z component of the axis @return this
[ "Apply", "rotation", "to", "this", "{", "@link", "#isAffine", "()", "affine", "}", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "specified", "<code", ">", "(", "x", "y", "z", ")", "<", "/", "code", ">", "axis", ".", "<p", ">", "This", "method", "assumes", "<code", ">", "this<", "/", "code", ">", "to", "be", "{", "@link", "#isAffine", "()", "affine", "}", ".", "<p", ">", "The", "axis", "described", "by", "the", "three", "components", "needs", "to", "be", "a", "unit", "vector", ".", "<p", ">", "When", "used", "with", "a", "right", "-", "handed", "coordinate", "system", "the", "produced", "rotation", "will", "rotate", "a", "vector", "counter", "-", "clockwise", "around", "the", "rotation", "axis", "when", "viewing", "along", "the", "negative", "axis", "direction", "towards", "the", "origin", ".", "When", "used", "with", "a", "left", "-", "handed", "coordinate", "system", "the", "rotation", "is", "clockwise", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "R<", "/", "code", ">", "the", "rotation", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "R<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "R", "*", "v<", "/", "code", ">", "the", "rotation", "will", "be", "applied", "first!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "rotation", "matrix", "without", "post", "-", "multiplying", "the", "rotation", "transformation", "use", "{", "@link", "#rotation", "(", "double", "double", "double", "double", ")", "rotation", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Rotation_matrix#Rotation_matrix_from_axis_and_angle", ">", "http", ":", "//", "en", ".", "wikipedia", ".", "org<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L4975-L4977
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java
BoxApiMetadata.getUpdateMetadataRequest
@Deprecated public BoxRequestsMetadata.UpdateFileMetadata getUpdateMetadataRequest(String id, String scope, String template) { """ Gets a request that updates the metadata for a specific template on a file Deprecated: Use getUpdateFileMetadataRequest or getUpdateFolderMetadataRequest instead. @param id id of the file to retrieve metadata for @param scope currently only global and enterprise scopes are supported @param template metadata template to use @return request to update metadata on a file """ return getUpdateFileMetadataRequest(id, scope, template); }
java
@Deprecated public BoxRequestsMetadata.UpdateFileMetadata getUpdateMetadataRequest(String id, String scope, String template) { return getUpdateFileMetadataRequest(id, scope, template); }
[ "@", "Deprecated", "public", "BoxRequestsMetadata", ".", "UpdateFileMetadata", "getUpdateMetadataRequest", "(", "String", "id", ",", "String", "scope", ",", "String", "template", ")", "{", "return", "getUpdateFileMetadataRequest", "(", "id", ",", "scope", ",", "template", ")", ";", "}" ]
Gets a request that updates the metadata for a specific template on a file Deprecated: Use getUpdateFileMetadataRequest or getUpdateFolderMetadataRequest instead. @param id id of the file to retrieve metadata for @param scope currently only global and enterprise scopes are supported @param template metadata template to use @return request to update metadata on a file
[ "Gets", "a", "request", "that", "updates", "the", "metadata", "for", "a", "specific", "template", "on", "a", "file", "Deprecated", ":", "Use", "getUpdateFileMetadataRequest", "or", "getUpdateFolderMetadataRequest", "instead", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiMetadata.java#L215-L218
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Triangle2dfx.java
Triangle2dfx.ccwProperty
@Pure public ReadOnlyBooleanProperty ccwProperty() { """ Replies the property that indictes if the triangle's points are defined in a counter-clockwise order. @return the ccw property. """ if (this.ccw == null) { this.ccw = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.CCW); this.ccw.bind(Bindings.createBooleanBinding(() -> Triangle2afp.isCCW( getX1(), getY1(), getX2(), getY2(), getX3(), getY3()), x1Property(), y1Property(), x2Property(), y2Property(), x3Property(), y3Property())); } return this.ccw.getReadOnlyProperty(); }
java
@Pure public ReadOnlyBooleanProperty ccwProperty() { if (this.ccw == null) { this.ccw = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.CCW); this.ccw.bind(Bindings.createBooleanBinding(() -> Triangle2afp.isCCW( getX1(), getY1(), getX2(), getY2(), getX3(), getY3()), x1Property(), y1Property(), x2Property(), y2Property(), x3Property(), y3Property())); } return this.ccw.getReadOnlyProperty(); }
[ "@", "Pure", "public", "ReadOnlyBooleanProperty", "ccwProperty", "(", ")", "{", "if", "(", "this", ".", "ccw", "==", "null", ")", "{", "this", ".", "ccw", "=", "new", "ReadOnlyBooleanWrapper", "(", "this", ",", "MathFXAttributeNames", ".", "CCW", ")", ";", "this", ".", "ccw", ".", "bind", "(", "Bindings", ".", "createBooleanBinding", "(", "(", ")", "->", "Triangle2afp", ".", "isCCW", "(", "getX1", "(", ")", ",", "getY1", "(", ")", ",", "getX2", "(", ")", ",", "getY2", "(", ")", ",", "getX3", "(", ")", ",", "getY3", "(", ")", ")", ",", "x1Property", "(", ")", ",", "y1Property", "(", ")", ",", "x2Property", "(", ")", ",", "y2Property", "(", ")", ",", "x3Property", "(", ")", ",", "y3Property", "(", ")", ")", ")", ";", "}", "return", "this", ".", "ccw", ".", "getReadOnlyProperty", "(", ")", ";", "}" ]
Replies the property that indictes if the triangle's points are defined in a counter-clockwise order. @return the ccw property.
[ "Replies", "the", "property", "that", "indictes", "if", "the", "triangle", "s", "points", "are", "defined", "in", "a", "counter", "-", "clockwise", "order", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Triangle2dfx.java#L305-L318
LearnLib/automatalib
commons/smartcollections/src/main/java/net/automatalib/commons/smartcollections/AbstractLinkedList.java
AbstractLinkedList.insertBeforeEntry
protected void insertBeforeEntry(T e, T insertPos) { """ Inserts a new entry <i>before</i> a given one. @param e the entry to add. @param insertPos the entry before which to add the new one. """ T oldPrev = insertPos.getPrev(); e.setNext(insertPos); e.setPrev(oldPrev); insertPos.setPrev(e); if (oldPrev != null) { oldPrev.setNext(e); } else { head = e; } size++; }
java
protected void insertBeforeEntry(T e, T insertPos) { T oldPrev = insertPos.getPrev(); e.setNext(insertPos); e.setPrev(oldPrev); insertPos.setPrev(e); if (oldPrev != null) { oldPrev.setNext(e); } else { head = e; } size++; }
[ "protected", "void", "insertBeforeEntry", "(", "T", "e", ",", "T", "insertPos", ")", "{", "T", "oldPrev", "=", "insertPos", ".", "getPrev", "(", ")", ";", "e", ".", "setNext", "(", "insertPos", ")", ";", "e", ".", "setPrev", "(", "oldPrev", ")", ";", "insertPos", ".", "setPrev", "(", "e", ")", ";", "if", "(", "oldPrev", "!=", "null", ")", "{", "oldPrev", ".", "setNext", "(", "e", ")", ";", "}", "else", "{", "head", "=", "e", ";", "}", "size", "++", ";", "}" ]
Inserts a new entry <i>before</i> a given one. @param e the entry to add. @param insertPos the entry before which to add the new one.
[ "Inserts", "a", "new", "entry", "<i", ">", "before<", "/", "i", ">", "a", "given", "one", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/smartcollections/src/main/java/net/automatalib/commons/smartcollections/AbstractLinkedList.java#L433-L444
mabe02/lanterna
src/main/java/com/googlecode/lanterna/TerminalTextUtils.java
TerminalTextUtils.fitString
public static String fitString(String string, int fromColumn, int availableColumnSpace) { """ Given a string that may or may not contain CJK characters, returns the substring which will fit inside <code>availableColumnSpace</code> columns. This method does not handle special cases like tab or new-line. <p> This overload has a {@code fromColumn} parameter that specified where inside the string to start fitting. Please notice that {@code fromColumn} is not a character index inside the string, but a column index as if the string has been printed from the left-most side of the terminal. So if the string is "日本語", fromColumn set to 1 will not starting counting from the second character ("本") in the string but from the CJK filler character belonging to "日". If you want to count from a particular character index inside the string, please pass in a substring and use fromColumn set to 0. @param string The string to fit inside the availableColumnSpace @param fromColumn From what column of the input string to start fitting (see description above!) @param availableColumnSpace Number of columns to fit the string inside @return The whole or part of the input string which will fit inside the supplied availableColumnSpace """ if(availableColumnSpace <= 0) { return ""; } StringBuilder bob = new StringBuilder(); int column = 0; int index = 0; while(index < string.length() && column < fromColumn) { char c = string.charAt(index++); column += TerminalTextUtils.isCharCJK(c) ? 2 : 1; } if(column > fromColumn) { bob.append(" "); availableColumnSpace--; } while(availableColumnSpace > 0 && index < string.length()) { char c = string.charAt(index++); availableColumnSpace -= TerminalTextUtils.isCharCJK(c) ? 2 : 1; if(availableColumnSpace < 0) { bob.append(' '); } else { bob.append(c); } } return bob.toString(); }
java
public static String fitString(String string, int fromColumn, int availableColumnSpace) { if(availableColumnSpace <= 0) { return ""; } StringBuilder bob = new StringBuilder(); int column = 0; int index = 0; while(index < string.length() && column < fromColumn) { char c = string.charAt(index++); column += TerminalTextUtils.isCharCJK(c) ? 2 : 1; } if(column > fromColumn) { bob.append(" "); availableColumnSpace--; } while(availableColumnSpace > 0 && index < string.length()) { char c = string.charAt(index++); availableColumnSpace -= TerminalTextUtils.isCharCJK(c) ? 2 : 1; if(availableColumnSpace < 0) { bob.append(' '); } else { bob.append(c); } } return bob.toString(); }
[ "public", "static", "String", "fitString", "(", "String", "string", ",", "int", "fromColumn", ",", "int", "availableColumnSpace", ")", "{", "if", "(", "availableColumnSpace", "<=", "0", ")", "{", "return", "\"\"", ";", "}", "StringBuilder", "bob", "=", "new", "StringBuilder", "(", ")", ";", "int", "column", "=", "0", ";", "int", "index", "=", "0", ";", "while", "(", "index", "<", "string", ".", "length", "(", ")", "&&", "column", "<", "fromColumn", ")", "{", "char", "c", "=", "string", ".", "charAt", "(", "index", "++", ")", ";", "column", "+=", "TerminalTextUtils", ".", "isCharCJK", "(", "c", ")", "?", "2", ":", "1", ";", "}", "if", "(", "column", ">", "fromColumn", ")", "{", "bob", ".", "append", "(", "\" \"", ")", ";", "availableColumnSpace", "--", ";", "}", "while", "(", "availableColumnSpace", ">", "0", "&&", "index", "<", "string", ".", "length", "(", ")", ")", "{", "char", "c", "=", "string", ".", "charAt", "(", "index", "++", ")", ";", "availableColumnSpace", "-=", "TerminalTextUtils", ".", "isCharCJK", "(", "c", ")", "?", "2", ":", "1", ";", "if", "(", "availableColumnSpace", "<", "0", ")", "{", "bob", ".", "append", "(", "'", "'", ")", ";", "}", "else", "{", "bob", ".", "append", "(", "c", ")", ";", "}", "}", "return", "bob", ".", "toString", "(", ")", ";", "}" ]
Given a string that may or may not contain CJK characters, returns the substring which will fit inside <code>availableColumnSpace</code> columns. This method does not handle special cases like tab or new-line. <p> This overload has a {@code fromColumn} parameter that specified where inside the string to start fitting. Please notice that {@code fromColumn} is not a character index inside the string, but a column index as if the string has been printed from the left-most side of the terminal. So if the string is "日本語", fromColumn set to 1 will not starting counting from the second character ("本") in the string but from the CJK filler character belonging to "日". If you want to count from a particular character index inside the string, please pass in a substring and use fromColumn set to 0. @param string The string to fit inside the availableColumnSpace @param fromColumn From what column of the input string to start fitting (see description above!) @param availableColumnSpace Number of columns to fit the string inside @return The whole or part of the input string which will fit inside the supplied availableColumnSpace
[ "Given", "a", "string", "that", "may", "or", "may", "not", "contain", "CJK", "characters", "returns", "the", "substring", "which", "will", "fit", "inside", "<code", ">", "availableColumnSpace<", "/", "code", ">", "columns", ".", "This", "method", "does", "not", "handle", "special", "cases", "like", "tab", "or", "new", "-", "line", ".", "<p", ">", "This", "overload", "has", "a", "{" ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/TerminalTextUtils.java#L269-L297
apache/incubator-heron
storm-compatibility/src/java/org/apache/storm/task/GeneralTopologyContext.java
GeneralTopologyContext.getComponentOutputFields
public Fields getComponentOutputFields(String componentId, String streamId) { """ Gets the declared output fields for the specified component/stream. """ return new Fields(delegate.getComponentOutputFields(componentId, streamId)); }
java
public Fields getComponentOutputFields(String componentId, String streamId) { return new Fields(delegate.getComponentOutputFields(componentId, streamId)); }
[ "public", "Fields", "getComponentOutputFields", "(", "String", "componentId", ",", "String", "streamId", ")", "{", "return", "new", "Fields", "(", "delegate", ".", "getComponentOutputFields", "(", "componentId", ",", "streamId", ")", ")", ";", "}" ]
Gets the declared output fields for the specified component/stream.
[ "Gets", "the", "declared", "output", "fields", "for", "the", "specified", "component", "/", "stream", "." ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/storm-compatibility/src/java/org/apache/storm/task/GeneralTopologyContext.java#L119-L121
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsSimpleSearchConfigurationParser.java
CmsSimpleSearchConfigurationParser.createInstanceWithNoJsonConfig
public static CmsSimpleSearchConfigurationParser createInstanceWithNoJsonConfig( CmsObject cms, CmsListManager.ListConfigurationBean config) { """ Creates an instance for an empty JSON configuration.<p> The point of this is that we know that passing an empty configuration makes it impossible for a JSONException to thrown. @param cms the current CMS context @param config the search configuration @return the search config parser """ try { return new CmsSimpleSearchConfigurationParser(cms, config, null); } catch (JSONException e) { return null; } }
java
public static CmsSimpleSearchConfigurationParser createInstanceWithNoJsonConfig( CmsObject cms, CmsListManager.ListConfigurationBean config) { try { return new CmsSimpleSearchConfigurationParser(cms, config, null); } catch (JSONException e) { return null; } }
[ "public", "static", "CmsSimpleSearchConfigurationParser", "createInstanceWithNoJsonConfig", "(", "CmsObject", "cms", ",", "CmsListManager", ".", "ListConfigurationBean", "config", ")", "{", "try", "{", "return", "new", "CmsSimpleSearchConfigurationParser", "(", "cms", ",", "config", ",", "null", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "return", "null", ";", "}", "}" ]
Creates an instance for an empty JSON configuration.<p> The point of this is that we know that passing an empty configuration makes it impossible for a JSONException to thrown. @param cms the current CMS context @param config the search configuration @return the search config parser
[ "Creates", "an", "instance", "for", "an", "empty", "JSON", "configuration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsSimpleSearchConfigurationParser.java#L210-L220
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java
ProcessContext.setDataUsageFor
public void setDataUsageFor(String activity, Map<String, Set<DataUsage>> dataUsage) throws CompatibilityException { """ Sets the data attributes used by the given activity together with their usage.<br> The given activity/attributes have to be known by the context, i.e. be contained in the activity/attribute list. @param activity Activity for which the attribute usage is set. @param dataUsage Data usage of input attributes. @throws ParameterException @throws CompatibilityException @throws IllegalArgumentException If the given activity/attributes are not known. @throws NullPointerException If the data usage set is <code>null</code> @see DataUsage @see #getActivities() @see #getAttributes() @see #setAttributes(Set) """ validateActivity(activity); validateDataUsage(dataUsage); activityDataUsage.put(activity, dataUsage); }
java
public void setDataUsageFor(String activity, Map<String, Set<DataUsage>> dataUsage) throws CompatibilityException { validateActivity(activity); validateDataUsage(dataUsage); activityDataUsage.put(activity, dataUsage); }
[ "public", "void", "setDataUsageFor", "(", "String", "activity", ",", "Map", "<", "String", ",", "Set", "<", "DataUsage", ">", ">", "dataUsage", ")", "throws", "CompatibilityException", "{", "validateActivity", "(", "activity", ")", ";", "validateDataUsage", "(", "dataUsage", ")", ";", "activityDataUsage", ".", "put", "(", "activity", ",", "dataUsage", ")", ";", "}" ]
Sets the data attributes used by the given activity together with their usage.<br> The given activity/attributes have to be known by the context, i.e. be contained in the activity/attribute list. @param activity Activity for which the attribute usage is set. @param dataUsage Data usage of input attributes. @throws ParameterException @throws CompatibilityException @throws IllegalArgumentException If the given activity/attributes are not known. @throws NullPointerException If the data usage set is <code>null</code> @see DataUsage @see #getActivities() @see #getAttributes() @see #setAttributes(Set)
[ "Sets", "the", "data", "attributes", "used", "by", "the", "given", "activity", "together", "with", "their", "usage", ".", "<br", ">", "The", "given", "activity", "/", "attributes", "have", "to", "be", "known", "by", "the", "context", "i", ".", "e", ".", "be", "contained", "in", "the", "activity", "/", "attribute", "list", "." ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java#L589-L593
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/File.java
File.filenamesToFiles
private File[] filenamesToFiles(String[] filenames) { """ Converts a String[] containing filenames to a File[]. Note that the filenames must not contain slashes. This method is to remove duplication in the implementation of File.list's overloads. """ if (filenames == null) { return null; } int count = filenames.length; File[] result = new File[count]; for (int i = 0; i < count; ++i) { result[i] = new File(this, filenames[i]); } return result; }
java
private File[] filenamesToFiles(String[] filenames) { if (filenames == null) { return null; } int count = filenames.length; File[] result = new File[count]; for (int i = 0; i < count; ++i) { result[i] = new File(this, filenames[i]); } return result; }
[ "private", "File", "[", "]", "filenamesToFiles", "(", "String", "[", "]", "filenames", ")", "{", "if", "(", "filenames", "==", "null", ")", "{", "return", "null", ";", "}", "int", "count", "=", "filenames", ".", "length", ";", "File", "[", "]", "result", "=", "new", "File", "[", "count", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "++", "i", ")", "{", "result", "[", "i", "]", "=", "new", "File", "(", "this", ",", "filenames", "[", "i", "]", ")", ";", "}", "return", "result", ";", "}" ]
Converts a String[] containing filenames to a File[]. Note that the filenames must not contain slashes. This method is to remove duplication in the implementation of File.list's overloads.
[ "Converts", "a", "String", "[]", "containing", "filenames", "to", "a", "File", "[]", ".", "Note", "that", "the", "filenames", "must", "not", "contain", "slashes", ".", "This", "method", "is", "to", "remove", "duplication", "in", "the", "implementation", "of", "File", ".", "list", "s", "overloads", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/File.java#L926-L936
tango-controls/JTango
client/src/main/java/fr/soleil/tango/util/WaitStateUtilities.java
WaitStateUtilities.waitWhileState
public static void waitWhileState(final DeviceProxy proxy, final DevState waitState, final long timeout) throws DevFailed, TimeoutException { """ Wait while waitState does not change @param proxy the proxy on which to monitor the state @param waitState the state to wait @param timeout a timeout in ms @throws DevFailed @throws TimeoutException """ waitWhileState(proxy, waitState, timeout, 300); }
java
public static void waitWhileState(final DeviceProxy proxy, final DevState waitState, final long timeout) throws DevFailed, TimeoutException { waitWhileState(proxy, waitState, timeout, 300); }
[ "public", "static", "void", "waitWhileState", "(", "final", "DeviceProxy", "proxy", ",", "final", "DevState", "waitState", ",", "final", "long", "timeout", ")", "throws", "DevFailed", ",", "TimeoutException", "{", "waitWhileState", "(", "proxy", ",", "waitState", ",", "timeout", ",", "300", ")", ";", "}" ]
Wait while waitState does not change @param proxy the proxy on which to monitor the state @param waitState the state to wait @param timeout a timeout in ms @throws DevFailed @throws TimeoutException
[ "Wait", "while", "waitState", "does", "not", "change" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/util/WaitStateUtilities.java#L31-L34
rzwitserloot/lombok
src/core/lombok/eclipse/handlers/HandleSuperBuilder.java
HandleSuperBuilder.generateFillValuesMethod
private MethodDeclaration generateFillValuesMethod(EclipseNode tdParent, boolean inherited, String builderGenericName, String classGenericName, String builderClassName, TypeParameter[] typeParams) { """ Generates a <code>$fillValuesFrom()</code> method in the abstract builder class that looks like this: <pre> protected B $fillValuesFrom(final C instance) { super.$fillValuesFrom(instance); FoobarBuilderImpl.$fillValuesFromInstanceIntoBuilder(instance, this); return self(); } </pre> """ MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) tdParent.top().get()).compilationResult); out.selector = FILL_VALUES_METHOD_NAME; out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG; out.modifiers = ClassFileConstants.AccProtected; if (inherited) out.annotations = new Annotation[] {makeMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, tdParent.get())}; out.returnType = new SingleTypeReference(builderGenericName.toCharArray(), 0); TypeReference builderType = new SingleTypeReference(classGenericName.toCharArray(), 0); out.arguments = new Argument[] {new Argument(INSTANCE_VARIABLE_NAME, 0, builderType, Modifier.FINAL)}; List<Statement> body = new ArrayList<Statement>(); if (inherited) { // Call super. MessageSend callToSuper = new MessageSend(); callToSuper.receiver = new SuperReference(0, 0); callToSuper.selector = FILL_VALUES_METHOD_NAME; callToSuper.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0)}; body.add(callToSuper); } // Call the builder implemention's helper method that actually fills the values from the instance. MessageSend callStaticFillValuesMethod = new MessageSend(); callStaticFillValuesMethod.receiver = new SingleNameReference(builderClassName.toCharArray(), 0); callStaticFillValuesMethod.selector = FILL_VALUES_STATIC_METHOD_NAME; callStaticFillValuesMethod.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0), new ThisReference(0, 0)}; body.add(callStaticFillValuesMethod); // Return self(). MessageSend returnCall = new MessageSend(); returnCall.receiver = ThisReference.implicitThis(); returnCall.selector = SELF_METHOD_NAME; body.add(new ReturnStatement(returnCall, 0, 0)); out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]); return out; }
java
private MethodDeclaration generateFillValuesMethod(EclipseNode tdParent, boolean inherited, String builderGenericName, String classGenericName, String builderClassName, TypeParameter[] typeParams) { MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) tdParent.top().get()).compilationResult); out.selector = FILL_VALUES_METHOD_NAME; out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG; out.modifiers = ClassFileConstants.AccProtected; if (inherited) out.annotations = new Annotation[] {makeMarkerAnnotation(TypeConstants.JAVA_LANG_OVERRIDE, tdParent.get())}; out.returnType = new SingleTypeReference(builderGenericName.toCharArray(), 0); TypeReference builderType = new SingleTypeReference(classGenericName.toCharArray(), 0); out.arguments = new Argument[] {new Argument(INSTANCE_VARIABLE_NAME, 0, builderType, Modifier.FINAL)}; List<Statement> body = new ArrayList<Statement>(); if (inherited) { // Call super. MessageSend callToSuper = new MessageSend(); callToSuper.receiver = new SuperReference(0, 0); callToSuper.selector = FILL_VALUES_METHOD_NAME; callToSuper.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0)}; body.add(callToSuper); } // Call the builder implemention's helper method that actually fills the values from the instance. MessageSend callStaticFillValuesMethod = new MessageSend(); callStaticFillValuesMethod.receiver = new SingleNameReference(builderClassName.toCharArray(), 0); callStaticFillValuesMethod.selector = FILL_VALUES_STATIC_METHOD_NAME; callStaticFillValuesMethod.arguments = new Expression[] {new SingleNameReference(INSTANCE_VARIABLE_NAME, 0), new ThisReference(0, 0)}; body.add(callStaticFillValuesMethod); // Return self(). MessageSend returnCall = new MessageSend(); returnCall.receiver = ThisReference.implicitThis(); returnCall.selector = SELF_METHOD_NAME; body.add(new ReturnStatement(returnCall, 0, 0)); out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]); return out; }
[ "private", "MethodDeclaration", "generateFillValuesMethod", "(", "EclipseNode", "tdParent", ",", "boolean", "inherited", ",", "String", "builderGenericName", ",", "String", "classGenericName", ",", "String", "builderClassName", ",", "TypeParameter", "[", "]", "typeParams", ")", "{", "MethodDeclaration", "out", "=", "new", "MethodDeclaration", "(", "(", "(", "CompilationUnitDeclaration", ")", "tdParent", ".", "top", "(", ")", ".", "get", "(", ")", ")", ".", "compilationResult", ")", ";", "out", ".", "selector", "=", "FILL_VALUES_METHOD_NAME", ";", "out", ".", "bits", "|=", "ECLIPSE_DO_NOT_TOUCH_FLAG", ";", "out", ".", "modifiers", "=", "ClassFileConstants", ".", "AccProtected", ";", "if", "(", "inherited", ")", "out", ".", "annotations", "=", "new", "Annotation", "[", "]", "{", "makeMarkerAnnotation", "(", "TypeConstants", ".", "JAVA_LANG_OVERRIDE", ",", "tdParent", ".", "get", "(", ")", ")", "}", ";", "out", ".", "returnType", "=", "new", "SingleTypeReference", "(", "builderGenericName", ".", "toCharArray", "(", ")", ",", "0", ")", ";", "TypeReference", "builderType", "=", "new", "SingleTypeReference", "(", "classGenericName", ".", "toCharArray", "(", ")", ",", "0", ")", ";", "out", ".", "arguments", "=", "new", "Argument", "[", "]", "{", "new", "Argument", "(", "INSTANCE_VARIABLE_NAME", ",", "0", ",", "builderType", ",", "Modifier", ".", "FINAL", ")", "}", ";", "List", "<", "Statement", ">", "body", "=", "new", "ArrayList", "<", "Statement", ">", "(", ")", ";", "if", "(", "inherited", ")", "{", "// Call super.", "MessageSend", "callToSuper", "=", "new", "MessageSend", "(", ")", ";", "callToSuper", ".", "receiver", "=", "new", "SuperReference", "(", "0", ",", "0", ")", ";", "callToSuper", ".", "selector", "=", "FILL_VALUES_METHOD_NAME", ";", "callToSuper", ".", "arguments", "=", "new", "Expression", "[", "]", "{", "new", "SingleNameReference", "(", "INSTANCE_VARIABLE_NAME", ",", "0", ")", "}", ";", "body", ".", "add", "(", "callToSuper", ")", ";", "}", "// Call the builder implemention's helper method that actually fills the values from the instance.", "MessageSend", "callStaticFillValuesMethod", "=", "new", "MessageSend", "(", ")", ";", "callStaticFillValuesMethod", ".", "receiver", "=", "new", "SingleNameReference", "(", "builderClassName", ".", "toCharArray", "(", ")", ",", "0", ")", ";", "callStaticFillValuesMethod", ".", "selector", "=", "FILL_VALUES_STATIC_METHOD_NAME", ";", "callStaticFillValuesMethod", ".", "arguments", "=", "new", "Expression", "[", "]", "{", "new", "SingleNameReference", "(", "INSTANCE_VARIABLE_NAME", ",", "0", ")", ",", "new", "ThisReference", "(", "0", ",", "0", ")", "}", ";", "body", ".", "add", "(", "callStaticFillValuesMethod", ")", ";", "// Return self().", "MessageSend", "returnCall", "=", "new", "MessageSend", "(", ")", ";", "returnCall", ".", "receiver", "=", "ThisReference", ".", "implicitThis", "(", ")", ";", "returnCall", ".", "selector", "=", "SELF_METHOD_NAME", ";", "body", ".", "add", "(", "new", "ReturnStatement", "(", "returnCall", ",", "0", ",", "0", ")", ")", ";", "out", ".", "statements", "=", "body", ".", "isEmpty", "(", ")", "?", "null", ":", "body", ".", "toArray", "(", "new", "Statement", "[", "0", "]", ")", ";", "return", "out", ";", "}" ]
Generates a <code>$fillValuesFrom()</code> method in the abstract builder class that looks like this: <pre> protected B $fillValuesFrom(final C instance) { super.$fillValuesFrom(instance); FoobarBuilderImpl.$fillValuesFromInstanceIntoBuilder(instance, this); return self(); } </pre>
[ "Generates", "a", "<code", ">", "$fillValuesFrom", "()", "<", "/", "code", ">", "method", "in", "the", "abstract", "builder", "class", "that", "looks", "like", "this", ":", "<pre", ">", "protected", "B", "$fillValuesFrom", "(", "final", "C", "instance", ")", "{", "super", ".", "$fillValuesFrom", "(", "instance", ")", ";", "FoobarBuilderImpl", ".", "$fillValuesFromInstanceIntoBuilder", "(", "instance", "this", ")", ";", "return", "self", "()", ";", "}", "<", "/", "pre", ">" ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java#L637-L675
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupBean.java
CmsSetupBean.isChecked
public String isChecked(String value1, String value2) { """ Over simplistic helper to compare two strings to check radio buttons. @param value1 the first value @param value2 the second value @return "checked" if both values are equal, the empty String "" otherwise """ if ((value1 == null) || (value2 == null)) { return ""; } if (value1.trim().equalsIgnoreCase(value2.trim())) { return "checked"; } return ""; }
java
public String isChecked(String value1, String value2) { if ((value1 == null) || (value2 == null)) { return ""; } if (value1.trim().equalsIgnoreCase(value2.trim())) { return "checked"; } return ""; }
[ "public", "String", "isChecked", "(", "String", "value1", ",", "String", "value2", ")", "{", "if", "(", "(", "value1", "==", "null", ")", "||", "(", "value2", "==", "null", ")", ")", "{", "return", "\"\"", ";", "}", "if", "(", "value1", ".", "trim", "(", ")", ".", "equalsIgnoreCase", "(", "value2", ".", "trim", "(", ")", ")", ")", "{", "return", "\"checked\"", ";", "}", "return", "\"\"", ";", "}" ]
Over simplistic helper to compare two strings to check radio buttons. @param value1 the first value @param value2 the second value @return "checked" if both values are equal, the empty String "" otherwise
[ "Over", "simplistic", "helper", "to", "compare", "two", "strings", "to", "check", "radio", "buttons", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L1393-L1404
dnsjava/dnsjava
update.java
update.parseRR
Record parseRR(Tokenizer st, int classValue, long TTLValue) throws IOException { """ /* <name> [ttl] [class] <type> <data> Ignore the class, if present. """ Name name = st.getName(zone); long ttl; int type; Record record; String s = st.getString(); try { ttl = TTL.parseTTL(s); s = st.getString(); } catch (NumberFormatException e) { ttl = TTLValue; } if (DClass.value(s) >= 0) { classValue = DClass.value(s); s = st.getString(); } if ((type = Type.value(s)) < 0) throw new IOException("Invalid type: " + s); record = Record.fromString(name, type, classValue, ttl, st, zone); if (record != null) return (record); else throw new IOException("Parse error"); }
java
Record parseRR(Tokenizer st, int classValue, long TTLValue) throws IOException { Name name = st.getName(zone); long ttl; int type; Record record; String s = st.getString(); try { ttl = TTL.parseTTL(s); s = st.getString(); } catch (NumberFormatException e) { ttl = TTLValue; } if (DClass.value(s) >= 0) { classValue = DClass.value(s); s = st.getString(); } if ((type = Type.value(s)) < 0) throw new IOException("Invalid type: " + s); record = Record.fromString(name, type, classValue, ttl, st, zone); if (record != null) return (record); else throw new IOException("Parse error"); }
[ "Record", "parseRR", "(", "Tokenizer", "st", ",", "int", "classValue", ",", "long", "TTLValue", ")", "throws", "IOException", "{", "Name", "name", "=", "st", ".", "getName", "(", "zone", ")", ";", "long", "ttl", ";", "int", "type", ";", "Record", "record", ";", "String", "s", "=", "st", ".", "getString", "(", ")", ";", "try", "{", "ttl", "=", "TTL", ".", "parseTTL", "(", "s", ")", ";", "s", "=", "st", ".", "getString", "(", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "ttl", "=", "TTLValue", ";", "}", "if", "(", "DClass", ".", "value", "(", "s", ")", ">=", "0", ")", "{", "classValue", "=", "DClass", ".", "value", "(", "s", ")", ";", "s", "=", "st", ".", "getString", "(", ")", ";", "}", "if", "(", "(", "type", "=", "Type", ".", "value", "(", "s", ")", ")", "<", "0", ")", "throw", "new", "IOException", "(", "\"Invalid type: \"", "+", "s", ")", ";", "record", "=", "Record", ".", "fromString", "(", "name", ",", "type", ",", "classValue", ",", "ttl", ",", "st", ",", "zone", ")", ";", "if", "(", "record", "!=", "null", ")", "return", "(", "record", ")", ";", "else", "throw", "new", "IOException", "(", "\"Parse error\"", ")", ";", "}" ]
/* <name> [ttl] [class] <type> <data> Ignore the class, if present.
[ "/", "*", "<name", ">", "[", "ttl", "]", "[", "class", "]", "<type", ">", "<data", ">", "Ignore", "the", "class", "if", "present", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/update.java#L282-L314
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/platforms/WindowsPlatform.java
WindowsPlatform.encodeVersion
private static void encodeVersion(final StringBuffer buf, final short[] version) { """ Converts parsed version information into a string representation. @param buf StringBuffer string buffer to receive version number @param version short[] four-element array """ for (int i = 0; i < 3; i++) { buf.append(Short.toString(version[i])); buf.append(','); } buf.append(Short.toString(version[3])); }
java
private static void encodeVersion(final StringBuffer buf, final short[] version) { for (int i = 0; i < 3; i++) { buf.append(Short.toString(version[i])); buf.append(','); } buf.append(Short.toString(version[3])); }
[ "private", "static", "void", "encodeVersion", "(", "final", "StringBuffer", "buf", ",", "final", "short", "[", "]", "version", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "buf", ".", "append", "(", "Short", ".", "toString", "(", "version", "[", "i", "]", ")", ")", ";", "buf", ".", "append", "(", "'", "'", ")", ";", "}", "buf", ".", "append", "(", "Short", ".", "toString", "(", "version", "[", "3", "]", ")", ")", ";", "}" ]
Converts parsed version information into a string representation. @param buf StringBuffer string buffer to receive version number @param version short[] four-element array
[ "Converts", "parsed", "version", "information", "into", "a", "string", "representation", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/platforms/WindowsPlatform.java#L128-L134
morimekta/utils
io-util/src/main/java/net/morimekta/util/FileWatcher.java
FileWatcher.removeWatcher
public boolean removeWatcher(Listener watcher) { """ Remove a watcher from the list of listeners. @param watcher The watcher to be removed. @return True if the watcher was removed from the list. """ if (watcher == null) { throw new IllegalArgumentException("Null watcher removed"); } synchronized (mutex) { AtomicBoolean removed = new AtomicBoolean(removeFromListeners(watchers, watcher)); watchedFiles.forEach((path, suppliers) -> { if (removeFromListeners(suppliers, watcher)) { removed.set(true); } }); return removed.get(); } }
java
public boolean removeWatcher(Listener watcher) { if (watcher == null) { throw new IllegalArgumentException("Null watcher removed"); } synchronized (mutex) { AtomicBoolean removed = new AtomicBoolean(removeFromListeners(watchers, watcher)); watchedFiles.forEach((path, suppliers) -> { if (removeFromListeners(suppliers, watcher)) { removed.set(true); } }); return removed.get(); } }
[ "public", "boolean", "removeWatcher", "(", "Listener", "watcher", ")", "{", "if", "(", "watcher", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null watcher removed\"", ")", ";", "}", "synchronized", "(", "mutex", ")", "{", "AtomicBoolean", "removed", "=", "new", "AtomicBoolean", "(", "removeFromListeners", "(", "watchers", ",", "watcher", ")", ")", ";", "watchedFiles", ".", "forEach", "(", "(", "path", ",", "suppliers", ")", "->", "{", "if", "(", "removeFromListeners", "(", "suppliers", ",", "watcher", ")", ")", "{", "removed", ".", "set", "(", "true", ")", ";", "}", "}", ")", ";", "return", "removed", ".", "get", "(", ")", ";", "}", "}" ]
Remove a watcher from the list of listeners. @param watcher The watcher to be removed. @return True if the watcher was removed from the list.
[ "Remove", "a", "watcher", "from", "the", "list", "of", "listeners", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/FileWatcher.java#L344-L358
googleads/googleads-java-lib
extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ConfigUtil.java
ConfigUtil.getIntConfigValue
public static int getIntConfigValue(String propertyName, int defaultValue) { """ Gets the specified system property's value as an integer. If the value is missing, cannot be parsed as an integer or is negative, returns {@code defaultValue}. @param propertyName the name of the system property. @param defaultValue the default value for the system property. @return the value of the system property as an int, if it's available and valid, else the {@code defaultValue} """ String propertyValueStr = System.getProperty(propertyName, String.valueOf(defaultValue)); int propertyValue = defaultValue; try { propertyValue = Integer.parseInt(propertyValueStr); } catch (NumberFormatException e) { // Just swallow it, and propertyValue is still default. } return propertyValue >= 0 ? propertyValue : defaultValue; }
java
public static int getIntConfigValue(String propertyName, int defaultValue) { String propertyValueStr = System.getProperty(propertyName, String.valueOf(defaultValue)); int propertyValue = defaultValue; try { propertyValue = Integer.parseInt(propertyValueStr); } catch (NumberFormatException e) { // Just swallow it, and propertyValue is still default. } return propertyValue >= 0 ? propertyValue : defaultValue; }
[ "public", "static", "int", "getIntConfigValue", "(", "String", "propertyName", ",", "int", "defaultValue", ")", "{", "String", "propertyValueStr", "=", "System", ".", "getProperty", "(", "propertyName", ",", "String", ".", "valueOf", "(", "defaultValue", ")", ")", ";", "int", "propertyValue", "=", "defaultValue", ";", "try", "{", "propertyValue", "=", "Integer", ".", "parseInt", "(", "propertyValueStr", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "// Just swallow it, and propertyValue is still default.", "}", "return", "propertyValue", ">=", "0", "?", "propertyValue", ":", "defaultValue", ";", "}" ]
Gets the specified system property's value as an integer. If the value is missing, cannot be parsed as an integer or is negative, returns {@code defaultValue}. @param propertyName the name of the system property. @param defaultValue the default value for the system property. @return the value of the system property as an int, if it's available and valid, else the {@code defaultValue}
[ "Gets", "the", "specified", "system", "property", "s", "value", "as", "an", "integer", ".", "If", "the", "value", "is", "missing", "cannot", "be", "parsed", "as", "an", "integer", "or", "is", "negative", "returns", "{", "@code", "defaultValue", "}", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ConfigUtil.java#L30-L40
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java
CoverageDataCore.getSource
private float getSource(float dest, float destMin, float srcMin, float ratio) { """ Determine the source pixel location @param dest destination pixel location @param destMin destination minimum most pixel @param srcMin source minimum most pixel @param ratio source over destination length ratio @return source pixel """ float destDistance = dest - destMin; float srcDistance = destDistance * ratio; float ySource = srcMin + srcDistance; return ySource; }
java
private float getSource(float dest, float destMin, float srcMin, float ratio) { float destDistance = dest - destMin; float srcDistance = destDistance * ratio; float ySource = srcMin + srcDistance; return ySource; }
[ "private", "float", "getSource", "(", "float", "dest", ",", "float", "destMin", ",", "float", "srcMin", ",", "float", "ratio", ")", "{", "float", "destDistance", "=", "dest", "-", "destMin", ";", "float", "srcDistance", "=", "destDistance", "*", "ratio", ";", "float", "ySource", "=", "srcMin", "+", "srcDistance", ";", "return", "ySource", ";", "}" ]
Determine the source pixel location @param dest destination pixel location @param destMin destination minimum most pixel @param srcMin source minimum most pixel @param ratio source over destination length ratio @return source pixel
[ "Determine", "the", "source", "pixel", "location" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L842-L849
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.updateHierarchicalEntityChildWithServiceResponseAsync
public Observable<ServiceResponse<OperationStatus>> updateHierarchicalEntityChildWithServiceResponseAsync(UUID appId, String versionId, UUID hEntityId, UUID hChildId, UpdateHierarchicalEntityChildOptionalParameter updateHierarchicalEntityChildOptionalParameter) { """ Renames a single child in an existing hierarchical entity model. @param appId The application ID. @param versionId The version ID. @param hEntityId The hierarchical entity extractor ID. @param hChildId The hierarchical entity extractor child ID. @param updateHierarchicalEntityChildOptionalParameter 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 OperationStatus object """ if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (hEntityId == null) { throw new IllegalArgumentException("Parameter hEntityId is required and cannot be null."); } if (hChildId == null) { throw new IllegalArgumentException("Parameter hChildId is required and cannot be null."); } final String name = updateHierarchicalEntityChildOptionalParameter != null ? updateHierarchicalEntityChildOptionalParameter.name() : null; return updateHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, hChildId, name); }
java
public Observable<ServiceResponse<OperationStatus>> updateHierarchicalEntityChildWithServiceResponseAsync(UUID appId, String versionId, UUID hEntityId, UUID hChildId, UpdateHierarchicalEntityChildOptionalParameter updateHierarchicalEntityChildOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (appId == null) { throw new IllegalArgumentException("Parameter appId is required and cannot be null."); } if (versionId == null) { throw new IllegalArgumentException("Parameter versionId is required and cannot be null."); } if (hEntityId == null) { throw new IllegalArgumentException("Parameter hEntityId is required and cannot be null."); } if (hChildId == null) { throw new IllegalArgumentException("Parameter hChildId is required and cannot be null."); } final String name = updateHierarchicalEntityChildOptionalParameter != null ? updateHierarchicalEntityChildOptionalParameter.name() : null; return updateHierarchicalEntityChildWithServiceResponseAsync(appId, versionId, hEntityId, hChildId, name); }
[ "public", "Observable", "<", "ServiceResponse", "<", "OperationStatus", ">", ">", "updateHierarchicalEntityChildWithServiceResponseAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "hEntityId", ",", "UUID", "hChildId", ",", "UpdateHierarchicalEntityChildOptionalParameter", "updateHierarchicalEntityChildOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "endpoint", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.endpoint() is required and cannot be null.\"", ")", ";", "}", "if", "(", "appId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter appId is required and cannot be null.\"", ")", ";", "}", "if", "(", "versionId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter versionId is required and cannot be null.\"", ")", ";", "}", "if", "(", "hEntityId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter hEntityId is required and cannot be null.\"", ")", ";", "}", "if", "(", "hChildId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter hChildId is required and cannot be null.\"", ")", ";", "}", "final", "String", "name", "=", "updateHierarchicalEntityChildOptionalParameter", "!=", "null", "?", "updateHierarchicalEntityChildOptionalParameter", ".", "name", "(", ")", ":", "null", ";", "return", "updateHierarchicalEntityChildWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "hEntityId", ",", "hChildId", ",", "name", ")", ";", "}" ]
Renames a single child in an existing hierarchical entity model. @param appId The application ID. @param versionId The version ID. @param hEntityId The hierarchical entity extractor ID. @param hChildId The hierarchical entity extractor child ID. @param updateHierarchicalEntityChildOptionalParameter 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 OperationStatus object
[ "Renames", "a", "single", "child", "in", "an", "existing", "hierarchical", "entity", "model", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L6392-L6411
lucee/Lucee
core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java
XMLConfigWebFactory.getAttr
public static String getAttr(Element el, String name) { """ reads an attribute from a xml Element and parses placeholders @param el @param name @return """ String v = el.getAttribute(name); return replaceConfigPlaceHolder(v); }
java
public static String getAttr(Element el, String name) { String v = el.getAttribute(name); return replaceConfigPlaceHolder(v); }
[ "public", "static", "String", "getAttr", "(", "Element", "el", ",", "String", "name", ")", "{", "String", "v", "=", "el", ".", "getAttribute", "(", "name", ")", ";", "return", "replaceConfigPlaceHolder", "(", "v", ")", ";", "}" ]
reads an attribute from a xml Element and parses placeholders @param el @param name @return
[ "reads", "an", "attribute", "from", "a", "xml", "Element", "and", "parses", "placeholders" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigWebFactory.java#L4918-L4921
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/util/TransparentReplicaGetHelper.java
TransparentReplicaGetHelper.getFirstPrimaryOrReplica
@InterfaceStability.Experimental @InterfaceAudience.Public public Single<JsonDocument> getFirstPrimaryOrReplica(final String id, final Bucket bucket, final long primaryTimeout, final long replicaTimeout) { """ Asynchronously fetch the document from the primary and if that operations fails try all the replicas and return the first document that comes back from them (with custom primary and replica timeout values). @param id the document ID to fetch. @param bucket the bucket to use when fetching the doc. @param primaryTimeout the timeout to use in MS when fetching the primary. @param replicaTimeout the timeout to use in MS when subsequently fetching the replicas and primary. @return an {@link Single} with either 0 or 1 {@link JsonDocument}. """ return getFirstPrimaryOrReplica(id, JsonDocument.class, bucket, primaryTimeout, replicaTimeout); }
java
@InterfaceStability.Experimental @InterfaceAudience.Public public Single<JsonDocument> getFirstPrimaryOrReplica(final String id, final Bucket bucket, final long primaryTimeout, final long replicaTimeout) { return getFirstPrimaryOrReplica(id, JsonDocument.class, bucket, primaryTimeout, replicaTimeout); }
[ "@", "InterfaceStability", ".", "Experimental", "@", "InterfaceAudience", ".", "Public", "public", "Single", "<", "JsonDocument", ">", "getFirstPrimaryOrReplica", "(", "final", "String", "id", ",", "final", "Bucket", "bucket", ",", "final", "long", "primaryTimeout", ",", "final", "long", "replicaTimeout", ")", "{", "return", "getFirstPrimaryOrReplica", "(", "id", ",", "JsonDocument", ".", "class", ",", "bucket", ",", "primaryTimeout", ",", "replicaTimeout", ")", ";", "}" ]
Asynchronously fetch the document from the primary and if that operations fails try all the replicas and return the first document that comes back from them (with custom primary and replica timeout values). @param id the document ID to fetch. @param bucket the bucket to use when fetching the doc. @param primaryTimeout the timeout to use in MS when fetching the primary. @param replicaTimeout the timeout to use in MS when subsequently fetching the replicas and primary. @return an {@link Single} with either 0 or 1 {@link JsonDocument}.
[ "Asynchronously", "fetch", "the", "document", "from", "the", "primary", "and", "if", "that", "operations", "fails", "try", "all", "the", "replicas", "and", "return", "the", "first", "document", "that", "comes", "back", "from", "them", "(", "with", "custom", "primary", "and", "replica", "timeout", "values", ")", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/util/TransparentReplicaGetHelper.java#L54-L59
apache/spark
launcher/src/main/java/org/apache/spark/launcher/Main.java
Main.prepareWindowsCommand
private static String prepareWindowsCommand(List<String> cmd, Map<String, String> childEnv) { """ Prepare a command line for execution from a Windows batch script. The method quotes all arguments so that spaces are handled as expected. Quotes within arguments are "double quoted" (which is batch for escaping a quote). This page has more details about quoting and other batch script fun stuff: http://ss64.com/nt/syntax-esc.html """ StringBuilder cmdline = new StringBuilder(); for (Map.Entry<String, String> e : childEnv.entrySet()) { cmdline.append(String.format("set %s=%s", e.getKey(), e.getValue())); cmdline.append(" && "); } for (String arg : cmd) { cmdline.append(quoteForBatchScript(arg)); cmdline.append(" "); } return cmdline.toString(); }
java
private static String prepareWindowsCommand(List<String> cmd, Map<String, String> childEnv) { StringBuilder cmdline = new StringBuilder(); for (Map.Entry<String, String> e : childEnv.entrySet()) { cmdline.append(String.format("set %s=%s", e.getKey(), e.getValue())); cmdline.append(" && "); } for (String arg : cmd) { cmdline.append(quoteForBatchScript(arg)); cmdline.append(" "); } return cmdline.toString(); }
[ "private", "static", "String", "prepareWindowsCommand", "(", "List", "<", "String", ">", "cmd", ",", "Map", "<", "String", ",", "String", ">", "childEnv", ")", "{", "StringBuilder", "cmdline", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "e", ":", "childEnv", ".", "entrySet", "(", ")", ")", "{", "cmdline", ".", "append", "(", "String", ".", "format", "(", "\"set %s=%s\"", ",", "e", ".", "getKey", "(", ")", ",", "e", ".", "getValue", "(", ")", ")", ")", ";", "cmdline", ".", "append", "(", "\" && \"", ")", ";", "}", "for", "(", "String", "arg", ":", "cmd", ")", "{", "cmdline", ".", "append", "(", "quoteForBatchScript", "(", "arg", ")", ")", ";", "cmdline", ".", "append", "(", "\" \"", ")", ";", "}", "return", "cmdline", ".", "toString", "(", ")", ";", "}" ]
Prepare a command line for execution from a Windows batch script. The method quotes all arguments so that spaces are handled as expected. Quotes within arguments are "double quoted" (which is batch for escaping a quote). This page has more details about quoting and other batch script fun stuff: http://ss64.com/nt/syntax-esc.html
[ "Prepare", "a", "command", "line", "for", "execution", "from", "a", "Windows", "batch", "script", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/Main.java#L125-L136
ckpoint/CheckPoint
src/main/java/hsim/checkpoint/util/ValidationObjUtil.java
ValidationObjUtil.objectDeepCopyWithWhiteList
public static <T> T objectDeepCopyWithWhiteList(Object from, Object to, String... copyFields) { """ Object deep copy with white list t. @param <T> the type parameter @param from the from @param to the to @param copyFields the copy fields @return the t """ return (T) to.getClass().cast(objDeepCopy(from, to, copyFields)); }
java
public static <T> T objectDeepCopyWithWhiteList(Object from, Object to, String... copyFields) { return (T) to.getClass().cast(objDeepCopy(from, to, copyFields)); }
[ "public", "static", "<", "T", ">", "T", "objectDeepCopyWithWhiteList", "(", "Object", "from", ",", "Object", "to", ",", "String", "...", "copyFields", ")", "{", "return", "(", "T", ")", "to", ".", "getClass", "(", ")", ".", "cast", "(", "objDeepCopy", "(", "from", ",", "to", ",", "copyFields", ")", ")", ";", "}" ]
Object deep copy with white list t. @param <T> the type parameter @param from the from @param to the to @param copyFields the copy fields @return the t
[ "Object", "deep", "copy", "with", "white", "list", "t", "." ]
train
https://github.com/ckpoint/CheckPoint/blob/2c2b1a87a88485d49ea6afa34acdf16ef4134f19/src/main/java/hsim/checkpoint/util/ValidationObjUtil.java#L360-L362
Samsung/GearVRf
GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRPhysicsLoader.java
GVRPhysicsLoader.loadPhysicsFile
public static void loadPhysicsFile(GVRContext gvrContext, String fileName, GVRScene scene) throws IOException { """ Loads a physics settings file. @param gvrContext The context of the app. @param fileName Physics settings file name. @param scene The scene containing the objects to attach physics components. """ loadPhysicsFile(gvrContext, fileName, false, scene); }
java
public static void loadPhysicsFile(GVRContext gvrContext, String fileName, GVRScene scene) throws IOException { loadPhysicsFile(gvrContext, fileName, false, scene); }
[ "public", "static", "void", "loadPhysicsFile", "(", "GVRContext", "gvrContext", ",", "String", "fileName", ",", "GVRScene", "scene", ")", "throws", "IOException", "{", "loadPhysicsFile", "(", "gvrContext", ",", "fileName", ",", "false", ",", "scene", ")", ";", "}" ]
Loads a physics settings file. @param gvrContext The context of the app. @param fileName Physics settings file name. @param scene The scene containing the objects to attach physics components.
[ "Loads", "a", "physics", "settings", "file", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRPhysicsLoader.java#L49-L52
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/reporting/ReportGenerator.java
ReportGenerator.processTemplate
@SuppressFBWarnings(justification = "try with resources will clean up the output stream", value = { """ Generates a report from a given Velocity Template. The template name provided can be the name of a template contained in the jar file, such as 'XmlReport' or 'HtmlReport', or the template name can be the path to a template file. @param template the name of the template to load @param file the output file to write the report to @throws ReportException is thrown when the report cannot be generated """"OBL_UNSATISFIED_OBLIGATION"}) protected void processTemplate(String template, File file) throws ReportException { ensureParentDirectoryExists(file); try (OutputStream output = new FileOutputStream(file)) { processTemplate(template, output); } catch (IOException ex) { throw new ReportException(String.format("Unable to write to file: %s", file), ex); } }
java
@SuppressFBWarnings(justification = "try with resources will clean up the output stream", value = {"OBL_UNSATISFIED_OBLIGATION"}) protected void processTemplate(String template, File file) throws ReportException { ensureParentDirectoryExists(file); try (OutputStream output = new FileOutputStream(file)) { processTemplate(template, output); } catch (IOException ex) { throw new ReportException(String.format("Unable to write to file: %s", file), ex); } }
[ "@", "SuppressFBWarnings", "(", "justification", "=", "\"try with resources will clean up the output stream\"", ",", "value", "=", "{", "\"OBL_UNSATISFIED_OBLIGATION\"", "}", ")", "protected", "void", "processTemplate", "(", "String", "template", ",", "File", "file", ")", "throws", "ReportException", "{", "ensureParentDirectoryExists", "(", "file", ")", ";", "try", "(", "OutputStream", "output", "=", "new", "FileOutputStream", "(", "file", ")", ")", "{", "processTemplate", "(", "template", ",", "output", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "ReportException", "(", "String", ".", "format", "(", "\"Unable to write to file: %s\"", ",", "file", ")", ",", "ex", ")", ";", "}", "}" ]
Generates a report from a given Velocity Template. The template name provided can be the name of a template contained in the jar file, such as 'XmlReport' or 'HtmlReport', or the template name can be the path to a template file. @param template the name of the template to load @param file the output file to write the report to @throws ReportException is thrown when the report cannot be generated
[ "Generates", "a", "report", "from", "a", "given", "Velocity", "Template", ".", "The", "template", "name", "provided", "can", "be", "the", "name", "of", "a", "template", "contained", "in", "the", "jar", "file", "such", "as", "XmlReport", "or", "HtmlReport", "or", "the", "template", "name", "can", "be", "the", "path", "to", "a", "template", "file", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/reporting/ReportGenerator.java#L309-L317
neo4j/neo4j-java-driver
driver/src/main/java/org/neo4j/driver/internal/util/CertificateTool.java
CertificateTool.saveX509Cert
public static void saveX509Cert( Certificate cert, File certFile ) throws GeneralSecurityException, IOException { """ Save a certificate to a file. Remove all the content in the file if there is any before. @param cert @param certFile @throws GeneralSecurityException @throws IOException """ saveX509Cert( new Certificate[]{cert}, certFile ); }
java
public static void saveX509Cert( Certificate cert, File certFile ) throws GeneralSecurityException, IOException { saveX509Cert( new Certificate[]{cert}, certFile ); }
[ "public", "static", "void", "saveX509Cert", "(", "Certificate", "cert", ",", "File", "certFile", ")", "throws", "GeneralSecurityException", ",", "IOException", "{", "saveX509Cert", "(", "new", "Certificate", "[", "]", "{", "cert", "}", ",", "certFile", ")", ";", "}" ]
Save a certificate to a file. Remove all the content in the file if there is any before. @param cert @param certFile @throws GeneralSecurityException @throws IOException
[ "Save", "a", "certificate", "to", "a", "file", ".", "Remove", "all", "the", "content", "in", "the", "file", "if", "there", "is", "any", "before", "." ]
train
https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/util/CertificateTool.java#L72-L75
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/commons/JSRInlinerAdapter.java
JSRInlinerAdapter.visitJumpInsn
@Override public void visitJumpInsn(final int opcode, final Label lbl) { """ Detects a JSR instruction and sets a flag to indicate we will need to do inlining. """ super.visitJumpInsn(opcode, lbl); LabelNode ln = ((JumpInsnNode) instructions.getLast()).label; if (opcode == JSR && !subroutineHeads.containsKey(ln)) { subroutineHeads.put(ln, new BitSet()); } }
java
@Override public void visitJumpInsn(final int opcode, final Label lbl) { super.visitJumpInsn(opcode, lbl); LabelNode ln = ((JumpInsnNode) instructions.getLast()).label; if (opcode == JSR && !subroutineHeads.containsKey(ln)) { subroutineHeads.put(ln, new BitSet()); } }
[ "@", "Override", "public", "void", "visitJumpInsn", "(", "final", "int", "opcode", ",", "final", "Label", "lbl", ")", "{", "super", ".", "visitJumpInsn", "(", "opcode", ",", "lbl", ")", ";", "LabelNode", "ln", "=", "(", "(", "JumpInsnNode", ")", "instructions", ".", "getLast", "(", ")", ")", ".", "label", ";", "if", "(", "opcode", "==", "JSR", "&&", "!", "subroutineHeads", ".", "containsKey", "(", "ln", ")", ")", "{", "subroutineHeads", ".", "put", "(", "ln", ",", "new", "BitSet", "(", ")", ")", ";", "}", "}" ]
Detects a JSR instruction and sets a flag to indicate we will need to do inlining.
[ "Detects", "a", "JSR", "instruction", "and", "sets", "a", "flag", "to", "indicate", "we", "will", "need", "to", "do", "inlining", "." ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/commons/JSRInlinerAdapter.java#L157-L164
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.uploadFile
public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload, String mediaType) throws GitLabApiException { """ Uploads a file to the specified project to be used in an issue or merge request description, or a comment. <pre><code>POST /projects/:id/uploads</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param fileToUpload the File instance of the file to upload, required @param mediaType the media type of the file to upload, optional @return a FileUpload instance with information on the just uploaded file @throws GitLabApiException if any exception occurs """ Response response = upload(Response.Status.CREATED, "file", fileToUpload, mediaType, "projects", getProjectIdOrPath(projectIdOrPath), "uploads"); return (response.readEntity(FileUpload.class)); }
java
public FileUpload uploadFile(Object projectIdOrPath, File fileToUpload, String mediaType) throws GitLabApiException { Response response = upload(Response.Status.CREATED, "file", fileToUpload, mediaType, "projects", getProjectIdOrPath(projectIdOrPath), "uploads"); return (response.readEntity(FileUpload.class)); }
[ "public", "FileUpload", "uploadFile", "(", "Object", "projectIdOrPath", ",", "File", "fileToUpload", ",", "String", "mediaType", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "upload", "(", "Response", ".", "Status", ".", "CREATED", ",", "\"file\"", ",", "fileToUpload", ",", "mediaType", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"uploads\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "FileUpload", ".", "class", ")", ")", ";", "}" ]
Uploads a file to the specified project to be used in an issue or merge request description, or a comment. <pre><code>POST /projects/:id/uploads</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param fileToUpload the File instance of the file to upload, required @param mediaType the media type of the file to upload, optional @return a FileUpload instance with information on the just uploaded file @throws GitLabApiException if any exception occurs
[ "Uploads", "a", "file", "to", "the", "specified", "project", "to", "be", "used", "in", "an", "issue", "or", "merge", "request", "description", "or", "a", "comment", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2160-L2163
googleapis/cloud-bigtable-client
bigtable-hbase-1.x-parent/bigtable-hbase-1.x-mapreduce/src/main/java/com/google/cloud/bigtable/mapreduce/Import.java
Import.createSubmittableJob
public static Job createSubmittableJob(Configuration conf, String[] args) throws IOException { """ Sets up the actual job. @param conf The current configuration. @param args The command line parameters. @return The newly created job. @throws java.io.IOException When setting up the job fails. """ conf.setIfUnset("hbase.client.connection.impl", BigtableConfiguration.getConnectionClass().getName()); conf.setIfUnset(BigtableOptionsFactory.BIGTABLE_RPC_TIMEOUT_MS_KEY, "60000"); TableName tableName = TableName.valueOf(args[0]); conf.set(TABLE_NAME, tableName.getNameAsString()); Path inputDir = new Path(args[1]); Job job = Job.getInstance(conf, conf.get(JOB_NAME_CONF_KEY, NAME + "_" + tableName)); job.setJarByClass(Importer.class); FileInputFormat.setInputPaths(job, inputDir); // Randomize the splits to avoid hot spotting a single tablet server job.setInputFormatClass(ShuffledSequenceFileInputFormat.class); // Give the mappers enough work to do otherwise each split will be dominated by spinup time ShuffledSequenceFileInputFormat.setMinInputSplitSize(job, 1L*1024*1024*1024); String hfileOutPath = conf.get(BULK_OUTPUT_CONF_KEY); // make sure we get the filter in the jars try { Class<? extends Filter> filter = conf.getClass(FILTER_CLASS_CONF_KEY, null, Filter.class); if (filter != null) { TableMapReduceUtil.addDependencyJars(conf, filter); } } catch (Exception e) { throw new IOException(e); } if (hfileOutPath != null) { job.setMapperClass(KeyValueImporter.class); try (Connection conn = ConnectionFactory.createConnection(conf); Table table = conn.getTable(tableName); RegionLocator regionLocator = conn.getRegionLocator(tableName)){ job.setReducerClass(KeyValueSortReducer.class); Path outputDir = new Path(hfileOutPath); FileOutputFormat.setOutputPath(job, outputDir); job.setMapOutputKeyClass(ImmutableBytesWritable.class); job.setMapOutputValueClass(KeyValue.class); HFileOutputFormat2.configureIncrementalLoad(job, table, regionLocator); TableMapReduceUtil.addDependencyJars(job.getConfiguration(), com.google.common.base.Preconditions.class); } } else { // No reducers. Just write straight to table. Call initTableReducerJob // because it sets up the TableOutputFormat. job.setMapperClass(Importer.class); //TableMapReduceUtil.initTableReducerJob(tableName.getNameAsString(), null, job); TableMapReduceUtil.initTableReducerJob(tableName.getNameAsString(), null, job, null, null, null, null, false); job.setNumReduceTasks(0); } return job; }
java
public static Job createSubmittableJob(Configuration conf, String[] args) throws IOException { conf.setIfUnset("hbase.client.connection.impl", BigtableConfiguration.getConnectionClass().getName()); conf.setIfUnset(BigtableOptionsFactory.BIGTABLE_RPC_TIMEOUT_MS_KEY, "60000"); TableName tableName = TableName.valueOf(args[0]); conf.set(TABLE_NAME, tableName.getNameAsString()); Path inputDir = new Path(args[1]); Job job = Job.getInstance(conf, conf.get(JOB_NAME_CONF_KEY, NAME + "_" + tableName)); job.setJarByClass(Importer.class); FileInputFormat.setInputPaths(job, inputDir); // Randomize the splits to avoid hot spotting a single tablet server job.setInputFormatClass(ShuffledSequenceFileInputFormat.class); // Give the mappers enough work to do otherwise each split will be dominated by spinup time ShuffledSequenceFileInputFormat.setMinInputSplitSize(job, 1L*1024*1024*1024); String hfileOutPath = conf.get(BULK_OUTPUT_CONF_KEY); // make sure we get the filter in the jars try { Class<? extends Filter> filter = conf.getClass(FILTER_CLASS_CONF_KEY, null, Filter.class); if (filter != null) { TableMapReduceUtil.addDependencyJars(conf, filter); } } catch (Exception e) { throw new IOException(e); } if (hfileOutPath != null) { job.setMapperClass(KeyValueImporter.class); try (Connection conn = ConnectionFactory.createConnection(conf); Table table = conn.getTable(tableName); RegionLocator regionLocator = conn.getRegionLocator(tableName)){ job.setReducerClass(KeyValueSortReducer.class); Path outputDir = new Path(hfileOutPath); FileOutputFormat.setOutputPath(job, outputDir); job.setMapOutputKeyClass(ImmutableBytesWritable.class); job.setMapOutputValueClass(KeyValue.class); HFileOutputFormat2.configureIncrementalLoad(job, table, regionLocator); TableMapReduceUtil.addDependencyJars(job.getConfiguration(), com.google.common.base.Preconditions.class); } } else { // No reducers. Just write straight to table. Call initTableReducerJob // because it sets up the TableOutputFormat. job.setMapperClass(Importer.class); //TableMapReduceUtil.initTableReducerJob(tableName.getNameAsString(), null, job); TableMapReduceUtil.initTableReducerJob(tableName.getNameAsString(), null, job, null, null, null, null, false); job.setNumReduceTasks(0); } return job; }
[ "public", "static", "Job", "createSubmittableJob", "(", "Configuration", "conf", ",", "String", "[", "]", "args", ")", "throws", "IOException", "{", "conf", ".", "setIfUnset", "(", "\"hbase.client.connection.impl\"", ",", "BigtableConfiguration", ".", "getConnectionClass", "(", ")", ".", "getName", "(", ")", ")", ";", "conf", ".", "setIfUnset", "(", "BigtableOptionsFactory", ".", "BIGTABLE_RPC_TIMEOUT_MS_KEY", ",", "\"60000\"", ")", ";", "TableName", "tableName", "=", "TableName", ".", "valueOf", "(", "args", "[", "0", "]", ")", ";", "conf", ".", "set", "(", "TABLE_NAME", ",", "tableName", ".", "getNameAsString", "(", ")", ")", ";", "Path", "inputDir", "=", "new", "Path", "(", "args", "[", "1", "]", ")", ";", "Job", "job", "=", "Job", ".", "getInstance", "(", "conf", ",", "conf", ".", "get", "(", "JOB_NAME_CONF_KEY", ",", "NAME", "+", "\"_\"", "+", "tableName", ")", ")", ";", "job", ".", "setJarByClass", "(", "Importer", ".", "class", ")", ";", "FileInputFormat", ".", "setInputPaths", "(", "job", ",", "inputDir", ")", ";", "// Randomize the splits to avoid hot spotting a single tablet server", "job", ".", "setInputFormatClass", "(", "ShuffledSequenceFileInputFormat", ".", "class", ")", ";", "// Give the mappers enough work to do otherwise each split will be dominated by spinup time", "ShuffledSequenceFileInputFormat", ".", "setMinInputSplitSize", "(", "job", ",", "1L", "*", "1024", "*", "1024", "*", "1024", ")", ";", "String", "hfileOutPath", "=", "conf", ".", "get", "(", "BULK_OUTPUT_CONF_KEY", ")", ";", "// make sure we get the filter in the jars", "try", "{", "Class", "<", "?", "extends", "Filter", ">", "filter", "=", "conf", ".", "getClass", "(", "FILTER_CLASS_CONF_KEY", ",", "null", ",", "Filter", ".", "class", ")", ";", "if", "(", "filter", "!=", "null", ")", "{", "TableMapReduceUtil", ".", "addDependencyJars", "(", "conf", ",", "filter", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IOException", "(", "e", ")", ";", "}", "if", "(", "hfileOutPath", "!=", "null", ")", "{", "job", ".", "setMapperClass", "(", "KeyValueImporter", ".", "class", ")", ";", "try", "(", "Connection", "conn", "=", "ConnectionFactory", ".", "createConnection", "(", "conf", ")", ";", "Table", "table", "=", "conn", ".", "getTable", "(", "tableName", ")", ";", "RegionLocator", "regionLocator", "=", "conn", ".", "getRegionLocator", "(", "tableName", ")", ")", "{", "job", ".", "setReducerClass", "(", "KeyValueSortReducer", ".", "class", ")", ";", "Path", "outputDir", "=", "new", "Path", "(", "hfileOutPath", ")", ";", "FileOutputFormat", ".", "setOutputPath", "(", "job", ",", "outputDir", ")", ";", "job", ".", "setMapOutputKeyClass", "(", "ImmutableBytesWritable", ".", "class", ")", ";", "job", ".", "setMapOutputValueClass", "(", "KeyValue", ".", "class", ")", ";", "HFileOutputFormat2", ".", "configureIncrementalLoad", "(", "job", ",", "table", ",", "regionLocator", ")", ";", "TableMapReduceUtil", ".", "addDependencyJars", "(", "job", ".", "getConfiguration", "(", ")", ",", "com", ".", "google", ".", "common", ".", "base", ".", "Preconditions", ".", "class", ")", ";", "}", "}", "else", "{", "// No reducers. Just write straight to table. Call initTableReducerJob", "// because it sets up the TableOutputFormat.", "job", ".", "setMapperClass", "(", "Importer", ".", "class", ")", ";", "//TableMapReduceUtil.initTableReducerJob(tableName.getNameAsString(), null, job);", "TableMapReduceUtil", ".", "initTableReducerJob", "(", "tableName", ".", "getNameAsString", "(", ")", ",", "null", ",", "job", ",", "null", ",", "null", ",", "null", ",", "null", ",", "false", ")", ";", "job", ".", "setNumReduceTasks", "(", "0", ")", ";", "}", "return", "job", ";", "}" ]
Sets up the actual job. @param conf The current configuration. @param args The command line parameters. @return The newly created job. @throws java.io.IOException When setting up the job fails.
[ "Sets", "up", "the", "actual", "job", "." ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-hbase-1.x-parent/bigtable-hbase-1.x-mapreduce/src/main/java/com/google/cloud/bigtable/mapreduce/Import.java#L406-L457
rabbitmq/hop
src/main/java/com/rabbitmq/http/client/Client.java
Client.closeConnection
public void closeConnection(String name, String reason) { """ Forcefully closes individual connection with a user-provided message. The client will receive a <i>connection.close</i> method frame. @param name connection name @param reason the reason of closing """ final URI uri = uriWithPath("./connections/" + encodePathSegment(name)); MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>(); headers.put("X-Reason", Collections.singletonList(reason)); deleteIgnoring404(uri, headers); }
java
public void closeConnection(String name, String reason) { final URI uri = uriWithPath("./connections/" + encodePathSegment(name)); MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>(); headers.put("X-Reason", Collections.singletonList(reason)); deleteIgnoring404(uri, headers); }
[ "public", "void", "closeConnection", "(", "String", "name", ",", "String", "reason", ")", "{", "final", "URI", "uri", "=", "uriWithPath", "(", "\"./connections/\"", "+", "encodePathSegment", "(", "name", ")", ")", ";", "MultiValueMap", "<", "String", ",", "String", ">", "headers", "=", "new", "LinkedMultiValueMap", "<", "String", ",", "String", ">", "(", ")", ";", "headers", ".", "put", "(", "\"X-Reason\"", ",", "Collections", ".", "singletonList", "(", "reason", ")", ")", ";", "deleteIgnoring404", "(", "uri", ",", "headers", ")", ";", "}" ]
Forcefully closes individual connection with a user-provided message. The client will receive a <i>connection.close</i> method frame. @param name connection name @param reason the reason of closing
[ "Forcefully", "closes", "individual", "connection", "with", "a", "user", "-", "provided", "message", ".", "The", "client", "will", "receive", "a", "<i", ">", "connection", ".", "close<", "/", "i", ">", "method", "frame", "." ]
train
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L322-L329
eobermuhlner/big-math
ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java
BigDecimalMath.sinh
public static BigDecimal sinh(BigDecimal x, MathContext mathContext) { """ Calculates the hyperbolic sine of {@link BigDecimal} x. <p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p> @param x the {@link BigDecimal} to calculate the hyperbolic sine for @param mathContext the {@link MathContext} used for the result @return the calculated hyperbolic sine {@link BigDecimal} with the precision specified in the <code>mathContext</code> @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision """ checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); BigDecimal result = SinhCalculator.INSTANCE.calculate(x, mc); return round(result, mathContext); }
java
public static BigDecimal sinh(BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); BigDecimal result = SinhCalculator.INSTANCE.calculate(x, mc); return round(result, mathContext); }
[ "public", "static", "BigDecimal", "sinh", "(", "BigDecimal", "x", ",", "MathContext", "mathContext", ")", "{", "checkMathContext", "(", "mathContext", ")", ";", "MathContext", "mc", "=", "new", "MathContext", "(", "mathContext", ".", "getPrecision", "(", ")", "+", "4", ",", "mathContext", ".", "getRoundingMode", "(", ")", ")", ";", "BigDecimal", "result", "=", "SinhCalculator", ".", "INSTANCE", ".", "calculate", "(", "x", ",", "mc", ")", ";", "return", "round", "(", "result", ",", "mathContext", ")", ";", "}" ]
Calculates the hyperbolic sine of {@link BigDecimal} x. <p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p> @param x the {@link BigDecimal} to calculate the hyperbolic sine for @param mathContext the {@link MathContext} used for the result @return the calculated hyperbolic sine {@link BigDecimal} with the precision specified in the <code>mathContext</code> @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision
[ "Calculates", "the", "hyperbolic", "sine", "of", "{", "@link", "BigDecimal", "}", "x", "." ]
train
https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java#L1533-L1538
antlrjavaparser/antlr-java-parser
src/main/java/com/github/antlrjavaparser/ASTHelper.java
ASTHelper.addParameter
public static void addParameter(MethodDeclaration method, Parameter parameter) { """ Adds the given parameter to the method. The list of parameters will be initialized if it is <code>null</code>. @param method method @param parameter parameter """ List<Parameter> parameters = method.getParameters(); if (parameters == null) { parameters = new ArrayList<Parameter>(); method.setParameters(parameters); } parameters.add(parameter); }
java
public static void addParameter(MethodDeclaration method, Parameter parameter) { List<Parameter> parameters = method.getParameters(); if (parameters == null) { parameters = new ArrayList<Parameter>(); method.setParameters(parameters); } parameters.add(parameter); }
[ "public", "static", "void", "addParameter", "(", "MethodDeclaration", "method", ",", "Parameter", "parameter", ")", "{", "List", "<", "Parameter", ">", "parameters", "=", "method", ".", "getParameters", "(", ")", ";", "if", "(", "parameters", "==", "null", ")", "{", "parameters", "=", "new", "ArrayList", "<", "Parameter", ">", "(", ")", ";", "method", ".", "setParameters", "(", "parameters", ")", ";", "}", "parameters", ".", "add", "(", "parameter", ")", ";", "}" ]
Adds the given parameter to the method. The list of parameters will be initialized if it is <code>null</code>. @param method method @param parameter parameter
[ "Adds", "the", "given", "parameter", "to", "the", "method", ".", "The", "list", "of", "parameters", "will", "be", "initialized", "if", "it", "is", "<code", ">", "null<", "/", "code", ">", "." ]
train
https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/ASTHelper.java#L166-L173
iig-uni-freiburg/SEWOL
ext/org/deckfour/xes/extension/std/XLifecycleExtension.java
XLifecycleExtension.assignTransition
public void assignTransition(XEvent event, String transition) { """ Assigns a lifecycle transition string to the given event. @param event Event to be tagged. @param transition Lifecycle transition string to be assigned. """ if (transition != null && transition.trim().length() > 0) { XAttributeLiteral transAttr = (XAttributeLiteral) ATTR_TRANSITION .clone(); transAttr.setValue(transition.trim()); event.getAttributes().put(KEY_TRANSITION, transAttr); } }
java
public void assignTransition(XEvent event, String transition) { if (transition != null && transition.trim().length() > 0) { XAttributeLiteral transAttr = (XAttributeLiteral) ATTR_TRANSITION .clone(); transAttr.setValue(transition.trim()); event.getAttributes().put(KEY_TRANSITION, transAttr); } }
[ "public", "void", "assignTransition", "(", "XEvent", "event", ",", "String", "transition", ")", "{", "if", "(", "transition", "!=", "null", "&&", "transition", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "XAttributeLiteral", "transAttr", "=", "(", "XAttributeLiteral", ")", "ATTR_TRANSITION", ".", "clone", "(", ")", ";", "transAttr", ".", "setValue", "(", "transition", ".", "trim", "(", ")", ")", ";", "event", ".", "getAttributes", "(", ")", ".", "put", "(", "KEY_TRANSITION", ",", "transAttr", ")", ";", "}", "}" ]
Assigns a lifecycle transition string to the given event. @param event Event to be tagged. @param transition Lifecycle transition string to be assigned.
[ "Assigns", "a", "lifecycle", "transition", "string", "to", "the", "given", "event", "." ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/ext/org/deckfour/xes/extension/std/XLifecycleExtension.java#L311-L318
openbase/jul
communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractConfigurableRemote.java
AbstractConfigurableRemote.applyConfigUpdate
@Override public CONFIG applyConfigUpdate(final CONFIG config) throws CouldNotPerformException, InterruptedException { """ {@inheritDoc} @param config {@inheritDoc} @return {@inheritDoc} @throws CouldNotPerformException {@inheritDoc} @throws InterruptedException {@inheritDoc} """ synchronized (CONFIG_LOCK) { try { this.config = config; configObservable.notifyObservers(config); // detect scope change if instance is already active and reinit if needed. try { if (isActive() && !currentScope.equals(detectScope(config))) { currentScope = detectScope(); reinit(currentScope); } } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not verify scope changes!", ex); } try { notifyConfigUpdate(config); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify config update!", ex), logger); } return this.config; } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not apply config update!", ex); } } }
java
@Override public CONFIG applyConfigUpdate(final CONFIG config) throws CouldNotPerformException, InterruptedException { synchronized (CONFIG_LOCK) { try { this.config = config; configObservable.notifyObservers(config); // detect scope change if instance is already active and reinit if needed. try { if (isActive() && !currentScope.equals(detectScope(config))) { currentScope = detectScope(); reinit(currentScope); } } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not verify scope changes!", ex); } try { notifyConfigUpdate(config); } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify config update!", ex), logger); } return this.config; } catch (CouldNotPerformException ex) { throw new CouldNotPerformException("Could not apply config update!", ex); } } }
[ "@", "Override", "public", "CONFIG", "applyConfigUpdate", "(", "final", "CONFIG", "config", ")", "throws", "CouldNotPerformException", ",", "InterruptedException", "{", "synchronized", "(", "CONFIG_LOCK", ")", "{", "try", "{", "this", ".", "config", "=", "config", ";", "configObservable", ".", "notifyObservers", "(", "config", ")", ";", "// detect scope change if instance is already active and reinit if needed.", "try", "{", "if", "(", "isActive", "(", ")", "&&", "!", "currentScope", ".", "equals", "(", "detectScope", "(", "config", ")", ")", ")", "{", "currentScope", "=", "detectScope", "(", ")", ";", "reinit", "(", "currentScope", ")", ";", "}", "}", "catch", "(", "CouldNotPerformException", "ex", ")", "{", "throw", "new", "CouldNotPerformException", "(", "\"Could not verify scope changes!\"", ",", "ex", ")", ";", "}", "try", "{", "notifyConfigUpdate", "(", "config", ")", ";", "}", "catch", "(", "CouldNotPerformException", "ex", ")", "{", "ExceptionPrinter", ".", "printHistory", "(", "new", "CouldNotPerformException", "(", "\"Could not notify config update!\"", ",", "ex", ")", ",", "logger", ")", ";", "}", "return", "this", ".", "config", ";", "}", "catch", "(", "CouldNotPerformException", "ex", ")", "{", "throw", "new", "CouldNotPerformException", "(", "\"Could not apply config update!\"", ",", "ex", ")", ";", "}", "}", "}" ]
{@inheritDoc} @param config {@inheritDoc} @return {@inheritDoc} @throws CouldNotPerformException {@inheritDoc} @throws InterruptedException {@inheritDoc}
[ "{", "@inheritDoc", "}" ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractConfigurableRemote.java#L106-L133
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/text/StrBuilder.java
StrBuilder.setCharAt
public StrBuilder setCharAt(final int index, final char ch) { """ Sets the character at the specified index. @see #charAt(int) @see #deleteCharAt(int) @param index the index to set @param ch the new character @return this, to enable chaining @throws IndexOutOfBoundsException if the index is invalid """ if (index < 0 || index >= length()) { throw new StringIndexOutOfBoundsException(index); } buffer[index] = ch; return this; }
java
public StrBuilder setCharAt(final int index, final char ch) { if (index < 0 || index >= length()) { throw new StringIndexOutOfBoundsException(index); } buffer[index] = ch; return this; }
[ "public", "StrBuilder", "setCharAt", "(", "final", "int", "index", ",", "final", "char", "ch", ")", "{", "if", "(", "index", "<", "0", "||", "index", ">=", "length", "(", ")", ")", "{", "throw", "new", "StringIndexOutOfBoundsException", "(", "index", ")", ";", "}", "buffer", "[", "index", "]", "=", "ch", ";", "return", "this", ";", "}" ]
Sets the character at the specified index. @see #charAt(int) @see #deleteCharAt(int) @param index the index to set @param ch the new character @return this, to enable chaining @throws IndexOutOfBoundsException if the index is invalid
[ "Sets", "the", "character", "at", "the", "specified", "index", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/text/StrBuilder.java#L333-L339
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/auth/AuthenticatorFactory.java
AuthenticatorFactory.createFacebookAuthenticator
public static Authenticator createFacebookAuthenticator(String token) { """ /* Creates an Authenticator that knows how to do Facebook authentication. @param token Facebook access token """ Map<String, String> params = new HashMap<String, String>(); params.put("access_token", token); return new TokenAuthenticator("_facebook", params); }
java
public static Authenticator createFacebookAuthenticator(String token) { Map<String, String> params = new HashMap<String, String>(); params.put("access_token", token); return new TokenAuthenticator("_facebook", params); }
[ "public", "static", "Authenticator", "createFacebookAuthenticator", "(", "String", "token", ")", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "params", ".", "put", "(", "\"access_token\"", ",", "token", ")", ";", "return", "new", "TokenAuthenticator", "(", "\"_facebook\"", ",", "params", ")", ";", "}" ]
/* Creates an Authenticator that knows how to do Facebook authentication. @param token Facebook access token
[ "/", "*", "Creates", "an", "Authenticator", "that", "knows", "how", "to", "do", "Facebook", "authentication", "." ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/auth/AuthenticatorFactory.java#L39-L43
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ClassUtils.java
ClassUtils.getPropertyClass
public static Class getPropertyClass(Class parentClass, String propertyName) throws IllegalArgumentException { """ Returns the class of the property. <p /> For example, getPropertyClass(JFrame.class, "size") would return the java.awt.Dimension class. @param parentClass the class to look for the property in @param propertyName the name of the property @return the class of the property; never null @throws IllegalArgumentException if either argument is null @throws IllegalArgumentException <tt>propertyName</tt> is not a property of <tt>parentClass</tt> """ if (parentClass == null) throw new IllegalArgumentException("theClass == null"); if (propertyName == null) throw new IllegalArgumentException("propertyName == null"); final Method getterMethod = getReadMethod(parentClass, propertyName); if (getterMethod != null) { return getterMethod.getReturnType(); } final Method setterMethod = getWriteMethod(parentClass, propertyName); if (setterMethod != null) { return setterMethod.getParameterTypes()[0]; } throw new IllegalArgumentException(propertyName + " is not a property of " + parentClass); }
java
public static Class getPropertyClass(Class parentClass, String propertyName) throws IllegalArgumentException { if (parentClass == null) throw new IllegalArgumentException("theClass == null"); if (propertyName == null) throw new IllegalArgumentException("propertyName == null"); final Method getterMethod = getReadMethod(parentClass, propertyName); if (getterMethod != null) { return getterMethod.getReturnType(); } final Method setterMethod = getWriteMethod(parentClass, propertyName); if (setterMethod != null) { return setterMethod.getParameterTypes()[0]; } throw new IllegalArgumentException(propertyName + " is not a property of " + parentClass); }
[ "public", "static", "Class", "getPropertyClass", "(", "Class", "parentClass", ",", "String", "propertyName", ")", "throws", "IllegalArgumentException", "{", "if", "(", "parentClass", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"theClass == null\"", ")", ";", "if", "(", "propertyName", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"propertyName == null\"", ")", ";", "final", "Method", "getterMethod", "=", "getReadMethod", "(", "parentClass", ",", "propertyName", ")", ";", "if", "(", "getterMethod", "!=", "null", ")", "{", "return", "getterMethod", ".", "getReturnType", "(", ")", ";", "}", "final", "Method", "setterMethod", "=", "getWriteMethod", "(", "parentClass", ",", "propertyName", ")", ";", "if", "(", "setterMethod", "!=", "null", ")", "{", "return", "setterMethod", ".", "getParameterTypes", "(", ")", "[", "0", "]", ";", "}", "throw", "new", "IllegalArgumentException", "(", "propertyName", "+", "\" is not a property of \"", "+", "parentClass", ")", ";", "}" ]
Returns the class of the property. <p /> For example, getPropertyClass(JFrame.class, "size") would return the java.awt.Dimension class. @param parentClass the class to look for the property in @param propertyName the name of the property @return the class of the property; never null @throws IllegalArgumentException if either argument is null @throws IllegalArgumentException <tt>propertyName</tt> is not a property of <tt>parentClass</tt>
[ "Returns", "the", "class", "of", "the", "property", ".", "<p", "/", ">" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/ClassUtils.java#L462-L479
logic-ng/LogicNG
src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java
Encoder.buildCardinality
public void buildCardinality(final MiniSatStyleSolver s, final LNGIntVector lits, int rhs) { """ Manages the building of cardinality encodings. Currently is only used for incremental solving. @param s the solver @param lits the literals for the constraint @param rhs the right hand side of the constraint @throws IllegalStateException if the cardinality encoding does not support incrementality """ assert this.incrementalStrategy != IncrementalStrategy.NONE; switch (this.cardinalityEncoding) { case TOTALIZER: this.totalizer.build(s, lits, rhs); break; default: throw new IllegalStateException("Cardinality encoding does not support incrementality: " + this.incrementalStrategy); } }
java
public void buildCardinality(final MiniSatStyleSolver s, final LNGIntVector lits, int rhs) { assert this.incrementalStrategy != IncrementalStrategy.NONE; switch (this.cardinalityEncoding) { case TOTALIZER: this.totalizer.build(s, lits, rhs); break; default: throw new IllegalStateException("Cardinality encoding does not support incrementality: " + this.incrementalStrategy); } }
[ "public", "void", "buildCardinality", "(", "final", "MiniSatStyleSolver", "s", ",", "final", "LNGIntVector", "lits", ",", "int", "rhs", ")", "{", "assert", "this", ".", "incrementalStrategy", "!=", "IncrementalStrategy", ".", "NONE", ";", "switch", "(", "this", ".", "cardinalityEncoding", ")", "{", "case", "TOTALIZER", ":", "this", ".", "totalizer", ".", "build", "(", "s", ",", "lits", ",", "rhs", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Cardinality encoding does not support incrementality: \"", "+", "this", ".", "incrementalStrategy", ")", ";", "}", "}" ]
Manages the building of cardinality encodings. Currently is only used for incremental solving. @param s the solver @param lits the literals for the constraint @param rhs the right hand side of the constraint @throws IllegalStateException if the cardinality encoding does not support incrementality
[ "Manages", "the", "building", "of", "cardinality", "encodings", ".", "Currently", "is", "only", "used", "for", "incremental", "solving", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/maxsat/encodings/Encoder.java#L209-L218
briandilley/jsonrpc4j
src/main/java/com/googlecode/jsonrpc4j/ProxyUtil.java
ProxyUtil.createCompositeServiceProxy
public static Object createCompositeServiceProxy(ClassLoader classLoader, Object[] services, Class<?>[] serviceInterfaces, boolean allowMultipleInheritance) { """ Creates a composite service using all of the given services and implementing the given interfaces. @param classLoader the {@link ClassLoader} @param services the service objects @param serviceInterfaces the service interfaces @param allowMultipleInheritance whether or not to allow multiple inheritance @return the object """ Set<Class<?>> interfaces = collectInterfaces(services, serviceInterfaces); final Map<Class<?>, Object> serviceClassToInstanceMapping = buildServiceMap(services, allowMultipleInheritance, interfaces); // now create the proxy return Proxy.newProxyInstance(classLoader, interfaces.toArray(new Class<?>[0]), new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Class<?> clazz = method.getDeclaringClass(); if (clazz == Object.class) { return proxyObjectMethods(method, proxy, args); } return method.invoke(serviceClassToInstanceMapping.get(clazz), args); } }); }
java
public static Object createCompositeServiceProxy(ClassLoader classLoader, Object[] services, Class<?>[] serviceInterfaces, boolean allowMultipleInheritance) { Set<Class<?>> interfaces = collectInterfaces(services, serviceInterfaces); final Map<Class<?>, Object> serviceClassToInstanceMapping = buildServiceMap(services, allowMultipleInheritance, interfaces); // now create the proxy return Proxy.newProxyInstance(classLoader, interfaces.toArray(new Class<?>[0]), new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { Class<?> clazz = method.getDeclaringClass(); if (clazz == Object.class) { return proxyObjectMethods(method, proxy, args); } return method.invoke(serviceClassToInstanceMapping.get(clazz), args); } }); }
[ "public", "static", "Object", "createCompositeServiceProxy", "(", "ClassLoader", "classLoader", ",", "Object", "[", "]", "services", ",", "Class", "<", "?", ">", "[", "]", "serviceInterfaces", ",", "boolean", "allowMultipleInheritance", ")", "{", "Set", "<", "Class", "<", "?", ">", ">", "interfaces", "=", "collectInterfaces", "(", "services", ",", "serviceInterfaces", ")", ";", "final", "Map", "<", "Class", "<", "?", ">", ",", "Object", ">", "serviceClassToInstanceMapping", "=", "buildServiceMap", "(", "services", ",", "allowMultipleInheritance", ",", "interfaces", ")", ";", "// now create the proxy", "return", "Proxy", ".", "newProxyInstance", "(", "classLoader", ",", "interfaces", ".", "toArray", "(", "new", "Class", "<", "?", ">", "[", "0", "]", ")", ",", "new", "InvocationHandler", "(", ")", "{", "@", "Override", "public", "Object", "invoke", "(", "Object", "proxy", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "Throwable", "{", "Class", "<", "?", ">", "clazz", "=", "method", ".", "getDeclaringClass", "(", ")", ";", "if", "(", "clazz", "==", "Object", ".", "class", ")", "{", "return", "proxyObjectMethods", "(", "method", ",", "proxy", ",", "args", ")", ";", "}", "return", "method", ".", "invoke", "(", "serviceClassToInstanceMapping", ".", "get", "(", "clazz", ")", ",", "args", ")", ";", "}", "}", ")", ";", "}" ]
Creates a composite service using all of the given services and implementing the given interfaces. @param classLoader the {@link ClassLoader} @param services the service objects @param serviceInterfaces the service interfaces @param allowMultipleInheritance whether or not to allow multiple inheritance @return the object
[ "Creates", "a", "composite", "service", "using", "all", "of", "the", "given", "services", "and", "implementing", "the", "given", "interfaces", "." ]
train
https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/ProxyUtil.java#L51-L66
exoplatform/jcr
exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceRestore.java
JobExistingWorkspaceRestore.forceCloseSession
private int forceCloseSession(String repositoryName, String workspaceName) throws RepositoryException, RepositoryConfigurationException { """ Close sessions on specific workspace. @param repositoryName repository name @param workspaceName workspace name @return int return the how many sessions was closed @throws RepositoryConfigurationException will be generate RepositoryConfigurationException @throws RepositoryException will be generate RepositoryException """ ManageableRepository mr = repositoryService.getRepository(repositoryName); WorkspaceContainerFacade wc = mr.getWorkspaceContainer(workspaceName); SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class); return sessionRegistry.closeSessions(workspaceName); }
java
private int forceCloseSession(String repositoryName, String workspaceName) throws RepositoryException, RepositoryConfigurationException { ManageableRepository mr = repositoryService.getRepository(repositoryName); WorkspaceContainerFacade wc = mr.getWorkspaceContainer(workspaceName); SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class); return sessionRegistry.closeSessions(workspaceName); }
[ "private", "int", "forceCloseSession", "(", "String", "repositoryName", ",", "String", "workspaceName", ")", "throws", "RepositoryException", ",", "RepositoryConfigurationException", "{", "ManageableRepository", "mr", "=", "repositoryService", ".", "getRepository", "(", "repositoryName", ")", ";", "WorkspaceContainerFacade", "wc", "=", "mr", ".", "getWorkspaceContainer", "(", "workspaceName", ")", ";", "SessionRegistry", "sessionRegistry", "=", "(", "SessionRegistry", ")", "wc", ".", "getComponent", "(", "SessionRegistry", ".", "class", ")", ";", "return", "sessionRegistry", ".", "closeSessions", "(", "workspaceName", ")", ";", "}" ]
Close sessions on specific workspace. @param repositoryName repository name @param workspaceName workspace name @return int return the how many sessions was closed @throws RepositoryConfigurationException will be generate RepositoryConfigurationException @throws RepositoryException will be generate RepositoryException
[ "Close", "sessions", "on", "specific", "workspace", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/backup/impl/JobExistingWorkspaceRestore.java#L131-L140
jbundle/jbundle
app/program/db/src/main/java/org/jbundle/app/program/db/PropertiesStringField.java
PropertiesStringField.setupDefaultView
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { """ Set up the default screen control for this field. @param itsLocation Location of this component on screen (ie., GridBagConstraint). @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout). @param converter The converter to set the screenfield to. @param iDisplayFieldDesc Display the label? (optional). @param properties Extra properties @return Return the component or ScreenField that is created for this field. """ return super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); }
java
public ScreenComponent setupDefaultView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Map<String, Object> properties) { return super.setupDefaultView(itsLocation, targetScreen, converter, iDisplayFieldDesc, properties); }
[ "public", "ScreenComponent", "setupDefaultView", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "Convert", "converter", ",", "int", "iDisplayFieldDesc", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "return", "super", ".", "setupDefaultView", "(", "itsLocation", ",", "targetScreen", ",", "converter", ",", "iDisplayFieldDesc", ",", "properties", ")", ";", "}" ]
Set up the default screen control for this field. @param itsLocation Location of this component on screen (ie., GridBagConstraint). @param targetScreen Where to place this component (ie., Parent screen or GridBagLayout). @param converter The converter to set the screenfield to. @param iDisplayFieldDesc Display the label? (optional). @param properties Extra properties @return Return the component or ScreenField that is created for this field.
[ "Set", "up", "the", "default", "screen", "control", "for", "this", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/db/src/main/java/org/jbundle/app/program/db/PropertiesStringField.java#L67-L70
mapbox/mapbox-plugins-android
plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java
OfflinePlugin.errorDownload
void errorDownload(OfflineDownloadOptions offlineDownload, String error, String errorMessage) { """ Called when the OfflineDownloadService produced an error while downloading @param offlineDownload the offline download that produced an error @param error short description of the error @param errorMessage full description of the error @since 0.1.0 """ stateChangeDispatcher.onError(offlineDownload, error, errorMessage); offlineDownloads.remove(offlineDownload); }
java
void errorDownload(OfflineDownloadOptions offlineDownload, String error, String errorMessage) { stateChangeDispatcher.onError(offlineDownload, error, errorMessage); offlineDownloads.remove(offlineDownload); }
[ "void", "errorDownload", "(", "OfflineDownloadOptions", "offlineDownload", ",", "String", "error", ",", "String", "errorMessage", ")", "{", "stateChangeDispatcher", ".", "onError", "(", "offlineDownload", ",", "error", ",", "errorMessage", ")", ";", "offlineDownloads", ".", "remove", "(", "offlineDownload", ")", ";", "}" ]
Called when the OfflineDownloadService produced an error while downloading @param offlineDownload the offline download that produced an error @param error short description of the error @param errorMessage full description of the error @since 0.1.0
[ "Called", "when", "the", "OfflineDownloadService", "produced", "an", "error", "while", "downloading" ]
train
https://github.com/mapbox/mapbox-plugins-android/blob/c683cad4d8306945d71838d96fae73b8cbe2e6c9/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflinePlugin.java#L186-L189
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java
PgResultSet.readDoubleValue
private double readDoubleValue(byte[] bytes, int oid, String targetType) throws PSQLException { """ Converts any numeric binary field to double value. This method does no overflow checking. @param bytes The bytes of the numeric field. @param oid The oid of the field. @param targetType The target type. Used for error reporting. @return The value as double. @throws PSQLException If the field type is not supported numeric type. """ // currently implemented binary encoded fields switch (oid) { case Oid.INT2: return ByteConverter.int2(bytes, 0); case Oid.INT4: return ByteConverter.int4(bytes, 0); case Oid.INT8: // might not fit but there still should be no overflow checking return ByteConverter.int8(bytes, 0); case Oid.FLOAT4: return ByteConverter.float4(bytes, 0); case Oid.FLOAT8: return ByteConverter.float8(bytes, 0); } throw new PSQLException(GT.tr("Cannot convert the column of type {0} to requested type {1}.", Oid.toString(oid), targetType), PSQLState.DATA_TYPE_MISMATCH); }
java
private double readDoubleValue(byte[] bytes, int oid, String targetType) throws PSQLException { // currently implemented binary encoded fields switch (oid) { case Oid.INT2: return ByteConverter.int2(bytes, 0); case Oid.INT4: return ByteConverter.int4(bytes, 0); case Oid.INT8: // might not fit but there still should be no overflow checking return ByteConverter.int8(bytes, 0); case Oid.FLOAT4: return ByteConverter.float4(bytes, 0); case Oid.FLOAT8: return ByteConverter.float8(bytes, 0); } throw new PSQLException(GT.tr("Cannot convert the column of type {0} to requested type {1}.", Oid.toString(oid), targetType), PSQLState.DATA_TYPE_MISMATCH); }
[ "private", "double", "readDoubleValue", "(", "byte", "[", "]", "bytes", ",", "int", "oid", ",", "String", "targetType", ")", "throws", "PSQLException", "{", "// currently implemented binary encoded fields", "switch", "(", "oid", ")", "{", "case", "Oid", ".", "INT2", ":", "return", "ByteConverter", ".", "int2", "(", "bytes", ",", "0", ")", ";", "case", "Oid", ".", "INT4", ":", "return", "ByteConverter", ".", "int4", "(", "bytes", ",", "0", ")", ";", "case", "Oid", ".", "INT8", ":", "// might not fit but there still should be no overflow checking", "return", "ByteConverter", ".", "int8", "(", "bytes", ",", "0", ")", ";", "case", "Oid", ".", "FLOAT4", ":", "return", "ByteConverter", ".", "float4", "(", "bytes", ",", "0", ")", ";", "case", "Oid", ".", "FLOAT8", ":", "return", "ByteConverter", ".", "float8", "(", "bytes", ",", "0", ")", ";", "}", "throw", "new", "PSQLException", "(", "GT", ".", "tr", "(", "\"Cannot convert the column of type {0} to requested type {1}.\"", ",", "Oid", ".", "toString", "(", "oid", ")", ",", "targetType", ")", ",", "PSQLState", ".", "DATA_TYPE_MISMATCH", ")", ";", "}" ]
Converts any numeric binary field to double value. This method does no overflow checking. @param bytes The bytes of the numeric field. @param oid The oid of the field. @param targetType The target type. Used for error reporting. @return The value as double. @throws PSQLException If the field type is not supported numeric type.
[ "Converts", "any", "numeric", "binary", "field", "to", "double", "value", ".", "This", "method", "does", "no", "overflow", "checking", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java#L2952-L2969
percolate/caffeine
caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java
ViewUtils.showKeyboard
public static void showKeyboard(Context context, View field) { """ Show the pop-up keyboard @param context Activity/Context. @param field field that requests focus. """ try { field.requestFocus(); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(field, InputMethodManager.SHOW_IMPLICIT); } catch (Exception ex) { Log.e("Caffeine", "Error occurred trying to show the keyboard. Exception=" + ex); } }
java
public static void showKeyboard(Context context, View field){ try { field.requestFocus(); InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(field, InputMethodManager.SHOW_IMPLICIT); } catch (Exception ex) { Log.e("Caffeine", "Error occurred trying to show the keyboard. Exception=" + ex); } }
[ "public", "static", "void", "showKeyboard", "(", "Context", "context", ",", "View", "field", ")", "{", "try", "{", "field", ".", "requestFocus", "(", ")", ";", "InputMethodManager", "imm", "=", "(", "InputMethodManager", ")", "context", ".", "getSystemService", "(", "Context", ".", "INPUT_METHOD_SERVICE", ")", ";", "imm", ".", "showSoftInput", "(", "field", ",", "InputMethodManager", ".", "SHOW_IMPLICIT", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "Log", ".", "e", "(", "\"Caffeine\"", ",", "\"Error occurred trying to show the keyboard. Exception=\"", "+", "ex", ")", ";", "}", "}" ]
Show the pop-up keyboard @param context Activity/Context. @param field field that requests focus.
[ "Show", "the", "pop", "-", "up", "keyboard" ]
train
https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L156-L164
facebookarchive/hadoop-20
src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java
PersistentState.getState
public static ParseState getState(String fname) { """ Read and return the state of parsing for a particular log file. @param fname the log file for which to read the state """ String [] fields = persData.getProperty(fname, "null" + SEPARATOR + "0").split(SEPARATOR, 2); String firstLine; long offset; if (fields.length < 2) { System.err.println("Malformed persistent state data found"); Environment.logInfo("Malformed persistent state data found"); firstLine = null; offset = 0; } else { firstLine = (fields[0].equals("null") ? null : fields[0]); offset = Long.parseLong(fields[1]); } return new ParseState(fname, firstLine, offset); }
java
public static ParseState getState(String fname) { String [] fields = persData.getProperty(fname, "null" + SEPARATOR + "0").split(SEPARATOR, 2); String firstLine; long offset; if (fields.length < 2) { System.err.println("Malformed persistent state data found"); Environment.logInfo("Malformed persistent state data found"); firstLine = null; offset = 0; } else { firstLine = (fields[0].equals("null") ? null : fields[0]); offset = Long.parseLong(fields[1]); } return new ParseState(fname, firstLine, offset); }
[ "public", "static", "ParseState", "getState", "(", "String", "fname", ")", "{", "String", "[", "]", "fields", "=", "persData", ".", "getProperty", "(", "fname", ",", "\"null\"", "+", "SEPARATOR", "+", "\"0\"", ")", ".", "split", "(", "SEPARATOR", ",", "2", ")", ";", "String", "firstLine", ";", "long", "offset", ";", "if", "(", "fields", ".", "length", "<", "2", ")", "{", "System", ".", "err", ".", "println", "(", "\"Malformed persistent state data found\"", ")", ";", "Environment", ".", "logInfo", "(", "\"Malformed persistent state data found\"", ")", ";", "firstLine", "=", "null", ";", "offset", "=", "0", ";", "}", "else", "{", "firstLine", "=", "(", "fields", "[", "0", "]", ".", "equals", "(", "\"null\"", ")", "?", "null", ":", "fields", "[", "0", "]", ")", ";", "offset", "=", "Long", ".", "parseLong", "(", "fields", "[", "1", "]", ")", ";", "}", "return", "new", "ParseState", "(", "fname", ",", "firstLine", ",", "offset", ")", ";", "}" ]
Read and return the state of parsing for a particular log file. @param fname the log file for which to read the state
[ "Read", "and", "return", "the", "state", "of", "parsing", "for", "a", "particular", "log", "file", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/failmon/src/java/org/apache/hadoop/contrib/failmon/PersistentState.java#L76-L92
lecousin/java-framework-core
net.lecousin.core/src/main/java/net/lecousin/framework/math/RangeLong.java
RangeLong.removeIntersect
public Pair<RangeLong,RangeLong> removeIntersect(RangeLong o) { """ Remove the intersection between this range and the given range, and return the range before and the range after the intersection. """ if (o.max < min || o.min > max) // o is outside: no intersection return new Pair<>(copy(), null); if (o.min <= min) { // nothing before if (o.max >= max) return new Pair<>(null, null); // o is fully overlapping this return new Pair<>(null, new RangeLong(o.max + 1, max)); } if (o.max >= max) { // nothing after return new Pair<>(new RangeLong(min, o.min - 1), null); } // in the middle return new Pair<>(new RangeLong(min, o.min - 1), new RangeLong(o.max + 1, max)); }
java
public Pair<RangeLong,RangeLong> removeIntersect(RangeLong o) { if (o.max < min || o.min > max) // o is outside: no intersection return new Pair<>(copy(), null); if (o.min <= min) { // nothing before if (o.max >= max) return new Pair<>(null, null); // o is fully overlapping this return new Pair<>(null, new RangeLong(o.max + 1, max)); } if (o.max >= max) { // nothing after return new Pair<>(new RangeLong(min, o.min - 1), null); } // in the middle return new Pair<>(new RangeLong(min, o.min - 1), new RangeLong(o.max + 1, max)); }
[ "public", "Pair", "<", "RangeLong", ",", "RangeLong", ">", "removeIntersect", "(", "RangeLong", "o", ")", "{", "if", "(", "o", ".", "max", "<", "min", "||", "o", ".", "min", ">", "max", ")", "// o is outside: no intersection\r", "return", "new", "Pair", "<>", "(", "copy", "(", ")", ",", "null", ")", ";", "if", "(", "o", ".", "min", "<=", "min", ")", "{", "// nothing before\r", "if", "(", "o", ".", "max", ">=", "max", ")", "return", "new", "Pair", "<>", "(", "null", ",", "null", ")", ";", "// o is fully overlapping this\r", "return", "new", "Pair", "<>", "(", "null", ",", "new", "RangeLong", "(", "o", ".", "max", "+", "1", ",", "max", ")", ")", ";", "}", "if", "(", "o", ".", "max", ">=", "max", ")", "{", "// nothing after\r", "return", "new", "Pair", "<>", "(", "new", "RangeLong", "(", "min", ",", "o", ".", "min", "-", "1", ")", ",", "null", ")", ";", "}", "// in the middle\r", "return", "new", "Pair", "<>", "(", "new", "RangeLong", "(", "min", ",", "o", ".", "min", "-", "1", ")", ",", "new", "RangeLong", "(", "o", ".", "max", "+", "1", ",", "max", ")", ")", ";", "}" ]
Remove the intersection between this range and the given range, and return the range before and the range after the intersection.
[ "Remove", "the", "intersection", "between", "this", "range", "and", "the", "given", "range", "and", "return", "the", "range", "before", "and", "the", "range", "after", "the", "intersection", "." ]
train
https://github.com/lecousin/java-framework-core/blob/b0c893b44bfde2c03f90ea846a49ef5749d598f3/net.lecousin.core/src/main/java/net/lecousin/framework/math/RangeLong.java#L87-L102
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/DefaultBeanContext.java
DefaultBeanContext.getBeansOfType
protected @Nonnull <T> Collection<T> getBeansOfType( @Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) { """ Get all beans of the given type and qualifier. @param resolutionContext The bean resolution context @param beanType The bean type @param qualifier The qualifier @param <T> The bean type parameter @return The found beans """ return getBeansOfTypeInternal(resolutionContext, beanType, qualifier); }
java
protected @Nonnull <T> Collection<T> getBeansOfType( @Nullable BeanResolutionContext resolutionContext, @Nonnull Class<T> beanType, @Nullable Qualifier<T> qualifier) { return getBeansOfTypeInternal(resolutionContext, beanType, qualifier); }
[ "protected", "@", "Nonnull", "<", "T", ">", "Collection", "<", "T", ">", "getBeansOfType", "(", "@", "Nullable", "BeanResolutionContext", "resolutionContext", ",", "@", "Nonnull", "Class", "<", "T", ">", "beanType", ",", "@", "Nullable", "Qualifier", "<", "T", ">", "qualifier", ")", "{", "return", "getBeansOfTypeInternal", "(", "resolutionContext", ",", "beanType", ",", "qualifier", ")", ";", "}" ]
Get all beans of the given type and qualifier. @param resolutionContext The bean resolution context @param beanType The bean type @param qualifier The qualifier @param <T> The bean type parameter @return The found beans
[ "Get", "all", "beans", "of", "the", "given", "type", "and", "qualifier", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/DefaultBeanContext.java#L866-L871
buschmais/jqa-maven3-plugin
src/main/java/com/buschmais/jqassistant/plugin/maven3/api/artifact/MavenArtifactHelper.java
MavenArtifactHelper.setId
public static void setId(MavenArtifactDescriptor artifactDescriptor, Coordinates coordinates) { """ Set the fully qualified name of an artifact descriptor. @param artifactDescriptor The artifact descriptor. @param coordinates The coordinates. """ artifactDescriptor.setFullQualifiedName(MavenArtifactHelper.getId(coordinates)); }
java
public static void setId(MavenArtifactDescriptor artifactDescriptor, Coordinates coordinates) { artifactDescriptor.setFullQualifiedName(MavenArtifactHelper.getId(coordinates)); }
[ "public", "static", "void", "setId", "(", "MavenArtifactDescriptor", "artifactDescriptor", ",", "Coordinates", "coordinates", ")", "{", "artifactDescriptor", ".", "setFullQualifiedName", "(", "MavenArtifactHelper", ".", "getId", "(", "coordinates", ")", ")", ";", "}" ]
Set the fully qualified name of an artifact descriptor. @param artifactDescriptor The artifact descriptor. @param coordinates The coordinates.
[ "Set", "the", "fully", "qualified", "name", "of", "an", "artifact", "descriptor", "." ]
train
https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/api/artifact/MavenArtifactHelper.java#L45-L47
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java
LostExceptionStackTrace.updateExceptionRegister
private boolean updateExceptionRegister(CatchInfo ci, int seen, int pc) { """ looks to update the catchinfo block with the register used for the exception variable. If their is a local variable table, but the local variable can't be found return false, signifying an empty catch block. @param ci the catchinfo record for the catch starting at this pc @param seen the opcode of the currently visited instruction @param pc the current pc @return whether the catch block is empty """ if (OpcodeUtils.isAStore(seen)) { int reg = RegisterUtils.getAStoreReg(this, seen); ci.setReg(reg); exReg.put(Integer.valueOf(reg), Boolean.TRUE); LocalVariableTable lvt = getMethod().getLocalVariableTable(); if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, pc + 2); if (lv != null) { int finish = lv.getStartPC() + lv.getLength(); if (finish < ci.getFinish()) { ci.setFinish(finish); } } else { return false; } } } return true; }
java
private boolean updateExceptionRegister(CatchInfo ci, int seen, int pc) { if (OpcodeUtils.isAStore(seen)) { int reg = RegisterUtils.getAStoreReg(this, seen); ci.setReg(reg); exReg.put(Integer.valueOf(reg), Boolean.TRUE); LocalVariableTable lvt = getMethod().getLocalVariableTable(); if (lvt != null) { LocalVariable lv = lvt.getLocalVariable(reg, pc + 2); if (lv != null) { int finish = lv.getStartPC() + lv.getLength(); if (finish < ci.getFinish()) { ci.setFinish(finish); } } else { return false; } } } return true; }
[ "private", "boolean", "updateExceptionRegister", "(", "CatchInfo", "ci", ",", "int", "seen", ",", "int", "pc", ")", "{", "if", "(", "OpcodeUtils", ".", "isAStore", "(", "seen", ")", ")", "{", "int", "reg", "=", "RegisterUtils", ".", "getAStoreReg", "(", "this", ",", "seen", ")", ";", "ci", ".", "setReg", "(", "reg", ")", ";", "exReg", ".", "put", "(", "Integer", ".", "valueOf", "(", "reg", ")", ",", "Boolean", ".", "TRUE", ")", ";", "LocalVariableTable", "lvt", "=", "getMethod", "(", ")", ".", "getLocalVariableTable", "(", ")", ";", "if", "(", "lvt", "!=", "null", ")", "{", "LocalVariable", "lv", "=", "lvt", ".", "getLocalVariable", "(", "reg", ",", "pc", "+", "2", ")", ";", "if", "(", "lv", "!=", "null", ")", "{", "int", "finish", "=", "lv", ".", "getStartPC", "(", ")", "+", "lv", ".", "getLength", "(", ")", ";", "if", "(", "finish", "<", "ci", ".", "getFinish", "(", ")", ")", "{", "ci", ".", "setFinish", "(", "finish", ")", ";", "}", "}", "else", "{", "return", "false", ";", "}", "}", "}", "return", "true", ";", "}" ]
looks to update the catchinfo block with the register used for the exception variable. If their is a local variable table, but the local variable can't be found return false, signifying an empty catch block. @param ci the catchinfo record for the catch starting at this pc @param seen the opcode of the currently visited instruction @param pc the current pc @return whether the catch block is empty
[ "looks", "to", "update", "the", "catchinfo", "block", "with", "the", "register", "used", "for", "the", "exception", "variable", ".", "If", "their", "is", "a", "local", "variable", "table", "but", "the", "local", "variable", "can", "t", "be", "found", "return", "false", "signifying", "an", "empty", "catch", "block", "." ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/LostExceptionStackTrace.java#L394-L413
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/statement/dml/SelectStatement.java
SelectStatement.setIndexForItems
public void setIndexForItems(final Map<String, Integer> columnLabelIndexMap) { """ Set index for select items. @param columnLabelIndexMap map for column label and index """ setIndexForAggregationItem(columnLabelIndexMap); setIndexForOrderItem(columnLabelIndexMap, orderByItems); setIndexForOrderItem(columnLabelIndexMap, groupByItems); }
java
public void setIndexForItems(final Map<String, Integer> columnLabelIndexMap) { setIndexForAggregationItem(columnLabelIndexMap); setIndexForOrderItem(columnLabelIndexMap, orderByItems); setIndexForOrderItem(columnLabelIndexMap, groupByItems); }
[ "public", "void", "setIndexForItems", "(", "final", "Map", "<", "String", ",", "Integer", ">", "columnLabelIndexMap", ")", "{", "setIndexForAggregationItem", "(", "columnLabelIndexMap", ")", ";", "setIndexForOrderItem", "(", "columnLabelIndexMap", ",", "orderByItems", ")", ";", "setIndexForOrderItem", "(", "columnLabelIndexMap", ",", "groupByItems", ")", ";", "}" ]
Set index for select items. @param columnLabelIndexMap map for column label and index
[ "Set", "index", "for", "select", "items", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/antlr/sql/statement/dml/SelectStatement.java#L214-L218
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java
ConnectionContextFactory.cacheConnection
protected void cacheConnection(Connection connection, boolean closeExistingConnection) { """ To store a connection in this processor object, call this setter. If there was already a cached connection, it will be closed. NOTE: Calling {@link #createConnection(ConnectionContext)} does <b>not</b> set this processor's connection - that method only creates the connection and puts that connection in the context. It does not save that connection in this processor object. You must explicitly set the connection via this method if you want that connection cached here. See also {@link #createOrReuseConnection(ConnectionContext, boolean)}. @param connection the connection @param closeExistingConnection if true, and if there was already a connection cached, that connection will be closed. Otherwise it will be left alone but the new connection will take its place. @see #createOrReuseConnection(ConnectionContext, boolean) """ if (this.connection != null && closeExistingConnection) { try { // make sure it is closed to free up any resources it was using this.connection.close(); } catch (JMSException e) { msglog.errorCannotCloseConnectionMemoryMightLeak(e); } } this.connection = connection; }
java
protected void cacheConnection(Connection connection, boolean closeExistingConnection) { if (this.connection != null && closeExistingConnection) { try { // make sure it is closed to free up any resources it was using this.connection.close(); } catch (JMSException e) { msglog.errorCannotCloseConnectionMemoryMightLeak(e); } } this.connection = connection; }
[ "protected", "void", "cacheConnection", "(", "Connection", "connection", ",", "boolean", "closeExistingConnection", ")", "{", "if", "(", "this", ".", "connection", "!=", "null", "&&", "closeExistingConnection", ")", "{", "try", "{", "// make sure it is closed to free up any resources it was using", "this", ".", "connection", ".", "close", "(", ")", ";", "}", "catch", "(", "JMSException", "e", ")", "{", "msglog", ".", "errorCannotCloseConnectionMemoryMightLeak", "(", "e", ")", ";", "}", "}", "this", ".", "connection", "=", "connection", ";", "}" ]
To store a connection in this processor object, call this setter. If there was already a cached connection, it will be closed. NOTE: Calling {@link #createConnection(ConnectionContext)} does <b>not</b> set this processor's connection - that method only creates the connection and puts that connection in the context. It does not save that connection in this processor object. You must explicitly set the connection via this method if you want that connection cached here. See also {@link #createOrReuseConnection(ConnectionContext, boolean)}. @param connection the connection @param closeExistingConnection if true, and if there was already a connection cached, that connection will be closed. Otherwise it will be left alone but the new connection will take its place. @see #createOrReuseConnection(ConnectionContext, boolean)
[ "To", "store", "a", "connection", "in", "this", "processor", "object", "call", "this", "setter", ".", "If", "there", "was", "already", "a", "cached", "connection", "it", "will", "be", "closed", "." ]
train
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java#L192-L203
eurekaclinical/eurekaclinical-common
src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java
EurekaClinicalClient.doPostCreate
protected URI doPostCreate(String path, Object o) throws ClientException { """ Creates a resource specified as a JSON object. Adds appropriate Accepts and Content Type headers. @param path the the API to call. @param o the object that will be converted to JSON for sending. Must either be a Java bean or be recognized by the object mapper. @return the URI representing the created resource, for use in subsequent operations on the resource. @throws ClientException if a status code other than 201 (Created) is returned. """ return doPostCreate(path, o, null); }
java
protected URI doPostCreate(String path, Object o) throws ClientException { return doPostCreate(path, o, null); }
[ "protected", "URI", "doPostCreate", "(", "String", "path", ",", "Object", "o", ")", "throws", "ClientException", "{", "return", "doPostCreate", "(", "path", ",", "o", ",", "null", ")", ";", "}" ]
Creates a resource specified as a JSON object. Adds appropriate Accepts and Content Type headers. @param path the the API to call. @param o the object that will be converted to JSON for sending. Must either be a Java bean or be recognized by the object mapper. @return the URI representing the created resource, for use in subsequent operations on the resource. @throws ClientException if a status code other than 201 (Created) is returned.
[ "Creates", "a", "resource", "specified", "as", "a", "JSON", "object", ".", "Adds", "appropriate", "Accepts", "and", "Content", "Type", "headers", "." ]
train
https://github.com/eurekaclinical/eurekaclinical-common/blob/1867102ff43fe94e519f76a074d5f5923e9be61c/src/main/java/org/eurekaclinical/common/comm/clients/EurekaClinicalClient.java#L737-L739
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java
CommerceNotificationAttachmentPersistenceImpl.countByUUID_G
@Override public int countByUUID_G(String uuid, long groupId) { """ Returns the number of commerce notification attachments where uuid = &#63; and groupId = &#63;. @param uuid the uuid @param groupId the group ID @return the number of matching commerce notification attachments """ FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID_G; Object[] finderArgs = new Object[] { uuid, groupId }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCENOTIFICATIONATTACHMENT_WHERE); boolean bindUuid = false; if (uuid == null) { query.append(_FINDER_COLUMN_UUID_G_UUID_1); } else if (uuid.equals("")) { query.append(_FINDER_COLUMN_UUID_G_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_G_UUID_2); } query.append(_FINDER_COLUMN_UUID_G_GROUPID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } qPos.add(groupId); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByUUID_G(String uuid, long groupId) { FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID_G; Object[] finderArgs = new Object[] { uuid, groupId }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCENOTIFICATIONATTACHMENT_WHERE); boolean bindUuid = false; if (uuid == null) { query.append(_FINDER_COLUMN_UUID_G_UUID_1); } else if (uuid.equals("")) { query.append(_FINDER_COLUMN_UUID_G_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_G_UUID_2); } query.append(_FINDER_COLUMN_UUID_G_GROUPID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } qPos.add(groupId); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_UUID_G", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "uuid", ",", "groupId", "}", ";", "Long", "count", "=", "(", "Long", ")", "finderCache", ".", "getResult", "(", "finderPath", ",", "finderArgs", ",", "this", ")", ";", "if", "(", "count", "==", "null", ")", "{", "StringBundler", "query", "=", "new", "StringBundler", "(", "3", ")", ";", "query", ".", "append", "(", "_SQL_COUNT_COMMERCENOTIFICATIONATTACHMENT_WHERE", ")", ";", "boolean", "bindUuid", "=", "false", ";", "if", "(", "uuid", "==", "null", ")", "{", "query", ".", "append", "(", "_FINDER_COLUMN_UUID_G_UUID_1", ")", ";", "}", "else", "if", "(", "uuid", ".", "equals", "(", "\"\"", ")", ")", "{", "query", ".", "append", "(", "_FINDER_COLUMN_UUID_G_UUID_3", ")", ";", "}", "else", "{", "bindUuid", "=", "true", ";", "query", ".", "append", "(", "_FINDER_COLUMN_UUID_G_UUID_2", ")", ";", "}", "query", ".", "append", "(", "_FINDER_COLUMN_UUID_G_GROUPID_2", ")", ";", "String", "sql", "=", "query", ".", "toString", "(", ")", ";", "Session", "session", "=", "null", ";", "try", "{", "session", "=", "openSession", "(", ")", ";", "Query", "q", "=", "session", ".", "createQuery", "(", "sql", ")", ";", "QueryPos", "qPos", "=", "QueryPos", ".", "getInstance", "(", "q", ")", ";", "if", "(", "bindUuid", ")", "{", "qPos", ".", "add", "(", "uuid", ")", ";", "}", "qPos", ".", "add", "(", "groupId", ")", ";", "count", "=", "(", "Long", ")", "q", ".", "uniqueResult", "(", ")", ";", "finderCache", ".", "putResult", "(", "finderPath", ",", "finderArgs", ",", "count", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "finderCache", ".", "removeResult", "(", "finderPath", ",", "finderArgs", ")", ";", "throw", "processException", "(", "e", ")", ";", "}", "finally", "{", "closeSession", "(", "session", ")", ";", "}", "}", "return", "count", ".", "intValue", "(", ")", ";", "}" ]
Returns the number of commerce notification attachments where uuid = &#63; and groupId = &#63;. @param uuid the uuid @param groupId the group ID @return the number of matching commerce notification attachments
[ "Returns", "the", "number", "of", "commerce", "notification", "attachments", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java#L845-L906
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfLayer.java
PdfLayer.setCreatorInfo
public void setCreatorInfo(String creator, String subtype) { """ Used by the creating application to store application-specific data associated with this optional content group. @param creator a text string specifying the application that created the group @param subtype a string defining the type of content controlled by the group. Suggested values include but are not limited to <B>Artwork</B>, for graphic-design or publishing applications, and <B>Technical</B>, for technical designs such as building plans or schematics """ PdfDictionary usage = getUsage(); PdfDictionary dic = new PdfDictionary(); dic.put(PdfName.CREATOR, new PdfString(creator, PdfObject.TEXT_UNICODE)); dic.put(PdfName.SUBTYPE, new PdfName(subtype)); usage.put(PdfName.CREATORINFO, dic); }
java
public void setCreatorInfo(String creator, String subtype) { PdfDictionary usage = getUsage(); PdfDictionary dic = new PdfDictionary(); dic.put(PdfName.CREATOR, new PdfString(creator, PdfObject.TEXT_UNICODE)); dic.put(PdfName.SUBTYPE, new PdfName(subtype)); usage.put(PdfName.CREATORINFO, dic); }
[ "public", "void", "setCreatorInfo", "(", "String", "creator", ",", "String", "subtype", ")", "{", "PdfDictionary", "usage", "=", "getUsage", "(", ")", ";", "PdfDictionary", "dic", "=", "new", "PdfDictionary", "(", ")", ";", "dic", ".", "put", "(", "PdfName", ".", "CREATOR", ",", "new", "PdfString", "(", "creator", ",", "PdfObject", ".", "TEXT_UNICODE", ")", ")", ";", "dic", ".", "put", "(", "PdfName", ".", "SUBTYPE", ",", "new", "PdfName", "(", "subtype", ")", ")", ";", "usage", ".", "put", "(", "PdfName", ".", "CREATORINFO", ",", "dic", ")", ";", "}" ]
Used by the creating application to store application-specific data associated with this optional content group. @param creator a text string specifying the application that created the group @param subtype a string defining the type of content controlled by the group. Suggested values include but are not limited to <B>Artwork</B>, for graphic-design or publishing applications, and <B>Technical</B>, for technical designs such as building plans or schematics
[ "Used", "by", "the", "creating", "application", "to", "store", "application", "-", "specific", "data", "associated", "with", "this", "optional", "content", "group", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfLayer.java#L206-L212
alamkanak/Android-Week-View
library/src/main/java/com/alamkanak/weekview/WeekView.java
WeekView.cacheEvent
private void cacheEvent(WeekViewEvent event) { """ Cache the event for smooth scrolling functionality. @param event The event to cache. """ if(event.getStartTime().compareTo(event.getEndTime()) >= 0) return; List<WeekViewEvent> splitedEvents = event.splitWeekViewEvents(); for(WeekViewEvent splitedEvent: splitedEvents){ mEventRects.add(new EventRect(splitedEvent, event, null)); } }
java
private void cacheEvent(WeekViewEvent event) { if(event.getStartTime().compareTo(event.getEndTime()) >= 0) return; List<WeekViewEvent> splitedEvents = event.splitWeekViewEvents(); for(WeekViewEvent splitedEvent: splitedEvents){ mEventRects.add(new EventRect(splitedEvent, event, null)); } }
[ "private", "void", "cacheEvent", "(", "WeekViewEvent", "event", ")", "{", "if", "(", "event", ".", "getStartTime", "(", ")", ".", "compareTo", "(", "event", ".", "getEndTime", "(", ")", ")", ">=", "0", ")", "return", ";", "List", "<", "WeekViewEvent", ">", "splitedEvents", "=", "event", ".", "splitWeekViewEvents", "(", ")", ";", "for", "(", "WeekViewEvent", "splitedEvent", ":", "splitedEvents", ")", "{", "mEventRects", ".", "add", "(", "new", "EventRect", "(", "splitedEvent", ",", "event", ",", "null", ")", ")", ";", "}", "}" ]
Cache the event for smooth scrolling functionality. @param event The event to cache.
[ "Cache", "the", "event", "for", "smooth", "scrolling", "functionality", "." ]
train
https://github.com/alamkanak/Android-Week-View/blob/dc3f97d65d44785d1a761b52b58527c86c4eee1b/library/src/main/java/com/alamkanak/weekview/WeekView.java#L1053-L1060
sd4324530/fastweixin
src/main/java/com/github/sd4324530/fastweixin/api/DataCubeAPI.java
DataCubeAPI.getUserRead
public GetUserReadResponse getUserRead(Date beginDate, Date endDate) { """ 获取图文统计数据,最大跨度为3天 @param beginDate 开始时间 @param endDate 结束时间 @return 图文统计数据 """ BeanUtil.requireNonNull(beginDate, "beginDate is null"); BeanUtil.requireNonNull(endDate, "endDate is null"); GetUserReadResponse response = null; String url = BASE_API_URL + "datacube/getuserread?access_token=#"; Map<String, String> param = new HashMap<String, String>(); param.put("begin_date", DATE_FORMAT.format(beginDate)); param.put("end_date", DATE_FORMAT.format(endDate)); String json = JSONUtil.toJson(param); BaseResponse r = executePost(url, json); String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString(); response = JSONUtil.toBean(resultJson, GetUserReadResponse.class); return response; }
java
public GetUserReadResponse getUserRead(Date beginDate, Date endDate) { BeanUtil.requireNonNull(beginDate, "beginDate is null"); BeanUtil.requireNonNull(endDate, "endDate is null"); GetUserReadResponse response = null; String url = BASE_API_URL + "datacube/getuserread?access_token=#"; Map<String, String> param = new HashMap<String, String>(); param.put("begin_date", DATE_FORMAT.format(beginDate)); param.put("end_date", DATE_FORMAT.format(endDate)); String json = JSONUtil.toJson(param); BaseResponse r = executePost(url, json); String resultJson = isSuccess(r.getErrcode()) ? r.getErrmsg() : r.toJsonString(); response = JSONUtil.toBean(resultJson, GetUserReadResponse.class); return response; }
[ "public", "GetUserReadResponse", "getUserRead", "(", "Date", "beginDate", ",", "Date", "endDate", ")", "{", "BeanUtil", ".", "requireNonNull", "(", "beginDate", ",", "\"beginDate is null\"", ")", ";", "BeanUtil", ".", "requireNonNull", "(", "endDate", ",", "\"endDate is null\"", ")", ";", "GetUserReadResponse", "response", "=", "null", ";", "String", "url", "=", "BASE_API_URL", "+", "\"datacube/getuserread?access_token=#\"", ";", "Map", "<", "String", ",", "String", ">", "param", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "param", ".", "put", "(", "\"begin_date\"", ",", "DATE_FORMAT", ".", "format", "(", "beginDate", ")", ")", ";", "param", ".", "put", "(", "\"end_date\"", ",", "DATE_FORMAT", ".", "format", "(", "endDate", ")", ")", ";", "String", "json", "=", "JSONUtil", ".", "toJson", "(", "param", ")", ";", "BaseResponse", "r", "=", "executePost", "(", "url", ",", "json", ")", ";", "String", "resultJson", "=", "isSuccess", "(", "r", ".", "getErrcode", "(", ")", ")", "?", "r", ".", "getErrmsg", "(", ")", ":", "r", ".", "toJsonString", "(", ")", ";", "response", "=", "JSONUtil", ".", "toBean", "(", "resultJson", ",", "GetUserReadResponse", ".", "class", ")", ";", "return", "response", ";", "}" ]
获取图文统计数据,最大跨度为3天 @param beginDate 开始时间 @param endDate 结束时间 @return 图文统计数据
[ "获取图文统计数据,最大跨度为3天" ]
train
https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/api/DataCubeAPI.java#L122-L135
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/providers/GroupMembershipEvaluatorFactory.java
GroupMembershipEvaluatorFactory.getAttributeEvaluator
@Override public Evaluator getAttributeEvaluator(String name, String mode, String value) { """ Returns an instance of an evaluator specific to this factory and the passed in values. Name should be a well known group name. Case is important. The mode should be "memberOf" for now. Other modes may be added in the future like, "deepMemberOf". """ return new GroupMembershipEvaluator(mode, name); }
java
@Override public Evaluator getAttributeEvaluator(String name, String mode, String value) { return new GroupMembershipEvaluator(mode, name); }
[ "@", "Override", "public", "Evaluator", "getAttributeEvaluator", "(", "String", "name", ",", "String", "mode", ",", "String", "value", ")", "{", "return", "new", "GroupMembershipEvaluator", "(", "mode", ",", "name", ")", ";", "}" ]
Returns an instance of an evaluator specific to this factory and the passed in values. Name should be a well known group name. Case is important. The mode should be "memberOf" for now. Other modes may be added in the future like, "deepMemberOf".
[ "Returns", "an", "instance", "of", "an", "evaluator", "specific", "to", "this", "factory", "and", "the", "passed", "in", "values", ".", "Name", "should", "be", "a", "well", "known", "group", "name", ".", "Case", "is", "important", ".", "The", "mode", "should", "be", "memberOf", "for", "now", ".", "Other", "modes", "may", "be", "added", "in", "the", "future", "like", "deepMemberOf", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/providers/GroupMembershipEvaluatorFactory.java#L56-L59
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/PrefHelper.java
PrefHelper.setBool
public void setBool(String key, Boolean value) { """ <p>Sets the value of the {@link String} key value supplied in preferences.</p> @param key A {@link String} value containing the key to reference. @param value A {@link Boolean} value to set the preference record to. """ prefHelper_.prefsEditor_.putBoolean(key, value); prefHelper_.prefsEditor_.apply(); }
java
public void setBool(String key, Boolean value) { prefHelper_.prefsEditor_.putBoolean(key, value); prefHelper_.prefsEditor_.apply(); }
[ "public", "void", "setBool", "(", "String", "key", ",", "Boolean", "value", ")", "{", "prefHelper_", ".", "prefsEditor_", ".", "putBoolean", "(", "key", ",", "value", ")", ";", "prefHelper_", ".", "prefsEditor_", ".", "apply", "(", ")", ";", "}" ]
<p>Sets the value of the {@link String} key value supplied in preferences.</p> @param key A {@link String} value containing the key to reference. @param value A {@link Boolean} value to set the preference record to.
[ "<p", ">", "Sets", "the", "value", "of", "the", "{", "@link", "String", "}", "key", "value", "supplied", "in", "preferences", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/PrefHelper.java#L1014-L1017
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/tcpchannel/TCPConnectRequestContextFactory.java
TCPConnectRequestContextFactory.createTCPConnectRequestContext
public TCPConnectRequestContext createTCPConnectRequestContext(String _remoteHostName, int _remotePort, int _timeout) { """ Create a new connection request context based upon the input needed to fully define the context. The local address is assumed to be null, and the local port will be an ephemeral port @param _remoteHostName host name of the remote side of the connection @param _remotePort port to be used by the remote side of the connection @param _timeout timeout for waiting for the connection to complete @return a connect request context to be used by the channel connection """ return new TCPConnectRequestContextImpl(_remoteHostName, _remotePort, _timeout); }
java
public TCPConnectRequestContext createTCPConnectRequestContext(String _remoteHostName, int _remotePort, int _timeout) { return new TCPConnectRequestContextImpl(_remoteHostName, _remotePort, _timeout); }
[ "public", "TCPConnectRequestContext", "createTCPConnectRequestContext", "(", "String", "_remoteHostName", ",", "int", "_remotePort", ",", "int", "_timeout", ")", "{", "return", "new", "TCPConnectRequestContextImpl", "(", "_remoteHostName", ",", "_remotePort", ",", "_timeout", ")", ";", "}" ]
Create a new connection request context based upon the input needed to fully define the context. The local address is assumed to be null, and the local port will be an ephemeral port @param _remoteHostName host name of the remote side of the connection @param _remotePort port to be used by the remote side of the connection @param _timeout timeout for waiting for the connection to complete @return a connect request context to be used by the channel connection
[ "Create", "a", "new", "connection", "request", "context", "based", "upon", "the", "input", "needed", "to", "fully", "define", "the", "context", ".", "The", "local", "address", "is", "assumed", "to", "be", "null", "and", "the", "local", "port", "will", "be", "an", "ephemeral", "port" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/tcpchannel/TCPConnectRequestContextFactory.java#L59-L62
Ordinastie/MalisisCore
src/main/java/net/malisis/core/asm/AsmUtils.java
AsmUtils.varInsnEqual
public static boolean varInsnEqual(VarInsnNode insn1, VarInsnNode insn2) { """ Checks if two {@link VarInsnNode} are equals. @param insn1 the insn1 @param insn2 the insn2 @return true, if successful """ if (insn1.var == -1 || insn2.var == -1) return true; return insn1.var == insn2.var; }
java
public static boolean varInsnEqual(VarInsnNode insn1, VarInsnNode insn2) { if (insn1.var == -1 || insn2.var == -1) return true; return insn1.var == insn2.var; }
[ "public", "static", "boolean", "varInsnEqual", "(", "VarInsnNode", "insn1", ",", "VarInsnNode", "insn2", ")", "{", "if", "(", "insn1", ".", "var", "==", "-", "1", "||", "insn2", ".", "var", "==", "-", "1", ")", "return", "true", ";", "return", "insn1", ".", "var", "==", "insn2", ".", "var", ";", "}" ]
Checks if two {@link VarInsnNode} are equals. @param insn1 the insn1 @param insn2 the insn2 @return true, if successful
[ "Checks", "if", "two", "{", "@link", "VarInsnNode", "}", "are", "equals", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/asm/AsmUtils.java#L180-L186
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/FullMappingPropertiesBasedBundlesHandlerFactory.java
FullMappingPropertiesBasedBundlesHandlerFactory.getBundleFromName
private JoinableResourceBundle getBundleFromName(String bundleName, List<JoinableResourceBundle> bundles) { """ Returns a bundle using the bundle name from a list of bundles @param bundleName the bundle name @param bundles the list of bundle @return a bundle """ JoinableResourceBundle bundle = null; List<String> names = new ArrayList<>(); names.add(bundleName); List<JoinableResourceBundle> result = getBundlesFromName(names, bundles); if (!result.isEmpty()) { bundle = result.get(0); } return bundle; }
java
private JoinableResourceBundle getBundleFromName(String bundleName, List<JoinableResourceBundle> bundles) { JoinableResourceBundle bundle = null; List<String> names = new ArrayList<>(); names.add(bundleName); List<JoinableResourceBundle> result = getBundlesFromName(names, bundles); if (!result.isEmpty()) { bundle = result.get(0); } return bundle; }
[ "private", "JoinableResourceBundle", "getBundleFromName", "(", "String", "bundleName", ",", "List", "<", "JoinableResourceBundle", ">", "bundles", ")", "{", "JoinableResourceBundle", "bundle", "=", "null", ";", "List", "<", "String", ">", "names", "=", "new", "ArrayList", "<>", "(", ")", ";", "names", ".", "add", "(", "bundleName", ")", ";", "List", "<", "JoinableResourceBundle", ">", "result", "=", "getBundlesFromName", "(", "names", ",", "bundles", ")", ";", "if", "(", "!", "result", ".", "isEmpty", "(", ")", ")", "{", "bundle", "=", "result", ".", "get", "(", "0", ")", ";", "}", "return", "bundle", ";", "}" ]
Returns a bundle using the bundle name from a list of bundles @param bundleName the bundle name @param bundles the list of bundle @return a bundle
[ "Returns", "a", "bundle", "using", "the", "bundle", "name", "from", "a", "list", "of", "bundles" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/FullMappingPropertiesBasedBundlesHandlerFactory.java#L148-L158
CrawlScript/WebCollector
src/main/java/cn/edu/hfut/dmic/webcollector/crawler/Crawler.java
Crawler.addSeed
public void addSeed(Iterable<String> links, String type, boolean force) { """ 与addSeed(CrawlDatums datums, boolean force) 类似 @param links 种子URL集合 @param type 种子的type标识信息 @param force 是否强制注入 """ addSeedAndReturn(links, force).type(type); }
java
public void addSeed(Iterable<String> links, String type, boolean force) { addSeedAndReturn(links, force).type(type); }
[ "public", "void", "addSeed", "(", "Iterable", "<", "String", ">", "links", ",", "String", "type", ",", "boolean", "force", ")", "{", "addSeedAndReturn", "(", "links", ",", "force", ")", ".", "type", "(", "type", ")", ";", "}" ]
与addSeed(CrawlDatums datums, boolean force) 类似 @param links 种子URL集合 @param type 种子的type标识信息 @param force 是否强制注入
[ "与addSeed", "(", "CrawlDatums", "datums", "boolean", "force", ")", "类似" ]
train
https://github.com/CrawlScript/WebCollector/blob/4ca71ec0e69d354feaf64319d76e64663159902d/src/main/java/cn/edu/hfut/dmic/webcollector/crawler/Crawler.java#L210-L212
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java
Router.route
public RouteResult<T> route(HttpMethod method, String path) { """ If there's no match, returns the result with {@link #notFound(Object) notFound} as the target if it is set, otherwise returns {@code null}. """ return route(method, path, Collections.emptyMap()); }
java
public RouteResult<T> route(HttpMethod method, String path) { return route(method, path, Collections.emptyMap()); }
[ "public", "RouteResult", "<", "T", ">", "route", "(", "HttpMethod", "method", ",", "String", "path", ")", "{", "return", "route", "(", "method", ",", "path", ",", "Collections", ".", "emptyMap", "(", ")", ")", ";", "}" ]
If there's no match, returns the result with {@link #notFound(Object) notFound} as the target if it is set, otherwise returns {@code null}.
[ "If", "there", "s", "no", "match", "returns", "the", "result", "with", "{" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/router/Router.java#L218-L220
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.virtualNumbers_number_GET
public OvhVirtualNumberGenericService virtualNumbers_number_GET(String number) throws IOException { """ Get this object properties REST: GET /sms/virtualNumbers/{number} @param number [required] Your virtual number """ String qPath = "/sms/virtualNumbers/{number}"; StringBuilder sb = path(qPath, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVirtualNumberGenericService.class); }
java
public OvhVirtualNumberGenericService virtualNumbers_number_GET(String number) throws IOException { String qPath = "/sms/virtualNumbers/{number}"; StringBuilder sb = path(qPath, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVirtualNumberGenericService.class); }
[ "public", "OvhVirtualNumberGenericService", "virtualNumbers_number_GET", "(", "String", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/virtualNumbers/{number}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "number", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhVirtualNumberGenericService", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /sms/virtualNumbers/{number} @param number [required] Your virtual number
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1773-L1778
opentable/otj-logging
core/src/main/java/com/opentable/logging/LogMetadata.java
LogMetadata.and
public LogMetadata and(String key, Object value) { """ Extend a metadata marker with another key-value pair. @param key the key to add @param value the value for the key """ metadata.put(key, value); return this; }
java
public LogMetadata and(String key, Object value) { metadata.put(key, value); return this; }
[ "public", "LogMetadata", "and", "(", "String", "key", ",", "Object", "value", ")", "{", "metadata", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Extend a metadata marker with another key-value pair. @param key the key to add @param value the value for the key
[ "Extend", "a", "metadata", "marker", "with", "another", "key", "-", "value", "pair", "." ]
train
https://github.com/opentable/otj-logging/blob/eaa74c877c4721ddb9af8eb7fe1612166f7ac14d/core/src/main/java/com/opentable/logging/LogMetadata.java#L66-L69
Bedework/bw-util
bw-util-directory/src/main/java/org/bedework/util/directory/common/Directory.java
Directory.searchOne
public boolean searchOne(String base, String filter) throws NamingException { """ Carry out a one level search @param base @param filter @return DirSearchResult @throws NamingException """ return search(base, filter, scopeOne); }
java
public boolean searchOne(String base, String filter) throws NamingException { return search(base, filter, scopeOne); }
[ "public", "boolean", "searchOne", "(", "String", "base", ",", "String", "filter", ")", "throws", "NamingException", "{", "return", "search", "(", "base", ",", "filter", ",", "scopeOne", ")", ";", "}" ]
Carry out a one level search @param base @param filter @return DirSearchResult @throws NamingException
[ "Carry", "out", "a", "one", "level", "search" ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-directory/src/main/java/org/bedework/util/directory/common/Directory.java#L107-L109
signit-wesign/java-sdk
src/main/java/cn/signit/sdk/util/Case.java
Case.to
public static String to(String str, NamingStyle namingStyle) { """ 指定具体命名风格来生成相应命名风格的字符串. @param str 待转换字符串. 若为null,则返回null. @param namingStyle 命名风格的枚举. 若namingStyle为null,CAMEL @return namingStyle命名风格的字符串 @author zhd @since 1.0.0 """ NamingStyle ns = namingStyle; if (str == null) { return null; } if (ns == null) { ns = NamingStyle.CAMEL; } String formatStr; switch (ns) { case CAMEL: formatStr = toLowerCamel(str); break; case SNAKE: formatStr = toSnake(str); break; case PASCAL: formatStr = toPascal(str); break; case KEBAB: formatStr = toKebab(str); break; default: formatStr = toLowerCamel(str); break; } return formatStr; }
java
public static String to(String str, NamingStyle namingStyle) { NamingStyle ns = namingStyle; if (str == null) { return null; } if (ns == null) { ns = NamingStyle.CAMEL; } String formatStr; switch (ns) { case CAMEL: formatStr = toLowerCamel(str); break; case SNAKE: formatStr = toSnake(str); break; case PASCAL: formatStr = toPascal(str); break; case KEBAB: formatStr = toKebab(str); break; default: formatStr = toLowerCamel(str); break; } return formatStr; }
[ "public", "static", "String", "to", "(", "String", "str", ",", "NamingStyle", "namingStyle", ")", "{", "NamingStyle", "ns", "=", "namingStyle", ";", "if", "(", "str", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "ns", "==", "null", ")", "{", "ns", "=", "NamingStyle", ".", "CAMEL", ";", "}", "String", "formatStr", ";", "switch", "(", "ns", ")", "{", "case", "CAMEL", ":", "formatStr", "=", "toLowerCamel", "(", "str", ")", ";", "break", ";", "case", "SNAKE", ":", "formatStr", "=", "toSnake", "(", "str", ")", ";", "break", ";", "case", "PASCAL", ":", "formatStr", "=", "toPascal", "(", "str", ")", ";", "break", ";", "case", "KEBAB", ":", "formatStr", "=", "toKebab", "(", "str", ")", ";", "break", ";", "default", ":", "formatStr", "=", "toLowerCamel", "(", "str", ")", ";", "break", ";", "}", "return", "formatStr", ";", "}" ]
指定具体命名风格来生成相应命名风格的字符串. @param str 待转换字符串. 若为null,则返回null. @param namingStyle 命名风格的枚举. 若namingStyle为null,CAMEL @return namingStyle命名风格的字符串 @author zhd @since 1.0.0
[ "指定具体命名风格来生成相应命名风格的字符串", "." ]
train
https://github.com/signit-wesign/java-sdk/blob/6f3196c9d444818a953396fdaa8ffed9794d9530/src/main/java/cn/signit/sdk/util/Case.java#L261-L288
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/PathMap.java
PathMap.pathInfo
public static String pathInfo(String pathSpec, String path) { """ Return the portion of a path that is after a path spec. @return The path info string """ char c = pathSpec.charAt(0); if (c=='/') { if (pathSpec.length()==1) return null; if (pathSpec.equals(path)) return null; if (pathSpec.endsWith("/*") && pathSpec.regionMatches(0,path,0,pathSpec.length()-2)) { if (path.length()==pathSpec.length()-2) return null; return path.substring(pathSpec.length()-2); } } return null; }
java
public static String pathInfo(String pathSpec, String path) { char c = pathSpec.charAt(0); if (c=='/') { if (pathSpec.length()==1) return null; if (pathSpec.equals(path)) return null; if (pathSpec.endsWith("/*") && pathSpec.regionMatches(0,path,0,pathSpec.length()-2)) { if (path.length()==pathSpec.length()-2) return null; return path.substring(pathSpec.length()-2); } } return null; }
[ "public", "static", "String", "pathInfo", "(", "String", "pathSpec", ",", "String", "path", ")", "{", "char", "c", "=", "pathSpec", ".", "charAt", "(", "0", ")", ";", "if", "(", "c", "==", "'", "'", ")", "{", "if", "(", "pathSpec", ".", "length", "(", ")", "==", "1", ")", "return", "null", ";", "if", "(", "pathSpec", ".", "equals", "(", "path", ")", ")", "return", "null", ";", "if", "(", "pathSpec", ".", "endsWith", "(", "\"/*\"", ")", "&&", "pathSpec", ".", "regionMatches", "(", "0", ",", "path", ",", "0", ",", "pathSpec", ".", "length", "(", ")", "-", "2", ")", ")", "{", "if", "(", "path", ".", "length", "(", ")", "==", "pathSpec", ".", "length", "(", ")", "-", "2", ")", "return", "null", ";", "return", "path", ".", "substring", "(", "pathSpec", ".", "length", "(", ")", "-", "2", ")", ";", "}", "}", "return", "null", ";", "}" ]
Return the portion of a path that is after a path spec. @return The path info string
[ "Return", "the", "portion", "of", "a", "path", "that", "is", "after", "a", "path", "spec", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/PathMap.java#L454-L475
stackify/stackify-api-java
src/main/java/com/stackify/api/common/ApiClients.java
ApiClients.getApiClient
public static String getApiClient(final Class<?> apiClass, final String fileName, final String defaultClientName) { """ Gets the client name from the properties file @param fileName Properties file name @param defaultClientName Default client name @return The client name """ InputStream propertiesStream = null; try { propertiesStream = apiClass.getResourceAsStream(fileName); if (propertiesStream != null) { Properties props = new Properties(); props.load(propertiesStream); String name = (String) props.get("api-client.name"); String version = (String) props.get("api-client.version"); return name + "-" + version; } } catch (Throwable t) { LOGGER.error("Exception reading {} configuration file", fileName, t); } finally { if (propertiesStream != null) { try { propertiesStream.close(); } catch (Throwable t) { LOGGER.info("Exception closing {} configuration file", fileName, t); } } } return defaultClientName; }
java
public static String getApiClient(final Class<?> apiClass, final String fileName, final String defaultClientName) { InputStream propertiesStream = null; try { propertiesStream = apiClass.getResourceAsStream(fileName); if (propertiesStream != null) { Properties props = new Properties(); props.load(propertiesStream); String name = (String) props.get("api-client.name"); String version = (String) props.get("api-client.version"); return name + "-" + version; } } catch (Throwable t) { LOGGER.error("Exception reading {} configuration file", fileName, t); } finally { if (propertiesStream != null) { try { propertiesStream.close(); } catch (Throwable t) { LOGGER.info("Exception closing {} configuration file", fileName, t); } } } return defaultClientName; }
[ "public", "static", "String", "getApiClient", "(", "final", "Class", "<", "?", ">", "apiClass", ",", "final", "String", "fileName", ",", "final", "String", "defaultClientName", ")", "{", "InputStream", "propertiesStream", "=", "null", ";", "try", "{", "propertiesStream", "=", "apiClass", ".", "getResourceAsStream", "(", "fileName", ")", ";", "if", "(", "propertiesStream", "!=", "null", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "props", ".", "load", "(", "propertiesStream", ")", ";", "String", "name", "=", "(", "String", ")", "props", ".", "get", "(", "\"api-client.name\"", ")", ";", "String", "version", "=", "(", "String", ")", "props", ".", "get", "(", "\"api-client.version\"", ")", ";", "return", "name", "+", "\"-\"", "+", "version", ";", "}", "}", "catch", "(", "Throwable", "t", ")", "{", "LOGGER", ".", "error", "(", "\"Exception reading {} configuration file\"", ",", "fileName", ",", "t", ")", ";", "}", "finally", "{", "if", "(", "propertiesStream", "!=", "null", ")", "{", "try", "{", "propertiesStream", ".", "close", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "LOGGER", ".", "info", "(", "\"Exception closing {} configuration file\"", ",", "fileName", ",", "t", ")", ";", "}", "}", "}", "return", "defaultClientName", ";", "}" ]
Gets the client name from the properties file @param fileName Properties file name @param defaultClientName Default client name @return The client name
[ "Gets", "the", "client", "name", "from", "the", "properties", "file" ]
train
https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/ApiClients.java#L41-L70
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java
Configurer.getImplementation
public final <T> T getImplementation(Class<T> type, Class<?> paramType, Object paramValue, String... path) { """ Get the class implementation from its name by using a custom constructor. @param <T> The instance type. @param type The class type. @param paramType The parameter type. @param paramValue The parameter value. @param path The node path. @return The typed class instance. @throws LionEngineException If invalid class. """ return getImplementation(type, new Class<?>[] { paramType }, Arrays.asList(paramValue), path); }
java
public final <T> T getImplementation(Class<T> type, Class<?> paramType, Object paramValue, String... path) { return getImplementation(type, new Class<?>[] { paramType }, Arrays.asList(paramValue), path); }
[ "public", "final", "<", "T", ">", "T", "getImplementation", "(", "Class", "<", "T", ">", "type", ",", "Class", "<", "?", ">", "paramType", ",", "Object", "paramValue", ",", "String", "...", "path", ")", "{", "return", "getImplementation", "(", "type", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "paramType", "}", ",", "Arrays", ".", "asList", "(", "paramValue", ")", ",", "path", ")", ";", "}" ]
Get the class implementation from its name by using a custom constructor. @param <T> The instance type. @param type The class type. @param paramType The parameter type. @param paramValue The parameter value. @param path The node path. @return The typed class instance. @throws LionEngineException If invalid class.
[ "Get", "the", "class", "implementation", "from", "its", "name", "by", "using", "a", "custom", "constructor", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/Configurer.java#L326-L332
sebastiangraf/jSCSI
bundles/target/src/main/java/org/jscsi/target/scsi/sense/senseDataDescriptor/senseKeySpecific/SenseKeySpecificData.java
SenseKeySpecificData.serializeCommonFields
private final void serializeCommonFields (final ByteBuffer byteBuffer, final int index) { """ Serializes the fields common to all sense-key-specific data. @param byteBuffer where the serialized fields will be stored @param index the position of the first byte of the sense data descriptor in the {@link ByteBuffer} """ byteBuffer.position(index); byte b = 0; if (senseKeySpecificDataValid) b = BitManip.getByteWithBitSet(b, 7, true);// set MSB to 1 byteBuffer.put(b); }
java
private final void serializeCommonFields (final ByteBuffer byteBuffer, final int index) { byteBuffer.position(index); byte b = 0; if (senseKeySpecificDataValid) b = BitManip.getByteWithBitSet(b, 7, true);// set MSB to 1 byteBuffer.put(b); }
[ "private", "final", "void", "serializeCommonFields", "(", "final", "ByteBuffer", "byteBuffer", ",", "final", "int", "index", ")", "{", "byteBuffer", ".", "position", "(", "index", ")", ";", "byte", "b", "=", "0", ";", "if", "(", "senseKeySpecificDataValid", ")", "b", "=", "BitManip", ".", "getByteWithBitSet", "(", "b", ",", "7", ",", "true", ")", ";", "// set MSB to 1\r", "byteBuffer", ".", "put", "(", "b", ")", ";", "}" ]
Serializes the fields common to all sense-key-specific data. @param byteBuffer where the serialized fields will be stored @param index the position of the first byte of the sense data descriptor in the {@link ByteBuffer}
[ "Serializes", "the", "fields", "common", "to", "all", "sense", "-", "key", "-", "specific", "data", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/target/src/main/java/org/jscsi/target/scsi/sense/senseDataDescriptor/senseKeySpecific/SenseKeySpecificData.java#L81-L86
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/ContextXmlReader.java
ContextXmlReader.readContextPassword
private String readContextPassword(XMLEventReader reader) throws JournalException, XMLStreamException { """ Read the context password from XML. Note: While doing this, fetch the password type, and store it to use when deciphering the password. Not the cleanest structure, perhaps, but it will serve for now. """ XMLEvent startTag = readStartTag(reader, QNAME_TAG_PASSWORD); passwordType = getOptionalAttributeValue(startTag.asStartElement(), QNAME_ATTR_PASSWORD_TYPE); return readCharactersUntilEndTag(reader, QNAME_TAG_PASSWORD); }
java
private String readContextPassword(XMLEventReader reader) throws JournalException, XMLStreamException { XMLEvent startTag = readStartTag(reader, QNAME_TAG_PASSWORD); passwordType = getOptionalAttributeValue(startTag.asStartElement(), QNAME_ATTR_PASSWORD_TYPE); return readCharactersUntilEndTag(reader, QNAME_TAG_PASSWORD); }
[ "private", "String", "readContextPassword", "(", "XMLEventReader", "reader", ")", "throws", "JournalException", ",", "XMLStreamException", "{", "XMLEvent", "startTag", "=", "readStartTag", "(", "reader", ",", "QNAME_TAG_PASSWORD", ")", ";", "passwordType", "=", "getOptionalAttributeValue", "(", "startTag", ".", "asStartElement", "(", ")", ",", "QNAME_ATTR_PASSWORD_TYPE", ")", ";", "return", "readCharactersUntilEndTag", "(", "reader", ",", "QNAME_TAG_PASSWORD", ")", ";", "}" ]
Read the context password from XML. Note: While doing this, fetch the password type, and store it to use when deciphering the password. Not the cleanest structure, perhaps, but it will serve for now.
[ "Read", "the", "context", "password", "from", "XML", ".", "Note", ":", "While", "doing", "this", "fetch", "the", "password", "type", "and", "store", "it", "to", "use", "when", "deciphering", "the", "password", ".", "Not", "the", "cleanest", "structure", "perhaps", "but", "it", "will", "serve", "for", "now", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/xmlhelpers/ContextXmlReader.java#L78-L85
eurekaclinical/protempa
protempa-framework/src/main/java/org/protempa/JBossRuleCreator.java
JBossRuleCreator.visit
@Override public void visit(LowLevelAbstractionDefinition def) throws ProtempaException { """ Translates a low-level abstraction definition into rules. @param def a {@link LowLevelAbstractionDefinition}. Cannot be <code>null</code>. @throws KnowledgeSourceReadException if an error occurs accessing the knowledge source during rule creation. """ LOGGER.log(Level.FINER, "Creating rule for {0}", def); try { /* * If there are no value definitions defined, we might still have an * inverseIsA relationship with another low-level abstraction * definition. */ if (!def.getValueDefinitions().isEmpty()) { Rule rule = new Rule(def.getId()); Pattern sourceP = new Pattern(2, 1, PRIM_PARAM_OT, ""); Set<String> abstractedFrom = def.getAbstractedFrom(); String[] abstractedFromArr = abstractedFrom.toArray(new String[abstractedFrom.size()]); Set<String> subtrees = this.cache.collectPropIdDescendantsUsingInverseIsA(abstractedFromArr); sourceP.addConstraint(new PredicateConstraint( new PropositionPredicateExpression(subtrees))); Pattern resultP = new Pattern(1, 1, ARRAY_LIST_OT, "result"); resultP.setSource(new Collect(sourceP, new Pattern(1, 1, ARRAY_LIST_OT, "result"))); resultP.addConstraint(new PredicateConstraint( new CollectionSizeExpression(1))); rule.addPattern(resultP); String contextId = def.getContextId(); if (contextId != null) { Pattern sourceP2 = new Pattern(4, 1, CONTEXT_OT, "context"); sourceP2.addConstraint(new PredicateConstraint( new PropositionPredicateExpression(contextId))); Pattern resultP2 = new Pattern(3, 1, ARRAY_LIST_OT, "result2"); resultP2.setSource(new Collect(sourceP2, new Pattern(3, 1, ARRAY_LIST_OT, "result"))); resultP2.addConstraint(new PredicateConstraint( new CollectionSizeExpression(1))); rule.addPattern(resultP2); } Algorithm algo = this.algorithms.get(def); rule.setConsequence(new LowLevelAbstractionConsequence(def, algo, this.derivationsBuilder)); rule.setSalience(TWO_SALIENCE); this.ruleToAbstractionDefinition.put(rule, def); rules.add(rule); } } catch (InvalidRuleException e) { throw new AssertionError(e.getClass().getName() + ": " + e.getMessage()); } }
java
@Override public void visit(LowLevelAbstractionDefinition def) throws ProtempaException { LOGGER.log(Level.FINER, "Creating rule for {0}", def); try { /* * If there are no value definitions defined, we might still have an * inverseIsA relationship with another low-level abstraction * definition. */ if (!def.getValueDefinitions().isEmpty()) { Rule rule = new Rule(def.getId()); Pattern sourceP = new Pattern(2, 1, PRIM_PARAM_OT, ""); Set<String> abstractedFrom = def.getAbstractedFrom(); String[] abstractedFromArr = abstractedFrom.toArray(new String[abstractedFrom.size()]); Set<String> subtrees = this.cache.collectPropIdDescendantsUsingInverseIsA(abstractedFromArr); sourceP.addConstraint(new PredicateConstraint( new PropositionPredicateExpression(subtrees))); Pattern resultP = new Pattern(1, 1, ARRAY_LIST_OT, "result"); resultP.setSource(new Collect(sourceP, new Pattern(1, 1, ARRAY_LIST_OT, "result"))); resultP.addConstraint(new PredicateConstraint( new CollectionSizeExpression(1))); rule.addPattern(resultP); String contextId = def.getContextId(); if (contextId != null) { Pattern sourceP2 = new Pattern(4, 1, CONTEXT_OT, "context"); sourceP2.addConstraint(new PredicateConstraint( new PropositionPredicateExpression(contextId))); Pattern resultP2 = new Pattern(3, 1, ARRAY_LIST_OT, "result2"); resultP2.setSource(new Collect(sourceP2, new Pattern(3, 1, ARRAY_LIST_OT, "result"))); resultP2.addConstraint(new PredicateConstraint( new CollectionSizeExpression(1))); rule.addPattern(resultP2); } Algorithm algo = this.algorithms.get(def); rule.setConsequence(new LowLevelAbstractionConsequence(def, algo, this.derivationsBuilder)); rule.setSalience(TWO_SALIENCE); this.ruleToAbstractionDefinition.put(rule, def); rules.add(rule); } } catch (InvalidRuleException e) { throw new AssertionError(e.getClass().getName() + ": " + e.getMessage()); } }
[ "@", "Override", "public", "void", "visit", "(", "LowLevelAbstractionDefinition", "def", ")", "throws", "ProtempaException", "{", "LOGGER", ".", "log", "(", "Level", ".", "FINER", ",", "\"Creating rule for {0}\"", ",", "def", ")", ";", "try", "{", "/*\n * If there are no value definitions defined, we might still have an\n * inverseIsA relationship with another low-level abstraction\n * definition.\n */", "if", "(", "!", "def", ".", "getValueDefinitions", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "Rule", "rule", "=", "new", "Rule", "(", "def", ".", "getId", "(", ")", ")", ";", "Pattern", "sourceP", "=", "new", "Pattern", "(", "2", ",", "1", ",", "PRIM_PARAM_OT", ",", "\"\"", ")", ";", "Set", "<", "String", ">", "abstractedFrom", "=", "def", ".", "getAbstractedFrom", "(", ")", ";", "String", "[", "]", "abstractedFromArr", "=", "abstractedFrom", ".", "toArray", "(", "new", "String", "[", "abstractedFrom", ".", "size", "(", ")", "]", ")", ";", "Set", "<", "String", ">", "subtrees", "=", "this", ".", "cache", ".", "collectPropIdDescendantsUsingInverseIsA", "(", "abstractedFromArr", ")", ";", "sourceP", ".", "addConstraint", "(", "new", "PredicateConstraint", "(", "new", "PropositionPredicateExpression", "(", "subtrees", ")", ")", ")", ";", "Pattern", "resultP", "=", "new", "Pattern", "(", "1", ",", "1", ",", "ARRAY_LIST_OT", ",", "\"result\"", ")", ";", "resultP", ".", "setSource", "(", "new", "Collect", "(", "sourceP", ",", "new", "Pattern", "(", "1", ",", "1", ",", "ARRAY_LIST_OT", ",", "\"result\"", ")", ")", ")", ";", "resultP", ".", "addConstraint", "(", "new", "PredicateConstraint", "(", "new", "CollectionSizeExpression", "(", "1", ")", ")", ")", ";", "rule", ".", "addPattern", "(", "resultP", ")", ";", "String", "contextId", "=", "def", ".", "getContextId", "(", ")", ";", "if", "(", "contextId", "!=", "null", ")", "{", "Pattern", "sourceP2", "=", "new", "Pattern", "(", "4", ",", "1", ",", "CONTEXT_OT", ",", "\"context\"", ")", ";", "sourceP2", ".", "addConstraint", "(", "new", "PredicateConstraint", "(", "new", "PropositionPredicateExpression", "(", "contextId", ")", ")", ")", ";", "Pattern", "resultP2", "=", "new", "Pattern", "(", "3", ",", "1", ",", "ARRAY_LIST_OT", ",", "\"result2\"", ")", ";", "resultP2", ".", "setSource", "(", "new", "Collect", "(", "sourceP2", ",", "new", "Pattern", "(", "3", ",", "1", ",", "ARRAY_LIST_OT", ",", "\"result\"", ")", ")", ")", ";", "resultP2", ".", "addConstraint", "(", "new", "PredicateConstraint", "(", "new", "CollectionSizeExpression", "(", "1", ")", ")", ")", ";", "rule", ".", "addPattern", "(", "resultP2", ")", ";", "}", "Algorithm", "algo", "=", "this", ".", "algorithms", ".", "get", "(", "def", ")", ";", "rule", ".", "setConsequence", "(", "new", "LowLevelAbstractionConsequence", "(", "def", ",", "algo", ",", "this", ".", "derivationsBuilder", ")", ")", ";", "rule", ".", "setSalience", "(", "TWO_SALIENCE", ")", ";", "this", ".", "ruleToAbstractionDefinition", ".", "put", "(", "rule", ",", "def", ")", ";", "rules", ".", "add", "(", "rule", ")", ";", "}", "}", "catch", "(", "InvalidRuleException", "e", ")", "{", "throw", "new", "AssertionError", "(", "e", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Translates a low-level abstraction definition into rules. @param def a {@link LowLevelAbstractionDefinition}. Cannot be <code>null</code>. @throws KnowledgeSourceReadException if an error occurs accessing the knowledge source during rule creation.
[ "Translates", "a", "low", "-", "level", "abstraction", "definition", "into", "rules", "." ]
train
https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/JBossRuleCreator.java#L160-L209
KostyaSha/yet-another-docker-plugin
yet-another-docker-its/src/main/java/com/github/kostyasha/it/rule/DockerRule.java
DockerRule.runFreshJenkinsContainer
public String runFreshJenkinsContainer(DockerImagePullStrategy pullStrategy, boolean forceRefresh) throws IOException, SettingsBuildingException, InterruptedException { """ Run, record and remove after test container with jenkins. @param forceRefresh enforce data container and data image refresh """ LOG.debug("Entering run fresh jenkins container."); pullImage(pullStrategy, JENKINS_DEFAULT.getDockerImageName()); // labels attached to container allows cleanup container if it wasn't removed final Map<String, String> labels = new HashMap<>(); labels.put("test.displayName", description.getDisplayName()); LOG.debug("Removing existed container before"); try { final List<Container> containers = getDockerCli().listContainersCmd().withShowAll(true).exec(); for (Container c : containers) { if (c.getLabels().equals(labels)) { // equals? container labels vs image labels? LOG.debug("Removing {}, for labels: '{}'", c, labels); getDockerCli().removeContainerCmd(c.getId()) .withForce(true) .exec(); break; } } } catch (NotFoundException ex) { LOG.debug("Container wasn't found, that's ok"); } LOG.debug("Recreating data container without data-image doesn't make sense, so reuse boolean."); String dataContainerId = getDataContainerId(forceRefresh); final String id = getDockerCli().createContainerCmd(JENKINS_DEFAULT.getDockerImageName()) .withEnv(CONTAINER_JAVA_OPTS) .withExposedPorts(new ExposedPort(JENKINS_DEFAULT.tcpPort)) .withPortSpecs(String.format("%d/tcp", JENKINS_DEFAULT.tcpPort)) .withHostConfig(HostConfig.newHostConfig() .withPortBindings(PortBinding.parse("0.0.0.0:48000:48000")) .withVolumesFrom(new VolumesFrom(dataContainerId)) .withPublishAllPorts(true)) .withLabels(labels) // .withPortBindings(PortBinding.parse("0.0.0.0:48000:48000"), PortBinding.parse("0.0.0.0:50000:50000")) .exec() .getId(); provisioned.add(id); LOG.debug("Starting container"); getDockerCli().startContainerCmd(id).exec(); return id; }
java
public String runFreshJenkinsContainer(DockerImagePullStrategy pullStrategy, boolean forceRefresh) throws IOException, SettingsBuildingException, InterruptedException { LOG.debug("Entering run fresh jenkins container."); pullImage(pullStrategy, JENKINS_DEFAULT.getDockerImageName()); // labels attached to container allows cleanup container if it wasn't removed final Map<String, String> labels = new HashMap<>(); labels.put("test.displayName", description.getDisplayName()); LOG.debug("Removing existed container before"); try { final List<Container> containers = getDockerCli().listContainersCmd().withShowAll(true).exec(); for (Container c : containers) { if (c.getLabels().equals(labels)) { // equals? container labels vs image labels? LOG.debug("Removing {}, for labels: '{}'", c, labels); getDockerCli().removeContainerCmd(c.getId()) .withForce(true) .exec(); break; } } } catch (NotFoundException ex) { LOG.debug("Container wasn't found, that's ok"); } LOG.debug("Recreating data container without data-image doesn't make sense, so reuse boolean."); String dataContainerId = getDataContainerId(forceRefresh); final String id = getDockerCli().createContainerCmd(JENKINS_DEFAULT.getDockerImageName()) .withEnv(CONTAINER_JAVA_OPTS) .withExposedPorts(new ExposedPort(JENKINS_DEFAULT.tcpPort)) .withPortSpecs(String.format("%d/tcp", JENKINS_DEFAULT.tcpPort)) .withHostConfig(HostConfig.newHostConfig() .withPortBindings(PortBinding.parse("0.0.0.0:48000:48000")) .withVolumesFrom(new VolumesFrom(dataContainerId)) .withPublishAllPorts(true)) .withLabels(labels) // .withPortBindings(PortBinding.parse("0.0.0.0:48000:48000"), PortBinding.parse("0.0.0.0:50000:50000")) .exec() .getId(); provisioned.add(id); LOG.debug("Starting container"); getDockerCli().startContainerCmd(id).exec(); return id; }
[ "public", "String", "runFreshJenkinsContainer", "(", "DockerImagePullStrategy", "pullStrategy", ",", "boolean", "forceRefresh", ")", "throws", "IOException", ",", "SettingsBuildingException", ",", "InterruptedException", "{", "LOG", ".", "debug", "(", "\"Entering run fresh jenkins container.\"", ")", ";", "pullImage", "(", "pullStrategy", ",", "JENKINS_DEFAULT", ".", "getDockerImageName", "(", ")", ")", ";", "// labels attached to container allows cleanup container if it wasn't removed", "final", "Map", "<", "String", ",", "String", ">", "labels", "=", "new", "HashMap", "<>", "(", ")", ";", "labels", ".", "put", "(", "\"test.displayName\"", ",", "description", ".", "getDisplayName", "(", ")", ")", ";", "LOG", ".", "debug", "(", "\"Removing existed container before\"", ")", ";", "try", "{", "final", "List", "<", "Container", ">", "containers", "=", "getDockerCli", "(", ")", ".", "listContainersCmd", "(", ")", ".", "withShowAll", "(", "true", ")", ".", "exec", "(", ")", ";", "for", "(", "Container", "c", ":", "containers", ")", "{", "if", "(", "c", ".", "getLabels", "(", ")", ".", "equals", "(", "labels", ")", ")", "{", "// equals? container labels vs image labels?", "LOG", ".", "debug", "(", "\"Removing {}, for labels: '{}'\"", ",", "c", ",", "labels", ")", ";", "getDockerCli", "(", ")", ".", "removeContainerCmd", "(", "c", ".", "getId", "(", ")", ")", ".", "withForce", "(", "true", ")", ".", "exec", "(", ")", ";", "break", ";", "}", "}", "}", "catch", "(", "NotFoundException", "ex", ")", "{", "LOG", ".", "debug", "(", "\"Container wasn't found, that's ok\"", ")", ";", "}", "LOG", ".", "debug", "(", "\"Recreating data container without data-image doesn't make sense, so reuse boolean.\"", ")", ";", "String", "dataContainerId", "=", "getDataContainerId", "(", "forceRefresh", ")", ";", "final", "String", "id", "=", "getDockerCli", "(", ")", ".", "createContainerCmd", "(", "JENKINS_DEFAULT", ".", "getDockerImageName", "(", ")", ")", ".", "withEnv", "(", "CONTAINER_JAVA_OPTS", ")", ".", "withExposedPorts", "(", "new", "ExposedPort", "(", "JENKINS_DEFAULT", ".", "tcpPort", ")", ")", ".", "withPortSpecs", "(", "String", ".", "format", "(", "\"%d/tcp\"", ",", "JENKINS_DEFAULT", ".", "tcpPort", ")", ")", ".", "withHostConfig", "(", "HostConfig", ".", "newHostConfig", "(", ")", ".", "withPortBindings", "(", "PortBinding", ".", "parse", "(", "\"0.0.0.0:48000:48000\"", ")", ")", ".", "withVolumesFrom", "(", "new", "VolumesFrom", "(", "dataContainerId", ")", ")", ".", "withPublishAllPorts", "(", "true", ")", ")", ".", "withLabels", "(", "labels", ")", "// .withPortBindings(PortBinding.parse(\"0.0.0.0:48000:48000\"), PortBinding.parse(\"0.0.0.0:50000:50000\"))", ".", "exec", "(", ")", ".", "getId", "(", ")", ";", "provisioned", ".", "add", "(", "id", ")", ";", "LOG", ".", "debug", "(", "\"Starting container\"", ")", ";", "getDockerCli", "(", ")", ".", "startContainerCmd", "(", "id", ")", ".", "exec", "(", ")", ";", "return", "id", ";", "}" ]
Run, record and remove after test container with jenkins. @param forceRefresh enforce data container and data image refresh
[ "Run", "record", "and", "remove", "after", "test", "container", "with", "jenkins", "." ]
train
https://github.com/KostyaSha/yet-another-docker-plugin/blob/40b12e39ff94c3834cff7e028c3dd01c88e87d77/yet-another-docker-its/src/main/java/com/github/kostyasha/it/rule/DockerRule.java#L444-L488
HeidelTime/heideltime
src/de/unihd/dbs/uima/annotator/heideltime/resources/RePatternManager.java
RePatternManager.finalizeRePattern
private void finalizeRePattern(String name, String rePattern) { """ Pattern containing regular expression is finalized, i.e., created correctly and added to hmAllRePattern. @param name key name @param rePattern repattern value """ // create correct regular expression rePattern = rePattern.replaceFirst("\\|", ""); /* this was added to reduce the danger of getting unusable groups from user-made repattern * files with group-producing parentheses (i.e. "(foo|bar)" while matching against the documents. */ rePattern = rePattern.replaceAll("\\(([^\\?])", "(?:$1"); rePattern = "(" + rePattern + ")"; rePattern = rePattern.replaceAll("\\\\", "\\\\\\\\"); // add rePattern to hmAllRePattern hmAllRePattern.put(name, rePattern); }
java
private void finalizeRePattern(String name, String rePattern) { // create correct regular expression rePattern = rePattern.replaceFirst("\\|", ""); /* this was added to reduce the danger of getting unusable groups from user-made repattern * files with group-producing parentheses (i.e. "(foo|bar)" while matching against the documents. */ rePattern = rePattern.replaceAll("\\(([^\\?])", "(?:$1"); rePattern = "(" + rePattern + ")"; rePattern = rePattern.replaceAll("\\\\", "\\\\\\\\"); // add rePattern to hmAllRePattern hmAllRePattern.put(name, rePattern); }
[ "private", "void", "finalizeRePattern", "(", "String", "name", ",", "String", "rePattern", ")", "{", "// create correct regular expression", "rePattern", "=", "rePattern", ".", "replaceFirst", "(", "\"\\\\|\"", ",", "\"\"", ")", ";", "/* this was added to reduce the danger of getting unusable groups from user-made repattern\n\t\t * files with group-producing parentheses (i.e. \"(foo|bar)\" while matching against the documents. */", "rePattern", "=", "rePattern", ".", "replaceAll", "(", "\"\\\\(([^\\\\?])\"", ",", "\"(?:$1\"", ")", ";", "rePattern", "=", "\"(\"", "+", "rePattern", "+", "\")\"", ";", "rePattern", "=", "rePattern", ".", "replaceAll", "(", "\"\\\\\\\\\"", ",", "\"\\\\\\\\\\\\\\\\\"", ")", ";", "// add rePattern to hmAllRePattern", "hmAllRePattern", ".", "put", "(", "name", ",", "rePattern", ")", ";", "}" ]
Pattern containing regular expression is finalized, i.e., created correctly and added to hmAllRePattern. @param name key name @param rePattern repattern value
[ "Pattern", "containing", "regular", "expression", "is", "finalized", "i", ".", "e", ".", "created", "correctly", "and", "added", "to", "hmAllRePattern", "." ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/annotator/heideltime/resources/RePatternManager.java#L164-L174
anotheria/configureme
src/main/java/org/configureme/repository/Artefact.java
Artefact.addAttributeValue
public void addAttributeValue(final String attributeName, final Value attributeValue, Environment in) { """ Adds an attribute value. If the attribute doesn't exist it will be created. @param attributeName the name of the attribute. @param attributeValue the value of the attribute in the given environment. @param in the environment in which the attribute value applies """ if (in == null) in = GlobalEnvironment.INSTANCE; Attribute attr = attributes.get(attributeName); if (attr == null) { attr = new Attribute(attributeName); attributes.put(attr.getName(), attr); } attr.addValue(attributeValue, in); Map<String, Object> valueMap = contentMap.get(in); if(valueMap == null) valueMap = new HashMap<>(); valueMap.put(attributeName, attributeValue.getRaw()); contentMap.put(in, valueMap); //TODO check for loops and process such situation if (attributeValue instanceof IncludeValue) externalConfigurations.add(((IncludeValue) attributeValue).getConfigName()); }
java
public void addAttributeValue(final String attributeName, final Value attributeValue, Environment in) { if (in == null) in = GlobalEnvironment.INSTANCE; Attribute attr = attributes.get(attributeName); if (attr == null) { attr = new Attribute(attributeName); attributes.put(attr.getName(), attr); } attr.addValue(attributeValue, in); Map<String, Object> valueMap = contentMap.get(in); if(valueMap == null) valueMap = new HashMap<>(); valueMap.put(attributeName, attributeValue.getRaw()); contentMap.put(in, valueMap); //TODO check for loops and process such situation if (attributeValue instanceof IncludeValue) externalConfigurations.add(((IncludeValue) attributeValue).getConfigName()); }
[ "public", "void", "addAttributeValue", "(", "final", "String", "attributeName", ",", "final", "Value", "attributeValue", ",", "Environment", "in", ")", "{", "if", "(", "in", "==", "null", ")", "in", "=", "GlobalEnvironment", ".", "INSTANCE", ";", "Attribute", "attr", "=", "attributes", ".", "get", "(", "attributeName", ")", ";", "if", "(", "attr", "==", "null", ")", "{", "attr", "=", "new", "Attribute", "(", "attributeName", ")", ";", "attributes", ".", "put", "(", "attr", ".", "getName", "(", ")", ",", "attr", ")", ";", "}", "attr", ".", "addValue", "(", "attributeValue", ",", "in", ")", ";", "Map", "<", "String", ",", "Object", ">", "valueMap", "=", "contentMap", ".", "get", "(", "in", ")", ";", "if", "(", "valueMap", "==", "null", ")", "valueMap", "=", "new", "HashMap", "<>", "(", ")", ";", "valueMap", ".", "put", "(", "attributeName", ",", "attributeValue", ".", "getRaw", "(", ")", ")", ";", "contentMap", ".", "put", "(", "in", ",", "valueMap", ")", ";", "//TODO check for loops and process such situation", "if", "(", "attributeValue", "instanceof", "IncludeValue", ")", "externalConfigurations", ".", "add", "(", "(", "(", "IncludeValue", ")", "attributeValue", ")", ".", "getConfigName", "(", ")", ")", ";", "}" ]
Adds an attribute value. If the attribute doesn't exist it will be created. @param attributeName the name of the attribute. @param attributeValue the value of the attribute in the given environment. @param in the environment in which the attribute value applies
[ "Adds", "an", "attribute", "value", ".", "If", "the", "attribute", "doesn", "t", "exist", "it", "will", "be", "created", "." ]
train
https://github.com/anotheria/configureme/blob/1f52dd9109349623190586bdf5a592de8016e1fa/src/main/java/org/configureme/repository/Artefact.java#L91-L109
kikinteractive/ice
ice/src/main/java/com/kik/config/ice/internal/MethodIdProxyFactory.java
MethodIdProxyFactory.getProxy
public static <C> C getProxy(final Class<C> configInterface) { """ Produces a proxy impl of a configuration interface to identify methods called on it """ return getProxy(configInterface, Optional.empty()); }
java
public static <C> C getProxy(final Class<C> configInterface) { return getProxy(configInterface, Optional.empty()); }
[ "public", "static", "<", "C", ">", "C", "getProxy", "(", "final", "Class", "<", "C", ">", "configInterface", ")", "{", "return", "getProxy", "(", "configInterface", ",", "Optional", ".", "empty", "(", ")", ")", ";", "}" ]
Produces a proxy impl of a configuration interface to identify methods called on it
[ "Produces", "a", "proxy", "impl", "of", "a", "configuration", "interface", "to", "identify", "methods", "called", "on", "it" ]
train
https://github.com/kikinteractive/ice/blob/0c58d7bf2d9f6504892d0768d6022fcfa6df7514/ice/src/main/java/com/kik/config/ice/internal/MethodIdProxyFactory.java#L42-L45
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/extension/ExtensionRegistry.java
ExtensionRegistry.recordSubsystemVersions
public void recordSubsystemVersions(String moduleName, ModelNode subsystems) { """ Records the versions of the subsystems associated with the given {@code moduleName} as properties in the provided {@link ModelNode}. Each subsystem property key will be the subsystem name and the value will be a string composed of the subsystem major version dot appended to its minor version. @param moduleName the name of the extension module @param subsystems a model node of type {@link org.jboss.dmr.ModelType#UNDEFINED} or type {@link org.jboss.dmr.ModelType#OBJECT} """ final Map<String, SubsystemInformation> subsystemsInfo = getAvailableSubsystems(moduleName); if(subsystemsInfo != null && ! subsystemsInfo.isEmpty()) { for(final Map.Entry<String, SubsystemInformation> entry : subsystemsInfo.entrySet()) { SubsystemInformation subsystem = entry.getValue(); subsystems.add(entry.getKey(), subsystem.getManagementInterfaceMajorVersion() + "." + subsystem.getManagementInterfaceMinorVersion() + "." + subsystem.getManagementInterfaceMicroVersion()); } } }
java
public void recordSubsystemVersions(String moduleName, ModelNode subsystems) { final Map<String, SubsystemInformation> subsystemsInfo = getAvailableSubsystems(moduleName); if(subsystemsInfo != null && ! subsystemsInfo.isEmpty()) { for(final Map.Entry<String, SubsystemInformation> entry : subsystemsInfo.entrySet()) { SubsystemInformation subsystem = entry.getValue(); subsystems.add(entry.getKey(), subsystem.getManagementInterfaceMajorVersion() + "." + subsystem.getManagementInterfaceMinorVersion() + "." + subsystem.getManagementInterfaceMicroVersion()); } } }
[ "public", "void", "recordSubsystemVersions", "(", "String", "moduleName", ",", "ModelNode", "subsystems", ")", "{", "final", "Map", "<", "String", ",", "SubsystemInformation", ">", "subsystemsInfo", "=", "getAvailableSubsystems", "(", "moduleName", ")", ";", "if", "(", "subsystemsInfo", "!=", "null", "&&", "!", "subsystemsInfo", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "final", "Map", ".", "Entry", "<", "String", ",", "SubsystemInformation", ">", "entry", ":", "subsystemsInfo", ".", "entrySet", "(", ")", ")", "{", "SubsystemInformation", "subsystem", "=", "entry", ".", "getValue", "(", ")", ";", "subsystems", ".", "add", "(", "entry", ".", "getKey", "(", ")", ",", "subsystem", ".", "getManagementInterfaceMajorVersion", "(", ")", "+", "\".\"", "+", "subsystem", ".", "getManagementInterfaceMinorVersion", "(", ")", "+", "\".\"", "+", "subsystem", ".", "getManagementInterfaceMicroVersion", "(", ")", ")", ";", "}", "}", "}" ]
Records the versions of the subsystems associated with the given {@code moduleName} as properties in the provided {@link ModelNode}. Each subsystem property key will be the subsystem name and the value will be a string composed of the subsystem major version dot appended to its minor version. @param moduleName the name of the extension module @param subsystems a model node of type {@link org.jboss.dmr.ModelType#UNDEFINED} or type {@link org.jboss.dmr.ModelType#OBJECT}
[ "Records", "the", "versions", "of", "the", "subsystems", "associated", "with", "the", "given", "{", "@code", "moduleName", "}", "as", "properties", "in", "the", "provided", "{", "@link", "ModelNode", "}", ".", "Each", "subsystem", "property", "key", "will", "be", "the", "subsystem", "name", "and", "the", "value", "will", "be", "a", "string", "composed", "of", "the", "subsystem", "major", "version", "dot", "appended", "to", "its", "minor", "version", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/extension/ExtensionRegistry.java#L400-L411
Stratio/stratio-cassandra
src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java
CommitLogSegmentManager.allocate
public Allocation allocate(Mutation mutation, int size) { """ Reserve space in the current segment for the provided mutation or, if there isn't space available, create a new segment. @return the provided Allocation object """ CommitLogSegment segment = allocatingFrom(); Allocation alloc; while ( null == (alloc = segment.allocate(mutation, size)) ) { // failed to allocate, so move to a new segment with enough room advanceAllocatingFrom(segment); segment = allocatingFrom; } return alloc; }
java
public Allocation allocate(Mutation mutation, int size) { CommitLogSegment segment = allocatingFrom(); Allocation alloc; while ( null == (alloc = segment.allocate(mutation, size)) ) { // failed to allocate, so move to a new segment with enough room advanceAllocatingFrom(segment); segment = allocatingFrom; } return alloc; }
[ "public", "Allocation", "allocate", "(", "Mutation", "mutation", ",", "int", "size", ")", "{", "CommitLogSegment", "segment", "=", "allocatingFrom", "(", ")", ";", "Allocation", "alloc", ";", "while", "(", "null", "==", "(", "alloc", "=", "segment", ".", "allocate", "(", "mutation", ",", "size", ")", ")", ")", "{", "// failed to allocate, so move to a new segment with enough room", "advanceAllocatingFrom", "(", "segment", ")", ";", "segment", "=", "allocatingFrom", ";", "}", "return", "alloc", ";", "}" ]
Reserve space in the current segment for the provided mutation or, if there isn't space available, create a new segment. @return the provided Allocation object
[ "Reserve", "space", "in", "the", "current", "segment", "for", "the", "provided", "mutation", "or", "if", "there", "isn", "t", "space", "available", "create", "a", "new", "segment", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/db/commitlog/CommitLogSegmentManager.java#L182-L195
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java
OLAPService.browseOlapp
public String browseOlapp(Tenant tenant, Map<String, String> parameters) { """ Perform the given OLAP browser (_olapp) command. @param tenant Tenant context for command. @param parameters OLAP browser parameters. Should be empty to start the browser at the home page. @return An HTML-formatted page containing the results of the given OLAP browser command. """ checkServiceState(); return Olapp.process(tenant, m_olap, parameters); }
java
public String browseOlapp(Tenant tenant, Map<String, String> parameters) { checkServiceState(); return Olapp.process(tenant, m_olap, parameters); }
[ "public", "String", "browseOlapp", "(", "Tenant", "tenant", ",", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "checkServiceState", "(", ")", ";", "return", "Olapp", ".", "process", "(", "tenant", ",", "m_olap", ",", "parameters", ")", ";", "}" ]
Perform the given OLAP browser (_olapp) command. @param tenant Tenant context for command. @param parameters OLAP browser parameters. Should be empty to start the browser at the home page. @return An HTML-formatted page containing the results of the given OLAP browser command.
[ "Perform", "the", "given", "OLAP", "browser", "(", "_olapp", ")", "command", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java#L237-L240
BoltsFramework/Bolts-Android
bolts-tasks/src/main/java/bolts/Task.java
Task.callInBackground
public static <TResult> Task<TResult> callInBackground(Callable<TResult> callable) { """ Invokes the callable on a background thread, returning a Task to represent the operation. If you want to cancel the resulting Task throw a {@link java.util.concurrent.CancellationException} from the callable. """ return call(callable, BACKGROUND_EXECUTOR, null); }
java
public static <TResult> Task<TResult> callInBackground(Callable<TResult> callable) { return call(callable, BACKGROUND_EXECUTOR, null); }
[ "public", "static", "<", "TResult", ">", "Task", "<", "TResult", ">", "callInBackground", "(", "Callable", "<", "TResult", ">", "callable", ")", "{", "return", "call", "(", "callable", ",", "BACKGROUND_EXECUTOR", ",", "null", ")", ";", "}" ]
Invokes the callable on a background thread, returning a Task to represent the operation. If you want to cancel the resulting Task throw a {@link java.util.concurrent.CancellationException} from the callable.
[ "Invokes", "the", "callable", "on", "a", "background", "thread", "returning", "a", "Task", "to", "represent", "the", "operation", "." ]
train
https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-tasks/src/main/java/bolts/Task.java#L317-L319
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.processProperties
private void processProperties(XMLStreamWriter writer, Set<Method> methodSet, Class<?> aClass) throws IntrospectionException, XMLStreamException { """ Process class properties. @param writer output stream @param methodSet set of methods processed @param aClass class being processed @throws IntrospectionException @throws XMLStreamException """ BeanInfo beanInfo = Introspector.getBeanInfo(aClass, aClass.getSuperclass()); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (int i = 0; i < propertyDescriptors.length; i++) { PropertyDescriptor propertyDescriptor = propertyDescriptors[i]; if (propertyDescriptor.getPropertyType() != null) { String name = propertyDescriptor.getName(); Method readMethod = propertyDescriptor.getReadMethod(); Method writeMethod = propertyDescriptor.getWriteMethod(); String readMethodName = readMethod == null ? null : readMethod.getName(); String writeMethodName = writeMethod == null ? null : writeMethod.getName(); addProperty(writer, name, propertyDescriptor.getPropertyType(), readMethodName, writeMethodName); if (readMethod != null) { methodSet.add(readMethod); } if (writeMethod != null) { methodSet.add(writeMethod); } } else { processAmbiguousProperty(writer, methodSet, aClass, propertyDescriptor); } } }
java
private void processProperties(XMLStreamWriter writer, Set<Method> methodSet, Class<?> aClass) throws IntrospectionException, XMLStreamException { BeanInfo beanInfo = Introspector.getBeanInfo(aClass, aClass.getSuperclass()); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (int i = 0; i < propertyDescriptors.length; i++) { PropertyDescriptor propertyDescriptor = propertyDescriptors[i]; if (propertyDescriptor.getPropertyType() != null) { String name = propertyDescriptor.getName(); Method readMethod = propertyDescriptor.getReadMethod(); Method writeMethod = propertyDescriptor.getWriteMethod(); String readMethodName = readMethod == null ? null : readMethod.getName(); String writeMethodName = writeMethod == null ? null : writeMethod.getName(); addProperty(writer, name, propertyDescriptor.getPropertyType(), readMethodName, writeMethodName); if (readMethod != null) { methodSet.add(readMethod); } if (writeMethod != null) { methodSet.add(writeMethod); } } else { processAmbiguousProperty(writer, methodSet, aClass, propertyDescriptor); } } }
[ "private", "void", "processProperties", "(", "XMLStreamWriter", "writer", ",", "Set", "<", "Method", ">", "methodSet", ",", "Class", "<", "?", ">", "aClass", ")", "throws", "IntrospectionException", ",", "XMLStreamException", "{", "BeanInfo", "beanInfo", "=", "Introspector", ".", "getBeanInfo", "(", "aClass", ",", "aClass", ".", "getSuperclass", "(", ")", ")", ";", "PropertyDescriptor", "[", "]", "propertyDescriptors", "=", "beanInfo", ".", "getPropertyDescriptors", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "propertyDescriptors", ".", "length", ";", "i", "++", ")", "{", "PropertyDescriptor", "propertyDescriptor", "=", "propertyDescriptors", "[", "i", "]", ";", "if", "(", "propertyDescriptor", ".", "getPropertyType", "(", ")", "!=", "null", ")", "{", "String", "name", "=", "propertyDescriptor", ".", "getName", "(", ")", ";", "Method", "readMethod", "=", "propertyDescriptor", ".", "getReadMethod", "(", ")", ";", "Method", "writeMethod", "=", "propertyDescriptor", ".", "getWriteMethod", "(", ")", ";", "String", "readMethodName", "=", "readMethod", "==", "null", "?", "null", ":", "readMethod", ".", "getName", "(", ")", ";", "String", "writeMethodName", "=", "writeMethod", "==", "null", "?", "null", ":", "writeMethod", ".", "getName", "(", ")", ";", "addProperty", "(", "writer", ",", "name", ",", "propertyDescriptor", ".", "getPropertyType", "(", ")", ",", "readMethodName", ",", "writeMethodName", ")", ";", "if", "(", "readMethod", "!=", "null", ")", "{", "methodSet", ".", "add", "(", "readMethod", ")", ";", "}", "if", "(", "writeMethod", "!=", "null", ")", "{", "methodSet", ".", "add", "(", "writeMethod", ")", ";", "}", "}", "else", "{", "processAmbiguousProperty", "(", "writer", ",", "methodSet", ",", "aClass", ",", "propertyDescriptor", ")", ";", "}", "}", "}" ]
Process class properties. @param writer output stream @param methodSet set of methods processed @param aClass class being processed @throws IntrospectionException @throws XMLStreamException
[ "Process", "class", "properties", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L205-L238
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java
RoaringBitmap.flip
public static RoaringBitmap flip(RoaringBitmap bm, final long rangeStart, final long rangeEnd) { """ Complements the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive). The given bitmap is unchanged. @param bm bitmap being negated @param rangeStart inclusive beginning of range, in [0, 0xffffffff] @param rangeEnd exclusive ending of range, in [0, 0xffffffff + 1] @return a new Bitmap """ rangeSanityCheck(rangeStart, rangeEnd); if (rangeStart >= rangeEnd) { return bm.clone(); } RoaringBitmap answer = new RoaringBitmap(); final int hbStart = Util.toIntUnsigned(Util.highbits(rangeStart)); final int lbStart = Util.toIntUnsigned(Util.lowbits(rangeStart)); final int hbLast = Util.toIntUnsigned(Util.highbits(rangeEnd - 1)); final int lbLast = Util.toIntUnsigned(Util.lowbits(rangeEnd - 1)); // copy the containers before the active area answer.highLowContainer.appendCopiesUntil(bm.highLowContainer, (short) hbStart); for (int hb = hbStart; hb <= hbLast; ++hb) { final int containerStart = (hb == hbStart) ? lbStart : 0; final int containerLast = (hb == hbLast) ? lbLast : Util.maxLowBitAsInteger(); final int i = bm.highLowContainer.getIndex((short) hb); final int j = answer.highLowContainer.getIndex((short) hb); assert j < 0; if (i >= 0) { Container c = bm.highLowContainer.getContainerAtIndex(i).not(containerStart, containerLast + 1); if (!c.isEmpty()) { answer.highLowContainer.insertNewKeyValueAt(-j - 1, (short) hb, c); } } else { // *think* the range of ones must never be // empty. answer.highLowContainer.insertNewKeyValueAt(-j - 1, (short) hb, Container.rangeOfOnes(containerStart, containerLast + 1)); } } // copy the containers after the active area. answer.highLowContainer.appendCopiesAfter(bm.highLowContainer, (short) hbLast); return answer; }
java
public static RoaringBitmap flip(RoaringBitmap bm, final long rangeStart, final long rangeEnd) { rangeSanityCheck(rangeStart, rangeEnd); if (rangeStart >= rangeEnd) { return bm.clone(); } RoaringBitmap answer = new RoaringBitmap(); final int hbStart = Util.toIntUnsigned(Util.highbits(rangeStart)); final int lbStart = Util.toIntUnsigned(Util.lowbits(rangeStart)); final int hbLast = Util.toIntUnsigned(Util.highbits(rangeEnd - 1)); final int lbLast = Util.toIntUnsigned(Util.lowbits(rangeEnd - 1)); // copy the containers before the active area answer.highLowContainer.appendCopiesUntil(bm.highLowContainer, (short) hbStart); for (int hb = hbStart; hb <= hbLast; ++hb) { final int containerStart = (hb == hbStart) ? lbStart : 0; final int containerLast = (hb == hbLast) ? lbLast : Util.maxLowBitAsInteger(); final int i = bm.highLowContainer.getIndex((short) hb); final int j = answer.highLowContainer.getIndex((short) hb); assert j < 0; if (i >= 0) { Container c = bm.highLowContainer.getContainerAtIndex(i).not(containerStart, containerLast + 1); if (!c.isEmpty()) { answer.highLowContainer.insertNewKeyValueAt(-j - 1, (short) hb, c); } } else { // *think* the range of ones must never be // empty. answer.highLowContainer.insertNewKeyValueAt(-j - 1, (short) hb, Container.rangeOfOnes(containerStart, containerLast + 1)); } } // copy the containers after the active area. answer.highLowContainer.appendCopiesAfter(bm.highLowContainer, (short) hbLast); return answer; }
[ "public", "static", "RoaringBitmap", "flip", "(", "RoaringBitmap", "bm", ",", "final", "long", "rangeStart", ",", "final", "long", "rangeEnd", ")", "{", "rangeSanityCheck", "(", "rangeStart", ",", "rangeEnd", ")", ";", "if", "(", "rangeStart", ">=", "rangeEnd", ")", "{", "return", "bm", ".", "clone", "(", ")", ";", "}", "RoaringBitmap", "answer", "=", "new", "RoaringBitmap", "(", ")", ";", "final", "int", "hbStart", "=", "Util", ".", "toIntUnsigned", "(", "Util", ".", "highbits", "(", "rangeStart", ")", ")", ";", "final", "int", "lbStart", "=", "Util", ".", "toIntUnsigned", "(", "Util", ".", "lowbits", "(", "rangeStart", ")", ")", ";", "final", "int", "hbLast", "=", "Util", ".", "toIntUnsigned", "(", "Util", ".", "highbits", "(", "rangeEnd", "-", "1", ")", ")", ";", "final", "int", "lbLast", "=", "Util", ".", "toIntUnsigned", "(", "Util", ".", "lowbits", "(", "rangeEnd", "-", "1", ")", ")", ";", "// copy the containers before the active area", "answer", ".", "highLowContainer", ".", "appendCopiesUntil", "(", "bm", ".", "highLowContainer", ",", "(", "short", ")", "hbStart", ")", ";", "for", "(", "int", "hb", "=", "hbStart", ";", "hb", "<=", "hbLast", ";", "++", "hb", ")", "{", "final", "int", "containerStart", "=", "(", "hb", "==", "hbStart", ")", "?", "lbStart", ":", "0", ";", "final", "int", "containerLast", "=", "(", "hb", "==", "hbLast", ")", "?", "lbLast", ":", "Util", ".", "maxLowBitAsInteger", "(", ")", ";", "final", "int", "i", "=", "bm", ".", "highLowContainer", ".", "getIndex", "(", "(", "short", ")", "hb", ")", ";", "final", "int", "j", "=", "answer", ".", "highLowContainer", ".", "getIndex", "(", "(", "short", ")", "hb", ")", ";", "assert", "j", "<", "0", ";", "if", "(", "i", ">=", "0", ")", "{", "Container", "c", "=", "bm", ".", "highLowContainer", ".", "getContainerAtIndex", "(", "i", ")", ".", "not", "(", "containerStart", ",", "containerLast", "+", "1", ")", ";", "if", "(", "!", "c", ".", "isEmpty", "(", ")", ")", "{", "answer", ".", "highLowContainer", ".", "insertNewKeyValueAt", "(", "-", "j", "-", "1", ",", "(", "short", ")", "hb", ",", "c", ")", ";", "}", "}", "else", "{", "// *think* the range of ones must never be", "// empty.", "answer", ".", "highLowContainer", ".", "insertNewKeyValueAt", "(", "-", "j", "-", "1", ",", "(", "short", ")", "hb", ",", "Container", ".", "rangeOfOnes", "(", "containerStart", ",", "containerLast", "+", "1", ")", ")", ";", "}", "}", "// copy the containers after the active area.", "answer", ".", "highLowContainer", ".", "appendCopiesAfter", "(", "bm", ".", "highLowContainer", ",", "(", "short", ")", "hbLast", ")", ";", "return", "answer", ";", "}" ]
Complements the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive). The given bitmap is unchanged. @param bm bitmap being negated @param rangeStart inclusive beginning of range, in [0, 0xffffffff] @param rangeEnd exclusive ending of range, in [0, 0xffffffff + 1] @return a new Bitmap
[ "Complements", "the", "bits", "in", "the", "given", "range", "from", "rangeStart", "(", "inclusive", ")", "rangeEnd", "(", "exclusive", ")", ".", "The", "given", "bitmap", "is", "unchanged", "." ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/RoaringBitmap.java#L553-L591
tempodb/tempodb-java
src/main/java/com/tempodb/Client.java
Client.readSummary
public Result<Summary> readSummary(Series series, Interval interval) { """ Reads summary statistics for a series for the specified interval. @param series The series to read from @param interval The interval of data to summarize @return A set of statistics for an interval of data @see SingleValue @since 1.1.0 """ checkNotNull(series); checkNotNull(interval); DateTimeZone timezone = interval.getStart().getChronology().getZone(); URI uri = null; try { URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/summary/", API_VERSION, urlencode(series.getKey()))); addIntervalToURI(builder, interval); addTimeZoneToURI(builder, timezone); uri = builder.build(); } catch (URISyntaxException e) { String message = String.format("Could not build URI with inputs: key: %s, interval: %s, timezone: %s", series.getKey(), interval.toString(), timezone.toString()); throw new IllegalArgumentException(message, e); } HttpRequest request = buildRequest(uri.toString()); Result<Summary> result = execute(request, Summary.class); return result; }
java
public Result<Summary> readSummary(Series series, Interval interval) { checkNotNull(series); checkNotNull(interval); DateTimeZone timezone = interval.getStart().getChronology().getZone(); URI uri = null; try { URIBuilder builder = new URIBuilder(String.format("/%s/series/key/%s/summary/", API_VERSION, urlencode(series.getKey()))); addIntervalToURI(builder, interval); addTimeZoneToURI(builder, timezone); uri = builder.build(); } catch (URISyntaxException e) { String message = String.format("Could not build URI with inputs: key: %s, interval: %s, timezone: %s", series.getKey(), interval.toString(), timezone.toString()); throw new IllegalArgumentException(message, e); } HttpRequest request = buildRequest(uri.toString()); Result<Summary> result = execute(request, Summary.class); return result; }
[ "public", "Result", "<", "Summary", ">", "readSummary", "(", "Series", "series", ",", "Interval", "interval", ")", "{", "checkNotNull", "(", "series", ")", ";", "checkNotNull", "(", "interval", ")", ";", "DateTimeZone", "timezone", "=", "interval", ".", "getStart", "(", ")", ".", "getChronology", "(", ")", ".", "getZone", "(", ")", ";", "URI", "uri", "=", "null", ";", "try", "{", "URIBuilder", "builder", "=", "new", "URIBuilder", "(", "String", ".", "format", "(", "\"/%s/series/key/%s/summary/\"", ",", "API_VERSION", ",", "urlencode", "(", "series", ".", "getKey", "(", ")", ")", ")", ")", ";", "addIntervalToURI", "(", "builder", ",", "interval", ")", ";", "addTimeZoneToURI", "(", "builder", ",", "timezone", ")", ";", "uri", "=", "builder", ".", "build", "(", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "String", "message", "=", "String", ".", "format", "(", "\"Could not build URI with inputs: key: %s, interval: %s, timezone: %s\"", ",", "series", ".", "getKey", "(", ")", ",", "interval", ".", "toString", "(", ")", ",", "timezone", ".", "toString", "(", ")", ")", ";", "throw", "new", "IllegalArgumentException", "(", "message", ",", "e", ")", ";", "}", "HttpRequest", "request", "=", "buildRequest", "(", "uri", ".", "toString", "(", ")", ")", ";", "Result", "<", "Summary", ">", "result", "=", "execute", "(", "request", ",", "Summary", ".", "class", ")", ";", "return", "result", ";", "}" ]
Reads summary statistics for a series for the specified interval. @param series The series to read from @param interval The interval of data to summarize @return A set of statistics for an interval of data @see SingleValue @since 1.1.0
[ "Reads", "summary", "statistics", "for", "a", "series", "for", "the", "specified", "interval", "." ]
train
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L575-L594
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java
OmemoManager.trustOmemoIdentity
public void trustOmemoIdentity(OmemoDevice device, OmemoFingerprint fingerprint) { """ Trust that a fingerprint belongs to an OmemoDevice. The fingerprint must be the lowercase, hexadecimal fingerprint of the identityKey of the device and must be of length 64. @param device device @param fingerprint fingerprint """ if (trustCallback == null) { throw new IllegalStateException("No TrustCallback set."); } trustCallback.setTrust(device, fingerprint, TrustState.trusted); }
java
public void trustOmemoIdentity(OmemoDevice device, OmemoFingerprint fingerprint) { if (trustCallback == null) { throw new IllegalStateException("No TrustCallback set."); } trustCallback.setTrust(device, fingerprint, TrustState.trusted); }
[ "public", "void", "trustOmemoIdentity", "(", "OmemoDevice", "device", ",", "OmemoFingerprint", "fingerprint", ")", "{", "if", "(", "trustCallback", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"No TrustCallback set.\"", ")", ";", "}", "trustCallback", ".", "setTrust", "(", "device", ",", "fingerprint", ",", "TrustState", ".", "trusted", ")", ";", "}" ]
Trust that a fingerprint belongs to an OmemoDevice. The fingerprint must be the lowercase, hexadecimal fingerprint of the identityKey of the device and must be of length 64. @param device device @param fingerprint fingerprint
[ "Trust", "that", "a", "fingerprint", "belongs", "to", "an", "OmemoDevice", ".", "The", "fingerprint", "must", "be", "the", "lowercase", "hexadecimal", "fingerprint", "of", "the", "identityKey", "of", "the", "device", "and", "must", "be", "of", "length", "64", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java#L420-L426
lucee/Lucee
core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java
ResourceUtil.checkMoveToOK
public static void checkMoveToOK(Resource source, Resource target) throws IOException { """ check if moveing a file is ok with the rules for the Resource interface, to not change this rules. @param source @param target @throws IOException """ if (!source.exists()) { throw new IOException("can't move [" + source.getPath() + "] to [" + target.getPath() + "], source file does not exist"); } if (source.isDirectory() && target.isFile()) throw new IOException("can't move [" + source.getPath() + "] directory to [" + target.getPath() + "], target is a file"); if (source.isFile() && target.isDirectory()) throw new IOException("can't move [" + source.getPath() + "] file to [" + target.getPath() + "], target is a directory"); }
java
public static void checkMoveToOK(Resource source, Resource target) throws IOException { if (!source.exists()) { throw new IOException("can't move [" + source.getPath() + "] to [" + target.getPath() + "], source file does not exist"); } if (source.isDirectory() && target.isFile()) throw new IOException("can't move [" + source.getPath() + "] directory to [" + target.getPath() + "], target is a file"); if (source.isFile() && target.isDirectory()) throw new IOException("can't move [" + source.getPath() + "] file to [" + target.getPath() + "], target is a directory"); }
[ "public", "static", "void", "checkMoveToOK", "(", "Resource", "source", ",", "Resource", "target", ")", "throws", "IOException", "{", "if", "(", "!", "source", ".", "exists", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"can't move [\"", "+", "source", ".", "getPath", "(", ")", "+", "\"] to [\"", "+", "target", ".", "getPath", "(", ")", "+", "\"], source file does not exist\"", ")", ";", "}", "if", "(", "source", ".", "isDirectory", "(", ")", "&&", "target", ".", "isFile", "(", ")", ")", "throw", "new", "IOException", "(", "\"can't move [\"", "+", "source", ".", "getPath", "(", ")", "+", "\"] directory to [\"", "+", "target", ".", "getPath", "(", ")", "+", "\"], target is a file\"", ")", ";", "if", "(", "source", ".", "isFile", "(", ")", "&&", "target", ".", "isDirectory", "(", ")", ")", "throw", "new", "IOException", "(", "\"can't move [\"", "+", "source", ".", "getPath", "(", ")", "+", "\"] file to [\"", "+", "target", ".", "getPath", "(", ")", "+", "\"], target is a directory\"", ")", ";", "}" ]
check if moveing a file is ok with the rules for the Resource interface, to not change this rules. @param source @param target @throws IOException
[ "check", "if", "moveing", "a", "file", "is", "ok", "with", "the", "rules", "for", "the", "Resource", "interface", "to", "not", "change", "this", "rules", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L1340-L1346
tvbarthel/Cheerleader
library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java
CheerleaderPlayer.getInstance
private static CheerleaderPlayer getInstance(Context context, String clientId) { """ Simple Sound cloud client initialized with a client id. @param context context used to instantiate internal components, no hard reference will be kept. @param clientId sound cloud client id. @return instance of {@link CheerleaderPlayer} """ if (clientId == null) { throw new IllegalArgumentException("Sound cloud client id can't be null."); } if (sInstance == null || sInstance.mIsClosed) { sInstance = new CheerleaderPlayer(context.getApplicationContext(), clientId); } else { sInstance.mClientKey = clientId; } // reset destroy request each time an instance is requested. sInstance.mDestroyDelayed = false; return sInstance; }
java
private static CheerleaderPlayer getInstance(Context context, String clientId) { if (clientId == null) { throw new IllegalArgumentException("Sound cloud client id can't be null."); } if (sInstance == null || sInstance.mIsClosed) { sInstance = new CheerleaderPlayer(context.getApplicationContext(), clientId); } else { sInstance.mClientKey = clientId; } // reset destroy request each time an instance is requested. sInstance.mDestroyDelayed = false; return sInstance; }
[ "private", "static", "CheerleaderPlayer", "getInstance", "(", "Context", "context", ",", "String", "clientId", ")", "{", "if", "(", "clientId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Sound cloud client id can't be null.\"", ")", ";", "}", "if", "(", "sInstance", "==", "null", "||", "sInstance", ".", "mIsClosed", ")", "{", "sInstance", "=", "new", "CheerleaderPlayer", "(", "context", ".", "getApplicationContext", "(", ")", ",", "clientId", ")", ";", "}", "else", "{", "sInstance", ".", "mClientKey", "=", "clientId", ";", "}", "// reset destroy request each time an instance is requested.", "sInstance", ".", "mDestroyDelayed", "=", "false", ";", "return", "sInstance", ";", "}" ]
Simple Sound cloud client initialized with a client id. @param context context used to instantiate internal components, no hard reference will be kept. @param clientId sound cloud client id. @return instance of {@link CheerleaderPlayer}
[ "Simple", "Sound", "cloud", "client", "initialized", "with", "a", "client", "id", "." ]
train
https://github.com/tvbarthel/Cheerleader/blob/f61527e4cc44fcd0ed2e1e98aca285f8c236f24e/library/src/main/java/fr/tvbarthel/cheerleader/library/player/CheerleaderPlayer.java#L119-L131
camunda/camunda-bpm-platform
distro/wildfly8/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/service/ServiceNames.java
ServiceNames.forProcessApplicationDeploymentService
public static ServiceName forProcessApplicationDeploymentService(String moduleName, String deploymentName) { """ <p>Returns the name for a {@link ProcessApplicationDeploymentService} given the name of the deployment unit and the name of the deployment.</p> @param processApplicationName @param deploymentId """ return PROCESS_APPLICATION_MODULE.append(moduleName).append("DEPLOY").append(deploymentName); }
java
public static ServiceName forProcessApplicationDeploymentService(String moduleName, String deploymentName) { return PROCESS_APPLICATION_MODULE.append(moduleName).append("DEPLOY").append(deploymentName); }
[ "public", "static", "ServiceName", "forProcessApplicationDeploymentService", "(", "String", "moduleName", ",", "String", "deploymentName", ")", "{", "return", "PROCESS_APPLICATION_MODULE", ".", "append", "(", "moduleName", ")", ".", "append", "(", "\"DEPLOY\"", ")", ".", "append", "(", "deploymentName", ")", ";", "}" ]
<p>Returns the name for a {@link ProcessApplicationDeploymentService} given the name of the deployment unit and the name of the deployment.</p> @param processApplicationName @param deploymentId
[ "<p", ">", "Returns", "the", "name", "for", "a", "{", "@link", "ProcessApplicationDeploymentService", "}", "given", "the", "name", "of", "the", "deployment", "unit", "and", "the", "name", "of", "the", "deployment", ".", "<", "/", "p", ">" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/distro/wildfly8/subsystem/src/main/java/org/camunda/bpm/container/impl/jboss/service/ServiceNames.java#L115-L117
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/Validator.java
Validator.validateInjectionPoint
public void validateInjectionPoint(InjectionPoint ij, BeanManagerImpl beanManager) { """ Validate an injection point @param ij the injection point to validate @param beanManager the bean manager """ validateInjectionPointForDefinitionErrors(ij, ij.getBean(), beanManager); validateMetadataInjectionPoint(ij, ij.getBean(), ValidatorLogger.INJECTION_INTO_NON_BEAN); validateEventMetadataInjectionPoint(ij); validateInjectionPointForDeploymentProblems(ij, ij.getBean(), beanManager); }
java
public void validateInjectionPoint(InjectionPoint ij, BeanManagerImpl beanManager) { validateInjectionPointForDefinitionErrors(ij, ij.getBean(), beanManager); validateMetadataInjectionPoint(ij, ij.getBean(), ValidatorLogger.INJECTION_INTO_NON_BEAN); validateEventMetadataInjectionPoint(ij); validateInjectionPointForDeploymentProblems(ij, ij.getBean(), beanManager); }
[ "public", "void", "validateInjectionPoint", "(", "InjectionPoint", "ij", ",", "BeanManagerImpl", "beanManager", ")", "{", "validateInjectionPointForDefinitionErrors", "(", "ij", ",", "ij", ".", "getBean", "(", ")", ",", "beanManager", ")", ";", "validateMetadataInjectionPoint", "(", "ij", ",", "ij", ".", "getBean", "(", ")", ",", "ValidatorLogger", ".", "INJECTION_INTO_NON_BEAN", ")", ";", "validateEventMetadataInjectionPoint", "(", "ij", ")", ";", "validateInjectionPointForDeploymentProblems", "(", "ij", ",", "ij", ".", "getBean", "(", ")", ",", "beanManager", ")", ";", "}" ]
Validate an injection point @param ij the injection point to validate @param beanManager the bean manager
[ "Validate", "an", "injection", "point" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/Validator.java#L286-L291
jayantk/jklol
src/com/jayantkrish/jklol/ccg/CcgParser.java
CcgParser.beamSearch
public List<CcgParse> beamSearch(AnnotatedSentence input, int beamSize, LogFunction log) { """ Performs a beam search to find the best CCG parses of {@code input}. Note that this is an approximate inference strategy, and the returned parses may not be the best parses if at any point during the search more than {@code beamSize} parse trees exist for a span of the sentence. @param input @param beamSize @param log @return {@code beamSize} best parses for {@code terminals}. """ return beamSearch(input, beamSize, null, log, -1, Integer.MAX_VALUE, 1); }
java
public List<CcgParse> beamSearch(AnnotatedSentence input, int beamSize, LogFunction log) { return beamSearch(input, beamSize, null, log, -1, Integer.MAX_VALUE, 1); }
[ "public", "List", "<", "CcgParse", ">", "beamSearch", "(", "AnnotatedSentence", "input", ",", "int", "beamSize", ",", "LogFunction", "log", ")", "{", "return", "beamSearch", "(", "input", ",", "beamSize", ",", "null", ",", "log", ",", "-", "1", ",", "Integer", ".", "MAX_VALUE", ",", "1", ")", ";", "}" ]
Performs a beam search to find the best CCG parses of {@code input}. Note that this is an approximate inference strategy, and the returned parses may not be the best parses if at any point during the search more than {@code beamSize} parse trees exist for a span of the sentence. @param input @param beamSize @param log @return {@code beamSize} best parses for {@code terminals}.
[ "Performs", "a", "beam", "search", "to", "find", "the", "best", "CCG", "parses", "of", "{", "@code", "input", "}", ".", "Note", "that", "this", "is", "an", "approximate", "inference", "strategy", "and", "the", "returned", "parses", "may", "not", "be", "the", "best", "parses", "if", "at", "any", "point", "during", "the", "search", "more", "than", "{", "@code", "beamSize", "}", "parse", "trees", "exist", "for", "a", "span", "of", "the", "sentence", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/CcgParser.java#L520-L522
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/model/ClassDescriptorDef.java
ClassDescriptorDef.addRelevantBaseTypes
private void addRelevantBaseTypes(ClassDescriptorDef curType, ArrayList baseTypes) { """ Adds all relevant base types (depending on their include-inherited setting) to the given list. @param curType The type to process @param baseTypes The list of basetypes """ ClassDescriptorDef baseDef; for (Iterator it = curType.getDirectBaseTypes(); it.hasNext();) { baseDef = (ClassDescriptorDef)it.next(); if (!baseDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_INCLUDE_INHERITED, true)) { // the base type has include-inherited set to false which means that // it does not include base features // since we do want these base features, we have to traverse its base types addRelevantBaseTypes(baseDef, baseTypes); } baseTypes.add(baseDef); } }
java
private void addRelevantBaseTypes(ClassDescriptorDef curType, ArrayList baseTypes) { ClassDescriptorDef baseDef; for (Iterator it = curType.getDirectBaseTypes(); it.hasNext();) { baseDef = (ClassDescriptorDef)it.next(); if (!baseDef.getBooleanProperty(PropertyHelper.OJB_PROPERTY_INCLUDE_INHERITED, true)) { // the base type has include-inherited set to false which means that // it does not include base features // since we do want these base features, we have to traverse its base types addRelevantBaseTypes(baseDef, baseTypes); } baseTypes.add(baseDef); } }
[ "private", "void", "addRelevantBaseTypes", "(", "ClassDescriptorDef", "curType", ",", "ArrayList", "baseTypes", ")", "{", "ClassDescriptorDef", "baseDef", ";", "for", "(", "Iterator", "it", "=", "curType", ".", "getDirectBaseTypes", "(", ")", ";", "it", ".", "hasNext", "(", ")", ";", ")", "{", "baseDef", "=", "(", "ClassDescriptorDef", ")", "it", ".", "next", "(", ")", ";", "if", "(", "!", "baseDef", ".", "getBooleanProperty", "(", "PropertyHelper", ".", "OJB_PROPERTY_INCLUDE_INHERITED", ",", "true", ")", ")", "{", "// the base type has include-inherited set to false which means that\r", "// it does not include base features\r", "// since we do want these base features, we have to traverse its base types\r", "addRelevantBaseTypes", "(", "baseDef", ",", "baseTypes", ")", ";", "}", "baseTypes", ".", "add", "(", "baseDef", ")", ";", "}", "}" ]
Adds all relevant base types (depending on their include-inherited setting) to the given list. @param curType The type to process @param baseTypes The list of basetypes
[ "Adds", "all", "relevant", "base", "types", "(", "depending", "on", "their", "include", "-", "inherited", "setting", ")", "to", "the", "given", "list", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/model/ClassDescriptorDef.java#L294-L310