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
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
datoin/http-requests
src/main/java/org/datoin/net/http/Request.java
Request.getResponse
protected Response getResponse(HttpEntity entity, RequestBuilder req) { """ get response from preconfigured http entity and request builder @param entity : http entity to be used in request @param req : request builder object to build the http request @return : Response object prepared after executing the request """ CloseableHttpClient client = getClient(); initHeaders(req); req.setEntity(entity); CloseableHttpResponse resp = null; Response response = null; try { final HttpUriRequest uriRequest = req.build(); resp = client.execute(uriRequest); response = new Response(resp); response.setMethod(Methods.POST.getMethod()); response.setRequestLine(uriRequest.getRequestLine().toString()); } catch (Exception e) { // TODO: log the error e.printStackTrace(); } finally { try { client.close(); } catch (IOException e) { e.printStackTrace(); } } return response; }
java
protected Response getResponse(HttpEntity entity, RequestBuilder req) { CloseableHttpClient client = getClient(); initHeaders(req); req.setEntity(entity); CloseableHttpResponse resp = null; Response response = null; try { final HttpUriRequest uriRequest = req.build(); resp = client.execute(uriRequest); response = new Response(resp); response.setMethod(Methods.POST.getMethod()); response.setRequestLine(uriRequest.getRequestLine().toString()); } catch (Exception e) { // TODO: log the error e.printStackTrace(); } finally { try { client.close(); } catch (IOException e) { e.printStackTrace(); } } return response; }
[ "protected", "Response", "getResponse", "(", "HttpEntity", "entity", ",", "RequestBuilder", "req", ")", "{", "CloseableHttpClient", "client", "=", "getClient", "(", ")", ";", "initHeaders", "(", "req", ")", ";", "req", ".", "setEntity", "(", "entity", ")", ";", "CloseableHttpResponse", "resp", "=", "null", ";", "Response", "response", "=", "null", ";", "try", "{", "final", "HttpUriRequest", "uriRequest", "=", "req", ".", "build", "(", ")", ";", "resp", "=", "client", ".", "execute", "(", "uriRequest", ")", ";", "response", "=", "new", "Response", "(", "resp", ")", ";", "response", ".", "setMethod", "(", "Methods", ".", "POST", ".", "getMethod", "(", ")", ")", ";", "response", ".", "setRequestLine", "(", "uriRequest", ".", "getRequestLine", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// TODO: log the error", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "try", "{", "client", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "return", "response", ";", "}" ]
get response from preconfigured http entity and request builder @param entity : http entity to be used in request @param req : request builder object to build the http request @return : Response object prepared after executing the request
[ "get", "response", "from", "preconfigured", "http", "entity", "and", "request", "builder" ]
train
https://github.com/datoin/http-requests/blob/660a4bc516c594f321019df94451fead4dea19b6/src/main/java/org/datoin/net/http/Request.java#L455-L478
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java
EmulatedFields.get
public float get(String name, float defaultValue) throws IllegalArgumentException { """ Finds and returns the float value of a given field named {@code name} in the receiver. If the field has not been assigned any value yet, the default value {@code defaultValue} is returned instead. @param name the name of the field to find. @param defaultValue return value in case the field has not been assigned to yet. @return the value of the given field if it has been assigned, the default value otherwise. @throws IllegalArgumentException if the corresponding field can not be found. """ ObjectSlot slot = findMandatorySlot(name, float.class); return slot.defaulted ? defaultValue : ((Float) slot.fieldValue).floatValue(); }
java
public float get(String name, float defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, float.class); return slot.defaulted ? defaultValue : ((Float) slot.fieldValue).floatValue(); }
[ "public", "float", "get", "(", "String", "name", ",", "float", "defaultValue", ")", "throws", "IllegalArgumentException", "{", "ObjectSlot", "slot", "=", "findMandatorySlot", "(", "name", ",", "float", ".", "class", ")", ";", "return", "slot", ".", "defaulted", "?", "defaultValue", ":", "(", "(", "Float", ")", "slot", ".", "fieldValue", ")", ".", "floatValue", "(", ")", ";", "}" ]
Finds and returns the float value of a given field named {@code name} in the receiver. If the field has not been assigned any value yet, the default value {@code defaultValue} is returned instead. @param name the name of the field to find. @param defaultValue return value in case the field has not been assigned to yet. @return the value of the given field if it has been assigned, the default value otherwise. @throws IllegalArgumentException if the corresponding field can not be found.
[ "Finds", "and", "returns", "the", "float", "value", "of", "a", "given", "field", "named", "{", "@code", "name", "}", "in", "the", "receiver", ".", "If", "the", "field", "has", "not", "been", "assigned", "any", "value", "yet", "the", "default", "value", "{", "@code", "defaultValue", "}", "is", "returned", "instead", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java#L268-L271
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java
Bytes.padTail
public static byte [] padTail(final byte [] a, final int length) { """ Return a byte array with value in <code>a</code> plus <code>length</code> appended 0 bytes. @param a array @param length new array size @return Value in <code>a</code> plus <code>length</code> appended 0 bytes """ byte [] padding = new byte[length]; for (int i = 0; i < length; i++) { padding[i] = 0; } return add(a, padding); }
java
public static byte [] padTail(final byte [] a, final int length) { byte [] padding = new byte[length]; for (int i = 0; i < length; i++) { padding[i] = 0; } return add(a, padding); }
[ "public", "static", "byte", "[", "]", "padTail", "(", "final", "byte", "[", "]", "a", ",", "final", "int", "length", ")", "{", "byte", "[", "]", "padding", "=", "new", "byte", "[", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "padding", "[", "i", "]", "=", "0", ";", "}", "return", "add", "(", "a", ",", "padding", ")", ";", "}" ]
Return a byte array with value in <code>a</code> plus <code>length</code> appended 0 bytes. @param a array @param length new array size @return Value in <code>a</code> plus <code>length</code> appended 0 bytes
[ "Return", "a", "byte", "array", "with", "value", "in", "<code", ">", "a<", "/", "code", ">", "plus", "<code", ">", "length<", "/", "code", ">", "appended", "0", "bytes", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java#L1078-L1084
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/FlowLayoutExample.java
FlowLayoutExample.addBoxesWithDiffContent
private static void addBoxesWithDiffContent(final WPanel panel, final int amount) { """ Adds a set of boxes to the given panel. @param panel the panel to add the boxes to. @param amount the number of boxes to add. """ for (int i = 1; i <= amount; i++) { WPanel content = new WPanel(WPanel.Type.BOX); content.setLayout(new FlowLayout(FlowLayout.VERTICAL, 3)); for (int j = 1; j <= i; j++) { content.add(new WText(Integer.toString(i))); } panel.add(content); } }
java
private static void addBoxesWithDiffContent(final WPanel panel, final int amount) { for (int i = 1; i <= amount; i++) { WPanel content = new WPanel(WPanel.Type.BOX); content.setLayout(new FlowLayout(FlowLayout.VERTICAL, 3)); for (int j = 1; j <= i; j++) { content.add(new WText(Integer.toString(i))); } panel.add(content); } }
[ "private", "static", "void", "addBoxesWithDiffContent", "(", "final", "WPanel", "panel", ",", "final", "int", "amount", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "amount", ";", "i", "++", ")", "{", "WPanel", "content", "=", "new", "WPanel", "(", "WPanel", ".", "Type", ".", "BOX", ")", ";", "content", ".", "setLayout", "(", "new", "FlowLayout", "(", "FlowLayout", ".", "VERTICAL", ",", "3", ")", ")", ";", "for", "(", "int", "j", "=", "1", ";", "j", "<=", "i", ";", "j", "++", ")", "{", "content", ".", "add", "(", "new", "WText", "(", "Integer", ".", "toString", "(", "i", ")", ")", ")", ";", "}", "panel", ".", "add", "(", "content", ")", ";", "}", "}" ]
Adds a set of boxes to the given panel. @param panel the panel to add the boxes to. @param amount the number of boxes to add.
[ "Adds", "a", "set", "of", "boxes", "to", "the", "given", "panel", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/FlowLayoutExample.java#L191-L200
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.getTileGridWGS84
public static TileGrid getTileGridWGS84(BoundingBox boundingBox, int zoom) { """ Get the tile grid that includes the entire tile bounding box @param boundingBox wgs84 bounding box @param zoom zoom level @return tile grid @since 1.2.0 """ int tilesPerLat = tilesPerWGS84LatSide(zoom); int tilesPerLon = tilesPerWGS84LonSide(zoom); double tileSizeLat = tileSizeLatPerWGS84Side(tilesPerLat); double tileSizeLon = tileSizeLonPerWGS84Side(tilesPerLon); int minX = (int) ((boundingBox.getMinLongitude() + ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) / tileSizeLon); double tempMaxX = (boundingBox.getMaxLongitude() + ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) / tileSizeLon; int maxX = (int) tempMaxX; if (tempMaxX % 1 == 0) { maxX--; } maxX = Math.min(maxX, tilesPerLon - 1); int minY = (int) (((boundingBox.getMaxLatitude() - ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT) * -1) / tileSizeLat); double tempMaxY = ((boundingBox.getMinLatitude() - ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT) * -1) / tileSizeLat; int maxY = (int) tempMaxY; if (tempMaxY % 1 == 0) { maxY--; } maxY = Math.min(maxY, tilesPerLat - 1); TileGrid grid = new TileGrid(minX, minY, maxX, maxY); return grid; }
java
public static TileGrid getTileGridWGS84(BoundingBox boundingBox, int zoom) { int tilesPerLat = tilesPerWGS84LatSide(zoom); int tilesPerLon = tilesPerWGS84LonSide(zoom); double tileSizeLat = tileSizeLatPerWGS84Side(tilesPerLat); double tileSizeLon = tileSizeLonPerWGS84Side(tilesPerLon); int minX = (int) ((boundingBox.getMinLongitude() + ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) / tileSizeLon); double tempMaxX = (boundingBox.getMaxLongitude() + ProjectionConstants.WGS84_HALF_WORLD_LON_WIDTH) / tileSizeLon; int maxX = (int) tempMaxX; if (tempMaxX % 1 == 0) { maxX--; } maxX = Math.min(maxX, tilesPerLon - 1); int minY = (int) (((boundingBox.getMaxLatitude() - ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT) * -1) / tileSizeLat); double tempMaxY = ((boundingBox.getMinLatitude() - ProjectionConstants.WGS84_HALF_WORLD_LAT_HEIGHT) * -1) / tileSizeLat; int maxY = (int) tempMaxY; if (tempMaxY % 1 == 0) { maxY--; } maxY = Math.min(maxY, tilesPerLat - 1); TileGrid grid = new TileGrid(minX, minY, maxX, maxY); return grid; }
[ "public", "static", "TileGrid", "getTileGridWGS84", "(", "BoundingBox", "boundingBox", ",", "int", "zoom", ")", "{", "int", "tilesPerLat", "=", "tilesPerWGS84LatSide", "(", "zoom", ")", ";", "int", "tilesPerLon", "=", "tilesPerWGS84LonSide", "(", "zoom", ")", ";", "double", "tileSizeLat", "=", "tileSizeLatPerWGS84Side", "(", "tilesPerLat", ")", ";", "double", "tileSizeLon", "=", "tileSizeLonPerWGS84Side", "(", "tilesPerLon", ")", ";", "int", "minX", "=", "(", "int", ")", "(", "(", "boundingBox", ".", "getMinLongitude", "(", ")", "+", "ProjectionConstants", ".", "WGS84_HALF_WORLD_LON_WIDTH", ")", "/", "tileSizeLon", ")", ";", "double", "tempMaxX", "=", "(", "boundingBox", ".", "getMaxLongitude", "(", ")", "+", "ProjectionConstants", ".", "WGS84_HALF_WORLD_LON_WIDTH", ")", "/", "tileSizeLon", ";", "int", "maxX", "=", "(", "int", ")", "tempMaxX", ";", "if", "(", "tempMaxX", "%", "1", "==", "0", ")", "{", "maxX", "--", ";", "}", "maxX", "=", "Math", ".", "min", "(", "maxX", ",", "tilesPerLon", "-", "1", ")", ";", "int", "minY", "=", "(", "int", ")", "(", "(", "(", "boundingBox", ".", "getMaxLatitude", "(", ")", "-", "ProjectionConstants", ".", "WGS84_HALF_WORLD_LAT_HEIGHT", ")", "*", "-", "1", ")", "/", "tileSizeLat", ")", ";", "double", "tempMaxY", "=", "(", "(", "boundingBox", ".", "getMinLatitude", "(", ")", "-", "ProjectionConstants", ".", "WGS84_HALF_WORLD_LAT_HEIGHT", ")", "*", "-", "1", ")", "/", "tileSizeLat", ";", "int", "maxY", "=", "(", "int", ")", "tempMaxY", ";", "if", "(", "tempMaxY", "%", "1", "==", "0", ")", "{", "maxY", "--", ";", "}", "maxY", "=", "Math", ".", "min", "(", "maxY", ",", "tilesPerLat", "-", "1", ")", ";", "TileGrid", "grid", "=", "new", "TileGrid", "(", "minX", ",", "minY", ",", "maxX", ",", "maxY", ")", ";", "return", "grid", ";", "}" ]
Get the tile grid that includes the entire tile bounding box @param boundingBox wgs84 bounding box @param zoom zoom level @return tile grid @since 1.2.0
[ "Get", "the", "tile", "grid", "that", "includes", "the", "entire", "tile", "bounding", "box" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L1135-L1164
rhuss/jolokia
agent/core/src/main/java/org/jolokia/converter/json/ObjectToJsonConverter.java
ObjectToJsonConverter.setObjectValue
private Object setObjectValue(Object pInner, String pAttribute, Object pValue) throws IllegalAccessException, InvocationTargetException { """ Set an value of an inner object @param pInner the inner object @param pAttribute the attribute to set @param pValue the value to set @return the old value @throws IllegalAccessException if the reflection code fails during setting of the value @throws InvocationTargetException reflection error """ // Call various handlers depending on the type of the inner object, as is extract Object Class clazz = pInner.getClass(); if (clazz.isArray()) { return arrayExtractor.setObjectValue(stringToObjectConverter,pInner,pAttribute,pValue); } Extractor handler = getExtractor(clazz); if (handler != null) { return handler.setObjectValue(stringToObjectConverter,pInner,pAttribute,pValue); } else { throw new IllegalStateException( "Internal error: No handler found for class " + clazz + " for setting object value." + " (object: " + pInner + ", attribute: " + pAttribute + ", value: " + pValue + ")"); } }
java
private Object setObjectValue(Object pInner, String pAttribute, Object pValue) throws IllegalAccessException, InvocationTargetException { // Call various handlers depending on the type of the inner object, as is extract Object Class clazz = pInner.getClass(); if (clazz.isArray()) { return arrayExtractor.setObjectValue(stringToObjectConverter,pInner,pAttribute,pValue); } Extractor handler = getExtractor(clazz); if (handler != null) { return handler.setObjectValue(stringToObjectConverter,pInner,pAttribute,pValue); } else { throw new IllegalStateException( "Internal error: No handler found for class " + clazz + " for setting object value." + " (object: " + pInner + ", attribute: " + pAttribute + ", value: " + pValue + ")"); } }
[ "private", "Object", "setObjectValue", "(", "Object", "pInner", ",", "String", "pAttribute", ",", "Object", "pValue", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", "{", "// Call various handlers depending on the type of the inner object, as is extract Object", "Class", "clazz", "=", "pInner", ".", "getClass", "(", ")", ";", "if", "(", "clazz", ".", "isArray", "(", ")", ")", "{", "return", "arrayExtractor", ".", "setObjectValue", "(", "stringToObjectConverter", ",", "pInner", ",", "pAttribute", ",", "pValue", ")", ";", "}", "Extractor", "handler", "=", "getExtractor", "(", "clazz", ")", ";", "if", "(", "handler", "!=", "null", ")", "{", "return", "handler", ".", "setObjectValue", "(", "stringToObjectConverter", ",", "pInner", ",", "pAttribute", ",", "pValue", ")", ";", "}", "else", "{", "throw", "new", "IllegalStateException", "(", "\"Internal error: No handler found for class \"", "+", "clazz", "+", "\" for setting object value.\"", "+", "\" (object: \"", "+", "pInner", "+", "\", attribute: \"", "+", "pAttribute", "+", "\", value: \"", "+", "pValue", "+", "\")\"", ")", ";", "}", "}" ]
Set an value of an inner object @param pInner the inner object @param pAttribute the attribute to set @param pValue the value to set @return the old value @throws IllegalAccessException if the reflection code fails during setting of the value @throws InvocationTargetException reflection error
[ "Set", "an", "value", "of", "an", "inner", "object" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/json/ObjectToJsonConverter.java#L226-L244
forge/javaee-descriptors
impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/facespartialresponse20/WebFacesPartialResponseDescriptorImpl.java
WebFacesPartialResponseDescriptorImpl.addNamespace
public WebFacesPartialResponseDescriptor addNamespace(String name, String value) { """ Adds a new namespace @return the current instance of <code>WebFacesPartialResponseDescriptor</code> """ model.attribute(name, value); return this; }
java
public WebFacesPartialResponseDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
[ "public", "WebFacesPartialResponseDescriptor", "addNamespace", "(", "String", "name", ",", "String", "value", ")", "{", "model", ".", "attribute", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a new namespace @return the current instance of <code>WebFacesPartialResponseDescriptor</code>
[ "Adds", "a", "new", "namespace" ]
train
https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/facespartialresponse20/WebFacesPartialResponseDescriptorImpl.java#L85-L89
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java
LineSegment.getIntersection
public Coordinate getIntersection(LineSegment lineSegment) { """ Return the intersection point of 2 lines. Yes you are reading this correctly! For this function the LineSegments are treated as lines. This means that the intersection point does not necessarily lie on the LineSegment (in that case, the {@link #intersects} function would return false). @param lineSegment The other LineSegment. @return A {@link Coordinate} representing the intersection point. """ // may not be on either one of the line segments. // http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ double x1 = this.x1(); double y1 = this.y1(); double x2 = this.x2(); double y2 = this.y2(); double x3 = lineSegment.x1(); double y3 = lineSegment.y1(); double x4 = lineSegment.x2(); double y4 = lineSegment.y2(); double denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); double u1 = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom; double x = x1 + u1 * (x2 - x1); double y = y1 + u1 * (y2 - y1); return new Coordinate(x, y); }
java
public Coordinate getIntersection(LineSegment lineSegment) { // may not be on either one of the line segments. // http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ double x1 = this.x1(); double y1 = this.y1(); double x2 = this.x2(); double y2 = this.y2(); double x3 = lineSegment.x1(); double y3 = lineSegment.y1(); double x4 = lineSegment.x2(); double y4 = lineSegment.y2(); double denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1); double u1 = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom; double x = x1 + u1 * (x2 - x1); double y = y1 + u1 * (y2 - y1); return new Coordinate(x, y); }
[ "public", "Coordinate", "getIntersection", "(", "LineSegment", "lineSegment", ")", "{", "// may not be on either one of the line segments.", "// http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/", "double", "x1", "=", "this", ".", "x1", "(", ")", ";", "double", "y1", "=", "this", ".", "y1", "(", ")", ";", "double", "x2", "=", "this", ".", "x2", "(", ")", ";", "double", "y2", "=", "this", ".", "y2", "(", ")", ";", "double", "x3", "=", "lineSegment", ".", "x1", "(", ")", ";", "double", "y3", "=", "lineSegment", ".", "y1", "(", ")", ";", "double", "x4", "=", "lineSegment", ".", "x2", "(", ")", ";", "double", "y4", "=", "lineSegment", ".", "y2", "(", ")", ";", "double", "denom", "=", "(", "y4", "-", "y3", ")", "*", "(", "x2", "-", "x1", ")", "-", "(", "x4", "-", "x3", ")", "*", "(", "y2", "-", "y1", ")", ";", "double", "u1", "=", "(", "(", "x4", "-", "x3", ")", "*", "(", "y1", "-", "y3", ")", "-", "(", "y4", "-", "y3", ")", "*", "(", "x1", "-", "x3", ")", ")", "/", "denom", ";", "double", "x", "=", "x1", "+", "u1", "*", "(", "x2", "-", "x1", ")", ";", "double", "y", "=", "y1", "+", "u1", "*", "(", "y2", "-", "y1", ")", ";", "return", "new", "Coordinate", "(", "x", ",", "y", ")", ";", "}" ]
Return the intersection point of 2 lines. Yes you are reading this correctly! For this function the LineSegments are treated as lines. This means that the intersection point does not necessarily lie on the LineSegment (in that case, the {@link #intersects} function would return false). @param lineSegment The other LineSegment. @return A {@link Coordinate} representing the intersection point.
[ "Return", "the", "intersection", "point", "of", "2", "lines", ".", "Yes", "you", "are", "reading", "this", "correctly!", "For", "this", "function", "the", "LineSegments", "are", "treated", "as", "lines", ".", "This", "means", "that", "the", "intersection", "point", "does", "not", "necessarily", "lie", "on", "the", "LineSegment", "(", "in", "that", "case", "the", "{", "@link", "#intersects", "}", "function", "would", "return", "false", ")", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/LineSegment.java#L118-L135
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/core/Parser.java
Parser.parseLineComment
public static int parseLineComment(final char[] query, int offset) { """ Test if the <tt>-</tt> character at <tt>offset</tt> starts a <tt>--</tt> style line comment, and return the position of the first <tt>\r</tt> or <tt>\n</tt> character. @param query query @param offset start offset @return position of the first <tt>\r</tt> or <tt>\n</tt> character """ if (offset + 1 < query.length && query[offset + 1] == '-') { while (offset + 1 < query.length) { offset++; if (query[offset] == '\r' || query[offset] == '\n') { break; } } } return offset; }
java
public static int parseLineComment(final char[] query, int offset) { if (offset + 1 < query.length && query[offset + 1] == '-') { while (offset + 1 < query.length) { offset++; if (query[offset] == '\r' || query[offset] == '\n') { break; } } } return offset; }
[ "public", "static", "int", "parseLineComment", "(", "final", "char", "[", "]", "query", ",", "int", "offset", ")", "{", "if", "(", "offset", "+", "1", "<", "query", ".", "length", "&&", "query", "[", "offset", "+", "1", "]", "==", "'", "'", ")", "{", "while", "(", "offset", "+", "1", "<", "query", ".", "length", ")", "{", "offset", "++", ";", "if", "(", "query", "[", "offset", "]", "==", "'", "'", "||", "query", "[", "offset", "]", "==", "'", "'", ")", "{", "break", ";", "}", "}", "}", "return", "offset", ";", "}" ]
Test if the <tt>-</tt> character at <tt>offset</tt> starts a <tt>--</tt> style line comment, and return the position of the first <tt>\r</tt> or <tt>\n</tt> character. @param query query @param offset start offset @return position of the first <tt>\r</tt> or <tt>\n</tt> character
[ "Test", "if", "the", "<tt", ">", "-", "<", "/", "tt", ">", "character", "at", "<tt", ">", "offset<", "/", "tt", ">", "starts", "a", "<tt", ">", "--", "<", "/", "tt", ">", "style", "line", "comment", "and", "return", "the", "position", "of", "the", "first", "<tt", ">", "\\", "r<", "/", "tt", ">", "or", "<tt", ">", "\\", "n<", "/", "tt", ">", "character", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/Parser.java#L503-L513
graknlabs/grakn
server/src/server/exception/TemporaryWriteException.java
TemporaryWriteException.indexOverlap
public static TemporaryWriteException indexOverlap(Vertex vertex, Exception e) { """ Thrown when multiple transactions overlap in using an index. This results in incomplete vertices being shared between transactions. """ return new TemporaryWriteException(String.format("Index overlap has led to the accidental sharing of a partially complete vertex {%s}", vertex), e); }
java
public static TemporaryWriteException indexOverlap(Vertex vertex, Exception e){ return new TemporaryWriteException(String.format("Index overlap has led to the accidental sharing of a partially complete vertex {%s}", vertex), e); }
[ "public", "static", "TemporaryWriteException", "indexOverlap", "(", "Vertex", "vertex", ",", "Exception", "e", ")", "{", "return", "new", "TemporaryWriteException", "(", "String", ".", "format", "(", "\"Index overlap has led to the accidental sharing of a partially complete vertex {%s}\"", ",", "vertex", ")", ",", "e", ")", ";", "}" ]
Thrown when multiple transactions overlap in using an index. This results in incomplete vertices being shared between transactions.
[ "Thrown", "when", "multiple", "transactions", "overlap", "in", "using", "an", "index", ".", "This", "results", "in", "incomplete", "vertices", "being", "shared", "between", "transactions", "." ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/exception/TemporaryWriteException.java#L54-L56
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java
TaskSlotTable.markSlotInactive
public boolean markSlotInactive(AllocationID allocationId, Time slotTimeout) throws SlotNotFoundException { """ Marks the slot under the given allocation id as inactive. If the slot could not be found, then a {@link SlotNotFoundException} is thrown. @param allocationId to identify the task slot to mark as inactive @param slotTimeout until the slot times out @throws SlotNotFoundException if the slot could not be found for the given allocation id @return True if the slot could be marked inactive """ checkInit(); TaskSlot taskSlot = getTaskSlot(allocationId); if (taskSlot != null) { if (taskSlot.markInactive()) { // register a timeout to free the slot timerService.registerTimeout(allocationId, slotTimeout.getSize(), slotTimeout.getUnit()); return true; } else { return false; } } else { throw new SlotNotFoundException(allocationId); } }
java
public boolean markSlotInactive(AllocationID allocationId, Time slotTimeout) throws SlotNotFoundException { checkInit(); TaskSlot taskSlot = getTaskSlot(allocationId); if (taskSlot != null) { if (taskSlot.markInactive()) { // register a timeout to free the slot timerService.registerTimeout(allocationId, slotTimeout.getSize(), slotTimeout.getUnit()); return true; } else { return false; } } else { throw new SlotNotFoundException(allocationId); } }
[ "public", "boolean", "markSlotInactive", "(", "AllocationID", "allocationId", ",", "Time", "slotTimeout", ")", "throws", "SlotNotFoundException", "{", "checkInit", "(", ")", ";", "TaskSlot", "taskSlot", "=", "getTaskSlot", "(", "allocationId", ")", ";", "if", "(", "taskSlot", "!=", "null", ")", "{", "if", "(", "taskSlot", ".", "markInactive", "(", ")", ")", "{", "// register a timeout to free the slot", "timerService", ".", "registerTimeout", "(", "allocationId", ",", "slotTimeout", ".", "getSize", "(", ")", ",", "slotTimeout", ".", "getUnit", "(", ")", ")", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}", "else", "{", "throw", "new", "SlotNotFoundException", "(", "allocationId", ")", ";", "}", "}" ]
Marks the slot under the given allocation id as inactive. If the slot could not be found, then a {@link SlotNotFoundException} is thrown. @param allocationId to identify the task slot to mark as inactive @param slotTimeout until the slot times out @throws SlotNotFoundException if the slot could not be found for the given allocation id @return True if the slot could be marked inactive
[ "Marks", "the", "slot", "under", "the", "given", "allocation", "id", "as", "inactive", ".", "If", "the", "slot", "could", "not", "be", "found", "then", "a", "{", "@link", "SlotNotFoundException", "}", "is", "thrown", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L259-L276
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java
ClassDocImpl.serializationMethods
public MethodDoc[] serializationMethods() { """ Return the serialization methods for this class. @return an array of <code>MethodDocImpl</code> that represents the serialization methods for this class. """ if (serializedForm == null) { serializedForm = new SerializedForm(env, tsym, this); } //### Clone this? return serializedForm.methods(); }
java
public MethodDoc[] serializationMethods() { if (serializedForm == null) { serializedForm = new SerializedForm(env, tsym, this); } //### Clone this? return serializedForm.methods(); }
[ "public", "MethodDoc", "[", "]", "serializationMethods", "(", ")", "{", "if", "(", "serializedForm", "==", "null", ")", "{", "serializedForm", "=", "new", "SerializedForm", "(", "env", ",", "tsym", ",", "this", ")", ";", "}", "//### Clone this?", "return", "serializedForm", ".", "methods", "(", ")", ";", "}" ]
Return the serialization methods for this class. @return an array of <code>MethodDocImpl</code> that represents the serialization methods for this class.
[ "Return", "the", "serialization", "methods", "for", "this", "class", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java#L1258-L1264
impossibl/stencil
engine/src/main/java/com/impossibl/stencil/engine/StencilEngine.java
StencilEngine.renderInline
public String renderInline(String text, GlobalScope... extraGlobalScopes) throws IOException, ParseException { """ Renders given text and returns rendered text. @param text Template text to render @param extraGlobalScopes Any extra global scopes to make available @return Rendered text @throws IOException @throws ParseException """ return render(loadInline(text), extraGlobalScopes); }
java
public String renderInline(String text, GlobalScope... extraGlobalScopes) throws IOException, ParseException { return render(loadInline(text), extraGlobalScopes); }
[ "public", "String", "renderInline", "(", "String", "text", ",", "GlobalScope", "...", "extraGlobalScopes", ")", "throws", "IOException", ",", "ParseException", "{", "return", "render", "(", "loadInline", "(", "text", ")", ",", "extraGlobalScopes", ")", ";", "}" ]
Renders given text and returns rendered text. @param text Template text to render @param extraGlobalScopes Any extra global scopes to make available @return Rendered text @throws IOException @throws ParseException
[ "Renders", "given", "text", "and", "returns", "rendered", "text", "." ]
train
https://github.com/impossibl/stencil/blob/4aac1be605542b4248be95bf8916be4e2f755d1c/engine/src/main/java/com/impossibl/stencil/engine/StencilEngine.java#L299-L301
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONAssert.java
JSONAssert.assertEquals
public static void assertEquals(String message, String expectedStr, String actualStr, JSONCompareMode compareMode) throws JSONException { """ Asserts that the JSONArray provided matches the expected string. If it isn't it throws an {@link AssertionError}. @param message Error message to be displayed in case of assertion failure @param expectedStr Expected JSON string @param actualStr String to compare @param compareMode Specifies which comparison mode to use @throws JSONException JSON parsing error """ if (expectedStr==actualStr) return; if (expectedStr==null){ throw new AssertionError("Expected string is null."); }else if (actualStr==null){ throw new AssertionError("Actual string is null."); } JSONCompareResult result = JSONCompare.compareJSON(expectedStr, actualStr, compareMode); if (result.failed()) { throw new AssertionError(getCombinedMessage(message, result.getMessage())); } }
java
public static void assertEquals(String message, String expectedStr, String actualStr, JSONCompareMode compareMode) throws JSONException { if (expectedStr==actualStr) return; if (expectedStr==null){ throw new AssertionError("Expected string is null."); }else if (actualStr==null){ throw new AssertionError("Actual string is null."); } JSONCompareResult result = JSONCompare.compareJSON(expectedStr, actualStr, compareMode); if (result.failed()) { throw new AssertionError(getCombinedMessage(message, result.getMessage())); } }
[ "public", "static", "void", "assertEquals", "(", "String", "message", ",", "String", "expectedStr", ",", "String", "actualStr", ",", "JSONCompareMode", "compareMode", ")", "throws", "JSONException", "{", "if", "(", "expectedStr", "==", "actualStr", ")", "return", ";", "if", "(", "expectedStr", "==", "null", ")", "{", "throw", "new", "AssertionError", "(", "\"Expected string is null.\"", ")", ";", "}", "else", "if", "(", "actualStr", "==", "null", ")", "{", "throw", "new", "AssertionError", "(", "\"Actual string is null.\"", ")", ";", "}", "JSONCompareResult", "result", "=", "JSONCompare", ".", "compareJSON", "(", "expectedStr", ",", "actualStr", ",", "compareMode", ")", ";", "if", "(", "result", ".", "failed", "(", ")", ")", "{", "throw", "new", "AssertionError", "(", "getCombinedMessage", "(", "message", ",", "result", ".", "getMessage", "(", ")", ")", ")", ";", "}", "}" ]
Asserts that the JSONArray provided matches the expected string. If it isn't it throws an {@link AssertionError}. @param message Error message to be displayed in case of assertion failure @param expectedStr Expected JSON string @param actualStr String to compare @param compareMode Specifies which comparison mode to use @throws JSONException JSON parsing error
[ "Asserts", "that", "the", "JSONArray", "provided", "matches", "the", "expected", "string", ".", "If", "it", "isn", "t", "it", "throws", "an", "{", "@link", "AssertionError", "}", "." ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L407-L419
aehrc/ontology-core
ontology-import/src/main/java/au/csiro/ontology/importer/rf2/RF2Importer.java
RF2Importer.getOntologyBuilder
protected OntologyBuilder getOntologyBuilder(VersionRows vr, String rootModuleId, String rootModuleVersion, Map<String, String> metadata) { """ Hook method for subclasses to override. @param vr @param rootModuleId @param rootModuleVersion @param includeInactiveAxioms @return """ return new OntologyBuilder(vr, rootModuleId, rootModuleVersion, metadata); }
java
protected OntologyBuilder getOntologyBuilder(VersionRows vr, String rootModuleId, String rootModuleVersion, Map<String, String> metadata) { return new OntologyBuilder(vr, rootModuleId, rootModuleVersion, metadata); }
[ "protected", "OntologyBuilder", "getOntologyBuilder", "(", "VersionRows", "vr", ",", "String", "rootModuleId", ",", "String", "rootModuleVersion", ",", "Map", "<", "String", ",", "String", ">", "metadata", ")", "{", "return", "new", "OntologyBuilder", "(", "vr", ",", "rootModuleId", ",", "rootModuleVersion", ",", "metadata", ")", ";", "}" ]
Hook method for subclasses to override. @param vr @param rootModuleId @param rootModuleVersion @param includeInactiveAxioms @return
[ "Hook", "method", "for", "subclasses", "to", "override", "." ]
train
https://github.com/aehrc/ontology-core/blob/446aa691119f2bbcb8d184566084b8da7a07a44e/ontology-import/src/main/java/au/csiro/ontology/importer/rf2/RF2Importer.java#L663-L666
primefaces-extensions/core
src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java
DynaFormRow.addControl
public DynaFormControl addControl(final Object data, final int colspan, final int rowspan) { """ Adds control with given data, default type, colspan and rowspan. @param data data object @param colspan colspan @param rowspan rowspan @return DynaFormControl added control """ return addControl(data, DynaFormControl.DEFAULT_TYPE, colspan, rowspan); }
java
public DynaFormControl addControl(final Object data, final int colspan, final int rowspan) { return addControl(data, DynaFormControl.DEFAULT_TYPE, colspan, rowspan); }
[ "public", "DynaFormControl", "addControl", "(", "final", "Object", "data", ",", "final", "int", "colspan", ",", "final", "int", "rowspan", ")", "{", "return", "addControl", "(", "data", ",", "DynaFormControl", ".", "DEFAULT_TYPE", ",", "colspan", ",", "rowspan", ")", ";", "}" ]
Adds control with given data, default type, colspan and rowspan. @param data data object @param colspan colspan @param rowspan rowspan @return DynaFormControl added control
[ "Adds", "control", "with", "given", "data", "default", "type", "colspan", "and", "rowspan", "." ]
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/model/dynaform/DynaFormRow.java#L82-L84
igniterealtime/REST-API-Client
src/main/java/org/igniterealtime/restclient/RestApiClient.java
RestApiClient.deleteMember
public Response deleteMember(String roomName, String jid) { """ Delete member from chatroom. @param roomName the room name @param jid the jid @return the response """ return restClient.delete("chatrooms/" + roomName + "/members/" + jid, new HashMap<String, String>()); }
java
public Response deleteMember(String roomName, String jid) { return restClient.delete("chatrooms/" + roomName + "/members/" + jid, new HashMap<String, String>()); }
[ "public", "Response", "deleteMember", "(", "String", "roomName", ",", "String", "jid", ")", "{", "return", "restClient", ".", "delete", "(", "\"chatrooms/\"", "+", "roomName", "+", "\"/members/\"", "+", "jid", ",", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ";", "}" ]
Delete member from chatroom. @param roomName the room name @param jid the jid @return the response
[ "Delete", "member", "from", "chatroom", "." ]
train
https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L315-L318
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java
GeometryUtilities.scaleDownToFit
public static void scaleDownToFit( Rectangle2D rectToFitIn, Rectangle2D toScale ) { """ Scales a rectangle down to fit inside the given one, keeping the ratio. @param rectToFitIn the fixed rectangle to fit in. @param toScale the rectangle to scale. """ double fitWidth = rectToFitIn.getWidth(); double fitHeight = rectToFitIn.getHeight(); double toScaleWidth = toScale.getWidth(); double toScaleHeight = toScale.getHeight(); if (toScaleWidth > fitWidth) { double factor = toScaleWidth / fitWidth; toScaleWidth = fitWidth; toScaleHeight = toScaleHeight / factor; } if (toScaleHeight > fitHeight) { double factor = toScaleHeight / fitHeight; toScaleHeight = fitHeight; toScaleWidth = toScaleWidth / factor; } toScale.setRect(0, 0, toScaleWidth, toScaleHeight); }
java
public static void scaleDownToFit( Rectangle2D rectToFitIn, Rectangle2D toScale ) { double fitWidth = rectToFitIn.getWidth(); double fitHeight = rectToFitIn.getHeight(); double toScaleWidth = toScale.getWidth(); double toScaleHeight = toScale.getHeight(); if (toScaleWidth > fitWidth) { double factor = toScaleWidth / fitWidth; toScaleWidth = fitWidth; toScaleHeight = toScaleHeight / factor; } if (toScaleHeight > fitHeight) { double factor = toScaleHeight / fitHeight; toScaleHeight = fitHeight; toScaleWidth = toScaleWidth / factor; } toScale.setRect(0, 0, toScaleWidth, toScaleHeight); }
[ "public", "static", "void", "scaleDownToFit", "(", "Rectangle2D", "rectToFitIn", ",", "Rectangle2D", "toScale", ")", "{", "double", "fitWidth", "=", "rectToFitIn", ".", "getWidth", "(", ")", ";", "double", "fitHeight", "=", "rectToFitIn", ".", "getHeight", "(", ")", ";", "double", "toScaleWidth", "=", "toScale", ".", "getWidth", "(", ")", ";", "double", "toScaleHeight", "=", "toScale", ".", "getHeight", "(", ")", ";", "if", "(", "toScaleWidth", ">", "fitWidth", ")", "{", "double", "factor", "=", "toScaleWidth", "/", "fitWidth", ";", "toScaleWidth", "=", "fitWidth", ";", "toScaleHeight", "=", "toScaleHeight", "/", "factor", ";", "}", "if", "(", "toScaleHeight", ">", "fitHeight", ")", "{", "double", "factor", "=", "toScaleHeight", "/", "fitHeight", ";", "toScaleHeight", "=", "fitHeight", ";", "toScaleWidth", "=", "toScaleWidth", "/", "factor", ";", "}", "toScale", ".", "setRect", "(", "0", ",", "0", ",", "toScaleWidth", ",", "toScaleHeight", ")", ";", "}" ]
Scales a rectangle down to fit inside the given one, keeping the ratio. @param rectToFitIn the fixed rectangle to fit in. @param toScale the rectangle to scale.
[ "Scales", "a", "rectangle", "down", "to", "fit", "inside", "the", "given", "one", "keeping", "the", "ratio", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L716-L734
google/closure-templates
java/src/com/google/template/soy/plugin/java/restricted/JavaValueFactory.java
JavaValueFactory.createMethod
public static Method createMethod(Class<?> clazz, String methodName, Class<?>... params) { """ Convenience method for retrieving a {@link Method} from a class. @see Class#getMethod(String, Class...) """ try { return clazz.getMethod(methodName, params); } catch (NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } }
java
public static Method createMethod(Class<?> clazz, String methodName, Class<?>... params) { try { return clazz.getMethod(methodName, params); } catch (NoSuchMethodException | SecurityException e) { throw new IllegalArgumentException(e); } }
[ "public", "static", "Method", "createMethod", "(", "Class", "<", "?", ">", "clazz", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "params", ")", "{", "try", "{", "return", "clazz", ".", "getMethod", "(", "methodName", ",", "params", ")", ";", "}", "catch", "(", "NoSuchMethodException", "|", "SecurityException", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "e", ")", ";", "}", "}" ]
Convenience method for retrieving a {@link Method} from a class. @see Class#getMethod(String, Class...)
[ "Convenience", "method", "for", "retrieving", "a", "{", "@link", "Method", "}", "from", "a", "class", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/plugin/java/restricted/JavaValueFactory.java#L61-L67
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java
DatabasesInner.listByServerAsync
public Observable<Page<DatabaseInner>> listByServerAsync(final String resourceGroupName, final String serverName) { """ Gets a list of databases. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DatabaseInner&gt; object """ return listByServerWithServiceResponseAsync(resourceGroupName, serverName) .map(new Func1<ServiceResponse<Page<DatabaseInner>>, Page<DatabaseInner>>() { @Override public Page<DatabaseInner> call(ServiceResponse<Page<DatabaseInner>> response) { return response.body(); } }); }
java
public Observable<Page<DatabaseInner>> listByServerAsync(final String resourceGroupName, final String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName) .map(new Func1<ServiceResponse<Page<DatabaseInner>>, Page<DatabaseInner>>() { @Override public Page<DatabaseInner> call(ServiceResponse<Page<DatabaseInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "DatabaseInner", ">", ">", "listByServerAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "DatabaseInner", ">", ">", ",", "Page", "<", "DatabaseInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "DatabaseInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "DatabaseInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a list of databases. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DatabaseInner&gt; object
[ "Gets", "a", "list", "of", "databases", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabasesInner.java#L192-L200
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/Jinx.java
Jinx.flickrUpload
public <T> T flickrUpload(Map<String, String> params, byte[] photoData, Class<T> tClass) throws JinxException { """ Upload a photo or video to Flickr. <br> Do not call this directly. Use the {@link net.jeremybrooks.jinx.api.PhotosUploadApi} class. @param params request parameters. @param photoData photo or video data to upload. @param tClass the class that will be returned. @param <T> type of the class returned. @return an instance of the specified class containing data from Flickr. @throws JinxException if there are any errors. """ if (this.oAuthAccessToken == null) { throw new JinxException("Jinx has not been configured with an OAuth Access Token."); } params.put("api_key", getApiKey()); return uploadOrReplace(params, photoData, tClass, new OAuthRequest(Verb.POST, FLICKR_PHOTO_UPLOAD_URL)); }
java
public <T> T flickrUpload(Map<String, String> params, byte[] photoData, Class<T> tClass) throws JinxException { if (this.oAuthAccessToken == null) { throw new JinxException("Jinx has not been configured with an OAuth Access Token."); } params.put("api_key", getApiKey()); return uploadOrReplace(params, photoData, tClass, new OAuthRequest(Verb.POST, FLICKR_PHOTO_UPLOAD_URL)); }
[ "public", "<", "T", ">", "T", "flickrUpload", "(", "Map", "<", "String", ",", "String", ">", "params", ",", "byte", "[", "]", "photoData", ",", "Class", "<", "T", ">", "tClass", ")", "throws", "JinxException", "{", "if", "(", "this", ".", "oAuthAccessToken", "==", "null", ")", "{", "throw", "new", "JinxException", "(", "\"Jinx has not been configured with an OAuth Access Token.\"", ")", ";", "}", "params", ".", "put", "(", "\"api_key\"", ",", "getApiKey", "(", ")", ")", ";", "return", "uploadOrReplace", "(", "params", ",", "photoData", ",", "tClass", ",", "new", "OAuthRequest", "(", "Verb", ".", "POST", ",", "FLICKR_PHOTO_UPLOAD_URL", ")", ")", ";", "}" ]
Upload a photo or video to Flickr. <br> Do not call this directly. Use the {@link net.jeremybrooks.jinx.api.PhotosUploadApi} class. @param params request parameters. @param photoData photo or video data to upload. @param tClass the class that will be returned. @param <T> type of the class returned. @return an instance of the specified class containing data from Flickr. @throws JinxException if there are any errors.
[ "Upload", "a", "photo", "or", "video", "to", "Flickr", ".", "<br", ">", "Do", "not", "call", "this", "directly", ".", "Use", "the", "{", "@link", "net", ".", "jeremybrooks", ".", "jinx", ".", "api", ".", "PhotosUploadApi", "}", "class", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/Jinx.java#L593-L599
twilio/twilio-java
src/main/java/com/twilio/rest/authy/v1/service/EntityReader.java
EntityReader.previousPage
@Override public Page<Entity> previousPage(final Page<Entity> page, final TwilioRestClient client) { """ Retrieve the previous page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Previous Page """ Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.AUTHY.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<Entity> previousPage(final Page<Entity> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getPreviousPageUrl( Domains.AUTHY.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "Entity", ">", "previousPage", "(", "final", "Page", "<", "Entity", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", ",", "page", ".", "getPreviousPageUrl", "(", "Domains", ".", "AUTHY", ".", "toString", "(", ")", ",", "client", ".", "getRegion", "(", ")", ")", ")", ";", "return", "pageForRequest", "(", "client", ",", "request", ")", ";", "}" ]
Retrieve the previous page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Previous Page
[ "Retrieve", "the", "previous", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/authy/v1/service/EntityReader.java#L115-L126
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/waiters/WaiterExecution.java
WaiterExecution.pollResource
public boolean pollResource() throws AmazonServiceException, WaiterTimedOutException, WaiterUnrecoverableException { """ Polls until a specified resource transitions into either success or failure state or until the specified number of retries has been made. @return True if the resource transitions into desired state. @throws AmazonServiceException If the service exception thrown doesn't match any of the expected exceptions, it's re-thrown. @throws WaiterUnrecoverableException If the resource transitions into a failure/unexpected state. @throws WaiterTimedOutException If the resource doesn't transition into the desired state even after a certain number of retries. """ int retriesAttempted = 0; while (true) { switch (getCurrentState()) { case SUCCESS: return true; case FAILURE: throw new WaiterUnrecoverableException("Resource never entered the desired state as it failed."); case RETRY: PollingStrategyContext pollingStrategyContext = new PollingStrategyContext(request, retriesAttempted); if (pollingStrategy.getRetryStrategy().shouldRetry(pollingStrategyContext)) { safeCustomDelay(pollingStrategyContext); retriesAttempted++; } else { throw new WaiterTimedOutException("Reached maximum attempts without transitioning to the desired state"); } break; } } }
java
public boolean pollResource() throws AmazonServiceException, WaiterTimedOutException, WaiterUnrecoverableException { int retriesAttempted = 0; while (true) { switch (getCurrentState()) { case SUCCESS: return true; case FAILURE: throw new WaiterUnrecoverableException("Resource never entered the desired state as it failed."); case RETRY: PollingStrategyContext pollingStrategyContext = new PollingStrategyContext(request, retriesAttempted); if (pollingStrategy.getRetryStrategy().shouldRetry(pollingStrategyContext)) { safeCustomDelay(pollingStrategyContext); retriesAttempted++; } else { throw new WaiterTimedOutException("Reached maximum attempts without transitioning to the desired state"); } break; } } }
[ "public", "boolean", "pollResource", "(", ")", "throws", "AmazonServiceException", ",", "WaiterTimedOutException", ",", "WaiterUnrecoverableException", "{", "int", "retriesAttempted", "=", "0", ";", "while", "(", "true", ")", "{", "switch", "(", "getCurrentState", "(", ")", ")", "{", "case", "SUCCESS", ":", "return", "true", ";", "case", "FAILURE", ":", "throw", "new", "WaiterUnrecoverableException", "(", "\"Resource never entered the desired state as it failed.\"", ")", ";", "case", "RETRY", ":", "PollingStrategyContext", "pollingStrategyContext", "=", "new", "PollingStrategyContext", "(", "request", ",", "retriesAttempted", ")", ";", "if", "(", "pollingStrategy", ".", "getRetryStrategy", "(", ")", ".", "shouldRetry", "(", "pollingStrategyContext", ")", ")", "{", "safeCustomDelay", "(", "pollingStrategyContext", ")", ";", "retriesAttempted", "++", ";", "}", "else", "{", "throw", "new", "WaiterTimedOutException", "(", "\"Reached maximum attempts without transitioning to the desired state\"", ")", ";", "}", "break", ";", "}", "}", "}" ]
Polls until a specified resource transitions into either success or failure state or until the specified number of retries has been made. @return True if the resource transitions into desired state. @throws AmazonServiceException If the service exception thrown doesn't match any of the expected exceptions, it's re-thrown. @throws WaiterUnrecoverableException If the resource transitions into a failure/unexpected state. @throws WaiterTimedOutException If the resource doesn't transition into the desired state even after a certain number of retries.
[ "Polls", "until", "a", "specified", "resource", "transitions", "into", "either", "success", "or", "failure", "state", "or", "until", "the", "specified", "number", "of", "retries", "has", "been", "made", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/waiters/WaiterExecution.java#L71-L92
tempodb/tempodb-java
src/main/java/com/tempodb/Client.java
Client.readDataPoints
public Cursor<DataPoint> readDataPoints(Filter filter, Interval interval, DateTimeZone timezone, Aggregation aggregation, Rollup rollup, Interpolation interpolation) { """ Returns a cursor of datapoints specified by a series filter. This endpoint allows one to request multiple series and apply an aggregation function. @param filter The series filter @param interval An interval of time for the query (start/end datetimes) @param timezone The time zone for the returned datapoints. @param aggregation The aggregation for the read query. This is required. @param rollup The rollup for the read query. This can be null. @param interpolation The interpolation for the read query. This can be null. @return A Cursor of DataPoints. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request. @see Aggregation @see Cursor @see Filter @see Interpolation @see Rollup @since 1.0.0 """ checkNotNull(filter); checkNotNull(interval); checkNotNull(aggregation); checkNotNull(timezone); URI uri = null; try { URIBuilder builder = new URIBuilder(String.format("/%s/segment/", API_VERSION)); addFilterToURI(builder, filter); addInterpolationToURI(builder, interpolation); addIntervalToURI(builder, interval); addAggregationToURI(builder, aggregation); addRollupToURI(builder, rollup); addTimeZoneToURI(builder, timezone); uri = builder.build(); } catch (URISyntaxException e) { String message = String.format("Could not build URI with inputs: filter: %s, interval: %s, aggregation: %s, rollup: %s, timezone: %s", filter, interval, aggregation, rollup, timezone); throw new IllegalArgumentException(message, e); } Cursor<DataPoint> cursor = new DataPointCursor(uri, this); return cursor; }
java
public Cursor<DataPoint> readDataPoints(Filter filter, Interval interval, DateTimeZone timezone, Aggregation aggregation, Rollup rollup, Interpolation interpolation) { checkNotNull(filter); checkNotNull(interval); checkNotNull(aggregation); checkNotNull(timezone); URI uri = null; try { URIBuilder builder = new URIBuilder(String.format("/%s/segment/", API_VERSION)); addFilterToURI(builder, filter); addInterpolationToURI(builder, interpolation); addIntervalToURI(builder, interval); addAggregationToURI(builder, aggregation); addRollupToURI(builder, rollup); addTimeZoneToURI(builder, timezone); uri = builder.build(); } catch (URISyntaxException e) { String message = String.format("Could not build URI with inputs: filter: %s, interval: %s, aggregation: %s, rollup: %s, timezone: %s", filter, interval, aggregation, rollup, timezone); throw new IllegalArgumentException(message, e); } Cursor<DataPoint> cursor = new DataPointCursor(uri, this); return cursor; }
[ "public", "Cursor", "<", "DataPoint", ">", "readDataPoints", "(", "Filter", "filter", ",", "Interval", "interval", ",", "DateTimeZone", "timezone", ",", "Aggregation", "aggregation", ",", "Rollup", "rollup", ",", "Interpolation", "interpolation", ")", "{", "checkNotNull", "(", "filter", ")", ";", "checkNotNull", "(", "interval", ")", ";", "checkNotNull", "(", "aggregation", ")", ";", "checkNotNull", "(", "timezone", ")", ";", "URI", "uri", "=", "null", ";", "try", "{", "URIBuilder", "builder", "=", "new", "URIBuilder", "(", "String", ".", "format", "(", "\"/%s/segment/\"", ",", "API_VERSION", ")", ")", ";", "addFilterToURI", "(", "builder", ",", "filter", ")", ";", "addInterpolationToURI", "(", "builder", ",", "interpolation", ")", ";", "addIntervalToURI", "(", "builder", ",", "interval", ")", ";", "addAggregationToURI", "(", "builder", ",", "aggregation", ")", ";", "addRollupToURI", "(", "builder", ",", "rollup", ")", ";", "addTimeZoneToURI", "(", "builder", ",", "timezone", ")", ";", "uri", "=", "builder", ".", "build", "(", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "String", "message", "=", "String", ".", "format", "(", "\"Could not build URI with inputs: filter: %s, interval: %s, aggregation: %s, rollup: %s, timezone: %s\"", ",", "filter", ",", "interval", ",", "aggregation", ",", "rollup", ",", "timezone", ")", ";", "throw", "new", "IllegalArgumentException", "(", "message", ",", "e", ")", ";", "}", "Cursor", "<", "DataPoint", ">", "cursor", "=", "new", "DataPointCursor", "(", "uri", ",", "this", ")", ";", "return", "cursor", ";", "}" ]
Returns a cursor of datapoints specified by a series filter. This endpoint allows one to request multiple series and apply an aggregation function. @param filter The series filter @param interval An interval of time for the query (start/end datetimes) @param timezone The time zone for the returned datapoints. @param aggregation The aggregation for the read query. This is required. @param rollup The rollup for the read query. This can be null. @param interpolation The interpolation for the read query. This can be null. @return A Cursor of DataPoints. The cursor.iterator().next() may throw a {@link TempoDBException} if an error occurs while making a request. @see Aggregation @see Cursor @see Filter @see Interpolation @see Rollup @since 1.0.0
[ "Returns", "a", "cursor", "of", "datapoints", "specified", "by", "a", "series", "filter", "." ]
train
https://github.com/tempodb/tempodb-java/blob/5733f204fe4c8dda48916ba1f67cf44f5a3f9c69/src/main/java/com/tempodb/Client.java#L830-L853
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java
OjbTagsHandler.processNested
public String processNested(Properties attributes) throws XDocletException { """ Addes the current member as a nested object. @param template The template @param attributes The attributes of the tag @exception XDocletException If an error occurs @doc.tag type="content" """ String name = OjbMemberTagsHandler.getMemberName(); XClass type = OjbMemberTagsHandler.getMemberType(); int dim = OjbMemberTagsHandler.getMemberDimension(); NestedDef nestedDef = _curClassDef.getNested(name); if (type == null) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.COULD_NOT_DETERMINE_TYPE_OF_MEMBER, new String[]{name})); } if (dim > 0) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.MEMBER_CANNOT_BE_NESTED, new String[]{name, _curClassDef.getName()})); } ClassDescriptorDef nestedTypeDef = _model.getClass(type.getQualifiedName()); if (nestedTypeDef == null) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.COULD_NOT_DETERMINE_TYPE_OF_MEMBER, new String[]{name})); } if (nestedDef == null) { nestedDef = new NestedDef(name, nestedTypeDef); _curClassDef.addNested(nestedDef); } LogHelper.debug(false, OjbTagsHandler.class, "processNested", " Processing nested object "+nestedDef.getName()+" of type "+nestedTypeDef.getName()); String attrName; for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); ) { attrName = (String)attrNames.nextElement(); nestedDef.setProperty(attrName, attributes.getProperty(attrName)); } return ""; }
java
public String processNested(Properties attributes) throws XDocletException { String name = OjbMemberTagsHandler.getMemberName(); XClass type = OjbMemberTagsHandler.getMemberType(); int dim = OjbMemberTagsHandler.getMemberDimension(); NestedDef nestedDef = _curClassDef.getNested(name); if (type == null) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.COULD_NOT_DETERMINE_TYPE_OF_MEMBER, new String[]{name})); } if (dim > 0) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.MEMBER_CANNOT_BE_NESTED, new String[]{name, _curClassDef.getName()})); } ClassDescriptorDef nestedTypeDef = _model.getClass(type.getQualifiedName()); if (nestedTypeDef == null) { throw new XDocletException(Translator.getString(XDocletModulesOjbMessages.class, XDocletModulesOjbMessages.COULD_NOT_DETERMINE_TYPE_OF_MEMBER, new String[]{name})); } if (nestedDef == null) { nestedDef = new NestedDef(name, nestedTypeDef); _curClassDef.addNested(nestedDef); } LogHelper.debug(false, OjbTagsHandler.class, "processNested", " Processing nested object "+nestedDef.getName()+" of type "+nestedTypeDef.getName()); String attrName; for (Enumeration attrNames = attributes.propertyNames(); attrNames.hasMoreElements(); ) { attrName = (String)attrNames.nextElement(); nestedDef.setProperty(attrName, attributes.getProperty(attrName)); } return ""; }
[ "public", "String", "processNested", "(", "Properties", "attributes", ")", "throws", "XDocletException", "{", "String", "name", "=", "OjbMemberTagsHandler", ".", "getMemberName", "(", ")", ";", "XClass", "type", "=", "OjbMemberTagsHandler", ".", "getMemberType", "(", ")", ";", "int", "dim", "=", "OjbMemberTagsHandler", ".", "getMemberDimension", "(", ")", ";", "NestedDef", "nestedDef", "=", "_curClassDef", ".", "getNested", "(", "name", ")", ";", "if", "(", "type", "==", "null", ")", "{", "throw", "new", "XDocletException", "(", "Translator", ".", "getString", "(", "XDocletModulesOjbMessages", ".", "class", ",", "XDocletModulesOjbMessages", ".", "COULD_NOT_DETERMINE_TYPE_OF_MEMBER", ",", "new", "String", "[", "]", "{", "name", "}", ")", ")", ";", "}", "if", "(", "dim", ">", "0", ")", "{", "throw", "new", "XDocletException", "(", "Translator", ".", "getString", "(", "XDocletModulesOjbMessages", ".", "class", ",", "XDocletModulesOjbMessages", ".", "MEMBER_CANNOT_BE_NESTED", ",", "new", "String", "[", "]", "{", "name", ",", "_curClassDef", ".", "getName", "(", ")", "}", ")", ")", ";", "}", "ClassDescriptorDef", "nestedTypeDef", "=", "_model", ".", "getClass", "(", "type", ".", "getQualifiedName", "(", ")", ")", ";", "if", "(", "nestedTypeDef", "==", "null", ")", "{", "throw", "new", "XDocletException", "(", "Translator", ".", "getString", "(", "XDocletModulesOjbMessages", ".", "class", ",", "XDocletModulesOjbMessages", ".", "COULD_NOT_DETERMINE_TYPE_OF_MEMBER", ",", "new", "String", "[", "]", "{", "name", "}", ")", ")", ";", "}", "if", "(", "nestedDef", "==", "null", ")", "{", "nestedDef", "=", "new", "NestedDef", "(", "name", ",", "nestedTypeDef", ")", ";", "_curClassDef", ".", "addNested", "(", "nestedDef", ")", ";", "}", "LogHelper", ".", "debug", "(", "false", ",", "OjbTagsHandler", ".", "class", ",", "\"processNested\"", ",", "\" Processing nested object \"", "+", "nestedDef", ".", "getName", "(", ")", "+", "\" of type \"", "+", "nestedTypeDef", ".", "getName", "(", ")", ")", ";", "String", "attrName", ";", "for", "(", "Enumeration", "attrNames", "=", "attributes", ".", "propertyNames", "(", ")", ";", "attrNames", ".", "hasMoreElements", "(", ")", ";", ")", "{", "attrName", "=", "(", "String", ")", "attrNames", ".", "nextElement", "(", ")", ";", "nestedDef", ".", "setProperty", "(", "attrName", ",", "attributes", ".", "getProperty", "(", "attrName", ")", ")", ";", "}", "return", "\"\"", ";", "}" ]
Addes the current member as a nested object. @param template The template @param attributes The attributes of the tag @exception XDocletException If an error occurs @doc.tag type="content"
[ "Addes", "the", "current", "member", "as", "a", "nested", "object", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbTagsHandler.java#L1084-L1127
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
ComputationGraph.feedForward
public Map<String, INDArray> feedForward(INDArray[] input, boolean train) { """ Conduct forward pass using an array of inputs @param input An array of ComputationGraph inputs @param train If true: do forward pass at training time; false: do forward pass at test time @return A map of activations for each layer (not each GraphVertex). Keys = layer name, values = layer activations """ return feedForward(input, train, true); }
java
public Map<String, INDArray> feedForward(INDArray[] input, boolean train) { return feedForward(input, train, true); }
[ "public", "Map", "<", "String", ",", "INDArray", ">", "feedForward", "(", "INDArray", "[", "]", "input", ",", "boolean", "train", ")", "{", "return", "feedForward", "(", "input", ",", "train", ",", "true", ")", ";", "}" ]
Conduct forward pass using an array of inputs @param input An array of ComputationGraph inputs @param train If true: do forward pass at training time; false: do forward pass at test time @return A map of activations for each layer (not each GraphVertex). Keys = layer name, values = layer activations
[ "Conduct", "forward", "pass", "using", "an", "array", "of", "inputs" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L1530-L1532
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java
SyncAgentsInner.getAsync
public Observable<SyncAgentInner> getAsync(String resourceGroupName, String serverName, String syncAgentName) { """ Gets a sync agent. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server on which the sync agent is hosted. @param syncAgentName The name of the sync agent. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SyncAgentInner object """ return getWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1<ServiceResponse<SyncAgentInner>, SyncAgentInner>() { @Override public SyncAgentInner call(ServiceResponse<SyncAgentInner> response) { return response.body(); } }); }
java
public Observable<SyncAgentInner> getAsync(String resourceGroupName, String serverName, String syncAgentName) { return getWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName).map(new Func1<ServiceResponse<SyncAgentInner>, SyncAgentInner>() { @Override public SyncAgentInner call(ServiceResponse<SyncAgentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SyncAgentInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "syncAgentName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "syncAgentName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "SyncAgentInner", ">", ",", "SyncAgentInner", ">", "(", ")", "{", "@", "Override", "public", "SyncAgentInner", "call", "(", "ServiceResponse", "<", "SyncAgentInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a sync agent. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server on which the sync agent is hosted. @param syncAgentName The name of the sync agent. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SyncAgentInner object
[ "Gets", "a", "sync", "agent", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java#L144-L151
EdwardRaff/JSAT
JSAT/src/jsat/linear/RowColumnOps.java
RowColumnOps.addCol
public static void addCol(Matrix A, int j, int start, int to, double c) { """ Updates the values of column <tt>j</tt> in the given matrix to be A[:,j] = A[:,j]+ c @param A the matrix to perform he update on @param j the row to update @param start the first index of the row to update from (inclusive) @param to the last index of the row to update (exclusive) @param c the constant to add to each element """ for(int i = start; i < to; i++) A.increment(i, j, c); }
java
public static void addCol(Matrix A, int j, int start, int to, double c) { for(int i = start; i < to; i++) A.increment(i, j, c); }
[ "public", "static", "void", "addCol", "(", "Matrix", "A", ",", "int", "j", ",", "int", "start", ",", "int", "to", ",", "double", "c", ")", "{", "for", "(", "int", "i", "=", "start", ";", "i", "<", "to", ";", "i", "++", ")", "A", ".", "increment", "(", "i", ",", "j", ",", ")", ";", "}" ]
Updates the values of column <tt>j</tt> in the given matrix to be A[:,j] = A[:,j]+ c @param A the matrix to perform he update on @param j the row to update @param start the first index of the row to update from (inclusive) @param to the last index of the row to update (exclusive) @param c the constant to add to each element
[ "Updates", "the", "values", "of", "column", "<tt", ">", "j<", "/", "tt", ">", "in", "the", "given", "matrix", "to", "be", "A", "[", ":", "j", "]", "=", "A", "[", ":", "j", "]", "+", "c" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L177-L181
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.beginCreateOrUpdateWorkerPool
public WorkerPoolResourceInner beginCreateOrUpdateWorkerPool(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) { """ Create or update a worker pool. Create or update a worker pool. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param workerPoolName Name of the worker pool. @param workerPoolEnvelope Properties of the worker pool. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the WorkerPoolResourceInner object if successful. """ return beginCreateOrUpdateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).toBlocking().single().body(); }
java
public WorkerPoolResourceInner beginCreateOrUpdateWorkerPool(String resourceGroupName, String name, String workerPoolName, WorkerPoolResourceInner workerPoolEnvelope) { return beginCreateOrUpdateWorkerPoolWithServiceResponseAsync(resourceGroupName, name, workerPoolName, workerPoolEnvelope).toBlocking().single().body(); }
[ "public", "WorkerPoolResourceInner", "beginCreateOrUpdateWorkerPool", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "workerPoolName", ",", "WorkerPoolResourceInner", "workerPoolEnvelope", ")", "{", "return", "beginCreateOrUpdateWorkerPoolWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "workerPoolName", ",", "workerPoolEnvelope", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create or update a worker pool. Create or update a worker pool. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param workerPoolName Name of the worker pool. @param workerPoolEnvelope Properties of the worker pool. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the WorkerPoolResourceInner object if successful.
[ "Create", "or", "update", "a", "worker", "pool", ".", "Create", "or", "update", "a", "worker", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L5278-L5280
jkrasnay/sqlbuilder
src/main/java/ca/krasnay/sqlbuilder/orm/ReflectionUtils.java
ReflectionUtils.getDeclaredFieldWithPath
public static Field getDeclaredFieldWithPath(Class<?> clazz, String path) { """ Returns the Field for a given parent class and a dot-separated path of field names. @param clazz Parent class. @param path Path to the desired field. """ int lastDot = path.lastIndexOf('.'); if (lastDot > -1) { String parentPath = path.substring(0, lastDot); String fieldName = path.substring(lastDot + 1); Field parentField = getDeclaredFieldWithPath(clazz, parentPath); return getDeclaredFieldInHierarchy(parentField.getType(), fieldName); } else { return getDeclaredFieldInHierarchy(clazz, path); } }
java
public static Field getDeclaredFieldWithPath(Class<?> clazz, String path) { int lastDot = path.lastIndexOf('.'); if (lastDot > -1) { String parentPath = path.substring(0, lastDot); String fieldName = path.substring(lastDot + 1); Field parentField = getDeclaredFieldWithPath(clazz, parentPath); return getDeclaredFieldInHierarchy(parentField.getType(), fieldName); } else { return getDeclaredFieldInHierarchy(clazz, path); } }
[ "public", "static", "Field", "getDeclaredFieldWithPath", "(", "Class", "<", "?", ">", "clazz", ",", "String", "path", ")", "{", "int", "lastDot", "=", "path", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "lastDot", ">", "-", "1", ")", "{", "String", "parentPath", "=", "path", ".", "substring", "(", "0", ",", "lastDot", ")", ";", "String", "fieldName", "=", "path", ".", "substring", "(", "lastDot", "+", "1", ")", ";", "Field", "parentField", "=", "getDeclaredFieldWithPath", "(", "clazz", ",", "parentPath", ")", ";", "return", "getDeclaredFieldInHierarchy", "(", "parentField", ".", "getType", "(", ")", ",", "fieldName", ")", ";", "}", "else", "{", "return", "getDeclaredFieldInHierarchy", "(", "clazz", ",", "path", ")", ";", "}", "}" ]
Returns the Field for a given parent class and a dot-separated path of field names. @param clazz Parent class. @param path Path to the desired field.
[ "Returns", "the", "Field", "for", "a", "given", "parent", "class", "and", "a", "dot", "-", "separated", "path", "of", "field", "names", "." ]
train
https://github.com/jkrasnay/sqlbuilder/blob/8e6acedc51cfad0527263376af51e1ef052f7147/src/main/java/ca/krasnay/sqlbuilder/orm/ReflectionUtils.java#L44-L56
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java
CQLSSTableWriter.rawAddRow
public CQLSSTableWriter rawAddRow(List<ByteBuffer> values) throws InvalidRequestException, IOException { """ Adds a new row to the writer given already serialized values. <p> This is a shortcut for {@code rawAddRow(Arrays.asList(values))}. @param values the row values (corresponding to the bind variables of the insertion statement used when creating by this writer) as binary. @return this writer. """ if (values.size() != boundNames.size()) throw new InvalidRequestException(String.format("Invalid number of arguments, expecting %d values but got %d", boundNames.size(), values.size())); QueryOptions options = QueryOptions.forInternalCalls(null, values); List<ByteBuffer> keys = insert.buildPartitionKeyNames(options); Composite clusteringPrefix = insert.createClusteringPrefix(options); long now = System.currentTimeMillis() * 1000; UpdateParameters params = new UpdateParameters(insert.cfm, options, insert.getTimestamp(now, options), insert.getTimeToLive(options), Collections.<ByteBuffer, CQL3Row>emptyMap()); try { for (ByteBuffer key : keys) { if (writer.shouldStartNewRow() || !key.equals(writer.currentKey().getKey())) writer.newRow(key); insert.addUpdateForKey(writer.currentColumnFamily(), key, clusteringPrefix, params, false); } return this; } catch (BufferedWriter.SyncException e) { // If we use a BufferedWriter and had a problem writing to disk, the IOException has been // wrapped in a SyncException (see BufferedWriter below). We want to extract that IOE. throw (IOException)e.getCause(); } }
java
public CQLSSTableWriter rawAddRow(List<ByteBuffer> values) throws InvalidRequestException, IOException { if (values.size() != boundNames.size()) throw new InvalidRequestException(String.format("Invalid number of arguments, expecting %d values but got %d", boundNames.size(), values.size())); QueryOptions options = QueryOptions.forInternalCalls(null, values); List<ByteBuffer> keys = insert.buildPartitionKeyNames(options); Composite clusteringPrefix = insert.createClusteringPrefix(options); long now = System.currentTimeMillis() * 1000; UpdateParameters params = new UpdateParameters(insert.cfm, options, insert.getTimestamp(now, options), insert.getTimeToLive(options), Collections.<ByteBuffer, CQL3Row>emptyMap()); try { for (ByteBuffer key : keys) { if (writer.shouldStartNewRow() || !key.equals(writer.currentKey().getKey())) writer.newRow(key); insert.addUpdateForKey(writer.currentColumnFamily(), key, clusteringPrefix, params, false); } return this; } catch (BufferedWriter.SyncException e) { // If we use a BufferedWriter and had a problem writing to disk, the IOException has been // wrapped in a SyncException (see BufferedWriter below). We want to extract that IOE. throw (IOException)e.getCause(); } }
[ "public", "CQLSSTableWriter", "rawAddRow", "(", "List", "<", "ByteBuffer", ">", "values", ")", "throws", "InvalidRequestException", ",", "IOException", "{", "if", "(", "values", ".", "size", "(", ")", "!=", "boundNames", ".", "size", "(", ")", ")", "throw", "new", "InvalidRequestException", "(", "String", ".", "format", "(", "\"Invalid number of arguments, expecting %d values but got %d\"", ",", "boundNames", ".", "size", "(", ")", ",", "values", ".", "size", "(", ")", ")", ")", ";", "QueryOptions", "options", "=", "QueryOptions", ".", "forInternalCalls", "(", "null", ",", "values", ")", ";", "List", "<", "ByteBuffer", ">", "keys", "=", "insert", ".", "buildPartitionKeyNames", "(", "options", ")", ";", "Composite", "clusteringPrefix", "=", "insert", ".", "createClusteringPrefix", "(", "options", ")", ";", "long", "now", "=", "System", ".", "currentTimeMillis", "(", ")", "*", "1000", ";", "UpdateParameters", "params", "=", "new", "UpdateParameters", "(", "insert", ".", "cfm", ",", "options", ",", "insert", ".", "getTimestamp", "(", "now", ",", "options", ")", ",", "insert", ".", "getTimeToLive", "(", "options", ")", ",", "Collections", ".", "<", "ByteBuffer", ",", "CQL3Row", ">", "emptyMap", "(", ")", ")", ";", "try", "{", "for", "(", "ByteBuffer", "key", ":", "keys", ")", "{", "if", "(", "writer", ".", "shouldStartNewRow", "(", ")", "||", "!", "key", ".", "equals", "(", "writer", ".", "currentKey", "(", ")", ".", "getKey", "(", ")", ")", ")", "writer", ".", "newRow", "(", "key", ")", ";", "insert", ".", "addUpdateForKey", "(", "writer", ".", "currentColumnFamily", "(", ")", ",", "key", ",", "clusteringPrefix", ",", "params", ",", "false", ")", ";", "}", "return", "this", ";", "}", "catch", "(", "BufferedWriter", ".", "SyncException", "e", ")", "{", "// If we use a BufferedWriter and had a problem writing to disk, the IOException has been", "// wrapped in a SyncException (see BufferedWriter below). We want to extract that IOE.", "throw", "(", "IOException", ")", "e", ".", "getCause", "(", ")", ";", "}", "}" ]
Adds a new row to the writer given already serialized values. <p> This is a shortcut for {@code rawAddRow(Arrays.asList(values))}. @param values the row values (corresponding to the bind variables of the insertion statement used when creating by this writer) as binary. @return this writer.
[ "Adds", "a", "new", "row", "to", "the", "writer", "given", "already", "serialized", "values", ".", "<p", ">", "This", "is", "a", "shortcut", "for", "{", "@code", "rawAddRow", "(", "Arrays", ".", "asList", "(", "values", "))", "}", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java#L201-L234
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/chrono/IsoChronology.java
IsoChronology.dateYearDay
@Override // override with covariant return type public LocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { """ Obtains an ISO local date from the era, year-of-era and day-of-year fields. @param era the ISO era, not null @param yearOfEra the ISO year-of-era @param dayOfYear the ISO day-of-year @return the ISO local date, not null @throws DateTimeException if unable to create the date """ return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
java
@Override // override with covariant return type public LocalDate dateYearDay(Era era, int yearOfEra, int dayOfYear) { return dateYearDay(prolepticYear(era, yearOfEra), dayOfYear); }
[ "@", "Override", "// override with covariant return type", "public", "LocalDate", "dateYearDay", "(", "Era", "era", ",", "int", "yearOfEra", ",", "int", "dayOfYear", ")", "{", "return", "dateYearDay", "(", "prolepticYear", "(", "era", ",", "yearOfEra", ")", ",", "dayOfYear", ")", ";", "}" ]
Obtains an ISO local date from the era, year-of-era and day-of-year fields. @param era the ISO era, not null @param yearOfEra the ISO year-of-era @param dayOfYear the ISO day-of-year @return the ISO local date, not null @throws DateTimeException if unable to create the date
[ "Obtains", "an", "ISO", "local", "date", "from", "the", "era", "year", "-", "of", "-", "era", "and", "day", "-", "of", "-", "year", "fields", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/chrono/IsoChronology.java#L217-L220
jenkinsci/jenkins
core/src/main/java/hudson/security/csrf/CrumbIssuer.java
CrumbIssuer.validateCrumb
public boolean validateCrumb(ServletRequest request, MultipartFormDataParser parser) { """ Get a crumb from multipart form data and validate it against other data in the current request. The salt and request parameter that is used is defined by the current configuration. @param request @param parser """ CrumbIssuerDescriptor<CrumbIssuer> desc = getDescriptor(); String crumbField = desc.getCrumbRequestField(); String crumbSalt = desc.getCrumbSalt(); return validateCrumb(request, crumbSalt, parser.get(crumbField)); }
java
public boolean validateCrumb(ServletRequest request, MultipartFormDataParser parser) { CrumbIssuerDescriptor<CrumbIssuer> desc = getDescriptor(); String crumbField = desc.getCrumbRequestField(); String crumbSalt = desc.getCrumbSalt(); return validateCrumb(request, crumbSalt, parser.get(crumbField)); }
[ "public", "boolean", "validateCrumb", "(", "ServletRequest", "request", ",", "MultipartFormDataParser", "parser", ")", "{", "CrumbIssuerDescriptor", "<", "CrumbIssuer", ">", "desc", "=", "getDescriptor", "(", ")", ";", "String", "crumbField", "=", "desc", ".", "getCrumbRequestField", "(", ")", ";", "String", "crumbSalt", "=", "desc", ".", "getCrumbSalt", "(", ")", ";", "return", "validateCrumb", "(", "request", ",", "crumbSalt", ",", "parser", ".", "get", "(", "crumbField", ")", ")", ";", "}" ]
Get a crumb from multipart form data and validate it against other data in the current request. The salt and request parameter that is used is defined by the current configuration. @param request @param parser
[ "Get", "a", "crumb", "from", "multipart", "form", "data", "and", "validate", "it", "against", "other", "data", "in", "the", "current", "request", ".", "The", "salt", "and", "request", "parameter", "that", "is", "used", "is", "defined", "by", "the", "current", "configuration", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/csrf/CrumbIssuer.java#L131-L137
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java
TreeScanner.visitCase
@Override public R visitCase(CaseTree node, P p) { """ {@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning """ R r = scan(node.getExpression(), p); r = scanAndReduce(node.getStatements(), p, r); return r; }
java
@Override public R visitCase(CaseTree node, P p) { R r = scan(node.getExpression(), p); r = scanAndReduce(node.getStatements(), p, r); return r; }
[ "@", "Override", "public", "R", "visitCase", "(", "CaseTree", "node", ",", "P", "p", ")", "{", "R", "r", "=", "scan", "(", "node", ".", "getExpression", "(", ")", ",", "p", ")", ";", "r", "=", "scanAndReduce", "(", "node", ".", "getStatements", "(", ")", ",", "p", ",", "r", ")", ";", "return", "r", ";", "}" ]
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java#L343-L348
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/xml/XMLOutputUtil.java
XMLOutputUtil.writeElementList
public static void writeElementList(XMLOutput xmlOutput, String tagName, Iterator<String> listValueIterator) throws IOException { """ Write a list of Strings to document as elements with given tag name. @param xmlOutput the XMLOutput object to write to @param tagName the tag name @param listValueIterator Iterator over String values to write """ while (listValueIterator.hasNext()) { xmlOutput.openTag(tagName); xmlOutput.writeText(listValueIterator.next()); xmlOutput.closeTag(tagName); } }
java
public static void writeElementList(XMLOutput xmlOutput, String tagName, Iterator<String> listValueIterator) throws IOException { while (listValueIterator.hasNext()) { xmlOutput.openTag(tagName); xmlOutput.writeText(listValueIterator.next()); xmlOutput.closeTag(tagName); } }
[ "public", "static", "void", "writeElementList", "(", "XMLOutput", "xmlOutput", ",", "String", "tagName", ",", "Iterator", "<", "String", ">", "listValueIterator", ")", "throws", "IOException", "{", "while", "(", "listValueIterator", ".", "hasNext", "(", ")", ")", "{", "xmlOutput", ".", "openTag", "(", "tagName", ")", ";", "xmlOutput", ".", "writeText", "(", "listValueIterator", ".", "next", "(", ")", ")", ";", "xmlOutput", ".", "closeTag", "(", "tagName", ")", ";", "}", "}" ]
Write a list of Strings to document as elements with given tag name. @param xmlOutput the XMLOutput object to write to @param tagName the tag name @param listValueIterator Iterator over String values to write
[ "Write", "a", "list", "of", "Strings", "to", "document", "as", "elements", "with", "given", "tag", "name", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/xml/XMLOutputUtil.java#L58-L65
samskivert/samskivert
src/main/java/com/samskivert/servlet/user/UserRepository.java
UserRepository.registerSession
public String registerSession (User user, int expireDays) throws PersistenceException { """ Creates a new session for the specified user and returns the randomly generated session identifier for that session. If a session entry already exists for the specified user it will be reused. @param expireDays the number of days in which the session token should expire. """ // look for an existing session for this user final String query = "select authcode from sessions where userId = " + user.userId; String authcode = execute(new Operation<String>() { public String invoke (Connection conn, DatabaseLiaison liaison) throws PersistenceException, SQLException { Statement stmt = conn.createStatement(); try { ResultSet rs = stmt.executeQuery(query); while (rs.next()) { return rs.getString(1); } return null; } finally { JDBCUtil.close(stmt); } } }); // figure out when to expire the session Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, expireDays); Date expires = new Date(cal.getTime().getTime()); // if we found one, update its expires time and reuse it if (authcode != null) { update("update sessions set expires = '" + expires + "' where " + "authcode = '" + authcode + "'"); } else { // otherwise create a new one and insert it into the table authcode = UserUtil.genAuthCode(user); update("insert into sessions (authcode, userId, expires) values('" + authcode + "', " + user.userId + ", '" + expires + "')"); } return authcode; }
java
public String registerSession (User user, int expireDays) throws PersistenceException { // look for an existing session for this user final String query = "select authcode from sessions where userId = " + user.userId; String authcode = execute(new Operation<String>() { public String invoke (Connection conn, DatabaseLiaison liaison) throws PersistenceException, SQLException { Statement stmt = conn.createStatement(); try { ResultSet rs = stmt.executeQuery(query); while (rs.next()) { return rs.getString(1); } return null; } finally { JDBCUtil.close(stmt); } } }); // figure out when to expire the session Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, expireDays); Date expires = new Date(cal.getTime().getTime()); // if we found one, update its expires time and reuse it if (authcode != null) { update("update sessions set expires = '" + expires + "' where " + "authcode = '" + authcode + "'"); } else { // otherwise create a new one and insert it into the table authcode = UserUtil.genAuthCode(user); update("insert into sessions (authcode, userId, expires) values('" + authcode + "', " + user.userId + ", '" + expires + "')"); } return authcode; }
[ "public", "String", "registerSession", "(", "User", "user", ",", "int", "expireDays", ")", "throws", "PersistenceException", "{", "// look for an existing session for this user", "final", "String", "query", "=", "\"select authcode from sessions where userId = \"", "+", "user", ".", "userId", ";", "String", "authcode", "=", "execute", "(", "new", "Operation", "<", "String", ">", "(", ")", "{", "public", "String", "invoke", "(", "Connection", "conn", ",", "DatabaseLiaison", "liaison", ")", "throws", "PersistenceException", ",", "SQLException", "{", "Statement", "stmt", "=", "conn", ".", "createStatement", "(", ")", ";", "try", "{", "ResultSet", "rs", "=", "stmt", ".", "executeQuery", "(", "query", ")", ";", "while", "(", "rs", ".", "next", "(", ")", ")", "{", "return", "rs", ".", "getString", "(", "1", ")", ";", "}", "return", "null", ";", "}", "finally", "{", "JDBCUtil", ".", "close", "(", "stmt", ")", ";", "}", "}", "}", ")", ";", "// figure out when to expire the session", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "DATE", ",", "expireDays", ")", ";", "Date", "expires", "=", "new", "Date", "(", "cal", ".", "getTime", "(", ")", ".", "getTime", "(", ")", ")", ";", "// if we found one, update its expires time and reuse it", "if", "(", "authcode", "!=", "null", ")", "{", "update", "(", "\"update sessions set expires = '\"", "+", "expires", "+", "\"' where \"", "+", "\"authcode = '\"", "+", "authcode", "+", "\"'\"", ")", ";", "}", "else", "{", "// otherwise create a new one and insert it into the table", "authcode", "=", "UserUtil", ".", "genAuthCode", "(", "user", ")", ";", "update", "(", "\"insert into sessions (authcode, userId, expires) values('\"", "+", "authcode", "+", "\"', \"", "+", "user", ".", "userId", "+", "\", '\"", "+", "expires", "+", "\"')\"", ")", ";", "}", "return", "authcode", ";", "}" ]
Creates a new session for the specified user and returns the randomly generated session identifier for that session. If a session entry already exists for the specified user it will be reused. @param expireDays the number of days in which the session token should expire.
[ "Creates", "a", "new", "session", "for", "the", "specified", "user", "and", "returns", "the", "randomly", "generated", "session", "identifier", "for", "that", "session", ".", "If", "a", "session", "entry", "already", "exists", "for", "the", "specified", "user", "it", "will", "be", "reused", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/user/UserRepository.java#L250-L289
unbescape/unbescape
src/main/java/org/unbescape/json/JsonEscape.java
JsonEscape.escapeJsonMinimal
public static void escapeJsonMinimal(final String text, final Writer writer) throws IOException { """ <p> Perform a JSON level 1 (only basic set) <strong>escape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the JSON basic escape set: </p> <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;b</tt> (<tt>U+0008</tt>), <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>), <tt>&#92;&quot;</tt> (<tt>U+0022</tt>), <tt>&#92;&#92;</tt> (<tt>U+005C</tt>) and <tt>&#92;&#47;</tt> (<tt>U+002F</tt>). Note that <tt>&#92;&#47;</tt> is optional, and will only be used when the <tt>&#47;</tt> symbol appears after <tt>&lt;</tt>, as in <tt>&lt;&#47;</tt>. This is to avoid accidentally closing <tt>&lt;script&gt;</tt> tags in HTML. </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> (required by the JSON spec) and <tt>U+007F</tt> to <tt>U+009F</tt> (additional). </li> </ul> <p> This method calls {@link #escapeJson(String, Writer, JsonEscapeType, JsonEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link JsonEscapeType#SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA}</li> <li><tt>level</tt>: {@link JsonEscapeLevel#LEVEL_1_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2 """ escapeJson(text, writer, JsonEscapeType.SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA, JsonEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
java
public static void escapeJsonMinimal(final String text, final Writer writer) throws IOException { escapeJson(text, writer, JsonEscapeType.SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA, JsonEscapeLevel.LEVEL_1_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapeJsonMinimal", "(", "final", "String", "text", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeJson", "(", "text", ",", "writer", ",", "JsonEscapeType", ".", "SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA", ",", "JsonEscapeLevel", ".", "LEVEL_1_BASIC_ESCAPE_SET", ")", ";", "}" ]
<p> Perform a JSON level 1 (only basic set) <strong>escape</strong> operation on a <tt>String</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the JSON basic escape set: </p> <ul> <li>The <em>Single Escape Characters</em>: <tt>&#92;b</tt> (<tt>U+0008</tt>), <tt>&#92;t</tt> (<tt>U+0009</tt>), <tt>&#92;n</tt> (<tt>U+000A</tt>), <tt>&#92;f</tt> (<tt>U+000C</tt>), <tt>&#92;r</tt> (<tt>U+000D</tt>), <tt>&#92;&quot;</tt> (<tt>U+0022</tt>), <tt>&#92;&#92;</tt> (<tt>U+005C</tt>) and <tt>&#92;&#47;</tt> (<tt>U+002F</tt>). Note that <tt>&#92;&#47;</tt> is optional, and will only be used when the <tt>&#47;</tt> symbol appears after <tt>&lt;</tt>, as in <tt>&lt;&#47;</tt>. This is to avoid accidentally closing <tt>&lt;script&gt;</tt> tags in HTML. </li> <li> Two ranges of non-displayable, control characters (some of which are already part of the <em>single escape characters</em> list): <tt>U+0000</tt> to <tt>U+001F</tt> (required by the JSON spec) and <tt>U+007F</tt> to <tt>U+009F</tt> (additional). </li> </ul> <p> This method calls {@link #escapeJson(String, Writer, JsonEscapeType, JsonEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link JsonEscapeType#SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA}</li> <li><tt>level</tt>: {@link JsonEscapeLevel#LEVEL_1_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "JSON", "level", "1", "(", "only", "basic", "set", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "writing", "results", "to", "a", "<tt", ">", "Writer<", "/", "tt", ">", ".", "<", "/", "p", ">", "<p", ">", "<em", ">", "Level", "1<", "/", "em", ">", "means", "this", "method", "will", "only", "escape", "the", "JSON", "basic", "escape", "set", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "The", "<em", ">", "Single", "Escape", "Characters<", "/", "em", ">", ":", "<tt", ">", "&#92", ";", "b<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "0008<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "t<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "0009<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "n<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "000A<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "f<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "000C<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "r<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "000D<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "&quot", ";", "<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "0022<", "/", "tt", ">", ")", "<tt", ">", "&#92", ";", "&#92", ";", "<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "005C<", "/", "tt", ">", ")", "and", "<tt", ">", "&#92", ";", "&#47", ";", "<", "/", "tt", ">", "(", "<tt", ">", "U", "+", "002F<", "/", "tt", ">", ")", ".", "Note", "that", "<tt", ">", "&#92", ";", "&#47", ";", "<", "/", "tt", ">", "is", "optional", "and", "will", "only", "be", "used", "when", "the", "<tt", ">", "&#47", ";", "<", "/", "tt", ">", "symbol", "appears", "after", "<tt", ">", "&lt", ";", "<", "/", "tt", ">", "as", "in", "<tt", ">", "&lt", ";", "&#47", ";", "<", "/", "tt", ">", ".", "This", "is", "to", "avoid", "accidentally", "closing", "<tt", ">", "&lt", ";", "script&gt", ";", "<", "/", "tt", ">", "tags", "in", "HTML", ".", "<", "/", "li", ">", "<li", ">", "Two", "ranges", "of", "non", "-", "displayable", "control", "characters", "(", "some", "of", "which", "are", "already", "part", "of", "the", "<em", ">", "single", "escape", "characters<", "/", "em", ">", "list", ")", ":", "<tt", ">", "U", "+", "0000<", "/", "tt", ">", "to", "<tt", ">", "U", "+", "001F<", "/", "tt", ">", "(", "required", "by", "the", "JSON", "spec", ")", "and", "<tt", ">", "U", "+", "007F<", "/", "tt", ">", "to", "<tt", ">", "U", "+", "009F<", "/", "tt", ">", "(", "additional", ")", ".", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "method", "calls", "{", "@link", "#escapeJson", "(", "String", "Writer", "JsonEscapeType", "JsonEscapeLevel", ")", "}", "with", "the", "following", "preconfigured", "values", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<tt", ">", "type<", "/", "tt", ">", ":", "{", "@link", "JsonEscapeType#SINGLE_ESCAPE_CHARS_DEFAULT_TO_UHEXA", "}", "<", "/", "li", ">", "<li", ">", "<tt", ">", "level<", "/", "tt", ">", ":", "{", "@link", "JsonEscapeLevel#LEVEL_1_BASIC_ESCAPE_SET", "}", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "This", "method", "is", "<strong", ">", "thread", "-", "safe<", "/", "strong", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/json/JsonEscape.java#L374-L379
Jasig/uPortal
uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AnyUnblockedGrantPermissionPolicy.java
AnyUnblockedGrantPermissionPolicy.containsType
private boolean containsType(final Set<IPermission> permissions, final String soughtType) { """ Returns true if a set of IPermission instances contains a permission of the specified type, otherwise false. Permissions passed to this method <em>must</em> already be filtered of inactive (expired) instances. @return True if the set contains a permission of the sought type, false otherwise @throws IllegalArgumentException if input set or type is null. """ // Assertions if (permissions == null) { throw new IllegalArgumentException("Cannot check null set for contents."); } if (soughtType == null) { throw new IllegalArgumentException("Cannot search for type null."); } boolean rslt = false; // default for (IPermission p : permissions) { if (soughtType.equals(p.getType())) { rslt = true; } } return rslt; }
java
private boolean containsType(final Set<IPermission> permissions, final String soughtType) { // Assertions if (permissions == null) { throw new IllegalArgumentException("Cannot check null set for contents."); } if (soughtType == null) { throw new IllegalArgumentException("Cannot search for type null."); } boolean rslt = false; // default for (IPermission p : permissions) { if (soughtType.equals(p.getType())) { rslt = true; } } return rslt; }
[ "private", "boolean", "containsType", "(", "final", "Set", "<", "IPermission", ">", "permissions", ",", "final", "String", "soughtType", ")", "{", "// Assertions", "if", "(", "permissions", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot check null set for contents.\"", ")", ";", "}", "if", "(", "soughtType", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot search for type null.\"", ")", ";", "}", "boolean", "rslt", "=", "false", ";", "// default", "for", "(", "IPermission", "p", ":", "permissions", ")", "{", "if", "(", "soughtType", ".", "equals", "(", "p", ".", "getType", "(", ")", ")", ")", "{", "rslt", "=", "true", ";", "}", "}", "return", "rslt", ";", "}" ]
Returns true if a set of IPermission instances contains a permission of the specified type, otherwise false. Permissions passed to this method <em>must</em> already be filtered of inactive (expired) instances. @return True if the set contains a permission of the sought type, false otherwise @throws IllegalArgumentException if input set or type is null.
[ "Returns", "true", "if", "a", "set", "of", "IPermission", "instances", "contains", "a", "permission", "of", "the", "specified", "type", "otherwise", "false", ".", "Permissions", "passed", "to", "this", "method", "<em", ">", "must<", "/", "em", ">", "already", "be", "filtered", "of", "inactive", "(", "expired", ")", "instances", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AnyUnblockedGrantPermissionPolicy.java#L385-L404
pawelprazak/java-extended
guava/src/main/java/com/bluecatcode/common/contract/Checks.java
Checks.checkIsInstance
@Beta public static <T> T checkIsInstance(Class<T> class_, Object reference, @Nullable String errorMessage) { """ Performs a runtime check if the reference is an instance of the provided class @param class_ the class to use @param reference reference to check @param errorMessage the exception message to use if the check fails; will be converted to a string using {@link String#valueOf(Object)} @param <T> the reference type @see Checks#checkIsInstance(Class, Object, String, Object...) """ return checkIsInstance(class_, reference, errorMessage, EMPTY_ERROR_MESSAGE_ARGS); }
java
@Beta public static <T> T checkIsInstance(Class<T> class_, Object reference, @Nullable String errorMessage) { return checkIsInstance(class_, reference, errorMessage, EMPTY_ERROR_MESSAGE_ARGS); }
[ "@", "Beta", "public", "static", "<", "T", ">", "T", "checkIsInstance", "(", "Class", "<", "T", ">", "class_", ",", "Object", "reference", ",", "@", "Nullable", "String", "errorMessage", ")", "{", "return", "checkIsInstance", "(", "class_", ",", "reference", ",", "errorMessage", ",", "EMPTY_ERROR_MESSAGE_ARGS", ")", ";", "}" ]
Performs a runtime check if the reference is an instance of the provided class @param class_ the class to use @param reference reference to check @param errorMessage the exception message to use if the check fails; will be converted to a string using {@link String#valueOf(Object)} @param <T> the reference type @see Checks#checkIsInstance(Class, Object, String, Object...)
[ "Performs", "a", "runtime", "check", "if", "the", "reference", "is", "an", "instance", "of", "the", "provided", "class" ]
train
https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/contract/Checks.java#L401-L405
Erudika/para
para-core/src/main/java/com/erudika/para/core/User.java
User.resetPassword
public final boolean resetPassword(String token, String newpass) { """ Changes the user password permanently. @param token the reset token. see {@link #generatePasswordResetToken()} @param newpass the new password @return true if successful """ if (StringUtils.isBlank(newpass) || StringUtils.isBlank(token) || newpass.length() < Config.MIN_PASS_LENGTH) { return false; } Sysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier); if (isValidToken(s, Config._RESET_TOKEN, token)) { s.removeProperty(Config._RESET_TOKEN); String hashed = Utils.bcrypt(newpass); s.addProperty(Config._PASSWORD, hashed); setPassword(hashed); CoreUtils.getInstance().getDao().update(getAppid(), s); return true; } return false; }
java
public final boolean resetPassword(String token, String newpass) { if (StringUtils.isBlank(newpass) || StringUtils.isBlank(token) || newpass.length() < Config.MIN_PASS_LENGTH) { return false; } Sysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier); if (isValidToken(s, Config._RESET_TOKEN, token)) { s.removeProperty(Config._RESET_TOKEN); String hashed = Utils.bcrypt(newpass); s.addProperty(Config._PASSWORD, hashed); setPassword(hashed); CoreUtils.getInstance().getDao().update(getAppid(), s); return true; } return false; }
[ "public", "final", "boolean", "resetPassword", "(", "String", "token", ",", "String", "newpass", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "newpass", ")", "||", "StringUtils", ".", "isBlank", "(", "token", ")", "||", "newpass", ".", "length", "(", ")", "<", "Config", ".", "MIN_PASS_LENGTH", ")", "{", "return", "false", ";", "}", "Sysprop", "s", "=", "CoreUtils", ".", "getInstance", "(", ")", ".", "getDao", "(", ")", ".", "read", "(", "getAppid", "(", ")", ",", "identifier", ")", ";", "if", "(", "isValidToken", "(", "s", ",", "Config", ".", "_RESET_TOKEN", ",", "token", ")", ")", "{", "s", ".", "removeProperty", "(", "Config", ".", "_RESET_TOKEN", ")", ";", "String", "hashed", "=", "Utils", ".", "bcrypt", "(", "newpass", ")", ";", "s", ".", "addProperty", "(", "Config", ".", "_PASSWORD", ",", "hashed", ")", ";", "setPassword", "(", "hashed", ")", ";", "CoreUtils", ".", "getInstance", "(", ")", ".", "getDao", "(", ")", ".", "update", "(", "getAppid", "(", ")", ",", "s", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Changes the user password permanently. @param token the reset token. see {@link #generatePasswordResetToken()} @param newpass the new password @return true if successful
[ "Changes", "the", "user", "password", "permanently", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/User.java#L629-L643
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/MapTileAppenderModel.java
MapTileAppenderModel.appendMap
private void appendMap(MapTile other, int offsetX, int offsetY) { """ Append the map at specified offset. @param other The map to append. @param offsetX The horizontal offset. @param offsetY The vertical offset. """ for (int v = 0; v < other.getInTileHeight(); v++) { final int ty = offsetY + v; for (int h = 0; h < other.getInTileWidth(); h++) { final int tx = offsetX + h; final Tile tile = other.getTile(h, v); if (tile != null) { final double x = tx * (double) map.getTileWidth(); final double y = ty * (double) map.getTileHeight(); map.setTile(map.createTile(tile.getSheet(), tile.getNumber(), x, y)); } } } }
java
private void appendMap(MapTile other, int offsetX, int offsetY) { for (int v = 0; v < other.getInTileHeight(); v++) { final int ty = offsetY + v; for (int h = 0; h < other.getInTileWidth(); h++) { final int tx = offsetX + h; final Tile tile = other.getTile(h, v); if (tile != null) { final double x = tx * (double) map.getTileWidth(); final double y = ty * (double) map.getTileHeight(); map.setTile(map.createTile(tile.getSheet(), tile.getNumber(), x, y)); } } } }
[ "private", "void", "appendMap", "(", "MapTile", "other", ",", "int", "offsetX", ",", "int", "offsetY", ")", "{", "for", "(", "int", "v", "=", "0", ";", "v", "<", "other", ".", "getInTileHeight", "(", ")", ";", "v", "++", ")", "{", "final", "int", "ty", "=", "offsetY", "+", "v", ";", "for", "(", "int", "h", "=", "0", ";", "h", "<", "other", ".", "getInTileWidth", "(", ")", ";", "h", "++", ")", "{", "final", "int", "tx", "=", "offsetX", "+", "h", ";", "final", "Tile", "tile", "=", "other", ".", "getTile", "(", "h", ",", "v", ")", ";", "if", "(", "tile", "!=", "null", ")", "{", "final", "double", "x", "=", "tx", "*", "(", "double", ")", "map", ".", "getTileWidth", "(", ")", ";", "final", "double", "y", "=", "ty", "*", "(", "double", ")", "map", ".", "getTileHeight", "(", ")", ";", "map", ".", "setTile", "(", "map", ".", "createTile", "(", "tile", ".", "getSheet", "(", ")", ",", "tile", ".", "getNumber", "(", ")", ",", "x", ",", "y", ")", ")", ";", "}", "}", "}", "}" ]
Append the map at specified offset. @param other The map to append. @param offsetX The horizontal offset. @param offsetY The vertical offset.
[ "Append", "the", "map", "at", "specified", "offset", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/MapTileAppenderModel.java#L67-L84
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java
BoxAuthentication.onAuthenticationFailure
public void onAuthenticationFailure(BoxAuthenticationInfo infoOriginal, Exception ex) { """ Callback method to be called if authentication process fails. @param infoOriginal the authentication information associated with the failed authentication. @param ex the exception if appliable that caused the logout. """ String msg = "failure:"; if (getAuthStorage() != null) { msg += "auth storage :" + getAuthStorage().toString(); } BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal); if (info != null) { msg += info.getUser() == null ? "null user" : info.getUser().getId() == null ? "null user id" : info.getUser().getId().length(); } BoxLogUtils.nonFatalE("BoxAuthfail", msg , ex); Set<AuthListener> listeners = getListeners(); for (AuthListener listener : listeners) { listener.onAuthFailure(info, ex); } }
java
public void onAuthenticationFailure(BoxAuthenticationInfo infoOriginal, Exception ex) { String msg = "failure:"; if (getAuthStorage() != null) { msg += "auth storage :" + getAuthStorage().toString(); } BoxAuthenticationInfo info = BoxAuthenticationInfo.unmodifiableObject(infoOriginal); if (info != null) { msg += info.getUser() == null ? "null user" : info.getUser().getId() == null ? "null user id" : info.getUser().getId().length(); } BoxLogUtils.nonFatalE("BoxAuthfail", msg , ex); Set<AuthListener> listeners = getListeners(); for (AuthListener listener : listeners) { listener.onAuthFailure(info, ex); } }
[ "public", "void", "onAuthenticationFailure", "(", "BoxAuthenticationInfo", "infoOriginal", ",", "Exception", "ex", ")", "{", "String", "msg", "=", "\"failure:\"", ";", "if", "(", "getAuthStorage", "(", ")", "!=", "null", ")", "{", "msg", "+=", "\"auth storage :\"", "+", "getAuthStorage", "(", ")", ".", "toString", "(", ")", ";", "}", "BoxAuthenticationInfo", "info", "=", "BoxAuthenticationInfo", ".", "unmodifiableObject", "(", "infoOriginal", ")", ";", "if", "(", "info", "!=", "null", ")", "{", "msg", "+=", "info", ".", "getUser", "(", ")", "==", "null", "?", "\"null user\"", ":", "info", ".", "getUser", "(", ")", ".", "getId", "(", ")", "==", "null", "?", "\"null user id\"", ":", "info", ".", "getUser", "(", ")", ".", "getId", "(", ")", ".", "length", "(", ")", ";", "}", "BoxLogUtils", ".", "nonFatalE", "(", "\"BoxAuthfail\"", ",", "msg", ",", "ex", ")", ";", "Set", "<", "AuthListener", ">", "listeners", "=", "getListeners", "(", ")", ";", "for", "(", "AuthListener", "listener", ":", "listeners", ")", "{", "listener", ".", "onAuthFailure", "(", "info", ",", "ex", ")", ";", "}", "}" ]
Callback method to be called if authentication process fails. @param infoOriginal the authentication information associated with the failed authentication. @param ex the exception if appliable that caused the logout.
[ "Callback", "method", "to", "be", "called", "if", "authentication", "process", "fails", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/BoxAuthentication.java#L180-L195
jglobus/JGlobus
gss/src/main/java/org/globus/gsi/gssapi/SSLUtil.java
SSLUtil.readFully
public static void readFully(InputStream in, byte [] buf, int off, int len) throws IOException { """ Reads some number of bytes from the input stream. This function blocks until all data is read or an I/O error occurs. @param in the input stream to read the bytes from. @param buf the buffer into which read the data is read. @param off the start offset in array b at which the data is written. @param len the maximum number of bytes to read. @exception IOException if I/O error occurs. """ int n = 0; while (n < len) { int count = in.read(buf, off + n, len - n); if (count < 0) throw new EOFException(); n += count; } }
java
public static void readFully(InputStream in, byte [] buf, int off, int len) throws IOException { int n = 0; while (n < len) { int count = in.read(buf, off + n, len - n); if (count < 0) throw new EOFException(); n += count; } }
[ "public", "static", "void", "readFully", "(", "InputStream", "in", ",", "byte", "[", "]", "buf", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "int", "n", "=", "0", ";", "while", "(", "n", "<", "len", ")", "{", "int", "count", "=", "in", ".", "read", "(", "buf", ",", "off", "+", "n", ",", "len", "-", "n", ")", ";", "if", "(", "count", "<", "0", ")", "throw", "new", "EOFException", "(", ")", ";", "n", "+=", "count", ";", "}", "}" ]
Reads some number of bytes from the input stream. This function blocks until all data is read or an I/O error occurs. @param in the input stream to read the bytes from. @param buf the buffer into which read the data is read. @param off the start offset in array b at which the data is written. @param len the maximum number of bytes to read. @exception IOException if I/O error occurs.
[ "Reads", "some", "number", "of", "bytes", "from", "the", "input", "stream", ".", "This", "function", "blocks", "until", "all", "data", "is", "read", "or", "an", "I", "/", "O", "error", "occurs", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/gsi/gssapi/SSLUtil.java#L61-L70
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/TagsInner.java
TagsInner.deleteValue
public void deleteValue(String tagName, String tagValue) { """ Deletes a tag value. @param tagName The name of the tag. @param tagValue The value of the tag to delete. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ deleteValueWithServiceResponseAsync(tagName, tagValue).toBlocking().single().body(); }
java
public void deleteValue(String tagName, String tagValue) { deleteValueWithServiceResponseAsync(tagName, tagValue).toBlocking().single().body(); }
[ "public", "void", "deleteValue", "(", "String", "tagName", ",", "String", "tagValue", ")", "{", "deleteValueWithServiceResponseAsync", "(", "tagName", ",", "tagValue", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Deletes a tag value. @param tagName The name of the tag. @param tagValue The value of the tag to delete. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "a", "tag", "value", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/TagsInner.java#L97-L99
threerings/narya
core/src/main/java/com/threerings/presents/data/TimeBaseObject.java
TimeBaseObject.getDelta
protected long getDelta (long timeStamp, long maxValue) { """ Obtains a delta with the specified maximum value, swapping from even to odd, if necessary. """ boolean even = (evenBase > oddBase); long base = even ? evenBase : oddBase; long delta = timeStamp - base; // make sure this timestamp is not sufficiently old that we can't // generate a delta time with it if (delta < 0) { String errmsg = "Time stamp too old for conversion to delta time"; throw new IllegalArgumentException(errmsg); } // see if it's time to swap if (delta > maxValue) { if (even) { setOddBase(timeStamp); } else { setEvenBase(timeStamp); } delta = 0; } // if we're odd, we need to mark the value as such if (!even) { delta = (-1 - delta); } return delta; }
java
protected long getDelta (long timeStamp, long maxValue) { boolean even = (evenBase > oddBase); long base = even ? evenBase : oddBase; long delta = timeStamp - base; // make sure this timestamp is not sufficiently old that we can't // generate a delta time with it if (delta < 0) { String errmsg = "Time stamp too old for conversion to delta time"; throw new IllegalArgumentException(errmsg); } // see if it's time to swap if (delta > maxValue) { if (even) { setOddBase(timeStamp); } else { setEvenBase(timeStamp); } delta = 0; } // if we're odd, we need to mark the value as such if (!even) { delta = (-1 - delta); } return delta; }
[ "protected", "long", "getDelta", "(", "long", "timeStamp", ",", "long", "maxValue", ")", "{", "boolean", "even", "=", "(", "evenBase", ">", "oddBase", ")", ";", "long", "base", "=", "even", "?", "evenBase", ":", "oddBase", ";", "long", "delta", "=", "timeStamp", "-", "base", ";", "// make sure this timestamp is not sufficiently old that we can't", "// generate a delta time with it", "if", "(", "delta", "<", "0", ")", "{", "String", "errmsg", "=", "\"Time stamp too old for conversion to delta time\"", ";", "throw", "new", "IllegalArgumentException", "(", "errmsg", ")", ";", "}", "// see if it's time to swap", "if", "(", "delta", ">", "maxValue", ")", "{", "if", "(", "even", ")", "{", "setOddBase", "(", "timeStamp", ")", ";", "}", "else", "{", "setEvenBase", "(", "timeStamp", ")", ";", "}", "delta", "=", "0", ";", "}", "// if we're odd, we need to mark the value as such", "if", "(", "!", "even", ")", "{", "delta", "=", "(", "-", "1", "-", "delta", ")", ";", "}", "return", "delta", ";", "}" ]
Obtains a delta with the specified maximum value, swapping from even to odd, if necessary.
[ "Obtains", "a", "delta", "with", "the", "specified", "maximum", "value", "swapping", "from", "even", "to", "odd", "if", "necessary", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/data/TimeBaseObject.java#L103-L132
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrieBuilder.java
CharsTrieBuilder.write
@Deprecated @Override protected int write(int offset, int length) { """ {@inheritDoc} @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android """ int newLength=charsLength+length; ensureCapacity(newLength); charsLength=newLength; int charsOffset=chars.length-charsLength; while(length>0) { chars[charsOffset++]=strings.charAt(offset++); --length; } return charsLength; }
java
@Deprecated @Override protected int write(int offset, int length) { int newLength=charsLength+length; ensureCapacity(newLength); charsLength=newLength; int charsOffset=chars.length-charsLength; while(length>0) { chars[charsOffset++]=strings.charAt(offset++); --length; } return charsLength; }
[ "@", "Deprecated", "@", "Override", "protected", "int", "write", "(", "int", "offset", ",", "int", "length", ")", "{", "int", "newLength", "=", "charsLength", "+", "length", ";", "ensureCapacity", "(", "newLength", ")", ";", "charsLength", "=", "newLength", ";", "int", "charsOffset", "=", "chars", ".", "length", "-", "charsLength", ";", "while", "(", "length", ">", "0", ")", "{", "chars", "[", "charsOffset", "++", "]", "=", "strings", ".", "charAt", "(", "offset", "++", ")", ";", "--", "length", ";", "}", "return", "charsLength", ";", "}" ]
{@inheritDoc} @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CharsTrieBuilder.java#L166-L178
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/io/Files.java
Files.readLines
public static List<String> readLines(File file, Charset charset) throws IOException { """ Reads the contents of a file line by line to a List of Strings. The file is always closed. """ InputStream in = null; try { in = new FileInputStream(file); if (null == charset) { return IOs.readLines(new InputStreamReader(in)); } else { InputStreamReader reader = new InputStreamReader(in, charset.name()); return IOs.readLines(reader); } } finally { IOs.close(in); } }
java
public static List<String> readLines(File file, Charset charset) throws IOException { InputStream in = null; try { in = new FileInputStream(file); if (null == charset) { return IOs.readLines(new InputStreamReader(in)); } else { InputStreamReader reader = new InputStreamReader(in, charset.name()); return IOs.readLines(reader); } } finally { IOs.close(in); } }
[ "public", "static", "List", "<", "String", ">", "readLines", "(", "File", "file", ",", "Charset", "charset", ")", "throws", "IOException", "{", "InputStream", "in", "=", "null", ";", "try", "{", "in", "=", "new", "FileInputStream", "(", "file", ")", ";", "if", "(", "null", "==", "charset", ")", "{", "return", "IOs", ".", "readLines", "(", "new", "InputStreamReader", "(", "in", ")", ")", ";", "}", "else", "{", "InputStreamReader", "reader", "=", "new", "InputStreamReader", "(", "in", ",", "charset", ".", "name", "(", ")", ")", ";", "return", "IOs", ".", "readLines", "(", "reader", ")", ";", "}", "}", "finally", "{", "IOs", ".", "close", "(", "in", ")", ";", "}", "}" ]
Reads the contents of a file line by line to a List of Strings. The file is always closed.
[ "Reads", "the", "contents", "of", "a", "file", "line", "by", "line", "to", "a", "List", "of", "Strings", ".", "The", "file", "is", "always", "closed", "." ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/io/Files.java#L76-L89
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFSubstitution.java
FractionalPartSubstitution.doSubstitution
public void doSubstitution(double number, StringBuilder toInsertInto, int position, int recursionCount) { """ If in "by digits" mode, fills in the substitution one decimal digit at a time using the rule set containing this substitution. Otherwise, uses the superclass function. @param number The number being formatted @param toInsertInto The string to insert the result of formatting the substitution into @param position The position of the owning rule's rule text in toInsertInto """ if (!byDigits) { // if we're not in "byDigits" mode, just use the inherited // doSubstitution() routine super.doSubstitution(number, toInsertInto, position, recursionCount); } else { // if we're in "byDigits" mode, transform the value into an integer // by moving the decimal point eight places to the right and // pulling digits off the right one at a time, formatting each digit // as an integer using this substitution's owning rule set // (this is slower, but more accurate, than doing it from the // other end) // just print to string and then use that DigitList dl = new DigitList(); dl.set(number, 20, true); boolean pad = false; while (dl.count > Math.max(0, dl.decimalAt)) { if (pad && useSpaces) { toInsertInto.insert(position + pos, ' '); } else { pad = true; } ruleSet.format(dl.digits[--dl.count] - '0', toInsertInto, position + pos, recursionCount); } while (dl.decimalAt < 0) { if (pad && useSpaces) { toInsertInto.insert(position + pos, ' '); } else { pad = true; } ruleSet.format(0, toInsertInto, position + pos, recursionCount); ++dl.decimalAt; } } }
java
public void doSubstitution(double number, StringBuilder toInsertInto, int position, int recursionCount) { if (!byDigits) { // if we're not in "byDigits" mode, just use the inherited // doSubstitution() routine super.doSubstitution(number, toInsertInto, position, recursionCount); } else { // if we're in "byDigits" mode, transform the value into an integer // by moving the decimal point eight places to the right and // pulling digits off the right one at a time, formatting each digit // as an integer using this substitution's owning rule set // (this is slower, but more accurate, than doing it from the // other end) // just print to string and then use that DigitList dl = new DigitList(); dl.set(number, 20, true); boolean pad = false; while (dl.count > Math.max(0, dl.decimalAt)) { if (pad && useSpaces) { toInsertInto.insert(position + pos, ' '); } else { pad = true; } ruleSet.format(dl.digits[--dl.count] - '0', toInsertInto, position + pos, recursionCount); } while (dl.decimalAt < 0) { if (pad && useSpaces) { toInsertInto.insert(position + pos, ' '); } else { pad = true; } ruleSet.format(0, toInsertInto, position + pos, recursionCount); ++dl.decimalAt; } } }
[ "public", "void", "doSubstitution", "(", "double", "number", ",", "StringBuilder", "toInsertInto", ",", "int", "position", ",", "int", "recursionCount", ")", "{", "if", "(", "!", "byDigits", ")", "{", "// if we're not in \"byDigits\" mode, just use the inherited", "// doSubstitution() routine", "super", ".", "doSubstitution", "(", "number", ",", "toInsertInto", ",", "position", ",", "recursionCount", ")", ";", "}", "else", "{", "// if we're in \"byDigits\" mode, transform the value into an integer", "// by moving the decimal point eight places to the right and", "// pulling digits off the right one at a time, formatting each digit", "// as an integer using this substitution's owning rule set", "// (this is slower, but more accurate, than doing it from the", "// other end)", "// just print to string and then use that", "DigitList", "dl", "=", "new", "DigitList", "(", ")", ";", "dl", ".", "set", "(", "number", ",", "20", ",", "true", ")", ";", "boolean", "pad", "=", "false", ";", "while", "(", "dl", ".", "count", ">", "Math", ".", "max", "(", "0", ",", "dl", ".", "decimalAt", ")", ")", "{", "if", "(", "pad", "&&", "useSpaces", ")", "{", "toInsertInto", ".", "insert", "(", "position", "+", "pos", ",", "'", "'", ")", ";", "}", "else", "{", "pad", "=", "true", ";", "}", "ruleSet", ".", "format", "(", "dl", ".", "digits", "[", "--", "dl", ".", "count", "]", "-", "'", "'", ",", "toInsertInto", ",", "position", "+", "pos", ",", "recursionCount", ")", ";", "}", "while", "(", "dl", ".", "decimalAt", "<", "0", ")", "{", "if", "(", "pad", "&&", "useSpaces", ")", "{", "toInsertInto", ".", "insert", "(", "position", "+", "pos", ",", "'", "'", ")", ";", "}", "else", "{", "pad", "=", "true", ";", "}", "ruleSet", ".", "format", "(", "0", ",", "toInsertInto", ",", "position", "+", "pos", ",", "recursionCount", ")", ";", "++", "dl", ".", "decimalAt", ";", "}", "}", "}" ]
If in "by digits" mode, fills in the substitution one decimal digit at a time using the rule set containing this substitution. Otherwise, uses the superclass function. @param number The number being formatted @param toInsertInto The string to insert the result of formatting the substitution into @param position The position of the owning rule's rule text in toInsertInto
[ "If", "in", "by", "digits", "mode", "fills", "in", "the", "substitution", "one", "decimal", "digit", "at", "a", "time", "using", "the", "rule", "set", "containing", "this", "substitution", ".", "Otherwise", "uses", "the", "superclass", "function", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NFSubstitution.java#L1174-L1211
JodaOrg/joda-time
src/main/java/org/joda/time/LocalDate.java
LocalDate.toInterval
public Interval toInterval(DateTimeZone zone) { """ Converts this object to an Interval representing the whole day. <p> The interval may have more or less than 24 hours if this is a daylight savings cutover date. <p> This instance is immutable and unaffected by this method call. @param zone the zone to get the Interval in, null means default @return a interval over the day """ zone = DateTimeUtils.getZone(zone); DateTime start = toDateTimeAtStartOfDay(zone); DateTime end = plusDays(1).toDateTimeAtStartOfDay(zone); return new Interval(start, end); }
java
public Interval toInterval(DateTimeZone zone) { zone = DateTimeUtils.getZone(zone); DateTime start = toDateTimeAtStartOfDay(zone); DateTime end = plusDays(1).toDateTimeAtStartOfDay(zone); return new Interval(start, end); }
[ "public", "Interval", "toInterval", "(", "DateTimeZone", "zone", ")", "{", "zone", "=", "DateTimeUtils", ".", "getZone", "(", "zone", ")", ";", "DateTime", "start", "=", "toDateTimeAtStartOfDay", "(", "zone", ")", ";", "DateTime", "end", "=", "plusDays", "(", "1", ")", ".", "toDateTimeAtStartOfDay", "(", "zone", ")", ";", "return", "new", "Interval", "(", "start", ",", "end", ")", ";", "}" ]
Converts this object to an Interval representing the whole day. <p> The interval may have more or less than 24 hours if this is a daylight savings cutover date. <p> This instance is immutable and unaffected by this method call. @param zone the zone to get the Interval in, null means default @return a interval over the day
[ "Converts", "this", "object", "to", "an", "Interval", "representing", "the", "whole", "day", ".", "<p", ">", "The", "interval", "may", "have", "more", "or", "less", "than", "24", "hours", "if", "this", "is", "a", "daylight", "savings", "cutover", "date", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDate.java#L991-L996
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.convertPixelToNorm
public static Point2D_F32 convertPixelToNorm(CameraModel param , Point2D_F32 pixel , Point2D_F32 norm ) { """ <p> Convenient function for converting from distorted image pixel coordinate to undistorted normalized image coordinates. If speed is a concern then {@link PinholePtoN_F32} should be used instead. </p> NOTE: norm and pixel can be the same instance. @param param Intrinsic camera parameters @param pixel Pixel coordinate @param norm Optional storage for output. If null a new instance will be declared. @return normalized image coordinate """ return ImplPerspectiveOps_F32.convertPixelToNorm(param, pixel, norm); }
java
public static Point2D_F32 convertPixelToNorm(CameraModel param , Point2D_F32 pixel , Point2D_F32 norm ) { return ImplPerspectiveOps_F32.convertPixelToNorm(param, pixel, norm); }
[ "public", "static", "Point2D_F32", "convertPixelToNorm", "(", "CameraModel", "param", ",", "Point2D_F32", "pixel", ",", "Point2D_F32", "norm", ")", "{", "return", "ImplPerspectiveOps_F32", ".", "convertPixelToNorm", "(", "param", ",", "pixel", ",", "norm", ")", ";", "}" ]
<p> Convenient function for converting from distorted image pixel coordinate to undistorted normalized image coordinates. If speed is a concern then {@link PinholePtoN_F32} should be used instead. </p> NOTE: norm and pixel can be the same instance. @param param Intrinsic camera parameters @param pixel Pixel coordinate @param norm Optional storage for output. If null a new instance will be declared. @return normalized image coordinate
[ "<p", ">", "Convenient", "function", "for", "converting", "from", "distorted", "image", "pixel", "coordinate", "to", "undistorted", "normalized", "image", "coordinates", ".", "If", "speed", "is", "a", "concern", "then", "{", "@link", "PinholePtoN_F32", "}", "should", "be", "used", "instead", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L462-L464
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java
UnicodeSet.stripFrom
@Deprecated public String stripFrom(CharSequence source, boolean matches) { """ Strips code points from source. If matches is true, script all that match <i>this</i>. If matches is false, then strip all that <i>don't</i> match. @param source The source of the CharSequence to strip from. @param matches A boolean to either strip all that matches or don't match with the current UnicodeSet object. @return The string after it has been stripped. @deprecated This API is ICU internal only. Use replaceFrom. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android """ StringBuilder result = new StringBuilder(); for (int pos = 0; pos < source.length();) { int inside = findIn(source, pos, !matches); result.append(source.subSequence(pos, inside)); pos = findIn(source, inside, matches); // get next start } return result.toString(); }
java
@Deprecated public String stripFrom(CharSequence source, boolean matches) { StringBuilder result = new StringBuilder(); for (int pos = 0; pos < source.length();) { int inside = findIn(source, pos, !matches); result.append(source.subSequence(pos, inside)); pos = findIn(source, inside, matches); // get next start } return result.toString(); }
[ "@", "Deprecated", "public", "String", "stripFrom", "(", "CharSequence", "source", ",", "boolean", "matches", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "pos", "=", "0", ";", "pos", "<", "source", ".", "length", "(", ")", ";", ")", "{", "int", "inside", "=", "findIn", "(", "source", ",", "pos", ",", "!", "matches", ")", ";", "result", ".", "append", "(", "source", ".", "subSequence", "(", "pos", ",", "inside", ")", ")", ";", "pos", "=", "findIn", "(", "source", ",", "inside", ",", "matches", ")", ";", "// get next start", "}", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Strips code points from source. If matches is true, script all that match <i>this</i>. If matches is false, then strip all that <i>don't</i> match. @param source The source of the CharSequence to strip from. @param matches A boolean to either strip all that matches or don't match with the current UnicodeSet object. @return The string after it has been stripped. @deprecated This API is ICU internal only. Use replaceFrom. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Strips", "code", "points", "from", "source", ".", "If", "matches", "is", "true", "script", "all", "that", "match", "<i", ">", "this<", "/", "i", ">", ".", "If", "matches", "is", "false", "then", "strip", "all", "that", "<i", ">", "don", "t<", "/", "i", ">", "match", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeSet.java#L4644-L4653
boncey/Flickr4Java
src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java
LicensesInterface.setLicense
public void setLicense(String photoId, int licenseId) throws FlickrException { """ Sets the license for a photo. This method requires authentication with 'write' permission. @param photoId The photo to update the license for. @param licenseId The license to apply, or 0 (zero) to remove the current license. @throws FlickrException """ Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_LICENSE); parameters.put("photo_id", photoId); parameters.put("license_id", Integer.toString(licenseId)); // Note: This method requires an HTTP POST request. Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // This method has no specific response - It returns an empty sucess response if it completes without error. }
java
public void setLicense(String photoId, int licenseId) throws FlickrException { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("method", METHOD_SET_LICENSE); parameters.put("photo_id", photoId); parameters.put("license_id", Integer.toString(licenseId)); // Note: This method requires an HTTP POST request. Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret); if (response.isError()) { throw new FlickrException(response.getErrorCode(), response.getErrorMessage()); } // This method has no specific response - It returns an empty sucess response if it completes without error. }
[ "public", "void", "setLicense", "(", "String", "photoId", ",", "int", "licenseId", ")", "throws", "FlickrException", "{", "Map", "<", "String", ",", "Object", ">", "parameters", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "parameters", ".", "put", "(", "\"method\"", ",", "METHOD_SET_LICENSE", ")", ";", "parameters", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "parameters", ".", "put", "(", "\"license_id\"", ",", "Integer", ".", "toString", "(", "licenseId", ")", ")", ";", "// Note: This method requires an HTTP POST request.\r", "Response", "response", "=", "transportAPI", ".", "post", "(", "transportAPI", ".", "getPath", "(", ")", ",", "parameters", ",", "apiKey", ",", "sharedSecret", ")", ";", "if", "(", "response", ".", "isError", "(", ")", ")", "{", "throw", "new", "FlickrException", "(", "response", ".", "getErrorCode", "(", ")", ",", "response", ".", "getErrorMessage", "(", ")", ")", ";", "}", "// This method has no specific response - It returns an empty sucess response if it completes without error.\r", "}" ]
Sets the license for a photo. This method requires authentication with 'write' permission. @param photoId The photo to update the license for. @param licenseId The license to apply, or 0 (zero) to remove the current license. @throws FlickrException
[ "Sets", "the", "license", "for", "a", "photo", "." ]
train
https://github.com/boncey/Flickr4Java/blob/f66987ba0e360e5fb7730efbbb8c51f3d978fc25/src/main/java/com/flickr4java/flickr/photos/licenses/LicensesInterface.java#L82-L95
alkacon/opencms-core
src/org/opencms/workplace/CmsWorkplace.java
CmsWorkplace.getStartSiteRoot
public static String getStartSiteRoot(CmsObject cms, CmsWorkplaceSettings settings) { """ Returns the start site from the given workplace settings.<p> @param cms the cms context @param settings the workplace settings @return the start site root """ return getStartSiteRoot(cms, settings.getUserSettings()); }
java
public static String getStartSiteRoot(CmsObject cms, CmsWorkplaceSettings settings) { return getStartSiteRoot(cms, settings.getUserSettings()); }
[ "public", "static", "String", "getStartSiteRoot", "(", "CmsObject", "cms", ",", "CmsWorkplaceSettings", "settings", ")", "{", "return", "getStartSiteRoot", "(", "cms", ",", "settings", ".", "getUserSettings", "(", ")", ")", ";", "}" ]
Returns the start site from the given workplace settings.<p> @param cms the cms context @param settings the workplace settings @return the start site root
[ "Returns", "the", "start", "site", "from", "the", "given", "workplace", "settings", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L629-L632
LearnLib/automatalib
incremental/src/main/java/net/automatalib/incremental/mealy/dag/IncrementalMealyDAGBuilder.java
IncrementalMealyDAGBuilder.updateInitSignature
private void updateInitSignature(int idx, State<O> succ) { """ Update the signature of the initial state. This requires special handling, as the initial state is not stored in the register (since it can never legally act as a predecessor). @param idx the transition index being changed @param succ the new successor state """ StateSignature<O> sig = init.getSignature(); State<O> oldSucc = sig.successors.array[idx]; if (oldSucc == succ) { return; } if (oldSucc != null) { oldSucc.decreaseIncoming(); } sig.successors.array[idx] = succ; succ.increaseIncoming(); }
java
private void updateInitSignature(int idx, State<O> succ) { StateSignature<O> sig = init.getSignature(); State<O> oldSucc = sig.successors.array[idx]; if (oldSucc == succ) { return; } if (oldSucc != null) { oldSucc.decreaseIncoming(); } sig.successors.array[idx] = succ; succ.increaseIncoming(); }
[ "private", "void", "updateInitSignature", "(", "int", "idx", ",", "State", "<", "O", ">", "succ", ")", "{", "StateSignature", "<", "O", ">", "sig", "=", "init", ".", "getSignature", "(", ")", ";", "State", "<", "O", ">", "oldSucc", "=", "sig", ".", "successors", ".", "array", "[", "idx", "]", ";", "if", "(", "oldSucc", "==", "succ", ")", "{", "return", ";", "}", "if", "(", "oldSucc", "!=", "null", ")", "{", "oldSucc", ".", "decreaseIncoming", "(", ")", ";", "}", "sig", ".", "successors", ".", "array", "[", "idx", "]", "=", "succ", ";", "succ", ".", "increaseIncoming", "(", ")", ";", "}" ]
Update the signature of the initial state. This requires special handling, as the initial state is not stored in the register (since it can never legally act as a predecessor). @param idx the transition index being changed @param succ the new successor state
[ "Update", "the", "signature", "of", "the", "initial", "state", ".", "This", "requires", "special", "handling", "as", "the", "initial", "state", "is", "not", "stored", "in", "the", "register", "(", "since", "it", "can", "never", "legally", "act", "as", "a", "predecessor", ")", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/incremental/src/main/java/net/automatalib/incremental/mealy/dag/IncrementalMealyDAGBuilder.java#L329-L340
lucee/Lucee
core/src/main/java/lucee/runtime/PageSourcePool.java
PageSourcePool.getPageSource
public PageSource getPageSource(String key, boolean updateAccesTime) { """ return pages matching to key @param key key for the page @param updateAccesTime define if do update access time @return page """ // DO NOT CHANGE INTERFACE (used by Argus Monitor) PageSource ps = pageSources.get(key.toLowerCase()); if (ps == null) return null; if (updateAccesTime) ps.setLastAccessTime(); return ps; }
java
public PageSource getPageSource(String key, boolean updateAccesTime) { // DO NOT CHANGE INTERFACE (used by Argus Monitor) PageSource ps = pageSources.get(key.toLowerCase()); if (ps == null) return null; if (updateAccesTime) ps.setLastAccessTime(); return ps; }
[ "public", "PageSource", "getPageSource", "(", "String", "key", ",", "boolean", "updateAccesTime", ")", "{", "// DO NOT CHANGE INTERFACE (used by Argus Monitor)", "PageSource", "ps", "=", "pageSources", ".", "get", "(", "key", ".", "toLowerCase", "(", ")", ")", ";", "if", "(", "ps", "==", "null", ")", "return", "null", ";", "if", "(", "updateAccesTime", ")", "ps", ".", "setLastAccessTime", "(", ")", ";", "return", "ps", ";", "}" ]
return pages matching to key @param key key for the page @param updateAccesTime define if do update access time @return page
[ "return", "pages", "matching", "to", "key" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/PageSourcePool.java#L67-L72
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java
Inet6Address.getByAddress
public static Inet6Address getByAddress(String host, byte[] addr, NetworkInterface nif) throws UnknownHostException { """ Create an Inet6Address in the exact manner of {@link InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is set to the value corresponding to the given interface for the address type specified in <code>addr</code>. The call will fail with an UnknownHostException if the given interface does not have a numeric scope_id assigned for the given address type (eg. link-local or site-local). See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6 scoped addresses. @param host the specified host @param addr the raw IP address in network byte order @param nif an interface this address must be associated with. @return an Inet6Address object created from the raw IP address. @exception UnknownHostException if IP address is of illegal length, or if the interface does not have a numeric scope_id assigned for the given address type. @since 1.5 """ if (host != null && host.length() > 0 && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); } } if (addr != null) { if (addr.length == Inet6Address.INADDRSZ) { return new Inet6Address(host, addr, nif); } } throw new UnknownHostException("addr is of illegal length"); }
java
public static Inet6Address getByAddress(String host, byte[] addr, NetworkInterface nif) throws UnknownHostException { if (host != null && host.length() > 0 && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); } } if (addr != null) { if (addr.length == Inet6Address.INADDRSZ) { return new Inet6Address(host, addr, nif); } } throw new UnknownHostException("addr is of illegal length"); }
[ "public", "static", "Inet6Address", "getByAddress", "(", "String", "host", ",", "byte", "[", "]", "addr", ",", "NetworkInterface", "nif", ")", "throws", "UnknownHostException", "{", "if", "(", "host", "!=", "null", "&&", "host", ".", "length", "(", ")", ">", "0", "&&", "host", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "if", "(", "host", ".", "charAt", "(", "host", ".", "length", "(", ")", "-", "1", ")", "==", "'", "'", ")", "{", "host", "=", "host", ".", "substring", "(", "1", ",", "host", ".", "length", "(", ")", "-", "1", ")", ";", "}", "}", "if", "(", "addr", "!=", "null", ")", "{", "if", "(", "addr", ".", "length", "==", "Inet6Address", ".", "INADDRSZ", ")", "{", "return", "new", "Inet6Address", "(", "host", ",", "addr", ",", "nif", ")", ";", "}", "}", "throw", "new", "UnknownHostException", "(", "\"addr is of illegal length\"", ")", ";", "}" ]
Create an Inet6Address in the exact manner of {@link InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is set to the value corresponding to the given interface for the address type specified in <code>addr</code>. The call will fail with an UnknownHostException if the given interface does not have a numeric scope_id assigned for the given address type (eg. link-local or site-local). See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6 scoped addresses. @param host the specified host @param addr the raw IP address in network byte order @param nif an interface this address must be associated with. @return an Inet6Address object created from the raw IP address. @exception UnknownHostException if IP address is of illegal length, or if the interface does not have a numeric scope_id assigned for the given address type. @since 1.5
[ "Create", "an", "Inet6Address", "in", "the", "exact", "manner", "of", "{", "@link", "InetAddress#getByAddress", "(", "String", "byte", "[]", ")", "}", "except", "that", "the", "IPv6", "scope_id", "is", "set", "to", "the", "value", "corresponding", "to", "the", "given", "interface", "for", "the", "address", "type", "specified", "in", "<code", ">", "addr<", "/", "code", ">", ".", "The", "call", "will", "fail", "with", "an", "UnknownHostException", "if", "the", "given", "interface", "does", "not", "have", "a", "numeric", "scope_id", "assigned", "for", "the", "given", "address", "type", "(", "eg", ".", "link", "-", "local", "or", "site", "-", "local", ")", ".", "See", "<a", "href", "=", "Inet6Address", ".", "html#scoped", ">", "here<", "/", "a", ">", "for", "a", "description", "of", "IPv6", "scoped", "addresses", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java#L289-L302
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/DoubleStream.java
DoubleStream.scan
@NotNull public DoubleStream scan(@NotNull final DoubleBinaryOperator accumulator) { """ Returns a {@code DoubleStream} produced by iterative application of a accumulation function to reduction value and next element of the current stream. Produces a {@code DoubleStream} consisting of {@code value1}, {@code acc(value1, value2)}, {@code acc(acc(value1, value2), value3)}, etc. <p>This is an intermediate operation. <p>Example: <pre> accumulator: (a, b) -&gt; a + b stream: [1, 2, 3, 4, 5] result: [1, 3, 6, 10, 15] </pre> @param accumulator the accumulation function @return the new stream @throws NullPointerException if {@code accumulator} is null @since 1.1.6 """ Objects.requireNonNull(accumulator); return new DoubleStream(params, new DoubleScan(iterator, accumulator)); }
java
@NotNull public DoubleStream scan(@NotNull final DoubleBinaryOperator accumulator) { Objects.requireNonNull(accumulator); return new DoubleStream(params, new DoubleScan(iterator, accumulator)); }
[ "@", "NotNull", "public", "DoubleStream", "scan", "(", "@", "NotNull", "final", "DoubleBinaryOperator", "accumulator", ")", "{", "Objects", ".", "requireNonNull", "(", "accumulator", ")", ";", "return", "new", "DoubleStream", "(", "params", ",", "new", "DoubleScan", "(", "iterator", ",", "accumulator", ")", ")", ";", "}" ]
Returns a {@code DoubleStream} produced by iterative application of a accumulation function to reduction value and next element of the current stream. Produces a {@code DoubleStream} consisting of {@code value1}, {@code acc(value1, value2)}, {@code acc(acc(value1, value2), value3)}, etc. <p>This is an intermediate operation. <p>Example: <pre> accumulator: (a, b) -&gt; a + b stream: [1, 2, 3, 4, 5] result: [1, 3, 6, 10, 15] </pre> @param accumulator the accumulation function @return the new stream @throws NullPointerException if {@code accumulator} is null @since 1.1.6
[ "Returns", "a", "{", "@code", "DoubleStream", "}", "produced", "by", "iterative", "application", "of", "a", "accumulation", "function", "to", "reduction", "value", "and", "next", "element", "of", "the", "current", "stream", ".", "Produces", "a", "{", "@code", "DoubleStream", "}", "consisting", "of", "{", "@code", "value1", "}", "{", "@code", "acc", "(", "value1", "value2", ")", "}", "{", "@code", "acc", "(", "acc", "(", "value1", "value2", ")", "value3", ")", "}", "etc", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/DoubleStream.java#L646-L650
threerings/gwt-utils
src/main/java/com/threerings/gwt/util/MessagesLookup.java
MessagesLookup.get
public String get (String key, Object... args) { """ Translate a key with any number of arguments, backed by the Lookup. """ // First make the key for GWT-friendly return fetch(key.replace('.', '_'), args); }
java
public String get (String key, Object... args) { // First make the key for GWT-friendly return fetch(key.replace('.', '_'), args); }
[ "public", "String", "get", "(", "String", "key", ",", "Object", "...", "args", ")", "{", "// First make the key for GWT-friendly", "return", "fetch", "(", "key", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ",", "args", ")", ";", "}" ]
Translate a key with any number of arguments, backed by the Lookup.
[ "Translate", "a", "key", "with", "any", "number", "of", "arguments", "backed", "by", "the", "Lookup", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/util/MessagesLookup.java#L63-L67
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java
ObjectUpdater.checkNewlySharded
private void checkNewlySharded(DBObject dbObj, Map<String, String> currScalarMap) { """ previously undetermined but is not being assigned to a shard. """ if (!m_tableDef.isSharded()) { return; } String shardingFieldName = m_tableDef.getShardingField().getName(); if (!currScalarMap.containsKey(shardingFieldName)) { m_dbTran.addAllObjectsColumn(m_tableDef, dbObj.getObjectID(), m_tableDef.getShardNumber(dbObj)); } }
java
private void checkNewlySharded(DBObject dbObj, Map<String, String> currScalarMap) { if (!m_tableDef.isSharded()) { return; } String shardingFieldName = m_tableDef.getShardingField().getName(); if (!currScalarMap.containsKey(shardingFieldName)) { m_dbTran.addAllObjectsColumn(m_tableDef, dbObj.getObjectID(), m_tableDef.getShardNumber(dbObj)); } }
[ "private", "void", "checkNewlySharded", "(", "DBObject", "dbObj", ",", "Map", "<", "String", ",", "String", ">", "currScalarMap", ")", "{", "if", "(", "!", "m_tableDef", ".", "isSharded", "(", ")", ")", "{", "return", ";", "}", "String", "shardingFieldName", "=", "m_tableDef", ".", "getShardingField", "(", ")", ".", "getName", "(", ")", ";", "if", "(", "!", "currScalarMap", ".", "containsKey", "(", "shardingFieldName", ")", ")", "{", "m_dbTran", ".", "addAllObjectsColumn", "(", "m_tableDef", ",", "dbObj", ".", "getObjectID", "(", ")", ",", "m_tableDef", ".", "getShardNumber", "(", "dbObj", ")", ")", ";", "}", "}" ]
previously undetermined but is not being assigned to a shard.
[ "previously", "undetermined", "but", "is", "not", "being", "assigned", "to", "a", "shard", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java#L233-L241
IBM/ibm-cos-sdk-java
ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/model/AccessControlList.java
AccessControlList.grantPermission
public void grantPermission(Grantee grantee, Permission permission) { """ Adds a grantee to the access control list (ACL) with the given permission. If this access control list already contains the grantee (i.e. the same grantee object) the permission for the grantee will be updated. @param grantee The grantee to whom the permission will apply. @param permission The permission to apply to the grantee. """ getGrantsAsList().add(new Grant(grantee, permission)); }
java
public void grantPermission(Grantee grantee, Permission permission) { getGrantsAsList().add(new Grant(grantee, permission)); }
[ "public", "void", "grantPermission", "(", "Grantee", "grantee", ",", "Permission", "permission", ")", "{", "getGrantsAsList", "(", ")", ".", "add", "(", "new", "Grant", "(", "grantee", ",", "permission", ")", ")", ";", "}" ]
Adds a grantee to the access control list (ACL) with the given permission. If this access control list already contains the grantee (i.e. the same grantee object) the permission for the grantee will be updated. @param grantee The grantee to whom the permission will apply. @param permission The permission to apply to the grantee.
[ "Adds", "a", "grantee", "to", "the", "access", "control", "list", "(", "ACL", ")", "with", "the", "given", "permission", ".", "If", "this", "access", "control", "list", "already", "contains", "the", "grantee", "(", "i", ".", "e", ".", "the", "same", "grantee", "object", ")", "the", "permission", "for", "the", "grantee", "will", "be", "updated", "." ]
train
https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/s3/model/AccessControlList.java#L141-L143
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/UriUtils.java
UriUtils.buildNewURI
public static URI buildNewURI( URI referenceUri, String uriSuffix ) throws URISyntaxException { """ Builds an URI from an URI and a suffix. <p> This suffix can be an absolute URL, or a relative path with respect to the first URI. In this case, the suffix is resolved with respect to the URI. </p> <p> If the suffix is already an URL, its is returned.<br> If the suffix is a relative file path and cannot be resolved, an exception is thrown. </p> <p> The returned URI is normalized. </p> @param referenceUri the reference URI (can be null) @param uriSuffix the URI suffix (not null) @return the new URI @throws URISyntaxException if the resolution failed """ if( uriSuffix == null ) throw new IllegalArgumentException( "The URI suffix cannot be null." ); uriSuffix = uriSuffix.replaceAll( "\\\\", "/" ); URI importUri = null; try { // Absolute URL ? importUri = urlToUri( new URL( uriSuffix )); } catch( Exception e ) { try { // Relative URL ? if( ! referenceUri.toString().endsWith( "/" ) && ! uriSuffix.startsWith( "/" )) referenceUri = new URI( referenceUri.toString() + "/" ); importUri = referenceUri.resolve( new URI( null, uriSuffix, null )); } catch( Exception e2 ) { String msg = "An URI could not be built from the URI " + referenceUri.toString() + " and the suffix " + uriSuffix + "."; throw new URISyntaxException( msg, e2.getMessage()); } } return importUri.normalize(); }
java
public static URI buildNewURI( URI referenceUri, String uriSuffix ) throws URISyntaxException { if( uriSuffix == null ) throw new IllegalArgumentException( "The URI suffix cannot be null." ); uriSuffix = uriSuffix.replaceAll( "\\\\", "/" ); URI importUri = null; try { // Absolute URL ? importUri = urlToUri( new URL( uriSuffix )); } catch( Exception e ) { try { // Relative URL ? if( ! referenceUri.toString().endsWith( "/" ) && ! uriSuffix.startsWith( "/" )) referenceUri = new URI( referenceUri.toString() + "/" ); importUri = referenceUri.resolve( new URI( null, uriSuffix, null )); } catch( Exception e2 ) { String msg = "An URI could not be built from the URI " + referenceUri.toString() + " and the suffix " + uriSuffix + "."; throw new URISyntaxException( msg, e2.getMessage()); } } return importUri.normalize(); }
[ "public", "static", "URI", "buildNewURI", "(", "URI", "referenceUri", ",", "String", "uriSuffix", ")", "throws", "URISyntaxException", "{", "if", "(", "uriSuffix", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"The URI suffix cannot be null.\"", ")", ";", "uriSuffix", "=", "uriSuffix", ".", "replaceAll", "(", "\"\\\\\\\\\"", ",", "\"/\"", ")", ";", "URI", "importUri", "=", "null", ";", "try", "{", "// Absolute URL ?", "importUri", "=", "urlToUri", "(", "new", "URL", "(", "uriSuffix", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "try", "{", "// Relative URL ?", "if", "(", "!", "referenceUri", ".", "toString", "(", ")", ".", "endsWith", "(", "\"/\"", ")", "&&", "!", "uriSuffix", ".", "startsWith", "(", "\"/\"", ")", ")", "referenceUri", "=", "new", "URI", "(", "referenceUri", ".", "toString", "(", ")", "+", "\"/\"", ")", ";", "importUri", "=", "referenceUri", ".", "resolve", "(", "new", "URI", "(", "null", ",", "uriSuffix", ",", "null", ")", ")", ";", "}", "catch", "(", "Exception", "e2", ")", "{", "String", "msg", "=", "\"An URI could not be built from the URI \"", "+", "referenceUri", ".", "toString", "(", ")", "+", "\" and the suffix \"", "+", "uriSuffix", "+", "\".\"", ";", "throw", "new", "URISyntaxException", "(", "msg", ",", "e2", ".", "getMessage", "(", ")", ")", ";", "}", "}", "return", "importUri", ".", "normalize", "(", ")", ";", "}" ]
Builds an URI from an URI and a suffix. <p> This suffix can be an absolute URL, or a relative path with respect to the first URI. In this case, the suffix is resolved with respect to the URI. </p> <p> If the suffix is already an URL, its is returned.<br> If the suffix is a relative file path and cannot be resolved, an exception is thrown. </p> <p> The returned URI is normalized. </p> @param referenceUri the reference URI (can be null) @param uriSuffix the URI suffix (not null) @return the new URI @throws URISyntaxException if the resolution failed
[ "Builds", "an", "URI", "from", "an", "URI", "and", "a", "suffix", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/UriUtils.java#L122-L151
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java
PoolOperations.removeNodeFromPool
public void removeNodeFromPool(String poolId, String computeNodeId) throws BatchErrorException, IOException { """ Removes the specified compute node from the specified pool. @param poolId The ID of the pool. @param computeNodeId The ID of the compute node to remove from the pool. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ removeNodeFromPool(poolId, computeNodeId, null, null, null); }
java
public void removeNodeFromPool(String poolId, String computeNodeId) throws BatchErrorException, IOException { removeNodeFromPool(poolId, computeNodeId, null, null, null); }
[ "public", "void", "removeNodeFromPool", "(", "String", "poolId", ",", "String", "computeNodeId", ")", "throws", "BatchErrorException", ",", "IOException", "{", "removeNodeFromPool", "(", "poolId", ",", "computeNodeId", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Removes the specified compute node from the specified pool. @param poolId The ID of the pool. @param computeNodeId The ID of the compute node to remove from the pool. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Removes", "the", "specified", "compute", "node", "from", "the", "specified", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/PoolOperations.java#L858-L860
qiniu/android-sdk
library/src/main/java/com/qiniu/android/utils/Etag.java
Etag.stream
public static String stream(InputStream in, long len) throws IOException { """ 计算输入流的etag @param in 数据输入流 @param len 数据流长度 @return 数据流的etag值 @throws IOException 文件读取异常 """ if (len == 0) { return "Fto5o-5ea0sNMlW_75VgGJCv2AcJ"; } byte[] buffer = new byte[64 * 1024]; byte[][] blocks = new byte[(int) ((len + Configuration.BLOCK_SIZE - 1) / Configuration.BLOCK_SIZE)][]; for (int i = 0; i < blocks.length; i++) { long left = len - (long) Configuration.BLOCK_SIZE * i; long read = left > Configuration.BLOCK_SIZE ? Configuration.BLOCK_SIZE : left; blocks[i] = oneBlock(buffer, in, (int) read); } return resultEncode(blocks); }
java
public static String stream(InputStream in, long len) throws IOException { if (len == 0) { return "Fto5o-5ea0sNMlW_75VgGJCv2AcJ"; } byte[] buffer = new byte[64 * 1024]; byte[][] blocks = new byte[(int) ((len + Configuration.BLOCK_SIZE - 1) / Configuration.BLOCK_SIZE)][]; for (int i = 0; i < blocks.length; i++) { long left = len - (long) Configuration.BLOCK_SIZE * i; long read = left > Configuration.BLOCK_SIZE ? Configuration.BLOCK_SIZE : left; blocks[i] = oneBlock(buffer, in, (int) read); } return resultEncode(blocks); }
[ "public", "static", "String", "stream", "(", "InputStream", "in", ",", "long", "len", ")", "throws", "IOException", "{", "if", "(", "len", "==", "0", ")", "{", "return", "\"Fto5o-5ea0sNMlW_75VgGJCv2AcJ\"", ";", "}", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "64", "*", "1024", "]", ";", "byte", "[", "]", "[", "]", "blocks", "=", "new", "byte", "[", "(", "int", ")", "(", "(", "len", "+", "Configuration", ".", "BLOCK_SIZE", "-", "1", ")", "/", "Configuration", ".", "BLOCK_SIZE", ")", "]", "[", "", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "blocks", ".", "length", ";", "i", "++", ")", "{", "long", "left", "=", "len", "-", "(", "long", ")", "Configuration", ".", "BLOCK_SIZE", "*", "i", ";", "long", "read", "=", "left", ">", "Configuration", ".", "BLOCK_SIZE", "?", "Configuration", ".", "BLOCK_SIZE", ":", "left", ";", "blocks", "[", "i", "]", "=", "oneBlock", "(", "buffer", ",", "in", ",", "(", "int", ")", "read", ")", ";", "}", "return", "resultEncode", "(", "blocks", ")", ";", "}" ]
计算输入流的etag @param in 数据输入流 @param len 数据流长度 @return 数据流的etag值 @throws IOException 文件读取异常
[ "计算输入流的etag" ]
train
https://github.com/qiniu/android-sdk/blob/dbd2a01fb3bff7a5e75e8934bbf81713124d8466/library/src/main/java/com/qiniu/android/utils/Etag.java#L100-L112
couchbase/couchbase-lite-java
src/main/java/okhttp3/internal/tls/CustomHostnameVerifier.java
CustomHostnameVerifier.verifyHostname
private boolean verifyHostname(String hostname, X509Certificate certificate) { """ Returns true if {@code certificate} matches {@code hostname}. """ hostname = hostname.toLowerCase(Locale.US); boolean hasDns = false; List<String> altNames = getSubjectAltNames(certificate, ALT_DNS_NAME); for (int i = 0, size = altNames.size(); i < size; i++) { hasDns = true; if (verifyHostname(hostname, altNames.get(i))) { return true; } } if (!hasDns) { X500Principal principal = certificate.getSubjectX500Principal(); // RFC 2818 advises using the most specific name for matching. String cn = new DistinguishedNameParser(principal).findMostSpecific("cn"); if (cn != null) { return verifyHostname(hostname, cn); } else { // NOTE: In case of empty Common Name (CN), not checking return true; } } return false; }
java
private boolean verifyHostname(String hostname, X509Certificate certificate) { hostname = hostname.toLowerCase(Locale.US); boolean hasDns = false; List<String> altNames = getSubjectAltNames(certificate, ALT_DNS_NAME); for (int i = 0, size = altNames.size(); i < size; i++) { hasDns = true; if (verifyHostname(hostname, altNames.get(i))) { return true; } } if (!hasDns) { X500Principal principal = certificate.getSubjectX500Principal(); // RFC 2818 advises using the most specific name for matching. String cn = new DistinguishedNameParser(principal).findMostSpecific("cn"); if (cn != null) { return verifyHostname(hostname, cn); } else { // NOTE: In case of empty Common Name (CN), not checking return true; } } return false; }
[ "private", "boolean", "verifyHostname", "(", "String", "hostname", ",", "X509Certificate", "certificate", ")", "{", "hostname", "=", "hostname", ".", "toLowerCase", "(", "Locale", ".", "US", ")", ";", "boolean", "hasDns", "=", "false", ";", "List", "<", "String", ">", "altNames", "=", "getSubjectAltNames", "(", "certificate", ",", "ALT_DNS_NAME", ")", ";", "for", "(", "int", "i", "=", "0", ",", "size", "=", "altNames", ".", "size", "(", ")", ";", "i", "<", "size", ";", "i", "++", ")", "{", "hasDns", "=", "true", ";", "if", "(", "verifyHostname", "(", "hostname", ",", "altNames", ".", "get", "(", "i", ")", ")", ")", "{", "return", "true", ";", "}", "}", "if", "(", "!", "hasDns", ")", "{", "X500Principal", "principal", "=", "certificate", ".", "getSubjectX500Principal", "(", ")", ";", "// RFC 2818 advises using the most specific name for matching.", "String", "cn", "=", "new", "DistinguishedNameParser", "(", "principal", ")", ".", "findMostSpecific", "(", "\"cn\"", ")", ";", "if", "(", "cn", "!=", "null", ")", "{", "return", "verifyHostname", "(", "hostname", ",", "cn", ")", ";", "}", "else", "{", "// NOTE: In case of empty Common Name (CN), not checking", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Returns true if {@code certificate} matches {@code hostname}.
[ "Returns", "true", "if", "{" ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/okhttp3/internal/tls/CustomHostnameVerifier.java#L95-L120
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java
EnhancedBigtableStub.createSampleRowKeysCallable
private UnaryCallable<String, List<KeyOffset>> createSampleRowKeysCallable() { """ Creates a callable chain to handle SampleRowKeys RPcs. The chain will: <ul> <li>Convert a table id to a {@link com.google.bigtable.v2.SampleRowKeysRequest}. <li>Dispatch the request to the GAPIC's {@link BigtableStub#sampleRowKeysCallable()}. <li>Spool responses into a list. <li>Retry on failure. <li>Convert the responses into {@link KeyOffset}s. </ul> """ UnaryCallable<SampleRowKeysRequest, List<SampleRowKeysResponse>> spoolable = stub.sampleRowKeysCallable().all(); UnaryCallable<SampleRowKeysRequest, List<SampleRowKeysResponse>> retryable = Callables.retrying(spoolable, settings.sampleRowKeysSettings(), clientContext); return createUserFacingUnaryCallable( "SampleRowKeys", new SampleRowKeysCallable(retryable, requestContext)); }
java
private UnaryCallable<String, List<KeyOffset>> createSampleRowKeysCallable() { UnaryCallable<SampleRowKeysRequest, List<SampleRowKeysResponse>> spoolable = stub.sampleRowKeysCallable().all(); UnaryCallable<SampleRowKeysRequest, List<SampleRowKeysResponse>> retryable = Callables.retrying(spoolable, settings.sampleRowKeysSettings(), clientContext); return createUserFacingUnaryCallable( "SampleRowKeys", new SampleRowKeysCallable(retryable, requestContext)); }
[ "private", "UnaryCallable", "<", "String", ",", "List", "<", "KeyOffset", ">", ">", "createSampleRowKeysCallable", "(", ")", "{", "UnaryCallable", "<", "SampleRowKeysRequest", ",", "List", "<", "SampleRowKeysResponse", ">", ">", "spoolable", "=", "stub", ".", "sampleRowKeysCallable", "(", ")", ".", "all", "(", ")", ";", "UnaryCallable", "<", "SampleRowKeysRequest", ",", "List", "<", "SampleRowKeysResponse", ">", ">", "retryable", "=", "Callables", ".", "retrying", "(", "spoolable", ",", "settings", ".", "sampleRowKeysSettings", "(", ")", ",", "clientContext", ")", ";", "return", "createUserFacingUnaryCallable", "(", "\"SampleRowKeys\"", ",", "new", "SampleRowKeysCallable", "(", "retryable", ",", "requestContext", ")", ")", ";", "}" ]
Creates a callable chain to handle SampleRowKeys RPcs. The chain will: <ul> <li>Convert a table id to a {@link com.google.bigtable.v2.SampleRowKeysRequest}. <li>Dispatch the request to the GAPIC's {@link BigtableStub#sampleRowKeysCallable()}. <li>Spool responses into a list. <li>Retry on failure. <li>Convert the responses into {@link KeyOffset}s. </ul>
[ "Creates", "a", "callable", "chain", "to", "handle", "SampleRowKeys", "RPcs", ".", "The", "chain", "will", ":" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStub.java#L279-L288
OpenLiberty/open-liberty
dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java
TypeConversion.bytesToLong
public static long bytesToLong(byte[] bytes, int offset) { """ A utility method to convert the long from the byte array to a long. @param bytes The byte array containing the long. @param offset The index at which the long is located. @return The long value. """ long result = 0x0; for (int i = offset; i < offset + 8; ++i) { result = result << 8; result |= (bytes[i] & 0x00000000000000FFl); } return result; }
java
public static long bytesToLong(byte[] bytes, int offset) { long result = 0x0; for (int i = offset; i < offset + 8; ++i) { result = result << 8; result |= (bytes[i] & 0x00000000000000FFl); } return result; }
[ "public", "static", "long", "bytesToLong", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ")", "{", "long", "result", "=", "0x0", ";", "for", "(", "int", "i", "=", "offset", ";", "i", "<", "offset", "+", "8", ";", "++", "i", ")", "{", "result", "=", "result", "<<", "8", ";", "result", "|=", "(", "bytes", "[", "i", "]", "&", "0x00000000000000FF", "l", ")", ";", "}", "return", "result", ";", "}" ]
A utility method to convert the long from the byte array to a long. @param bytes The byte array containing the long. @param offset The index at which the long is located. @return The long value.
[ "A", "utility", "method", "to", "convert", "the", "long", "from", "the", "byte", "array", "to", "a", "long", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java#L65-L72
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.deleteUser
public void deleteUser(CmsRequestContext context, String username) throws CmsException { """ Deletes a user.<p> @param context the current request context @param username the name of the user to be deleted @throws CmsException if something goes wrong """ CmsUser user = readUser(context, username); deleteUser(context, user, null); }
java
public void deleteUser(CmsRequestContext context, String username) throws CmsException { CmsUser user = readUser(context, username); deleteUser(context, user, null); }
[ "public", "void", "deleteUser", "(", "CmsRequestContext", "context", ",", "String", "username", ")", "throws", "CmsException", "{", "CmsUser", "user", "=", "readUser", "(", "context", ",", "username", ")", ";", "deleteUser", "(", "context", ",", "user", ",", "null", ")", ";", "}" ]
Deletes a user.<p> @param context the current request context @param username the name of the user to be deleted @throws CmsException if something goes wrong
[ "Deletes", "a", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L1697-L1701
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.primitiveArrayPut
protected static Object primitiveArrayPut(Object self, int idx, Object newValue) { """ Implements the setAt(int idx) method for primitive type arrays. @param self an object @param idx the index of interest @param newValue the new value to be put into the index of interest @return the added value @since 1.5.0 """ Array.set(self, normaliseIndex(idx, Array.getLength(self)), newValue); return newValue; }
java
protected static Object primitiveArrayPut(Object self, int idx, Object newValue) { Array.set(self, normaliseIndex(idx, Array.getLength(self)), newValue); return newValue; }
[ "protected", "static", "Object", "primitiveArrayPut", "(", "Object", "self", ",", "int", "idx", ",", "Object", "newValue", ")", "{", "Array", ".", "set", "(", "self", ",", "normaliseIndex", "(", "idx", ",", "Array", ".", "getLength", "(", "self", ")", ")", ",", "newValue", ")", ";", "return", "newValue", ";", "}" ]
Implements the setAt(int idx) method for primitive type arrays. @param self an object @param idx the index of interest @param newValue the new value to be put into the index of interest @return the added value @since 1.5.0
[ "Implements", "the", "setAt", "(", "int", "idx", ")", "method", "for", "primitive", "type", "arrays", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L14599-L14602
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java
HttpPostRequestEncoder.addBodyFileUpload
public void addBodyFileUpload(String name, String filename, File file, String contentType, boolean isText) throws ErrorDataEncoderException { """ Add a file as a FileUpload @param name the name of the parameter @param file the file to be uploaded (if not Multipart mode, only the filename will be included) @param filename the filename to use for this File part, empty String will be ignored by the encoder @param contentType the associated contentType for the File @param isText True if this file should be transmitted in Text format (else binary) @throws NullPointerException for name and file @throws ErrorDataEncoderException if the encoding is in error or if the finalize were already done """ checkNotNull(name, "name"); checkNotNull(file, "file"); if (filename == null) { filename = StringUtil.EMPTY_STRING; } String scontentType = contentType; String contentTransferEncoding = null; if (contentType == null) { if (isText) { scontentType = HttpPostBodyUtil.DEFAULT_TEXT_CONTENT_TYPE; } else { scontentType = HttpPostBodyUtil.DEFAULT_BINARY_CONTENT_TYPE; } } if (!isText) { contentTransferEncoding = HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value(); } FileUpload fileUpload = factory.createFileUpload(request, name, filename, scontentType, contentTransferEncoding, null, file.length()); try { fileUpload.setContent(file); } catch (IOException e) { throw new ErrorDataEncoderException(e); } addBodyHttpData(fileUpload); }
java
public void addBodyFileUpload(String name, String filename, File file, String contentType, boolean isText) throws ErrorDataEncoderException { checkNotNull(name, "name"); checkNotNull(file, "file"); if (filename == null) { filename = StringUtil.EMPTY_STRING; } String scontentType = contentType; String contentTransferEncoding = null; if (contentType == null) { if (isText) { scontentType = HttpPostBodyUtil.DEFAULT_TEXT_CONTENT_TYPE; } else { scontentType = HttpPostBodyUtil.DEFAULT_BINARY_CONTENT_TYPE; } } if (!isText) { contentTransferEncoding = HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value(); } FileUpload fileUpload = factory.createFileUpload(request, name, filename, scontentType, contentTransferEncoding, null, file.length()); try { fileUpload.setContent(file); } catch (IOException e) { throw new ErrorDataEncoderException(e); } addBodyHttpData(fileUpload); }
[ "public", "void", "addBodyFileUpload", "(", "String", "name", ",", "String", "filename", ",", "File", "file", ",", "String", "contentType", ",", "boolean", "isText", ")", "throws", "ErrorDataEncoderException", "{", "checkNotNull", "(", "name", ",", "\"name\"", ")", ";", "checkNotNull", "(", "file", ",", "\"file\"", ")", ";", "if", "(", "filename", "==", "null", ")", "{", "filename", "=", "StringUtil", ".", "EMPTY_STRING", ";", "}", "String", "scontentType", "=", "contentType", ";", "String", "contentTransferEncoding", "=", "null", ";", "if", "(", "contentType", "==", "null", ")", "{", "if", "(", "isText", ")", "{", "scontentType", "=", "HttpPostBodyUtil", ".", "DEFAULT_TEXT_CONTENT_TYPE", ";", "}", "else", "{", "scontentType", "=", "HttpPostBodyUtil", ".", "DEFAULT_BINARY_CONTENT_TYPE", ";", "}", "}", "if", "(", "!", "isText", ")", "{", "contentTransferEncoding", "=", "HttpPostBodyUtil", ".", "TransferEncodingMechanism", ".", "BINARY", ".", "value", "(", ")", ";", "}", "FileUpload", "fileUpload", "=", "factory", ".", "createFileUpload", "(", "request", ",", "name", ",", "filename", ",", "scontentType", ",", "contentTransferEncoding", ",", "null", ",", "file", ".", "length", "(", ")", ")", ";", "try", "{", "fileUpload", ".", "setContent", "(", "file", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "ErrorDataEncoderException", "(", "e", ")", ";", "}", "addBodyHttpData", "(", "fileUpload", ")", ";", "}" ]
Add a file as a FileUpload @param name the name of the parameter @param file the file to be uploaded (if not Multipart mode, only the filename will be included) @param filename the filename to use for this File part, empty String will be ignored by the encoder @param contentType the associated contentType for the File @param isText True if this file should be transmitted in Text format (else binary) @throws NullPointerException for name and file @throws ErrorDataEncoderException if the encoding is in error or if the finalize were already done
[ "Add", "a", "file", "as", "a", "FileUpload" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java#L384-L411
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java
Pixel.setRGB_fromDouble
public Pixel setRGB_fromDouble(double r, double g, double b) { """ Sets an opaque RGB value at the position currently referenced by this Pixel. <br> Each channel value is assumed to be within [0.0 .. 1.0]. Channel values outside these bounds will be clamped to them. @param r normalized red @param g normalized green @param b normalized blue @throws ArrayIndexOutOfBoundsException if this Pixel's index is not in range of the Img's data array. @see #setARGB_fromDouble(double, double, double, double) @see #setRGB_fromDouble_preserveAlpha(double, double, double) @see #setRGB(int, int, int) @see #a_asDouble() @see #r_asDouble() @see #g_asDouble() @see #b_asDouble() @since 1.2 """ return setValue(Pixel.rgb_fromNormalized(r, g, b)); }
java
public Pixel setRGB_fromDouble(double r, double g, double b){ return setValue(Pixel.rgb_fromNormalized(r, g, b)); }
[ "public", "Pixel", "setRGB_fromDouble", "(", "double", "r", ",", "double", "g", ",", "double", "b", ")", "{", "return", "setValue", "(", "Pixel", ".", "rgb_fromNormalized", "(", "r", ",", "g", ",", "b", ")", ")", ";", "}" ]
Sets an opaque RGB value at the position currently referenced by this Pixel. <br> Each channel value is assumed to be within [0.0 .. 1.0]. Channel values outside these bounds will be clamped to them. @param r normalized red @param g normalized green @param b normalized blue @throws ArrayIndexOutOfBoundsException if this Pixel's index is not in range of the Img's data array. @see #setARGB_fromDouble(double, double, double, double) @see #setRGB_fromDouble_preserveAlpha(double, double, double) @see #setRGB(int, int, int) @see #a_asDouble() @see #r_asDouble() @see #g_asDouble() @see #b_asDouble() @since 1.2
[ "Sets", "an", "opaque", "RGB", "value", "at", "the", "position", "currently", "referenced", "by", "this", "Pixel", ".", "<br", ">", "Each", "channel", "value", "is", "assumed", "to", "be", "within", "[", "0", ".", "0", "..", "1", ".", "0", "]", ".", "Channel", "values", "outside", "these", "bounds", "will", "be", "clamped", "to", "them", ".", "@param", "r", "normalized", "red", "@param", "g", "normalized", "green", "@param", "b", "normalized", "blue", "@throws", "ArrayIndexOutOfBoundsException", "if", "this", "Pixel", "s", "index", "is", "not", "in", "range", "of", "the", "Img", "s", "data", "array", "." ]
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L429-L431
graphql-java/graphql-java
src/main/java/graphql/execution/instrumentation/fieldvalidation/SimpleFieldValidation.java
SimpleFieldValidation.addRule
public SimpleFieldValidation addRule(ExecutionPath fieldPath, BiFunction<FieldAndArguments, FieldValidationEnvironment, Optional<GraphQLError>> rule) { """ Adds the rule against the field address path. If the rule returns an error, it will be added to the list of errors @param fieldPath the path to the field @param rule the rule function @return this validator """ rules.put(fieldPath, rule); return this; }
java
public SimpleFieldValidation addRule(ExecutionPath fieldPath, BiFunction<FieldAndArguments, FieldValidationEnvironment, Optional<GraphQLError>> rule) { rules.put(fieldPath, rule); return this; }
[ "public", "SimpleFieldValidation", "addRule", "(", "ExecutionPath", "fieldPath", ",", "BiFunction", "<", "FieldAndArguments", ",", "FieldValidationEnvironment", ",", "Optional", "<", "GraphQLError", ">", ">", "rule", ")", "{", "rules", ".", "put", "(", "fieldPath", ",", "rule", ")", ";", "return", "this", ";", "}" ]
Adds the rule against the field address path. If the rule returns an error, it will be added to the list of errors @param fieldPath the path to the field @param rule the rule function @return this validator
[ "Adds", "the", "rule", "against", "the", "field", "address", "path", ".", "If", "the", "rule", "returns", "an", "error", "it", "will", "be", "added", "to", "the", "list", "of", "errors" ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/execution/instrumentation/fieldvalidation/SimpleFieldValidation.java#L34-L37
UrielCh/ovh-java-sdk
ovh-java-sdk-licensevirtuozzo/src/main/java/net/minidev/ovh/api/ApiOvhLicensevirtuozzo.java
ApiOvhLicensevirtuozzo.serviceName_canLicenseBeMovedTo_GET
public OvhChangeIpStatus serviceName_canLicenseBeMovedTo_GET(String serviceName, String destinationIp) throws IOException { """ Will tell if the ip can accept the license REST: GET /license/virtuozzo/{serviceName}/canLicenseBeMovedTo @param destinationIp [required] The Ip on which you want to move this license @param serviceName [required] The name of your Virtuozzo license """ String qPath = "/license/virtuozzo/{serviceName}/canLicenseBeMovedTo"; StringBuilder sb = path(qPath, serviceName); query(sb, "destinationIp", destinationIp); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhChangeIpStatus.class); }
java
public OvhChangeIpStatus serviceName_canLicenseBeMovedTo_GET(String serviceName, String destinationIp) throws IOException { String qPath = "/license/virtuozzo/{serviceName}/canLicenseBeMovedTo"; StringBuilder sb = path(qPath, serviceName); query(sb, "destinationIp", destinationIp); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhChangeIpStatus.class); }
[ "public", "OvhChangeIpStatus", "serviceName_canLicenseBeMovedTo_GET", "(", "String", "serviceName", ",", "String", "destinationIp", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/license/virtuozzo/{serviceName}/canLicenseBeMovedTo\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"destinationIp\"", ",", "destinationIp", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhChangeIpStatus", ".", "class", ")", ";", "}" ]
Will tell if the ip can accept the license REST: GET /license/virtuozzo/{serviceName}/canLicenseBeMovedTo @param destinationIp [required] The Ip on which you want to move this license @param serviceName [required] The name of your Virtuozzo license
[ "Will", "tell", "if", "the", "ip", "can", "accept", "the", "license" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-licensevirtuozzo/src/main/java/net/minidev/ovh/api/ApiOvhLicensevirtuozzo.java#L227-L233
prestodb/presto
presto-parser/src/main/java/com/facebook/presto/sql/tree/Node.java
Node.accept
protected <R, C> R accept(AstVisitor<R, C> visitor, C context) { """ Accessible for {@link AstVisitor}, use {@link AstVisitor#process(Node, Object)} instead. """ return visitor.visitNode(this, context); }
java
protected <R, C> R accept(AstVisitor<R, C> visitor, C context) { return visitor.visitNode(this, context); }
[ "protected", "<", "R", ",", "C", ">", "R", "accept", "(", "AstVisitor", "<", "R", ",", "C", ">", "visitor", ",", "C", "context", ")", "{", "return", "visitor", ".", "visitNode", "(", "this", ",", "context", ")", ";", "}" ]
Accessible for {@link AstVisitor}, use {@link AstVisitor#process(Node, Object)} instead.
[ "Accessible", "for", "{" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-parser/src/main/java/com/facebook/presto/sql/tree/Node.java#L33-L36
google/error-prone-javac
src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocFormatter.java
JavadocFormatter.formatJavadoc
public String formatJavadoc(String header, String javadoc) { """ Format javadoc to plain text. @param header element caption that should be used @param javadoc to format @return javadoc formatted to plain text """ try { StringBuilder result = new StringBuilder(); result.append(escape(CODE_HIGHLIGHT)).append(header).append(escape(CODE_RESET)).append("\n"); if (javadoc == null) { return result.toString(); } JavacTask task = (JavacTask) ToolProvider.getSystemJavaCompiler().getTask(null, null, null, null, null, null); DocTrees trees = DocTrees.instance(task); DocCommentTree docComment = trees.getDocCommentTree(new SimpleJavaFileObject(new URI("mem://doc.html"), Kind.HTML) { @Override @DefinedBy(Api.COMPILER) public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return "<body>" + javadoc + "</body>"; } }); new FormatJavadocScanner(result, task).scan(docComment, null); addNewLineIfNeeded(result); return result.toString(); } catch (URISyntaxException ex) { throw new InternalError("Unexpected exception", ex); } }
java
public String formatJavadoc(String header, String javadoc) { try { StringBuilder result = new StringBuilder(); result.append(escape(CODE_HIGHLIGHT)).append(header).append(escape(CODE_RESET)).append("\n"); if (javadoc == null) { return result.toString(); } JavacTask task = (JavacTask) ToolProvider.getSystemJavaCompiler().getTask(null, null, null, null, null, null); DocTrees trees = DocTrees.instance(task); DocCommentTree docComment = trees.getDocCommentTree(new SimpleJavaFileObject(new URI("mem://doc.html"), Kind.HTML) { @Override @DefinedBy(Api.COMPILER) public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException { return "<body>" + javadoc + "</body>"; } }); new FormatJavadocScanner(result, task).scan(docComment, null); addNewLineIfNeeded(result); return result.toString(); } catch (URISyntaxException ex) { throw new InternalError("Unexpected exception", ex); } }
[ "public", "String", "formatJavadoc", "(", "String", "header", ",", "String", "javadoc", ")", "{", "try", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "escape", "(", "CODE_HIGHLIGHT", ")", ")", ".", "append", "(", "header", ")", ".", "append", "(", "escape", "(", "CODE_RESET", ")", ")", ".", "append", "(", "\"\\n\"", ")", ";", "if", "(", "javadoc", "==", "null", ")", "{", "return", "result", ".", "toString", "(", ")", ";", "}", "JavacTask", "task", "=", "(", "JavacTask", ")", "ToolProvider", ".", "getSystemJavaCompiler", "(", ")", ".", "getTask", "(", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ")", ";", "DocTrees", "trees", "=", "DocTrees", ".", "instance", "(", "task", ")", ";", "DocCommentTree", "docComment", "=", "trees", ".", "getDocCommentTree", "(", "new", "SimpleJavaFileObject", "(", "new", "URI", "(", "\"mem://doc.html\"", ")", ",", "Kind", ".", "HTML", ")", "{", "@", "Override", "@", "DefinedBy", "(", "Api", ".", "COMPILER", ")", "public", "CharSequence", "getCharContent", "(", "boolean", "ignoreEncodingErrors", ")", "throws", "IOException", "{", "return", "\"<body>\"", "+", "javadoc", "+", "\"</body>\"", ";", "}", "}", ")", ";", "new", "FormatJavadocScanner", "(", "result", ",", "task", ")", ".", "scan", "(", "docComment", ",", "null", ")", ";", "addNewLineIfNeeded", "(", "result", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}", "catch", "(", "URISyntaxException", "ex", ")", "{", "throw", "new", "InternalError", "(", "\"Unexpected exception\"", ",", "ex", ")", ";", "}", "}" ]
Format javadoc to plain text. @param header element caption that should be used @param javadoc to format @return javadoc formatted to plain text
[ "Format", "javadoc", "to", "plain", "text", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/jdk/internal/shellsupport/doc/JavadocFormatter.java#L99-L126
zaproxy/zaproxy
src/org/parosproxy/paros/core/scanner/VariantURLQuery.java
VariantURLQuery.getEscapedValue
@Override protected String getEscapedValue(HttpMessage msg, String value) { """ Encode the parameter for a correct URL introduction @param msg the message object @param value the value that need to be encoded @return the Encoded value """ // ZAP: unfortunately the method setQuery() defined inside the httpclient Apache component // create trouble when special characters like ?+? are set inside the parameter, // because this method implementation simply doesn't encode them. // So we have to explicitly encode values using the URLEncoder component before setting it. return (value != null) ? AbstractPlugin.getURLEncode(value) : ""; }
java
@Override protected String getEscapedValue(HttpMessage msg, String value) { // ZAP: unfortunately the method setQuery() defined inside the httpclient Apache component // create trouble when special characters like ?+? are set inside the parameter, // because this method implementation simply doesn't encode them. // So we have to explicitly encode values using the URLEncoder component before setting it. return (value != null) ? AbstractPlugin.getURLEncode(value) : ""; }
[ "@", "Override", "protected", "String", "getEscapedValue", "(", "HttpMessage", "msg", ",", "String", "value", ")", "{", "// ZAP: unfortunately the method setQuery() defined inside the httpclient Apache component\r", "// create trouble when special characters like ?+? are set inside the parameter, \r", "// because this method implementation simply doesn't encode them.\r", "// So we have to explicitly encode values using the URLEncoder component before setting it.\r", "return", "(", "value", "!=", "null", ")", "?", "AbstractPlugin", ".", "getURLEncode", "(", "value", ")", ":", "\"\"", ";", "}" ]
Encode the parameter for a correct URL introduction @param msg the message object @param value the value that need to be encoded @return the Encoded value
[ "Encode", "the", "parameter", "for", "a", "correct", "URL", "introduction" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/core/scanner/VariantURLQuery.java#L51-L59
elastic/elasticsearch-hadoop
storm/src/main/java/org/elasticsearch/storm/security/AutoElasticsearch.java
AutoElasticsearch.populateCredentials
@Override public void populateCredentials(Map<String, String> credentials, Map topologyConfiguration) { """ {@inheritDoc} @deprecated This is available for any storm cluster that operates against the older method of obtaining credentials """ populateCredentials(credentials, topologyConfiguration, null); }
java
@Override public void populateCredentials(Map<String, String> credentials, Map topologyConfiguration) { populateCredentials(credentials, topologyConfiguration, null); }
[ "@", "Override", "public", "void", "populateCredentials", "(", "Map", "<", "String", ",", "String", ">", "credentials", ",", "Map", "topologyConfiguration", ")", "{", "populateCredentials", "(", "credentials", ",", "topologyConfiguration", ",", "null", ")", ";", "}" ]
{@inheritDoc} @deprecated This is available for any storm cluster that operates against the older method of obtaining credentials
[ "{" ]
train
https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/storm/src/main/java/org/elasticsearch/storm/security/AutoElasticsearch.java#L98-L101
SeleniumHQ/fluent-selenium
java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java
FluentSelect.deselectByIndex
public FluentSelect deselectByIndex(final int index) { """ Deselect the option at the given index. This is done by examining the "index" attribute of an element, and not merely by counting. @param index The option at this index will be deselected """ executeAndWrapReThrowIfNeeded(new DeselectByIndex(index), Context.singular(context, "deselectByIndex", null, index), true); return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException); }
java
public FluentSelect deselectByIndex(final int index) { executeAndWrapReThrowIfNeeded(new DeselectByIndex(index), Context.singular(context, "deselectByIndex", null, index), true); return new FluentSelect(super.delegate, currentElement.getFound(), this.context, monitor, booleanInsteadOfNotFoundException); }
[ "public", "FluentSelect", "deselectByIndex", "(", "final", "int", "index", ")", "{", "executeAndWrapReThrowIfNeeded", "(", "new", "DeselectByIndex", "(", "index", ")", ",", "Context", ".", "singular", "(", "context", ",", "\"deselectByIndex\"", ",", "null", ",", "index", ")", ",", "true", ")", ";", "return", "new", "FluentSelect", "(", "super", ".", "delegate", ",", "currentElement", ".", "getFound", "(", ")", ",", "this", ".", "context", ",", "monitor", ",", "booleanInsteadOfNotFoundException", ")", ";", "}" ]
Deselect the option at the given index. This is done by examining the "index" attribute of an element, and not merely by counting. @param index The option at this index will be deselected
[ "Deselect", "the", "option", "at", "the", "given", "index", ".", "This", "is", "done", "by", "examining", "the", "index", "attribute", "of", "an", "element", "and", "not", "merely", "by", "counting", "." ]
train
https://github.com/SeleniumHQ/fluent-selenium/blob/fcb171471a7d1abb2800bcbca21b3ae3e6c12472/java/src/main/java/org/seleniumhq/selenium/fluent/FluentSelect.java#L152-L155
aragozin/jvm-tools
mxdump/src/main/java/org/gridkit/jvmtool/jackson/WriterBasedGenerator.java
WriterBasedGenerator._appendCharacterEscape
private final void _appendCharacterEscape(char ch, int escCode) throws IOException, JsonGenerationException { """ Method called to append escape sequence for given character, at the end of standard output buffer; or if not possible, write out directly. """ if (escCode >= 0) { // \\N (2 char) if ((_outputTail + 2) > _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = '\\'; _outputBuffer[_outputTail++] = (char) escCode; return; } if (escCode != CharacterEscapes.ESCAPE_CUSTOM) { // std, \\uXXXX if ((_outputTail + 2) > _outputEnd) { _flushBuffer(); } int ptr = _outputTail; char[] buf = _outputBuffer; buf[ptr++] = '\\'; buf[ptr++] = 'u'; // We know it's a control char, so only the last 2 chars are non-0 if (ch > 0xFF) { // beyond 8 bytes int hi = (ch >> 8) & 0xFF; buf[ptr++] = HEX_CHARS[hi >> 4]; buf[ptr++] = HEX_CHARS[hi & 0xF]; ch &= 0xFF; } else { buf[ptr++] = '0'; buf[ptr++] = '0'; } buf[ptr++] = HEX_CHARS[ch >> 4]; buf[ptr] = HEX_CHARS[ch & 0xF]; _outputTail = ptr; return; } }
java
private final void _appendCharacterEscape(char ch, int escCode) throws IOException, JsonGenerationException { if (escCode >= 0) { // \\N (2 char) if ((_outputTail + 2) > _outputEnd) { _flushBuffer(); } _outputBuffer[_outputTail++] = '\\'; _outputBuffer[_outputTail++] = (char) escCode; return; } if (escCode != CharacterEscapes.ESCAPE_CUSTOM) { // std, \\uXXXX if ((_outputTail + 2) > _outputEnd) { _flushBuffer(); } int ptr = _outputTail; char[] buf = _outputBuffer; buf[ptr++] = '\\'; buf[ptr++] = 'u'; // We know it's a control char, so only the last 2 chars are non-0 if (ch > 0xFF) { // beyond 8 bytes int hi = (ch >> 8) & 0xFF; buf[ptr++] = HEX_CHARS[hi >> 4]; buf[ptr++] = HEX_CHARS[hi & 0xF]; ch &= 0xFF; } else { buf[ptr++] = '0'; buf[ptr++] = '0'; } buf[ptr++] = HEX_CHARS[ch >> 4]; buf[ptr] = HEX_CHARS[ch & 0xF]; _outputTail = ptr; return; } }
[ "private", "final", "void", "_appendCharacterEscape", "(", "char", "ch", ",", "int", "escCode", ")", "throws", "IOException", ",", "JsonGenerationException", "{", "if", "(", "escCode", ">=", "0", ")", "{", "// \\\\N (2 char)", "if", "(", "(", "_outputTail", "+", "2", ")", ">", "_outputEnd", ")", "{", "_flushBuffer", "(", ")", ";", "}", "_outputBuffer", "[", "_outputTail", "++", "]", "=", "'", "'", ";", "_outputBuffer", "[", "_outputTail", "++", "]", "=", "(", "char", ")", "escCode", ";", "return", ";", "}", "if", "(", "escCode", "!=", "CharacterEscapes", ".", "ESCAPE_CUSTOM", ")", "{", "// std, \\\\uXXXX", "if", "(", "(", "_outputTail", "+", "2", ")", ">", "_outputEnd", ")", "{", "_flushBuffer", "(", ")", ";", "}", "int", "ptr", "=", "_outputTail", ";", "char", "[", "]", "buf", "=", "_outputBuffer", ";", "buf", "[", "ptr", "++", "]", "=", "'", "'", ";", "buf", "[", "ptr", "++", "]", "=", "'", "'", ";", "// We know it's a control char, so only the last 2 chars are non-0", "if", "(", "ch", ">", "0xFF", ")", "{", "// beyond 8 bytes", "int", "hi", "=", "(", "ch", ">>", "8", ")", "&", "0xFF", ";", "buf", "[", "ptr", "++", "]", "=", "HEX_CHARS", "[", "hi", ">>", "4", "]", ";", "buf", "[", "ptr", "++", "]", "=", "HEX_CHARS", "[", "hi", "&", "0xF", "]", ";", "ch", "&=", "0xFF", ";", "}", "else", "{", "buf", "[", "ptr", "++", "]", "=", "'", "'", ";", "buf", "[", "ptr", "++", "]", "=", "'", "'", ";", "}", "buf", "[", "ptr", "++", "]", "=", "HEX_CHARS", "[", "ch", ">>", "4", "]", ";", "buf", "[", "ptr", "]", "=", "HEX_CHARS", "[", "ch", "&", "0xF", "]", ";", "_outputTail", "=", "ptr", ";", "return", ";", "}", "}" ]
Method called to append escape sequence for given character, at the end of standard output buffer; or if not possible, write out directly.
[ "Method", "called", "to", "append", "escape", "sequence", "for", "given", "character", "at", "the", "end", "of", "standard", "output", "buffer", ";", "or", "if", "not", "possible", "write", "out", "directly", "." ]
train
https://github.com/aragozin/jvm-tools/blob/d3a4d0c6a47fb9317f274988569655f30dcd2f76/mxdump/src/main/java/org/gridkit/jvmtool/jackson/WriterBasedGenerator.java#L1325-L1359
netheosgithub/pcs_api
java/src/main/java/net/netheos/pcsapi/models/CDownloadRequest.java
CDownloadRequest.setRange
public CDownloadRequest setRange( long offset, long length ) { """ Defines a range for partial content download. Note that second parameter is a length, not an offset (this differs from http header Range header raw value). <ul> <li>(-1, -1) = default : download full blob.</li> <li>(10, -1) = download, starting at offset 10</li> <li>(-1, 10) = download last 10 bytes</li> <li>(10, 100) = download 100 bytes, starting at offset 10.</li> </ul> @param offset The start offset to download the file, or &lt;0 for downloading only end of file @param length (never 0) The data length to download, or &lt;0 for downloading up to end of file @return This download request """ if ( length == 0 ) { // Indicate we want to download 0 bytes ?! We ignore such specification length = -1; } if ( offset < 0 && length < 0 ) { byteRange = null; } else { byteRange = new ByteRange( offset, length ); } return this; }
java
public CDownloadRequest setRange( long offset, long length ) { if ( length == 0 ) { // Indicate we want to download 0 bytes ?! We ignore such specification length = -1; } if ( offset < 0 && length < 0 ) { byteRange = null; } else { byteRange = new ByteRange( offset, length ); } return this; }
[ "public", "CDownloadRequest", "setRange", "(", "long", "offset", ",", "long", "length", ")", "{", "if", "(", "length", "==", "0", ")", "{", "// Indicate we want to download 0 bytes ?! We ignore such specification", "length", "=", "-", "1", ";", "}", "if", "(", "offset", "<", "0", "&&", "length", "<", "0", ")", "{", "byteRange", "=", "null", ";", "}", "else", "{", "byteRange", "=", "new", "ByteRange", "(", "offset", ",", "length", ")", ";", "}", "return", "this", ";", "}" ]
Defines a range for partial content download. Note that second parameter is a length, not an offset (this differs from http header Range header raw value). <ul> <li>(-1, -1) = default : download full blob.</li> <li>(10, -1) = download, starting at offset 10</li> <li>(-1, 10) = download last 10 bytes</li> <li>(10, 100) = download 100 bytes, starting at offset 10.</li> </ul> @param offset The start offset to download the file, or &lt;0 for downloading only end of file @param length (never 0) The data length to download, or &lt;0 for downloading up to end of file @return This download request
[ "Defines", "a", "range", "for", "partial", "content", "download", ".", "Note", "that", "second", "parameter", "is", "a", "length", "not", "an", "offset", "(", "this", "differs", "from", "http", "header", "Range", "header", "raw", "value", ")", ".", "<ul", ">", "<li", ">", "(", "-", "1", "-", "1", ")", "=", "default", ":", "download", "full", "blob", ".", "<", "/", "li", ">", "<li", ">", "(", "10", "-", "1", ")", "=", "download", "starting", "at", "offset", "10<", "/", "li", ">", "<li", ">", "(", "-", "1", "10", ")", "=", "download", "last", "10", "bytes<", "/", "li", ">", "<li", ">", "(", "10", "100", ")", "=", "download", "100", "bytes", "starting", "at", "offset", "10", ".", "<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/models/CDownloadRequest.java#L101-L113
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/blueprint/BlueprintProducersFactory.java
BlueprintProducersFactory.getBlueprintProducer
public static BlueprintProducer getBlueprintProducer(String producerId, String category, String subsystem) { """ Returns the blueprint producer with this id. Creates one if none is existing. Uses DLC pattern to reduce synchronization overhead. @param producerId @param category @param subsystem @return """ try{ //first find producer BlueprintProducer producer = producers.get(producerId); if (producer==null){ synchronized(producers){ producer = producers.get(producerId); if (producer==null){ producer = new BlueprintProducer(producerId, category, subsystem); producers.put(producerId, producer); } } } //end producer lookup return producer; }catch(Exception e){ log.error("getBlueprintProducer("+producerId+", "+category+", "+subsystem+ ')', e); throw new RuntimeException("Handler instantiation failed - "+e.getMessage()); } }
java
public static BlueprintProducer getBlueprintProducer(String producerId, String category, String subsystem){ try{ //first find producer BlueprintProducer producer = producers.get(producerId); if (producer==null){ synchronized(producers){ producer = producers.get(producerId); if (producer==null){ producer = new BlueprintProducer(producerId, category, subsystem); producers.put(producerId, producer); } } } //end producer lookup return producer; }catch(Exception e){ log.error("getBlueprintProducer("+producerId+", "+category+", "+subsystem+ ')', e); throw new RuntimeException("Handler instantiation failed - "+e.getMessage()); } }
[ "public", "static", "BlueprintProducer", "getBlueprintProducer", "(", "String", "producerId", ",", "String", "category", ",", "String", "subsystem", ")", "{", "try", "{", "//first find producer", "BlueprintProducer", "producer", "=", "producers", ".", "get", "(", "producerId", ")", ";", "if", "(", "producer", "==", "null", ")", "{", "synchronized", "(", "producers", ")", "{", "producer", "=", "producers", ".", "get", "(", "producerId", ")", ";", "if", "(", "producer", "==", "null", ")", "{", "producer", "=", "new", "BlueprintProducer", "(", "producerId", ",", "category", ",", "subsystem", ")", ";", "producers", ".", "put", "(", "producerId", ",", "producer", ")", ";", "}", "}", "}", "//end producer lookup", "return", "producer", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"getBlueprintProducer(\"", "+", "producerId", "+", "\", \"", "+", "category", "+", "\", \"", "+", "subsystem", "+", "'", "'", ",", "e", ")", ";", "throw", "new", "RuntimeException", "(", "\"Handler instantiation failed - \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Returns the blueprint producer with this id. Creates one if none is existing. Uses DLC pattern to reduce synchronization overhead. @param producerId @param category @param subsystem @return
[ "Returns", "the", "blueprint", "producer", "with", "this", "id", ".", "Creates", "one", "if", "none", "is", "existing", ".", "Uses", "DLC", "pattern", "to", "reduce", "synchronization", "overhead", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/blueprint/BlueprintProducersFactory.java#L33-L53
bazaarvoice/emodb
common/stash/src/main/java/com/bazaarvoice/emodb/common/stash/RestartingS3InputStream.java
RestartingS3InputStream.reopenS3InputStream
private void reopenS3InputStream() throws IOException { """ Re-opens the input stream, starting at the first unread byte. """ // First attempt to close the existing input stream try { closeS3InputStream(); } catch (IOException ignore) { // Ignore this exception; we're re-opening because there was in issue with the existing stream // in the first place. } InputStream remainingIn = null; int attempt = 0; while (remainingIn == null) { try { S3Object s3Object = _s3.getObject( new GetObjectRequest(_bucket, _key) .withRange(_pos, _length - 1)); // Range is inclusive, hence length-1 remainingIn = s3Object.getObjectContent(); } catch (AmazonClientException e) { // Allow up to 3 retries attempt += 1; if (!e.isRetryable() || attempt == 4) { throw e; } // Back-off on each retry try { Thread.sleep(200 * attempt); } catch (InterruptedException interrupt) { throw Throwables.propagate(interrupt); } } } _in = remainingIn; }
java
private void reopenS3InputStream() throws IOException { // First attempt to close the existing input stream try { closeS3InputStream(); } catch (IOException ignore) { // Ignore this exception; we're re-opening because there was in issue with the existing stream // in the first place. } InputStream remainingIn = null; int attempt = 0; while (remainingIn == null) { try { S3Object s3Object = _s3.getObject( new GetObjectRequest(_bucket, _key) .withRange(_pos, _length - 1)); // Range is inclusive, hence length-1 remainingIn = s3Object.getObjectContent(); } catch (AmazonClientException e) { // Allow up to 3 retries attempt += 1; if (!e.isRetryable() || attempt == 4) { throw e; } // Back-off on each retry try { Thread.sleep(200 * attempt); } catch (InterruptedException interrupt) { throw Throwables.propagate(interrupt); } } } _in = remainingIn; }
[ "private", "void", "reopenS3InputStream", "(", ")", "throws", "IOException", "{", "// First attempt to close the existing input stream", "try", "{", "closeS3InputStream", "(", ")", ";", "}", "catch", "(", "IOException", "ignore", ")", "{", "// Ignore this exception; we're re-opening because there was in issue with the existing stream", "// in the first place.", "}", "InputStream", "remainingIn", "=", "null", ";", "int", "attempt", "=", "0", ";", "while", "(", "remainingIn", "==", "null", ")", "{", "try", "{", "S3Object", "s3Object", "=", "_s3", ".", "getObject", "(", "new", "GetObjectRequest", "(", "_bucket", ",", "_key", ")", ".", "withRange", "(", "_pos", ",", "_length", "-", "1", ")", ")", ";", "// Range is inclusive, hence length-1", "remainingIn", "=", "s3Object", ".", "getObjectContent", "(", ")", ";", "}", "catch", "(", "AmazonClientException", "e", ")", "{", "// Allow up to 3 retries", "attempt", "+=", "1", ";", "if", "(", "!", "e", ".", "isRetryable", "(", ")", "||", "attempt", "==", "4", ")", "{", "throw", "e", ";", "}", "// Back-off on each retry", "try", "{", "Thread", ".", "sleep", "(", "200", "*", "attempt", ")", ";", "}", "catch", "(", "InterruptedException", "interrupt", ")", "{", "throw", "Throwables", ".", "propagate", "(", "interrupt", ")", ";", "}", "}", "}", "_in", "=", "remainingIn", ";", "}" ]
Re-opens the input stream, starting at the first unread byte.
[ "Re", "-", "opens", "the", "input", "stream", "starting", "at", "the", "first", "unread", "byte", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/stash/src/main/java/com/bazaarvoice/emodb/common/stash/RestartingS3InputStream.java#L137-L172
eserating/siren4j
src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java
ReflectingConverter.getSubEntityAnnotation
private Siren4JSubEntity getSubEntityAnnotation(Field currentField, List<ReflectedInfo> fieldInfo) { """ Helper to retrieve a sub entity annotation from either the field itself or the getter. If an annotation exists on both, then the field wins. @param currentField assumed not <code>null</code>. @param fieldInfo assumed not <code>null</code>. @return the annotation if found else <code>null</code>. """ Siren4JSubEntity result = null; result = currentField.getAnnotation(Siren4JSubEntity.class); if (result == null && fieldInfo != null) { ReflectedInfo info = ReflectionUtils.getFieldInfoByName(fieldInfo, currentField.getName()); if (info != null && info.getGetter() != null) { result = info.getGetter().getAnnotation(Siren4JSubEntity.class); } } return result; }
java
private Siren4JSubEntity getSubEntityAnnotation(Field currentField, List<ReflectedInfo> fieldInfo) { Siren4JSubEntity result = null; result = currentField.getAnnotation(Siren4JSubEntity.class); if (result == null && fieldInfo != null) { ReflectedInfo info = ReflectionUtils.getFieldInfoByName(fieldInfo, currentField.getName()); if (info != null && info.getGetter() != null) { result = info.getGetter().getAnnotation(Siren4JSubEntity.class); } } return result; }
[ "private", "Siren4JSubEntity", "getSubEntityAnnotation", "(", "Field", "currentField", ",", "List", "<", "ReflectedInfo", ">", "fieldInfo", ")", "{", "Siren4JSubEntity", "result", "=", "null", ";", "result", "=", "currentField", ".", "getAnnotation", "(", "Siren4JSubEntity", ".", "class", ")", ";", "if", "(", "result", "==", "null", "&&", "fieldInfo", "!=", "null", ")", "{", "ReflectedInfo", "info", "=", "ReflectionUtils", ".", "getFieldInfoByName", "(", "fieldInfo", ",", "currentField", ".", "getName", "(", ")", ")", ";", "if", "(", "info", "!=", "null", "&&", "info", ".", "getGetter", "(", ")", "!=", "null", ")", "{", "result", "=", "info", ".", "getGetter", "(", ")", ".", "getAnnotation", "(", "Siren4JSubEntity", ".", "class", ")", ";", "}", "}", "return", "result", ";", "}" ]
Helper to retrieve a sub entity annotation from either the field itself or the getter. If an annotation exists on both, then the field wins. @param currentField assumed not <code>null</code>. @param fieldInfo assumed not <code>null</code>. @return the annotation if found else <code>null</code>.
[ "Helper", "to", "retrieve", "a", "sub", "entity", "annotation", "from", "either", "the", "field", "itself", "or", "the", "getter", ".", "If", "an", "annotation", "exists", "on", "both", "then", "the", "field", "wins", "." ]
train
https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L561-L571
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PKeyArea.java
PKeyArea.doRemove
public void doRemove(FieldTable table, KeyAreaInfo keyArea, BaseBuffer buffer) throws DBException { """ Delete the key from this buffer. @param table The basetable. @param keyArea The basetable's key area. @param buffer The buffer to compare. @exception DBException File exception. """ if (!this.atCurrent(buffer)) { buffer = this.doSeek("==", table, keyArea); if (buffer == null) throw new DBException(Constants.FILE_INCONSISTENCY); } this.removeCurrent(buffer); }
java
public void doRemove(FieldTable table, KeyAreaInfo keyArea, BaseBuffer buffer) throws DBException { if (!this.atCurrent(buffer)) { buffer = this.doSeek("==", table, keyArea); if (buffer == null) throw new DBException(Constants.FILE_INCONSISTENCY); } this.removeCurrent(buffer); }
[ "public", "void", "doRemove", "(", "FieldTable", "table", ",", "KeyAreaInfo", "keyArea", ",", "BaseBuffer", "buffer", ")", "throws", "DBException", "{", "if", "(", "!", "this", ".", "atCurrent", "(", "buffer", ")", ")", "{", "buffer", "=", "this", ".", "doSeek", "(", "\"==\"", ",", "table", ",", "keyArea", ")", ";", "if", "(", "buffer", "==", "null", ")", "throw", "new", "DBException", "(", "Constants", ".", "FILE_INCONSISTENCY", ")", ";", "}", "this", ".", "removeCurrent", "(", "buffer", ")", ";", "}" ]
Delete the key from this buffer. @param table The basetable. @param keyArea The basetable's key area. @param buffer The buffer to compare. @exception DBException File exception.
[ "Delete", "the", "key", "from", "this", "buffer", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PKeyArea.java#L102-L111
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFolder.java
BoxApiFolder.getCreateRequest
public BoxRequestsFolder.CreateFolder getCreateRequest(String parentId, String name) { """ Gets a request that creates a folder in a parent folder @param parentId id of the parent folder to create the folder in @param name name of the new folder @return request to create a folder """ BoxRequestsFolder.CreateFolder request = new BoxRequestsFolder.CreateFolder(parentId, name, getFoldersUrl(), mSession); return request; }
java
public BoxRequestsFolder.CreateFolder getCreateRequest(String parentId, String name) { BoxRequestsFolder.CreateFolder request = new BoxRequestsFolder.CreateFolder(parentId, name, getFoldersUrl(), mSession); return request; }
[ "public", "BoxRequestsFolder", ".", "CreateFolder", "getCreateRequest", "(", "String", "parentId", ",", "String", "name", ")", "{", "BoxRequestsFolder", ".", "CreateFolder", "request", "=", "new", "BoxRequestsFolder", ".", "CreateFolder", "(", "parentId", ",", "name", ",", "getFoldersUrl", "(", ")", ",", "mSession", ")", ";", "return", "request", ";", "}" ]
Gets a request that creates a folder in a parent folder @param parentId id of the parent folder to create the folder in @param name name of the new folder @return request to create a folder
[ "Gets", "a", "request", "that", "creates", "a", "folder", "in", "a", "parent", "folder" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFolder.java#L120-L123
datasift/datasift-java
src/main/java/com/datasift/client/accounts/DataSiftAccount.java
DataSiftAccount.getToken
public FutureData<Token> getToken(String identity, String service) { """ /* Fetch a token using it's service ID and it's Identity's ID @param identity the ID of the identity to query @param service the service of the token to fetch @return The identity for the ID provided """ FutureData<Token> future = new FutureData<>(); URI uri = newParams().put("id", identity) .forURL(config.newAPIEndpointURI(IDENTITY + "/" + identity + "/token/" + service)); Request request = config.http(). GET(uri, new PageReader(newRequestCallback(future, new Token(), config))); performRequest(future, request); return future; }
java
public FutureData<Token> getToken(String identity, String service) { FutureData<Token> future = new FutureData<>(); URI uri = newParams().put("id", identity) .forURL(config.newAPIEndpointURI(IDENTITY + "/" + identity + "/token/" + service)); Request request = config.http(). GET(uri, new PageReader(newRequestCallback(future, new Token(), config))); performRequest(future, request); return future; }
[ "public", "FutureData", "<", "Token", ">", "getToken", "(", "String", "identity", ",", "String", "service", ")", "{", "FutureData", "<", "Token", ">", "future", "=", "new", "FutureData", "<>", "(", ")", ";", "URI", "uri", "=", "newParams", "(", ")", ".", "put", "(", "\"id\"", ",", "identity", ")", ".", "forURL", "(", "config", ".", "newAPIEndpointURI", "(", "IDENTITY", "+", "\"/\"", "+", "identity", "+", "\"/token/\"", "+", "service", ")", ")", ";", "Request", "request", "=", "config", ".", "http", "(", ")", ".", "GET", "(", "uri", ",", "new", "PageReader", "(", "newRequestCallback", "(", "future", ",", "new", "Token", "(", ")", ",", "config", ")", ")", ")", ";", "performRequest", "(", "future", ",", "request", ")", ";", "return", "future", ";", "}" ]
/* Fetch a token using it's service ID and it's Identity's ID @param identity the ID of the identity to query @param service the service of the token to fetch @return The identity for the ID provided
[ "/", "*", "Fetch", "a", "token", "using", "it", "s", "service", "ID", "and", "it", "s", "Identity", "s", "ID" ]
train
https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/accounts/DataSiftAccount.java#L209-L217
pravega/pravega
shared/protocol/src/main/java/io/pravega/shared/segment/StreamSegmentNameUtils.java
StreamSegmentNameUtils.getTransactionNameFromId
public static String getTransactionNameFromId(String parentStreamSegmentName, UUID transactionId) { """ Returns the transaction name for a TransactionStreamSegment based on the name of the current Parent StreamSegment, and the transactionId. @param parentStreamSegmentName The name of the Parent StreamSegment for this transaction. @param transactionId The unique Id for the transaction. @return The name of the Transaction StreamSegmentId. """ StringBuilder result = new StringBuilder(); result.append(parentStreamSegmentName); result.append(TRANSACTION_DELIMITER); result.append(String.format(FULL_HEX_FORMAT, transactionId.getMostSignificantBits())); result.append(String.format(FULL_HEX_FORMAT, transactionId.getLeastSignificantBits())); return result.toString(); }
java
public static String getTransactionNameFromId(String parentStreamSegmentName, UUID transactionId) { StringBuilder result = new StringBuilder(); result.append(parentStreamSegmentName); result.append(TRANSACTION_DELIMITER); result.append(String.format(FULL_HEX_FORMAT, transactionId.getMostSignificantBits())); result.append(String.format(FULL_HEX_FORMAT, transactionId.getLeastSignificantBits())); return result.toString(); }
[ "public", "static", "String", "getTransactionNameFromId", "(", "String", "parentStreamSegmentName", ",", "UUID", "transactionId", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "parentStreamSegmentName", ")", ";", "result", ".", "append", "(", "TRANSACTION_DELIMITER", ")", ";", "result", ".", "append", "(", "String", ".", "format", "(", "FULL_HEX_FORMAT", ",", "transactionId", ".", "getMostSignificantBits", "(", ")", ")", ")", ";", "result", ".", "append", "(", "String", ".", "format", "(", "FULL_HEX_FORMAT", ",", "transactionId", ".", "getLeastSignificantBits", "(", ")", ")", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Returns the transaction name for a TransactionStreamSegment based on the name of the current Parent StreamSegment, and the transactionId. @param parentStreamSegmentName The name of the Parent StreamSegment for this transaction. @param transactionId The unique Id for the transaction. @return The name of the Transaction StreamSegmentId.
[ "Returns", "the", "transaction", "name", "for", "a", "TransactionStreamSegment", "based", "on", "the", "name", "of", "the", "current", "Parent", "StreamSegment", "and", "the", "transactionId", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/shared/protocol/src/main/java/io/pravega/shared/segment/StreamSegmentNameUtils.java#L83-L90
Atmosphere/wasync
wasync/src/main/java/org/atmosphere/wasync/RequestBuilder.java
RequestBuilder.queryString
public T queryString(String name, String value) { """ Add a query param. @param name header name @param value header value @return this """ List<String> l = queryString.get(name); if (l == null) { l = new ArrayList<String>(); } l.add(value); queryString.put(name, l); return derived.cast(this); }
java
public T queryString(String name, String value) { List<String> l = queryString.get(name); if (l == null) { l = new ArrayList<String>(); } l.add(value); queryString.put(name, l); return derived.cast(this); }
[ "public", "T", "queryString", "(", "String", "name", ",", "String", "value", ")", "{", "List", "<", "String", ">", "l", "=", "queryString", ".", "get", "(", "name", ")", ";", "if", "(", "l", "==", "null", ")", "{", "l", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "}", "l", ".", "add", "(", "value", ")", ";", "queryString", ".", "put", "(", "name", ",", "l", ")", ";", "return", "derived", ".", "cast", "(", "this", ")", ";", "}" ]
Add a query param. @param name header name @param value header value @return this
[ "Add", "a", "query", "param", "." ]
train
https://github.com/Atmosphere/wasync/blob/0146828b2f5138d4cbb4872fcbfe7d6e1887ac14/wasync/src/main/java/org/atmosphere/wasync/RequestBuilder.java#L125-L133
Alluxio/alluxio
core/common/src/main/java/alluxio/AbstractClient.java
AbstractClient.retryRPC
protected synchronized <V> V retryRPC(RpcCallable<V> rpc) throws AlluxioStatusException { """ Tries to execute an RPC defined as a {@link RpcCallable}. If a {@link UnavailableException} occurs, a reconnection will be tried through {@link #connect()} and the action will be re-executed. @param rpc the RPC call to be executed @param <V> type of return value of the RPC call @return the return value of the RPC call """ return retryRPCInternal(rpc, () -> null); }
java
protected synchronized <V> V retryRPC(RpcCallable<V> rpc) throws AlluxioStatusException { return retryRPCInternal(rpc, () -> null); }
[ "protected", "synchronized", "<", "V", ">", "V", "retryRPC", "(", "RpcCallable", "<", "V", ">", "rpc", ")", "throws", "AlluxioStatusException", "{", "return", "retryRPCInternal", "(", "rpc", ",", "(", ")", "->", "null", ")", ";", "}" ]
Tries to execute an RPC defined as a {@link RpcCallable}. If a {@link UnavailableException} occurs, a reconnection will be tried through {@link #connect()} and the action will be re-executed. @param rpc the RPC call to be executed @param <V> type of return value of the RPC call @return the return value of the RPC call
[ "Tries", "to", "execute", "an", "RPC", "defined", "as", "a", "{", "@link", "RpcCallable", "}", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/AbstractClient.java#L333-L335
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.setGroupShield
public ResponseWrapper setGroupShield(GroupShieldPayload payload, String username) throws APIConnectionException, APIRequestException { """ Set user's group message blocking @param payload GroupShieldPayload @param username Necessary @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception """ return _userClient.setGroupShield(payload, username); }
java
public ResponseWrapper setGroupShield(GroupShieldPayload payload, String username) throws APIConnectionException, APIRequestException { return _userClient.setGroupShield(payload, username); }
[ "public", "ResponseWrapper", "setGroupShield", "(", "GroupShieldPayload", "payload", ",", "String", "username", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_userClient", ".", "setGroupShield", "(", "payload", ",", "username", ")", ";", "}" ]
Set user's group message blocking @param payload GroupShieldPayload @param username Necessary @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Set", "user", "s", "group", "message", "blocking" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L341-L344
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/task/TopologyContext.java
TopologyContext.setSubscribedState
public <T extends ISubscribedState> T setSubscribedState(String componentId, T obj) { """ Synchronizes the default stream from the specified state spout component id with the provided ISubscribedState object. The recommended usage of this method is as follows: <pre> _myState = context.setSubscribedState(componentId, new MyState()); </pre> @param componentId the id of the StateSpout component to subscribe to @param obj Provided ISubscribedState implementation @return Returns the ISubscribedState object provided """ return setSubscribedState(componentId, Utils.DEFAULT_STREAM_ID, obj); }
java
public <T extends ISubscribedState> T setSubscribedState(String componentId, T obj) { return setSubscribedState(componentId, Utils.DEFAULT_STREAM_ID, obj); }
[ "public", "<", "T", "extends", "ISubscribedState", ">", "T", "setSubscribedState", "(", "String", "componentId", ",", "T", "obj", ")", "{", "return", "setSubscribedState", "(", "componentId", ",", "Utils", ".", "DEFAULT_STREAM_ID", ",", "obj", ")", ";", "}" ]
Synchronizes the default stream from the specified state spout component id with the provided ISubscribedState object. The recommended usage of this method is as follows: <pre> _myState = context.setSubscribedState(componentId, new MyState()); </pre> @param componentId the id of the StateSpout component to subscribe to @param obj Provided ISubscribedState implementation @return Returns the ISubscribedState object provided
[ "Synchronizes", "the", "default", "stream", "from", "the", "specified", "state", "spout", "component", "id", "with", "the", "provided", "ISubscribedState", "object", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/task/TopologyContext.java#L109-L111
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeSubregistry.java
NotificationHandlerNodeSubregistry.unregisterEntry
void unregisterEntry(ListIterator<PathElement> iterator, String value, ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry) { """ Get the registry child for the given {@code elementValue} and traverse it to unregister the entry. """ NotificationHandlerNodeRegistry registry = childRegistries.get(value); if (registry == null) { return; } registry.unregisterEntry(iterator, entry); }
java
void unregisterEntry(ListIterator<PathElement> iterator, String value, ConcreteNotificationHandlerRegistration.NotificationHandlerEntry entry) { NotificationHandlerNodeRegistry registry = childRegistries.get(value); if (registry == null) { return; } registry.unregisterEntry(iterator, entry); }
[ "void", "unregisterEntry", "(", "ListIterator", "<", "PathElement", ">", "iterator", ",", "String", "value", ",", "ConcreteNotificationHandlerRegistration", ".", "NotificationHandlerEntry", "entry", ")", "{", "NotificationHandlerNodeRegistry", "registry", "=", "childRegistries", ".", "get", "(", "value", ")", ";", "if", "(", "registry", "==", "null", ")", "{", "return", ";", "}", "registry", ".", "unregisterEntry", "(", "iterator", ",", "entry", ")", ";", "}" ]
Get the registry child for the given {@code elementValue} and traverse it to unregister the entry.
[ "Get", "the", "registry", "child", "for", "the", "given", "{" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/registry/NotificationHandlerNodeSubregistry.java#L82-L88
tobato/FastDFS_Client
src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/FdfsParamMapper.java
FdfsParamMapper.mapByIndex
private static <T> T mapByIndex(byte[] content, Class<T> genericType, ObjectMetaData objectMap, Charset charset) throws InstantiationException, IllegalAccessException, InvocationTargetException { """ 按列顺序映射 @param content @param genericType @param objectMap @return @throws InstantiationException @throws IllegalAccessException @throws InvocationTargetException """ List<FieldMetaData> mappingFields = objectMap.getFieldList(); T obj = genericType.newInstance(); for (int i = 0; i < mappingFields.size(); i++) { FieldMetaData field = mappingFields.get(i); // 设置属性值 LOGGER.debug("设置值是 " + field + field.getValue(content, charset)); BeanUtils.setProperty(obj, field.getFieldName(), field.getValue(content, charset)); } return obj; }
java
private static <T> T mapByIndex(byte[] content, Class<T> genericType, ObjectMetaData objectMap, Charset charset) throws InstantiationException, IllegalAccessException, InvocationTargetException { List<FieldMetaData> mappingFields = objectMap.getFieldList(); T obj = genericType.newInstance(); for (int i = 0; i < mappingFields.size(); i++) { FieldMetaData field = mappingFields.get(i); // 设置属性值 LOGGER.debug("设置值是 " + field + field.getValue(content, charset)); BeanUtils.setProperty(obj, field.getFieldName(), field.getValue(content, charset)); } return obj; }
[ "private", "static", "<", "T", ">", "T", "mapByIndex", "(", "byte", "[", "]", "content", ",", "Class", "<", "T", ">", "genericType", ",", "ObjectMetaData", "objectMap", ",", "Charset", "charset", ")", "throws", "InstantiationException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "List", "<", "FieldMetaData", ">", "mappingFields", "=", "objectMap", ".", "getFieldList", "(", ")", ";", "T", "obj", "=", "genericType", ".", "newInstance", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mappingFields", ".", "size", "(", ")", ";", "i", "++", ")", "{", "FieldMetaData", "field", "=", "mappingFields", ".", "get", "(", "i", ")", ";", "// 设置属性值", "LOGGER", ".", "debug", "(", "\"设置值是 \" + field", "+", "field", "g", "tValu", "e", "(content", ",", " charse", "t", ");", "", "", "", "BeanUtils", ".", "setProperty", "(", "obj", ",", "field", ".", "getFieldName", "(", ")", ",", "field", ".", "getValue", "(", "content", ",", "charset", ")", ")", ";", "}", "return", "obj", ";", "}" ]
按列顺序映射 @param content @param genericType @param objectMap @return @throws InstantiationException @throws IllegalAccessException @throws InvocationTargetException
[ "按列顺序映射" ]
train
https://github.com/tobato/FastDFS_Client/blob/8e3bfe712f1739028beed7f3a6b2cc4579a231e4/src/main/java/com/github/tobato/fastdfs/domain/proto/mapper/FdfsParamMapper.java#L90-L103
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/DBUtils.java
DBUtils.get
public static <T> T get(Class<T> clazz, String sql, Object... arg) { """ 本函数所查找的结果只能返回一条记录,若查找到的多条记录符合要求将返回第一条符合要求的记录 @param clazz 需要查找的对象的所属类的一个类(Class) @param sql 只能是SELECT语句,SQL语句中的字段别名必须与T类里的相应字段相同 @param arg SQL语句中的参数占位符参数 @return 将查找到的的记录包装成一个对象,并返回该对象,若没有记录则返回null """ List<T> list = DBUtils.getList(clazz, sql, arg); if (list.isEmpty()) { return null; } return list.get(0); }
java
public static <T> T get(Class<T> clazz, String sql, Object... arg) { List<T> list = DBUtils.getList(clazz, sql, arg); if (list.isEmpty()) { return null; } return list.get(0); }
[ "public", "static", "<", "T", ">", "T", "get", "(", "Class", "<", "T", ">", "clazz", ",", "String", "sql", ",", "Object", "...", "arg", ")", "{", "List", "<", "T", ">", "list", "=", "DBUtils", ".", "getList", "(", "clazz", ",", "sql", ",", "arg", ")", ";", "if", "(", "list", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "return", "list", ".", "get", "(", "0", ")", ";", "}" ]
本函数所查找的结果只能返回一条记录,若查找到的多条记录符合要求将返回第一条符合要求的记录 @param clazz 需要查找的对象的所属类的一个类(Class) @param sql 只能是SELECT语句,SQL语句中的字段别名必须与T类里的相应字段相同 @param arg SQL语句中的参数占位符参数 @return 将查找到的的记录包装成一个对象,并返回该对象,若没有记录则返回null
[ "本函数所查找的结果只能返回一条记录,若查找到的多条记录符合要求将返回第一条符合要求的记录" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/DBUtils.java#L263-L269
ineunetOS/knife-commons
knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java
StringUtils.indexOfAnyBut
public static int indexOfAnyBut(String str, String searchChars) { """ <p>Search a String to find the first index of any character not in the given set of characters.</p> <p>A <code>null</code> String will return <code>-1</code>. A <code>null</code> or empty search string will return <code>-1</code>.</p> <pre> StringUtils.indexOfAnyBut(null, *) = -1 StringUtils.indexOfAnyBut("", *) = -1 StringUtils.indexOfAnyBut(*, null) = -1 StringUtils.indexOfAnyBut(*, "") = -1 StringUtils.indexOfAnyBut("zzabyycdxx", "za") = 3 StringUtils.indexOfAnyBut("zzabyycdxx", "") = -1 StringUtils.indexOfAnyBut("aba","ab") = -1 </pre> @param str the String to check, may be null @param searchChars the chars to search for, may be null @return the index of any of the chars, -1 if no match or null input @since 2.0 """ if (isEmpty(str) || isEmpty(searchChars)) { return INDEX_NOT_FOUND; } int strLen = str.length(); for (int i = 0; i < strLen; i++) { char ch = str.charAt(i); boolean chFound = searchChars.indexOf(ch) >= 0; if (i + 1 < strLen && CharUtils.isHighSurrogate(ch)) { char ch2 = str.charAt(i + 1); if (chFound && searchChars.indexOf(ch2) < 0) { return i; } } else { if (!chFound) { return i; } } } return INDEX_NOT_FOUND; }
java
public static int indexOfAnyBut(String str, String searchChars) { if (isEmpty(str) || isEmpty(searchChars)) { return INDEX_NOT_FOUND; } int strLen = str.length(); for (int i = 0; i < strLen; i++) { char ch = str.charAt(i); boolean chFound = searchChars.indexOf(ch) >= 0; if (i + 1 < strLen && CharUtils.isHighSurrogate(ch)) { char ch2 = str.charAt(i + 1); if (chFound && searchChars.indexOf(ch2) < 0) { return i; } } else { if (!chFound) { return i; } } } return INDEX_NOT_FOUND; }
[ "public", "static", "int", "indexOfAnyBut", "(", "String", "str", ",", "String", "searchChars", ")", "{", "if", "(", "isEmpty", "(", "str", ")", "||", "isEmpty", "(", "searchChars", ")", ")", "{", "return", "INDEX_NOT_FOUND", ";", "}", "int", "strLen", "=", "str", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "strLen", ";", "i", "++", ")", "{", "char", "ch", "=", "str", ".", "charAt", "(", "i", ")", ";", "boolean", "chFound", "=", "searchChars", ".", "indexOf", "(", "ch", ")", ">=", "0", ";", "if", "(", "i", "+", "1", "<", "strLen", "&&", "CharUtils", ".", "isHighSurrogate", "(", "ch", ")", ")", "{", "char", "ch2", "=", "str", ".", "charAt", "(", "i", "+", "1", ")", ";", "if", "(", "chFound", "&&", "searchChars", ".", "indexOf", "(", "ch2", ")", "<", "0", ")", "{", "return", "i", ";", "}", "}", "else", "{", "if", "(", "!", "chFound", ")", "{", "return", "i", ";", "}", "}", "}", "return", "INDEX_NOT_FOUND", ";", "}" ]
<p>Search a String to find the first index of any character not in the given set of characters.</p> <p>A <code>null</code> String will return <code>-1</code>. A <code>null</code> or empty search string will return <code>-1</code>.</p> <pre> StringUtils.indexOfAnyBut(null, *) = -1 StringUtils.indexOfAnyBut("", *) = -1 StringUtils.indexOfAnyBut(*, null) = -1 StringUtils.indexOfAnyBut(*, "") = -1 StringUtils.indexOfAnyBut("zzabyycdxx", "za") = 3 StringUtils.indexOfAnyBut("zzabyycdxx", "") = -1 StringUtils.indexOfAnyBut("aba","ab") = -1 </pre> @param str the String to check, may be null @param searchChars the chars to search for, may be null @return the index of any of the chars, -1 if no match or null input @since 2.0
[ "<p", ">", "Search", "a", "String", "to", "find", "the", "first", "index", "of", "any", "character", "not", "in", "the", "given", "set", "of", "characters", ".", "<", "/", "p", ">" ]
train
https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java#L1520-L1540
apache/incubator-heron
heron/spi/src/java/org/apache/heron/spi/utils/NetworkUtils.java
NetworkUtils.getInetSocketAddress
public static InetSocketAddress getInetSocketAddress(String endpoint) { """ Convert an endpoint from String (host:port) to InetSocketAddress @param endpoint a String in (host:port) format @return an InetSocketAddress representing the endpoint """ String[] array = endpoint.split(":"); return new InetSocketAddress(array[0], Integer.parseInt(array[1])); }
java
public static InetSocketAddress getInetSocketAddress(String endpoint) { String[] array = endpoint.split(":"); return new InetSocketAddress(array[0], Integer.parseInt(array[1])); }
[ "public", "static", "InetSocketAddress", "getInetSocketAddress", "(", "String", "endpoint", ")", "{", "String", "[", "]", "array", "=", "endpoint", ".", "split", "(", "\":\"", ")", ";", "return", "new", "InetSocketAddress", "(", "array", "[", "0", "]", ",", "Integer", ".", "parseInt", "(", "array", "[", "1", "]", ")", ")", ";", "}" ]
Convert an endpoint from String (host:port) to InetSocketAddress @param endpoint a String in (host:port) format @return an InetSocketAddress representing the endpoint
[ "Convert", "an", "endpoint", "from", "String", "(", "host", ":", "port", ")", "to", "InetSocketAddress" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/utils/NetworkUtils.java#L534-L537
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.getAttribute
public String getAttribute(String section, String name) { """ Returns an attribute's value from a non-main section of this JAR's manifest. @param section the manifest's section @param name the attribute's name """ Attributes attr = getManifest().getAttributes(section); return attr != null ? attr.getValue(name) : null; }
java
public String getAttribute(String section, String name) { Attributes attr = getManifest().getAttributes(section); return attr != null ? attr.getValue(name) : null; }
[ "public", "String", "getAttribute", "(", "String", "section", ",", "String", "name", ")", "{", "Attributes", "attr", "=", "getManifest", "(", ")", ".", "getAttributes", "(", "section", ")", ";", "return", "attr", "!=", "null", "?", "attr", ".", "getValue", "(", "name", ")", ":", "null", ";", "}" ]
Returns an attribute's value from a non-main section of this JAR's manifest. @param section the manifest's section @param name the attribute's name
[ "Returns", "an", "attribute", "s", "value", "from", "a", "non", "-", "main", "section", "of", "this", "JAR", "s", "manifest", "." ]
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L234-L237
mygreen/xlsmapper
src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/AbstractFieldValidator.java
AbstractFieldValidator.error
public void error(final CellField<T> cellField, final String messageKey) { """ メッセージキーを指定して、エラー情報を追加します。 <p>エラーメッセージ中の変数は、{@link #getMessageVariables(CellField)}の値を使用します。</p> @param cellField フィールド情報 @param messageKey メッセージキー @throws IllegalArgumentException {@literal cellField == null or messageKey == null} @throws IllegalArgumentException {@literal messageKey.length() == 0} """ error(cellField, messageKey, getMessageVariables(cellField)); }
java
public void error(final CellField<T> cellField, final String messageKey) { error(cellField, messageKey, getMessageVariables(cellField)); }
[ "public", "void", "error", "(", "final", "CellField", "<", "T", ">", "cellField", ",", "final", "String", "messageKey", ")", "{", "error", "(", "cellField", ",", "messageKey", ",", "getMessageVariables", "(", "cellField", ")", ")", ";", "}" ]
メッセージキーを指定して、エラー情報を追加します。 <p>エラーメッセージ中の変数は、{@link #getMessageVariables(CellField)}の値を使用します。</p> @param cellField フィールド情報 @param messageKey メッセージキー @throws IllegalArgumentException {@literal cellField == null or messageKey == null} @throws IllegalArgumentException {@literal messageKey.length() == 0}
[ "メッセージキーを指定して、エラー情報を追加します。", "<p", ">", "エラーメッセージ中の変数は、", "{" ]
train
https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/AbstractFieldValidator.java#L101-L103
pravega/pravega
controller/src/main/java/io/pravega/controller/task/Stream/StreamTransactionMetadataTasks.java
StreamTransactionMetadataTasks.createTxn
public CompletableFuture<Pair<VersionedTransactionData, List<StreamSegmentRecord>>> createTxn(final String scope, final String stream, final long lease, final OperationContext contextOpt) { """ Create transaction. @param scope stream scope. @param stream stream name. @param lease Time for which transaction shall remain open with sending any heartbeat. the scaling operation is initiated on the txn stream. @param contextOpt operational context @return transaction id. """ final OperationContext context = getNonNullOperationContext(scope, stream, contextOpt); return createTxnBody(scope, stream, lease, context); }
java
public CompletableFuture<Pair<VersionedTransactionData, List<StreamSegmentRecord>>> createTxn(final String scope, final String stream, final long lease, final OperationContext contextOpt) { final OperationContext context = getNonNullOperationContext(scope, stream, contextOpt); return createTxnBody(scope, stream, lease, context); }
[ "public", "CompletableFuture", "<", "Pair", "<", "VersionedTransactionData", ",", "List", "<", "StreamSegmentRecord", ">", ">", ">", "createTxn", "(", "final", "String", "scope", ",", "final", "String", "stream", ",", "final", "long", "lease", ",", "final", "OperationContext", "contextOpt", ")", "{", "final", "OperationContext", "context", "=", "getNonNullOperationContext", "(", "scope", ",", "stream", ",", "contextOpt", ")", ";", "return", "createTxnBody", "(", "scope", ",", "stream", ",", "lease", ",", "context", ")", ";", "}" ]
Create transaction. @param scope stream scope. @param stream stream name. @param lease Time for which transaction shall remain open with sending any heartbeat. the scaling operation is initiated on the txn stream. @param contextOpt operational context @return transaction id.
[ "Create", "transaction", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/task/Stream/StreamTransactionMetadataTasks.java#L194-L200
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java
DataServiceVisitorJsBuilder.computeKeys
String computeKeys(ExecutableElement methodElement, List<String> arguments) { """ Generate key part for variable part of md5 @param methodElement @param arguments @return """ String keys = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator()); if (arguments != null && !arguments.isEmpty()) { JsCacheResult jcr = methodElement.getAnnotation(JsCacheResult.class); // if there is a jcr annotation with value diferrent of *, so we dont use all arguments if (!considerateAllArgs(jcr)) { keys = stringJoinAndDecorate(Arrays.asList(jcr.keys()), COMMA, new KeyForArgDecorator()); } } return keys; }
java
String computeKeys(ExecutableElement methodElement, List<String> arguments) { String keys = stringJoinAndDecorate(arguments, COMMA, new NothingDecorator()); if (arguments != null && !arguments.isEmpty()) { JsCacheResult jcr = methodElement.getAnnotation(JsCacheResult.class); // if there is a jcr annotation with value diferrent of *, so we dont use all arguments if (!considerateAllArgs(jcr)) { keys = stringJoinAndDecorate(Arrays.asList(jcr.keys()), COMMA, new KeyForArgDecorator()); } } return keys; }
[ "String", "computeKeys", "(", "ExecutableElement", "methodElement", ",", "List", "<", "String", ">", "arguments", ")", "{", "String", "keys", "=", "stringJoinAndDecorate", "(", "arguments", ",", "COMMA", ",", "new", "NothingDecorator", "(", ")", ")", ";", "if", "(", "arguments", "!=", "null", "&&", "!", "arguments", ".", "isEmpty", "(", ")", ")", "{", "JsCacheResult", "jcr", "=", "methodElement", ".", "getAnnotation", "(", "JsCacheResult", ".", "class", ")", ";", "// if there is a jcr annotation with value diferrent of *, so we dont use all arguments\r", "if", "(", "!", "considerateAllArgs", "(", "jcr", ")", ")", "{", "keys", "=", "stringJoinAndDecorate", "(", "Arrays", ".", "asList", "(", "jcr", ".", "keys", "(", ")", ")", ",", "COMMA", ",", "new", "KeyForArgDecorator", "(", ")", ")", ";", "}", "}", "return", "keys", ";", "}" ]
Generate key part for variable part of md5 @param methodElement @param arguments @return
[ "Generate", "key", "part", "for", "variable", "part", "of", "md5" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/DataServiceVisitorJsBuilder.java#L218-L228
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java
UCharacterName.getName
public String getName(int ch, int choice) { """ Retrieve the name of a Unicode code point. Depending on <code>choice</code>, the character name written into the buffer is the "modern" name or the name that was defined in Unicode version 1.0. The name contains only "invariant" characters like A-Z, 0-9, space, and '-'. @param ch the code point for which to get the name. @param choice Selector for which name to get. @return if code point is above 0x1fff, null is returned """ if (ch < UCharacter.MIN_VALUE || ch > UCharacter.MAX_VALUE || choice > UCharacterNameChoice.CHAR_NAME_CHOICE_COUNT) { return null; } String result = null; result = getAlgName(ch, choice); // getting normal character name if (result == null || result.length() == 0) { if (choice == UCharacterNameChoice.EXTENDED_CHAR_NAME) { result = getExtendedName(ch); } else { result = getGroupName(ch, choice); } } return result; }
java
public String getName(int ch, int choice) { if (ch < UCharacter.MIN_VALUE || ch > UCharacter.MAX_VALUE || choice > UCharacterNameChoice.CHAR_NAME_CHOICE_COUNT) { return null; } String result = null; result = getAlgName(ch, choice); // getting normal character name if (result == null || result.length() == 0) { if (choice == UCharacterNameChoice.EXTENDED_CHAR_NAME) { result = getExtendedName(ch); } else { result = getGroupName(ch, choice); } } return result; }
[ "public", "String", "getName", "(", "int", "ch", ",", "int", "choice", ")", "{", "if", "(", "ch", "<", "UCharacter", ".", "MIN_VALUE", "||", "ch", ">", "UCharacter", ".", "MAX_VALUE", "||", "choice", ">", "UCharacterNameChoice", ".", "CHAR_NAME_CHOICE_COUNT", ")", "{", "return", "null", ";", "}", "String", "result", "=", "null", ";", "result", "=", "getAlgName", "(", "ch", ",", "choice", ")", ";", "// getting normal character name", "if", "(", "result", "==", "null", "||", "result", ".", "length", "(", ")", "==", "0", ")", "{", "if", "(", "choice", "==", "UCharacterNameChoice", ".", "EXTENDED_CHAR_NAME", ")", "{", "result", "=", "getExtendedName", "(", "ch", ")", ";", "}", "else", "{", "result", "=", "getGroupName", "(", "ch", ",", "choice", ")", ";", "}", "}", "return", "result", ";", "}" ]
Retrieve the name of a Unicode code point. Depending on <code>choice</code>, the character name written into the buffer is the "modern" name or the name that was defined in Unicode version 1.0. The name contains only "invariant" characters like A-Z, 0-9, space, and '-'. @param ch the code point for which to get the name. @param choice Selector for which name to get. @return if code point is above 0x1fff, null is returned
[ "Retrieve", "the", "name", "of", "a", "Unicode", "code", "point", ".", "Depending", "on", "<code", ">", "choice<", "/", "code", ">", "the", "character", "name", "written", "into", "the", "buffer", "is", "the", "modern", "name", "or", "the", "name", "that", "was", "defined", "in", "Unicode", "version", "1", ".", "0", ".", "The", "name", "contains", "only", "invariant", "characters", "like", "A", "-", "Z", "0", "-", "9", "space", "and", "-", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterName.java#L82-L103