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
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java
TypeExtractionUtils.validateLambdaType
public static void validateLambdaType(Class<?> baseClass, Type t) { """ Checks whether the given type has the generic parameters declared in the class definition. @param t type to be validated """ if (!(t instanceof Class)) { return; } final Class<?> clazz = (Class<?>) t; if (clazz.getTypeParameters().length > 0) { throw new InvalidTypesException("The generic type parameters of '" + clazz.getSimpleName() + "' are missing. " + "In many cases lambda methods don't provide enough information for automatic type extraction when Java generics are involved. " + "An easy workaround is to use an (anonymous) class instead that implements the '" + baseClass.getName() + "' interface. " + "Otherwise the type has to be specified explicitly using type information."); } }
java
public static void validateLambdaType(Class<?> baseClass, Type t) { if (!(t instanceof Class)) { return; } final Class<?> clazz = (Class<?>) t; if (clazz.getTypeParameters().length > 0) { throw new InvalidTypesException("The generic type parameters of '" + clazz.getSimpleName() + "' are missing. " + "In many cases lambda methods don't provide enough information for automatic type extraction when Java generics are involved. " + "An easy workaround is to use an (anonymous) class instead that implements the '" + baseClass.getName() + "' interface. " + "Otherwise the type has to be specified explicitly using type information."); } }
[ "public", "static", "void", "validateLambdaType", "(", "Class", "<", "?", ">", "baseClass", ",", "Type", "t", ")", "{", "if", "(", "!", "(", "t", "instanceof", "Class", ")", ")", "{", "return", ";", "}", "final", "Class", "<", "?", ">", "clazz", "=", "(", "Class", "<", "?", ">", ")", "t", ";", "if", "(", "clazz", ".", "getTypeParameters", "(", ")", ".", "length", ">", "0", ")", "{", "throw", "new", "InvalidTypesException", "(", "\"The generic type parameters of '\"", "+", "clazz", ".", "getSimpleName", "(", ")", "+", "\"' are missing. \"", "+", "\"In many cases lambda methods don't provide enough information for automatic type extraction when Java generics are involved. \"", "+", "\"An easy workaround is to use an (anonymous) class instead that implements the '\"", "+", "baseClass", ".", "getName", "(", ")", "+", "\"' interface. \"", "+", "\"Otherwise the type has to be specified explicitly using type information.\"", ")", ";", "}", "}" ]
Checks whether the given type has the generic parameters declared in the class definition. @param t type to be validated
[ "Checks", "whether", "the", "given", "type", "has", "the", "generic", "parameters", "declared", "in", "the", "class", "definition", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java#L341-L353
samskivert/pythagoras
src/main/java/pythagoras/f/Crossing.java
Crossing.crossQuad
public static int crossQuad (float x1, float y1, float cx, float cy, float x2, float y2, float x, float y) { """ Returns how many times ray from point (x,y) cross quard curve """ // LEFT/RIGHT/UP/EMPTY if ((x < x1 && x < cx && x < x2) || (x > x1 && x > cx && x > x2) || (y > y1 && y > cy && y > y2) || (x1 == cx && cx == x2)) { return 0; } // DOWN if (y < y1 && y < cy && y < y2 && x != x1 && x != x2) { if (x1 < x2) { return x1 < x && x < x2 ? 1 : 0; } return x2 < x && x < x1 ? -1 : 0; } // INSIDE QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2); float px = x - x1, py = y - y1; float[] res = new float[3]; int rc = c.solvePoint(res, px); return c.cross(res, rc, py, py); }
java
public static int crossQuad (float x1, float y1, float cx, float cy, float x2, float y2, float x, float y) { // LEFT/RIGHT/UP/EMPTY if ((x < x1 && x < cx && x < x2) || (x > x1 && x > cx && x > x2) || (y > y1 && y > cy && y > y2) || (x1 == cx && cx == x2)) { return 0; } // DOWN if (y < y1 && y < cy && y < y2 && x != x1 && x != x2) { if (x1 < x2) { return x1 < x && x < x2 ? 1 : 0; } return x2 < x && x < x1 ? -1 : 0; } // INSIDE QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2); float px = x - x1, py = y - y1; float[] res = new float[3]; int rc = c.solvePoint(res, px); return c.cross(res, rc, py, py); }
[ "public", "static", "int", "crossQuad", "(", "float", "x1", ",", "float", "y1", ",", "float", "cx", ",", "float", "cy", ",", "float", "x2", ",", "float", "y2", ",", "float", "x", ",", "float", "y", ")", "{", "// LEFT/RIGHT/UP/EMPTY", "if", "(", "(", "x", "<", "x1", "&&", "x", "<", "cx", "&&", "x", "<", "x2", ")", "||", "(", "x", ">", "x1", "&&", "x", ">", "cx", "&&", "x", ">", "x2", ")", "||", "(", "y", ">", "y1", "&&", "y", ">", "cy", "&&", "y", ">", "y2", ")", "||", "(", "x1", "==", "cx", "&&", "cx", "==", "x2", ")", ")", "{", "return", "0", ";", "}", "// DOWN", "if", "(", "y", "<", "y1", "&&", "y", "<", "cy", "&&", "y", "<", "y2", "&&", "x", "!=", "x1", "&&", "x", "!=", "x2", ")", "{", "if", "(", "x1", "<", "x2", ")", "{", "return", "x1", "<", "x", "&&", "x", "<", "x2", "?", "1", ":", "0", ";", "}", "return", "x2", "<", "x", "&&", "x", "<", "x1", "?", "-", "1", ":", "0", ";", "}", "// INSIDE", "QuadCurve", "c", "=", "new", "QuadCurve", "(", "x1", ",", "y1", ",", "cx", ",", "cy", ",", "x2", ",", "y2", ")", ";", "float", "px", "=", "x", "-", "x1", ",", "py", "=", "y", "-", "y1", ";", "float", "[", "]", "res", "=", "new", "float", "[", "3", "]", ";", "int", "rc", "=", "c", ".", "solvePoint", "(", "res", ",", "px", ")", ";", "return", "c", ".", "cross", "(", "res", ",", "rc", ",", "py", ",", "py", ")", ";", "}" ]
Returns how many times ray from point (x,y) cross quard curve
[ "Returns", "how", "many", "times", "ray", "from", "point", "(", "x", "y", ")", "cross", "quard", "curve" ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Crossing.java#L369-L391
OpenLiberty/open-liberty
dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/java/NetworkInterfaces.java
NetworkInterfaces.getInterfaceInfo
private void getInterfaceInfo(NetworkInterface networkInterface, PrintWriter out) throws IOException { """ Capture interface specific information and write it to the provided writer. @param networkInterface the interface to introspect @param writer the print writer to write information to """ final String indent = " "; // Basic information from the interface out.println(); out.append("Interface: ").append(networkInterface.getDisplayName()).println(); out.append(indent).append(" loopback: ").append(Boolean.toString(networkInterface.isLoopback())).println(); out.append(indent).append(" mtu: ").append(Integer.toString(networkInterface.getMTU())).println(); out.append(indent).append(" point-to-point: ").append(Boolean.toString(networkInterface.isPointToPoint())).println(); out.append(indent).append("supports multicast: ").append(Boolean.toString(networkInterface.supportsMulticast())).println(); out.append(indent).append(" up: ").append(Boolean.toString(networkInterface.isUp())).println(); out.append(indent).append(" virtual: ").append(Boolean.toString(networkInterface.isVirtual())).println(); // Interface address information List<InterfaceAddress> intfAddresses = networkInterface.getInterfaceAddresses(); for (int i = 0; i < intfAddresses.size(); i++) { out.append(indent).append("InterfaceAddress #").append(Integer.toString(i + 1)).append(": ").append(String.valueOf(intfAddresses.get(i))).println(); } // Network interface information Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses(); for (int i = 1; inetAddresses.hasMoreElements(); i++) { InetAddress inetAddress = inetAddresses.nextElement(); out.append(indent).append("InetAddress #").append(Integer.toString(i)).println(":"); out.append(indent).append(indent).append(" IP address: ").append(inetAddress.getHostAddress()).println(); out.append(indent).append(indent).append(" host name: ").append(inetAddress.getHostName()).println(); out.append(indent).append(indent).append("FQDN host name: ").append(inetAddress.getCanonicalHostName()).println(); } }
java
private void getInterfaceInfo(NetworkInterface networkInterface, PrintWriter out) throws IOException { final String indent = " "; // Basic information from the interface out.println(); out.append("Interface: ").append(networkInterface.getDisplayName()).println(); out.append(indent).append(" loopback: ").append(Boolean.toString(networkInterface.isLoopback())).println(); out.append(indent).append(" mtu: ").append(Integer.toString(networkInterface.getMTU())).println(); out.append(indent).append(" point-to-point: ").append(Boolean.toString(networkInterface.isPointToPoint())).println(); out.append(indent).append("supports multicast: ").append(Boolean.toString(networkInterface.supportsMulticast())).println(); out.append(indent).append(" up: ").append(Boolean.toString(networkInterface.isUp())).println(); out.append(indent).append(" virtual: ").append(Boolean.toString(networkInterface.isVirtual())).println(); // Interface address information List<InterfaceAddress> intfAddresses = networkInterface.getInterfaceAddresses(); for (int i = 0; i < intfAddresses.size(); i++) { out.append(indent).append("InterfaceAddress #").append(Integer.toString(i + 1)).append(": ").append(String.valueOf(intfAddresses.get(i))).println(); } // Network interface information Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses(); for (int i = 1; inetAddresses.hasMoreElements(); i++) { InetAddress inetAddress = inetAddresses.nextElement(); out.append(indent).append("InetAddress #").append(Integer.toString(i)).println(":"); out.append(indent).append(indent).append(" IP address: ").append(inetAddress.getHostAddress()).println(); out.append(indent).append(indent).append(" host name: ").append(inetAddress.getHostName()).println(); out.append(indent).append(indent).append("FQDN host name: ").append(inetAddress.getCanonicalHostName()).println(); } }
[ "private", "void", "getInterfaceInfo", "(", "NetworkInterface", "networkInterface", ",", "PrintWriter", "out", ")", "throws", "IOException", "{", "final", "String", "indent", "=", "\" \"", ";", "// Basic information from the interface", "out", ".", "println", "(", ")", ";", "out", ".", "append", "(", "\"Interface: \"", ")", ".", "append", "(", "networkInterface", ".", "getDisplayName", "(", ")", ")", ".", "println", "(", ")", ";", "out", ".", "append", "(", "indent", ")", ".", "append", "(", "\" loopback: \"", ")", ".", "append", "(", "Boolean", ".", "toString", "(", "networkInterface", ".", "isLoopback", "(", ")", ")", ")", ".", "println", "(", ")", ";", "out", ".", "append", "(", "indent", ")", ".", "append", "(", "\" mtu: \"", ")", ".", "append", "(", "Integer", ".", "toString", "(", "networkInterface", ".", "getMTU", "(", ")", ")", ")", ".", "println", "(", ")", ";", "out", ".", "append", "(", "indent", ")", ".", "append", "(", "\" point-to-point: \"", ")", ".", "append", "(", "Boolean", ".", "toString", "(", "networkInterface", ".", "isPointToPoint", "(", ")", ")", ")", ".", "println", "(", ")", ";", "out", ".", "append", "(", "indent", ")", ".", "append", "(", "\"supports multicast: \"", ")", ".", "append", "(", "Boolean", ".", "toString", "(", "networkInterface", ".", "supportsMulticast", "(", ")", ")", ")", ".", "println", "(", ")", ";", "out", ".", "append", "(", "indent", ")", ".", "append", "(", "\" up: \"", ")", ".", "append", "(", "Boolean", ".", "toString", "(", "networkInterface", ".", "isUp", "(", ")", ")", ")", ".", "println", "(", ")", ";", "out", ".", "append", "(", "indent", ")", ".", "append", "(", "\" virtual: \"", ")", ".", "append", "(", "Boolean", ".", "toString", "(", "networkInterface", ".", "isVirtual", "(", ")", ")", ")", ".", "println", "(", ")", ";", "// Interface address information", "List", "<", "InterfaceAddress", ">", "intfAddresses", "=", "networkInterface", ".", "getInterfaceAddresses", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "intfAddresses", ".", "size", "(", ")", ";", "i", "++", ")", "{", "out", ".", "append", "(", "indent", ")", ".", "append", "(", "\"InterfaceAddress #\"", ")", ".", "append", "(", "Integer", ".", "toString", "(", "i", "+", "1", ")", ")", ".", "append", "(", "\": \"", ")", ".", "append", "(", "String", ".", "valueOf", "(", "intfAddresses", ".", "get", "(", "i", ")", ")", ")", ".", "println", "(", ")", ";", "}", "// Network interface information", "Enumeration", "<", "InetAddress", ">", "inetAddresses", "=", "networkInterface", ".", "getInetAddresses", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "inetAddresses", ".", "hasMoreElements", "(", ")", ";", "i", "++", ")", "{", "InetAddress", "inetAddress", "=", "inetAddresses", ".", "nextElement", "(", ")", ";", "out", ".", "append", "(", "indent", ")", ".", "append", "(", "\"InetAddress #\"", ")", ".", "append", "(", "Integer", ".", "toString", "(", "i", ")", ")", ".", "println", "(", "\":\"", ")", ";", "out", ".", "append", "(", "indent", ")", ".", "append", "(", "indent", ")", ".", "append", "(", "\" IP address: \"", ")", ".", "append", "(", "inetAddress", ".", "getHostAddress", "(", ")", ")", ".", "println", "(", ")", ";", "out", ".", "append", "(", "indent", ")", ".", "append", "(", "indent", ")", ".", "append", "(", "\" host name: \"", ")", ".", "append", "(", "inetAddress", ".", "getHostName", "(", ")", ")", ".", "println", "(", ")", ";", "out", ".", "append", "(", "indent", ")", ".", "append", "(", "indent", ")", ".", "append", "(", "\"FQDN host name: \"", ")", ".", "append", "(", "inetAddress", ".", "getCanonicalHostName", "(", ")", ")", ".", "println", "(", ")", ";", "}", "}" ]
Capture interface specific information and write it to the provided writer. @param networkInterface the interface to introspect @param writer the print writer to write information to
[ "Capture", "interface", "specific", "information", "and", "write", "it", "to", "the", "provided", "writer", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/java/NetworkInterfaces.java#L77-L105
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WHiddenCommentRenderer.java
WHiddenCommentRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WHiddenComment. @param component the WHiddenComment to paint. @param renderContext the RenderContext to paint to. """ WHiddenComment hiddenComponent = (WHiddenComment) component; XmlStringBuilder xml = renderContext.getWriter(); String hiddenText = hiddenComponent.getText(); if (!Util.empty(hiddenText)) { xml.appendTag("ui:comment"); xml.appendEscaped(hiddenText); xml.appendEndTag("ui:comment"); } }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WHiddenComment hiddenComponent = (WHiddenComment) component; XmlStringBuilder xml = renderContext.getWriter(); String hiddenText = hiddenComponent.getText(); if (!Util.empty(hiddenText)) { xml.appendTag("ui:comment"); xml.appendEscaped(hiddenText); xml.appendEndTag("ui:comment"); } }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WHiddenComment", "hiddenComponent", "=", "(", "WHiddenComment", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "String", "hiddenText", "=", "hiddenComponent", ".", "getText", "(", ")", ";", "if", "(", "!", "Util", ".", "empty", "(", "hiddenText", ")", ")", "{", "xml", ".", "appendTag", "(", "\"ui:comment\"", ")", ";", "xml", ".", "appendEscaped", "(", "hiddenText", ")", ";", "xml", ".", "appendEndTag", "(", "\"ui:comment\"", ")", ";", "}", "}" ]
Paints the given WHiddenComment. @param component the WHiddenComment to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WHiddenComment", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WHiddenCommentRenderer.java#L24-L36
spring-projects/spring-social-facebook
spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java
FqlResult.getLong
public Long getLong(String fieldName) { """ Returns the value of the identified field as a Long. @param fieldName the name of the field @return the value of the field as a Long @throws FqlException if the field cannot be expressed as an Long """ try { return hasValue(fieldName) ? Long.valueOf(String.valueOf(resultMap.get(fieldName))) : null; } catch (NumberFormatException e) { throw new FqlException("Field '" + fieldName +"' is not a number.", e); } }
java
public Long getLong(String fieldName) { try { return hasValue(fieldName) ? Long.valueOf(String.valueOf(resultMap.get(fieldName))) : null; } catch (NumberFormatException e) { throw new FqlException("Field '" + fieldName +"' is not a number.", e); } }
[ "public", "Long", "getLong", "(", "String", "fieldName", ")", "{", "try", "{", "return", "hasValue", "(", "fieldName", ")", "?", "Long", ".", "valueOf", "(", "String", ".", "valueOf", "(", "resultMap", ".", "get", "(", "fieldName", ")", ")", ")", ":", "null", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "FqlException", "(", "\"Field '\"", "+", "fieldName", "+", "\"' is not a number.\"", ",", "e", ")", ";", "}", "}" ]
Returns the value of the identified field as a Long. @param fieldName the name of the field @return the value of the field as a Long @throws FqlException if the field cannot be expressed as an Long
[ "Returns", "the", "value", "of", "the", "identified", "field", "as", "a", "Long", "." ]
train
https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java#L69-L75
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java
HashtableOnDisk.iterateKeys
public int iterateKeys(HashtableAction action, int index, int length) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { """ ************************************************************************ This invokes the action's "execute" method once for every object passing only the key to the method, to avoid the overhead of reading the object if it is not necessary. The iteration is synchronized with concurrent get and put operations to avoid locking the HTOD for long periods of time. Some objects which are added during iteration may not be seen by the iteration. @param action The object to be "invoked" for each object. *********************************************************************** """ return walkHash(action, RETRIEVE_KEY, index, length); }
java
public int iterateKeys(HashtableAction action, int index, int length) throws IOException, EOFException, FileManagerException, ClassNotFoundException, HashtableOnDiskException { return walkHash(action, RETRIEVE_KEY, index, length); }
[ "public", "int", "iterateKeys", "(", "HashtableAction", "action", ",", "int", "index", ",", "int", "length", ")", "throws", "IOException", ",", "EOFException", ",", "FileManagerException", ",", "ClassNotFoundException", ",", "HashtableOnDiskException", "{", "return", "walkHash", "(", "action", ",", "RETRIEVE_KEY", ",", "index", ",", "length", ")", ";", "}" ]
************************************************************************ This invokes the action's "execute" method once for every object passing only the key to the method, to avoid the overhead of reading the object if it is not necessary. The iteration is synchronized with concurrent get and put operations to avoid locking the HTOD for long periods of time. Some objects which are added during iteration may not be seen by the iteration. @param action The object to be "invoked" for each object. ***********************************************************************
[ "************************************************************************", "This", "invokes", "the", "action", "s", "execute", "method", "once", "for", "every", "object", "passing", "only", "the", "key", "to", "the", "method", "to", "avoid", "the", "overhead", "of", "reading", "the", "object", "if", "it", "is", "not", "necessary", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L1340-L1347
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/swing/StatusBar.java
StatusBar.addZone
public void addZone(String id, Component zone, String constraints) { """ Adds a new zone in the StatusBar. @param id @param zone @param constraints one of the constraint support by the {@link com.l2fprod.common.swing.PercentLayout} """ // is there already a zone with this id? Component previousZone = getZone(id); if (previousZone != null) { remove(previousZone); idToZones.remove(id); } if (zone instanceof JComponent) { JComponent jc = (JComponent) zone; if (jc.getBorder() == null || jc.getBorder() instanceof UIResource) { if (jc instanceof JLabel) { jc.setBorder( new CompoundBorder(zoneBorder, new EmptyBorder(0, 2, 0, 2))); ((JLabel) jc).setText(" "); } else { jc.setBorder(zoneBorder); } } } add(zone, constraints); idToZones.put(id, zone); }
java
public void addZone(String id, Component zone, String constraints) { // is there already a zone with this id? Component previousZone = getZone(id); if (previousZone != null) { remove(previousZone); idToZones.remove(id); } if (zone instanceof JComponent) { JComponent jc = (JComponent) zone; if (jc.getBorder() == null || jc.getBorder() instanceof UIResource) { if (jc instanceof JLabel) { jc.setBorder( new CompoundBorder(zoneBorder, new EmptyBorder(0, 2, 0, 2))); ((JLabel) jc).setText(" "); } else { jc.setBorder(zoneBorder); } } } add(zone, constraints); idToZones.put(id, zone); }
[ "public", "void", "addZone", "(", "String", "id", ",", "Component", "zone", ",", "String", "constraints", ")", "{", "// is there already a zone with this id?", "Component", "previousZone", "=", "getZone", "(", "id", ")", ";", "if", "(", "previousZone", "!=", "null", ")", "{", "remove", "(", "previousZone", ")", ";", "idToZones", ".", "remove", "(", "id", ")", ";", "}", "if", "(", "zone", "instanceof", "JComponent", ")", "{", "JComponent", "jc", "=", "(", "JComponent", ")", "zone", ";", "if", "(", "jc", ".", "getBorder", "(", ")", "==", "null", "||", "jc", ".", "getBorder", "(", ")", "instanceof", "UIResource", ")", "{", "if", "(", "jc", "instanceof", "JLabel", ")", "{", "jc", ".", "setBorder", "(", "new", "CompoundBorder", "(", "zoneBorder", ",", "new", "EmptyBorder", "(", "0", ",", "2", ",", "0", ",", "2", ")", ")", ")", ";", "(", "(", "JLabel", ")", "jc", ")", ".", "setText", "(", "\" \"", ")", ";", "}", "else", "{", "jc", ".", "setBorder", "(", "zoneBorder", ")", ";", "}", "}", "}", "add", "(", "zone", ",", "constraints", ")", ";", "idToZones", ".", "put", "(", "id", ",", "zone", ")", ";", "}" ]
Adds a new zone in the StatusBar. @param id @param zone @param constraints one of the constraint support by the {@link com.l2fprod.common.swing.PercentLayout}
[ "Adds", "a", "new", "zone", "in", "the", "StatusBar", "." ]
train
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/StatusBar.java#L67-L90
jenkinsci/jenkins
core/src/main/java/hudson/model/Resource.java
Resource.isCollidingWith
public boolean isCollidingWith(Resource that, int count) { """ Checks the resource collision. @param count If we are testing W/W conflict, total # of write counts. For R/W conflict test, this value should be set to {@link Integer#MAX_VALUE}. """ assert that!=null; for(Resource r=that; r!=null; r=r.parent) if(this.equals(r) && r.numConcurrentWrite<count) return true; for(Resource r=this; r!=null; r=r.parent) if(that.equals(r) && r.numConcurrentWrite<count) return true; return false; }
java
public boolean isCollidingWith(Resource that, int count) { assert that!=null; for(Resource r=that; r!=null; r=r.parent) if(this.equals(r) && r.numConcurrentWrite<count) return true; for(Resource r=this; r!=null; r=r.parent) if(that.equals(r) && r.numConcurrentWrite<count) return true; return false; }
[ "public", "boolean", "isCollidingWith", "(", "Resource", "that", ",", "int", "count", ")", "{", "assert", "that", "!=", "null", ";", "for", "(", "Resource", "r", "=", "that", ";", "r", "!=", "null", ";", "r", "=", "r", ".", "parent", ")", "if", "(", "this", ".", "equals", "(", "r", ")", "&&", "r", ".", "numConcurrentWrite", "<", "count", ")", "return", "true", ";", "for", "(", "Resource", "r", "=", "this", ";", "r", "!=", "null", ";", "r", "=", "r", ".", "parent", ")", "if", "(", "that", ".", "equals", "(", "r", ")", "&&", "r", ".", "numConcurrentWrite", "<", "count", ")", "return", "true", ";", "return", "false", ";", "}" ]
Checks the resource collision. @param count If we are testing W/W conflict, total # of write counts. For R/W conflict test, this value should be set to {@link Integer#MAX_VALUE}.
[ "Checks", "the", "resource", "collision", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Resource.java#L92-L101
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java
ClustersInner.beginRotateDiskEncryptionKey
public void beginRotateDiskEncryptionKey(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { """ Rotate disk encryption key of the specified HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param parameters The parameters for the disk encryption operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ beginRotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body(); }
java
public void beginRotateDiskEncryptionKey(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { beginRotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body(); }
[ "public", "void", "beginRotateDiskEncryptionKey", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "ClusterDiskEncryptionParameters", "parameters", ")", "{", "beginRotateDiskEncryptionKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Rotate disk encryption key of the specified HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param parameters The parameters for the disk encryption operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Rotate", "disk", "encryption", "key", "of", "the", "specified", "HDInsight", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L1369-L1371
grails/grails-core
grails-spring/src/main/groovy/grails/spring/BeanBuilder.java
BeanBuilder.setProperty
@Override public void setProperty(String name, Object value) { """ Overrides property setting in the scope of the BeanBuilder to set properties on the current BeanConfiguration. """ if (currentBeanConfig != null) { setPropertyOnBeanConfig(name, value); } }
java
@Override public void setProperty(String name, Object value) { if (currentBeanConfig != null) { setPropertyOnBeanConfig(name, value); } }
[ "@", "Override", "public", "void", "setProperty", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "currentBeanConfig", "!=", "null", ")", "{", "setPropertyOnBeanConfig", "(", "name", ",", "value", ")", ";", "}", "}" ]
Overrides property setting in the scope of the BeanBuilder to set properties on the current BeanConfiguration.
[ "Overrides", "property", "setting", "in", "the", "scope", "of", "the", "BeanBuilder", "to", "set", "properties", "on", "the", "current", "BeanConfiguration", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-spring/src/main/groovy/grails/spring/BeanBuilder.java#L769-L774
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java
FontUtils.drawRight
public static void drawRight(Font font, String s, int x, int y, int width) { """ Draw text right justified @param font The font to draw with @param s The string to draw @param x The x location to draw at @param y The y location to draw at @param width The width to fill with the text """ drawString(font, s, Alignment.RIGHT, x, y, width, Color.white); }
java
public static void drawRight(Font font, String s, int x, int y, int width) { drawString(font, s, Alignment.RIGHT, x, y, width, Color.white); }
[ "public", "static", "void", "drawRight", "(", "Font", "font", ",", "String", "s", ",", "int", "x", ",", "int", "y", ",", "int", "width", ")", "{", "drawString", "(", "font", ",", "s", ",", "Alignment", ".", "RIGHT", ",", "x", ",", "y", ",", "width", ",", "Color", ".", "white", ")", ";", "}" ]
Draw text right justified @param font The font to draw with @param s The string to draw @param x The x location to draw at @param y The y location to draw at @param width The width to fill with the text
[ "Draw", "text", "right", "justified" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/FontUtils.java#L79-L81
OpenLiberty/open-liberty
dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java
JaxWsDDHelper.getPortComponentByServletLink
static PortComponent getPortComponentByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException { """ Get the PortComponent by servlet-link. @param servletLink @param containerToAdapt @return @throws UnableToAdaptException """ return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, PortComponent.class, LinkType.SERVLET); }
java
static PortComponent getPortComponentByServletLink(String servletLink, Adaptable containerToAdapt) throws UnableToAdaptException { return getHighLevelElementByServiceImplBean(servletLink, containerToAdapt, PortComponent.class, LinkType.SERVLET); }
[ "static", "PortComponent", "getPortComponentByServletLink", "(", "String", "servletLink", ",", "Adaptable", "containerToAdapt", ")", "throws", "UnableToAdaptException", "{", "return", "getHighLevelElementByServiceImplBean", "(", "servletLink", ",", "containerToAdapt", ",", "PortComponent", ".", "class", ",", "LinkType", ".", "SERVLET", ")", ";", "}" ]
Get the PortComponent by servlet-link. @param servletLink @param containerToAdapt @return @throws UnableToAdaptException
[ "Get", "the", "PortComponent", "by", "servlet", "-", "link", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webservices.javaee.common/src/com/ibm/ws/webservices/javaee/common/internal/JaxWsDDHelper.java#L56-L58
gallandarakhneorg/afc
advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java
AbstractCommonShapeFileReader.setReadingPosition
protected void setReadingPosition(int recordIndex, int byteIndex) throws IOException { """ Set the reading position, excluding the header. @param recordIndex is the index of the next record to read. @param byteIndex is the index of the next byte to read (excluding the header). @throws IOException in case of error. """ if (this.seekEnabled) { this.nextExpectedRecordIndex = recordIndex; this.buffer.position(byteIndex); } else { throw new SeekOperationDisabledException(); } }
java
protected void setReadingPosition(int recordIndex, int byteIndex) throws IOException { if (this.seekEnabled) { this.nextExpectedRecordIndex = recordIndex; this.buffer.position(byteIndex); } else { throw new SeekOperationDisabledException(); } }
[ "protected", "void", "setReadingPosition", "(", "int", "recordIndex", ",", "int", "byteIndex", ")", "throws", "IOException", "{", "if", "(", "this", ".", "seekEnabled", ")", "{", "this", ".", "nextExpectedRecordIndex", "=", "recordIndex", ";", "this", ".", "buffer", ".", "position", "(", "byteIndex", ")", ";", "}", "else", "{", "throw", "new", "SeekOperationDisabledException", "(", ")", ";", "}", "}" ]
Set the reading position, excluding the header. @param recordIndex is the index of the next record to read. @param byteIndex is the index of the next byte to read (excluding the header). @throws IOException in case of error.
[ "Set", "the", "reading", "position", "excluding", "the", "header", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java#L614-L621
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java
CommerceNotificationTemplatePersistenceImpl.countByG_T_E
@Override public int countByG_T_E(long groupId, String type, boolean enabled) { """ Returns the number of commerce notification templates where groupId = &#63; and type = &#63; and enabled = &#63;. @param groupId the group ID @param type the type @param enabled the enabled @return the number of matching commerce notification templates """ FinderPath finderPath = FINDER_PATH_COUNT_BY_G_T_E; Object[] finderArgs = new Object[] { groupId, type, enabled }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_COMMERCENOTIFICATIONTEMPLATE_WHERE); query.append(_FINDER_COLUMN_G_T_E_GROUPID_2); boolean bindType = false; if (type == null) { query.append(_FINDER_COLUMN_G_T_E_TYPE_1); } else if (type.equals("")) { query.append(_FINDER_COLUMN_G_T_E_TYPE_3); } else { bindType = true; query.append(_FINDER_COLUMN_G_T_E_TYPE_2); } query.append(_FINDER_COLUMN_G_T_E_ENABLED_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindType) { qPos.add(type); } qPos.add(enabled); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByG_T_E(long groupId, String type, boolean enabled) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_T_E; Object[] finderArgs = new Object[] { groupId, type, enabled }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_COMMERCENOTIFICATIONTEMPLATE_WHERE); query.append(_FINDER_COLUMN_G_T_E_GROUPID_2); boolean bindType = false; if (type == null) { query.append(_FINDER_COLUMN_G_T_E_TYPE_1); } else if (type.equals("")) { query.append(_FINDER_COLUMN_G_T_E_TYPE_3); } else { bindType = true; query.append(_FINDER_COLUMN_G_T_E_TYPE_2); } query.append(_FINDER_COLUMN_G_T_E_ENABLED_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindType) { qPos.add(type); } qPos.add(enabled); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByG_T_E", "(", "long", "groupId", ",", "String", "type", ",", "boolean", "enabled", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_G_T_E", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "groupId", ",", "type", ",", "enabled", "}", ";", "Long", "count", "=", "(", "Long", ")", "finderCache", ".", "getResult", "(", "finderPath", ",", "finderArgs", ",", "this", ")", ";", "if", "(", "count", "==", "null", ")", "{", "StringBundler", "query", "=", "new", "StringBundler", "(", "4", ")", ";", "query", ".", "append", "(", "_SQL_COUNT_COMMERCENOTIFICATIONTEMPLATE_WHERE", ")", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_T_E_GROUPID_2", ")", ";", "boolean", "bindType", "=", "false", ";", "if", "(", "type", "==", "null", ")", "{", "query", ".", "append", "(", "_FINDER_COLUMN_G_T_E_TYPE_1", ")", ";", "}", "else", "if", "(", "type", ".", "equals", "(", "\"\"", ")", ")", "{", "query", ".", "append", "(", "_FINDER_COLUMN_G_T_E_TYPE_3", ")", ";", "}", "else", "{", "bindType", "=", "true", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_T_E_TYPE_2", ")", ";", "}", "query", ".", "append", "(", "_FINDER_COLUMN_G_T_E_ENABLED_2", ")", ";", "String", "sql", "=", "query", ".", "toString", "(", ")", ";", "Session", "session", "=", "null", ";", "try", "{", "session", "=", "openSession", "(", ")", ";", "Query", "q", "=", "session", ".", "createQuery", "(", "sql", ")", ";", "QueryPos", "qPos", "=", "QueryPos", ".", "getInstance", "(", "q", ")", ";", "qPos", ".", "add", "(", "groupId", ")", ";", "if", "(", "bindType", ")", "{", "qPos", ".", "add", "(", "type", ")", ";", "}", "qPos", ".", "add", "(", "enabled", ")", ";", "count", "=", "(", "Long", ")", "q", ".", "uniqueResult", "(", ")", ";", "finderCache", ".", "putResult", "(", "finderPath", ",", "finderArgs", ",", "count", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "finderCache", ".", "removeResult", "(", "finderPath", ",", "finderArgs", ")", ";", "throw", "processException", "(", "e", ")", ";", "}", "finally", "{", "closeSession", "(", "session", ")", ";", "}", "}", "return", "count", ".", "intValue", "(", ")", ";", "}" ]
Returns the number of commerce notification templates where groupId = &#63; and type = &#63; and enabled = &#63;. @param groupId the group ID @param type the type @param enabled the enabled @return the number of matching commerce notification templates
[ "Returns", "the", "number", "of", "commerce", "notification", "templates", "where", "groupId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "and", "enabled", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L4296-L4361
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java
IntrospectionUtils.getFieldValue
public static Object getFieldValue(FieldMetadata fieldMetadata, Object target) { """ Returns the value of the field represented by the given metadata. @param fieldMetadata the metadata of the field @param target the target object to which the field belongs. @return the value of the field. """ MethodHandle readMethod = fieldMetadata.getReadMethod(); try { return readMethod.invoke(target); } catch (Throwable t) { throw new EntityManagerException(t.getMessage(), t); } }
java
public static Object getFieldValue(FieldMetadata fieldMetadata, Object target) { MethodHandle readMethod = fieldMetadata.getReadMethod(); try { return readMethod.invoke(target); } catch (Throwable t) { throw new EntityManagerException(t.getMessage(), t); } }
[ "public", "static", "Object", "getFieldValue", "(", "FieldMetadata", "fieldMetadata", ",", "Object", "target", ")", "{", "MethodHandle", "readMethod", "=", "fieldMetadata", ".", "getReadMethod", "(", ")", ";", "try", "{", "return", "readMethod", ".", "invoke", "(", "target", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "throw", "new", "EntityManagerException", "(", "t", ".", "getMessage", "(", ")", ",", "t", ")", ";", "}", "}" ]
Returns the value of the field represented by the given metadata. @param fieldMetadata the metadata of the field @param target the target object to which the field belongs. @return the value of the field.
[ "Returns", "the", "value", "of", "the", "field", "represented", "by", "the", "given", "metadata", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IntrospectionUtils.java#L376-L383
graphhopper/graphhopper
core/src/main/java/com/graphhopper/storage/GraphEdgeIdFinder.java
GraphEdgeIdFinder.findClosestEdgeToPoint
public void findClosestEdgeToPoint(GHIntHashSet edgeIds, GHPoint point, EdgeFilter filter) { """ This method fills the edgeIds hash with edgeIds found close (exact match) to the specified point """ findClosestEdge(edgeIds, point.getLat(), point.getLon(), filter); }
java
public void findClosestEdgeToPoint(GHIntHashSet edgeIds, GHPoint point, EdgeFilter filter) { findClosestEdge(edgeIds, point.getLat(), point.getLon(), filter); }
[ "public", "void", "findClosestEdgeToPoint", "(", "GHIntHashSet", "edgeIds", ",", "GHPoint", "point", ",", "EdgeFilter", "filter", ")", "{", "findClosestEdge", "(", "edgeIds", ",", "point", ".", "getLat", "(", ")", ",", "point", ".", "getLon", "(", ")", ",", "filter", ")", ";", "}" ]
This method fills the edgeIds hash with edgeIds found close (exact match) to the specified point
[ "This", "method", "fills", "the", "edgeIds", "hash", "with", "edgeIds", "found", "close", "(", "exact", "match", ")", "to", "the", "specified", "point" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/storage/GraphEdgeIdFinder.java#L55-L57
alkacon/opencms-core
src/org/opencms/ui/apps/CmsDefaultAppButtonProvider.java
CmsDefaultAppButtonProvider.createIconButton
public static Button createIconButton(String name, String description, Resource icon, String buttonStyle) { """ Creates an icon button.<p> @param name the name @param description the description @param icon the icon @param buttonStyle the button style @return the created button """ Button button = new Button(name); button.setIcon(icon, name); button.setDescription(description); button.addStyleName(OpenCmsTheme.APP_BUTTON); button.addStyleName(ValoTheme.BUTTON_BORDERLESS); button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); if (buttonStyle != null) { button.addStyleName(buttonStyle); } if ((icon instanceof CmsCssIcon) && ((CmsCssIcon)icon).hasAdditionalButtonStyle()) { button.addStyleName(((CmsCssIcon)icon).getAdditionalButtonStyle()); } return button; }
java
public static Button createIconButton(String name, String description, Resource icon, String buttonStyle) { Button button = new Button(name); button.setIcon(icon, name); button.setDescription(description); button.addStyleName(OpenCmsTheme.APP_BUTTON); button.addStyleName(ValoTheme.BUTTON_BORDERLESS); button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP); if (buttonStyle != null) { button.addStyleName(buttonStyle); } if ((icon instanceof CmsCssIcon) && ((CmsCssIcon)icon).hasAdditionalButtonStyle()) { button.addStyleName(((CmsCssIcon)icon).getAdditionalButtonStyle()); } return button; }
[ "public", "static", "Button", "createIconButton", "(", "String", "name", ",", "String", "description", ",", "Resource", "icon", ",", "String", "buttonStyle", ")", "{", "Button", "button", "=", "new", "Button", "(", "name", ")", ";", "button", ".", "setIcon", "(", "icon", ",", "name", ")", ";", "button", ".", "setDescription", "(", "description", ")", ";", "button", ".", "addStyleName", "(", "OpenCmsTheme", ".", "APP_BUTTON", ")", ";", "button", ".", "addStyleName", "(", "ValoTheme", ".", "BUTTON_BORDERLESS", ")", ";", "button", ".", "addStyleName", "(", "ValoTheme", ".", "BUTTON_ICON_ALIGN_TOP", ")", ";", "if", "(", "buttonStyle", "!=", "null", ")", "{", "button", ".", "addStyleName", "(", "buttonStyle", ")", ";", "}", "if", "(", "(", "icon", "instanceof", "CmsCssIcon", ")", "&&", "(", "(", "CmsCssIcon", ")", "icon", ")", ".", "hasAdditionalButtonStyle", "(", ")", ")", "{", "button", ".", "addStyleName", "(", "(", "(", "CmsCssIcon", ")", "icon", ")", ".", "getAdditionalButtonStyle", "(", ")", ")", ";", "}", "return", "button", ";", "}" ]
Creates an icon button.<p> @param name the name @param description the description @param icon the icon @param buttonStyle the button style @return the created button
[ "Creates", "an", "icon", "button", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/CmsDefaultAppButtonProvider.java#L210-L225
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java
MethodDelegation.withEmptyConfiguration
public static WithCustomProperties withEmptyConfiguration() { """ Creates a configuration builder for a method delegation that does not apply any pre-configured {@link net.bytebuddy.implementation.bind.MethodDelegationBinder.AmbiguityResolver}s or {@link net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder}s. @return A method delegation configuration without any pre-configuration. """ return new WithCustomProperties(MethodDelegationBinder.AmbiguityResolver.NoOp.INSTANCE, Collections.<TargetMethodAnnotationDrivenBinder.ParameterBinder<?>>emptyList()); }
java
public static WithCustomProperties withEmptyConfiguration() { return new WithCustomProperties(MethodDelegationBinder.AmbiguityResolver.NoOp.INSTANCE, Collections.<TargetMethodAnnotationDrivenBinder.ParameterBinder<?>>emptyList()); }
[ "public", "static", "WithCustomProperties", "withEmptyConfiguration", "(", ")", "{", "return", "new", "WithCustomProperties", "(", "MethodDelegationBinder", ".", "AmbiguityResolver", ".", "NoOp", ".", "INSTANCE", ",", "Collections", ".", "<", "TargetMethodAnnotationDrivenBinder", ".", "ParameterBinder", "<", "?", ">", ">", "emptyList", "(", ")", ")", ";", "}" ]
Creates a configuration builder for a method delegation that does not apply any pre-configured {@link net.bytebuddy.implementation.bind.MethodDelegationBinder.AmbiguityResolver}s or {@link net.bytebuddy.implementation.bind.annotation.TargetMethodAnnotationDrivenBinder.ParameterBinder}s. @return A method delegation configuration without any pre-configuration.
[ "Creates", "a", "configuration", "builder", "for", "a", "method", "delegation", "that", "does", "not", "apply", "any", "pre", "-", "configured", "{", "@link", "net", ".", "bytebuddy", ".", "implementation", ".", "bind", ".", "MethodDelegationBinder", ".", "AmbiguityResolver", "}", "s", "or", "{", "@link", "net", ".", "bytebuddy", ".", "implementation", ".", "bind", ".", "annotation", ".", "TargetMethodAnnotationDrivenBinder", ".", "ParameterBinder", "}", "s", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/implementation/MethodDelegation.java#L547-L549
i-net-software/jlessc
src/com/inet/lib/less/UrlUtils.java
UrlUtils.getColor
static double getColor( Expression param, CssFormatter formatter ) throws LessException { """ Get the color value of the expression or fire an exception if not a color. @param param the expression to evaluate @param formatter current formatter @return the color value of the expression @throws LessException if the expression is not a color value """ switch( param.getDataType( formatter ) ) { case Expression.COLOR: case Expression.RGBA: return param.doubleValue( formatter ); } throw new LessException( "Not a color: " + param ); }
java
static double getColor( Expression param, CssFormatter formatter ) throws LessException { switch( param.getDataType( formatter ) ) { case Expression.COLOR: case Expression.RGBA: return param.doubleValue( formatter ); } throw new LessException( "Not a color: " + param ); }
[ "static", "double", "getColor", "(", "Expression", "param", ",", "CssFormatter", "formatter", ")", "throws", "LessException", "{", "switch", "(", "param", ".", "getDataType", "(", "formatter", ")", ")", "{", "case", "Expression", ".", "COLOR", ":", "case", "Expression", ".", "RGBA", ":", "return", "param", ".", "doubleValue", "(", "formatter", ")", ";", "}", "throw", "new", "LessException", "(", "\"Not a color: \"", "+", "param", ")", ";", "}" ]
Get the color value of the expression or fire an exception if not a color. @param param the expression to evaluate @param formatter current formatter @return the color value of the expression @throws LessException if the expression is not a color value
[ "Get", "the", "color", "value", "of", "the", "expression", "or", "fire", "an", "exception", "if", "not", "a", "color", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/UrlUtils.java#L153-L160
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLEquivalentClassesAxiomImpl_CustomFieldSerializer.java
OWLEquivalentClassesAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLEquivalentClassesAxiomImpl instance) throws SerializationException { """ Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful """ deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLEquivalentClassesAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLEquivalentClassesAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLEquivalentClassesAxiomImpl_CustomFieldSerializer.java#L95-L98
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/LambdaMetaHelper.java
LambdaMetaHelper.getConstructor
public <T, A> Function<A, T> getConstructor(Class<? extends T> clazz, Class<A> arg) { """ Gets single arg constructor as Function. @param clazz class to get constructor for. @param arg constructor argument type. @param <T> clazz. @param <A> argument class. @return function. """ return getConstructorAs(Function.class, "apply", clazz, arg); }
java
public <T, A> Function<A, T> getConstructor(Class<? extends T> clazz, Class<A> arg) { return getConstructorAs(Function.class, "apply", clazz, arg); }
[ "public", "<", "T", ",", "A", ">", "Function", "<", "A", ",", "T", ">", "getConstructor", "(", "Class", "<", "?", "extends", "T", ">", "clazz", ",", "Class", "<", "A", ">", "arg", ")", "{", "return", "getConstructorAs", "(", "Function", ".", "class", ",", "\"apply\"", ",", "clazz", ",", "arg", ")", ";", "}" ]
Gets single arg constructor as Function. @param clazz class to get constructor for. @param arg constructor argument type. @param <T> clazz. @param <A> argument class. @return function.
[ "Gets", "single", "arg", "constructor", "as", "Function", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/LambdaMetaHelper.java#L37-L39
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java
DocBookXMLPreProcessor.createLinkWrapperElement
protected Element createLinkWrapperElement(final Document document, final Node node, final String cssClass) { """ Creates the wrapper element for bug or editor links and adds it to the document. @param document The document to add the wrapper/link to. @param node The specific node the wrapper/link should be added to. @param cssClass The css class name to use for the wrapper. @return The wrapper element that links can be added to. """ // Create the bug/editor link root element final Element linkElement = document.createElement("para"); if (cssClass != null) { linkElement.setAttribute("role", cssClass); } node.appendChild(linkElement); return linkElement; }
java
protected Element createLinkWrapperElement(final Document document, final Node node, final String cssClass) { // Create the bug/editor link root element final Element linkElement = document.createElement("para"); if (cssClass != null) { linkElement.setAttribute("role", cssClass); } node.appendChild(linkElement); return linkElement; }
[ "protected", "Element", "createLinkWrapperElement", "(", "final", "Document", "document", ",", "final", "Node", "node", ",", "final", "String", "cssClass", ")", "{", "// Create the bug/editor link root element", "final", "Element", "linkElement", "=", "document", ".", "createElement", "(", "\"para\"", ")", ";", "if", "(", "cssClass", "!=", "null", ")", "{", "linkElement", ".", "setAttribute", "(", "\"role\"", ",", "cssClass", ")", ";", "}", "node", ".", "appendChild", "(", "linkElement", ")", ";", "return", "linkElement", ";", "}" ]
Creates the wrapper element for bug or editor links and adds it to the document. @param document The document to add the wrapper/link to. @param node The specific node the wrapper/link should be added to. @param cssClass The css class name to use for the wrapper. @return The wrapper element that links can be added to.
[ "Creates", "the", "wrapper", "element", "for", "bug", "or", "editor", "links", "and", "adds", "it", "to", "the", "document", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java#L227-L237
alibaba/jstorm
jstorm-core/src/main/java/backtype/storm/windowing/WindowManager.java
WindowManager.getEarliestEventTs
public long getEarliestEventTs(long startTs, long endTs) { """ Scans the event queue and returns the next earliest event ts between the startTs and endTs @param startTs the start ts (exclusive) @param endTs the end ts (inclusive) @return the earliest event ts between startTs and endTs """ long minTs = Long.MAX_VALUE; for (Event<T> event : queue) { if (event.getTimestamp() > startTs && event.getTimestamp() <= endTs) { minTs = Math.min(minTs, event.getTimestamp()); } } return minTs; }
java
public long getEarliestEventTs(long startTs, long endTs) { long minTs = Long.MAX_VALUE; for (Event<T> event : queue) { if (event.getTimestamp() > startTs && event.getTimestamp() <= endTs) { minTs = Math.min(minTs, event.getTimestamp()); } } return minTs; }
[ "public", "long", "getEarliestEventTs", "(", "long", "startTs", ",", "long", "endTs", ")", "{", "long", "minTs", "=", "Long", ".", "MAX_VALUE", ";", "for", "(", "Event", "<", "T", ">", "event", ":", "queue", ")", "{", "if", "(", "event", ".", "getTimestamp", "(", ")", ">", "startTs", "&&", "event", ".", "getTimestamp", "(", ")", "<=", "endTs", ")", "{", "minTs", "=", "Math", ".", "min", "(", "minTs", ",", "event", ".", "getTimestamp", "(", ")", ")", ";", "}", "}", "return", "minTs", ";", "}" ]
Scans the event queue and returns the next earliest event ts between the startTs and endTs @param startTs the start ts (exclusive) @param endTs the end ts (inclusive) @return the earliest event ts between startTs and endTs
[ "Scans", "the", "event", "queue", "and", "returns", "the", "next", "earliest", "event", "ts", "between", "the", "startTs", "and", "endTs" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/windowing/WindowManager.java#L225-L233
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/ScaleSceneStructure.java
ScaleSceneStructure.applyScale
public void applyScale( SceneStructureProjective structure , SceneObservations observations ) { """ Applies the scale transform to the input scene structure. Metric. @param structure 3D scene @param observations Observations of the scene """ if( structure.homogenous ) { applyScaleToPointsHomogenous(structure); } else { computePointStatistics(structure.points); applyScaleToPoints3D(structure); applyScaleTranslation3D(structure); } // Compute pixel scaling to normalize the coordinates computePixelScaling(structure, observations); // scale and translate observations, which changes camera matrix applyScaleToPixelsAndCameraMatrix(structure, observations); }
java
public void applyScale( SceneStructureProjective structure , SceneObservations observations ) { if( structure.homogenous ) { applyScaleToPointsHomogenous(structure); } else { computePointStatistics(structure.points); applyScaleToPoints3D(structure); applyScaleTranslation3D(structure); } // Compute pixel scaling to normalize the coordinates computePixelScaling(structure, observations); // scale and translate observations, which changes camera matrix applyScaleToPixelsAndCameraMatrix(structure, observations); }
[ "public", "void", "applyScale", "(", "SceneStructureProjective", "structure", ",", "SceneObservations", "observations", ")", "{", "if", "(", "structure", ".", "homogenous", ")", "{", "applyScaleToPointsHomogenous", "(", "structure", ")", ";", "}", "else", "{", "computePointStatistics", "(", "structure", ".", "points", ")", ";", "applyScaleToPoints3D", "(", "structure", ")", ";", "applyScaleTranslation3D", "(", "structure", ")", ";", "}", "// Compute pixel scaling to normalize the coordinates", "computePixelScaling", "(", "structure", ",", "observations", ")", ";", "// scale and translate observations, which changes camera matrix", "applyScaleToPixelsAndCameraMatrix", "(", "structure", ",", "observations", ")", ";", "}" ]
Applies the scale transform to the input scene structure. Metric. @param structure 3D scene @param observations Observations of the scene
[ "Applies", "the", "scale", "transform", "to", "the", "input", "scene", "structure", ".", "Metric", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/ScaleSceneStructure.java#L115-L130
FINRAOS/DataGenerator
dg-common/src/main/java/org/finra/datagenerator/common/SocialNetwork_Example_Java/SocialNetworkUtilities.java
SocialNetworkUtilities.areCoordinatesWithinThreshold
public static Boolean areCoordinatesWithinThreshold(Tuple2<Double, Double> point1, Tuple2<Double, Double> point2) { """ Whether or not points are within some threshold. @param point1 Point 1 @param point2 Point 2 @return True or false """ return getDistanceBetweenCoordinates(point1, point2) < COORDINATE_THRESHOLD; }
java
public static Boolean areCoordinatesWithinThreshold(Tuple2<Double, Double> point1, Tuple2<Double, Double> point2) { return getDistanceBetweenCoordinates(point1, point2) < COORDINATE_THRESHOLD; }
[ "public", "static", "Boolean", "areCoordinatesWithinThreshold", "(", "Tuple2", "<", "Double", ",", "Double", ">", "point1", ",", "Tuple2", "<", "Double", ",", "Double", ">", "point2", ")", "{", "return", "getDistanceBetweenCoordinates", "(", "point1", ",", "point2", ")", "<", "COORDINATE_THRESHOLD", ";", "}" ]
Whether or not points are within some threshold. @param point1 Point 1 @param point2 Point 2 @return True or false
[ "Whether", "or", "not", "points", "are", "within", "some", "threshold", "." ]
train
https://github.com/FINRAOS/DataGenerator/blob/1f69f949401cbed4db4f553c3eb8350832c4d45a/dg-common/src/main/java/org/finra/datagenerator/common/SocialNetwork_Example_Java/SocialNetworkUtilities.java#L94-L96
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java
RecurrenceUtility.getDuration
public static Duration getDuration(ProjectProperties properties, Integer durationValue, Integer unitsValue) { """ Convert the integer representation of a duration value and duration units into an MPXJ Duration instance. @param properties project properties, used for duration units conversion @param durationValue integer duration value @param unitsValue integer units value @return Duration instance """ Duration result; if (durationValue == null) { result = null; } else { result = Duration.getInstance(durationValue.intValue(), TimeUnit.MINUTES); TimeUnit units = getDurationUnits(unitsValue); if (result.getUnits() != units) { result = result.convertUnits(units, properties); } } return (result); }
java
public static Duration getDuration(ProjectProperties properties, Integer durationValue, Integer unitsValue) { Duration result; if (durationValue == null) { result = null; } else { result = Duration.getInstance(durationValue.intValue(), TimeUnit.MINUTES); TimeUnit units = getDurationUnits(unitsValue); if (result.getUnits() != units) { result = result.convertUnits(units, properties); } } return (result); }
[ "public", "static", "Duration", "getDuration", "(", "ProjectProperties", "properties", ",", "Integer", "durationValue", ",", "Integer", "unitsValue", ")", "{", "Duration", "result", ";", "if", "(", "durationValue", "==", "null", ")", "{", "result", "=", "null", ";", "}", "else", "{", "result", "=", "Duration", ".", "getInstance", "(", "durationValue", ".", "intValue", "(", ")", ",", "TimeUnit", ".", "MINUTES", ")", ";", "TimeUnit", "units", "=", "getDurationUnits", "(", "unitsValue", ")", ";", "if", "(", "result", ".", "getUnits", "(", ")", "!=", "units", ")", "{", "result", "=", "result", ".", "convertUnits", "(", "units", ",", "properties", ")", ";", "}", "}", "return", "(", "result", ")", ";", "}" ]
Convert the integer representation of a duration value and duration units into an MPXJ Duration instance. @param properties project properties, used for duration units conversion @param durationValue integer duration value @param unitsValue integer units value @return Duration instance
[ "Convert", "the", "integer", "representation", "of", "a", "duration", "value", "and", "duration", "units", "into", "an", "MPXJ", "Duration", "instance", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java#L63-L80
elki-project/elki
elki-timeseries/src/main/java/de/lmu/ifi/dbs/elki/algorithm/timeseries/OfflineChangePointDetectionAlgorithm.java
OfflineChangePointDetectionAlgorithm.run
public ChangePoints run(Relation<DoubleVector> relation) { """ Executes multiple change point detection for given relation @param relation the relation to process @return list with all the detected change point for every time series """ if(!(relation.getDBIDs() instanceof ArrayDBIDs)) { throw new AbortException("This implementation may only be used on static databases, with ArrayDBIDs to provide a clear order."); } return new Instance(rnd.getSingleThreadedRandom()).run(relation); }
java
public ChangePoints run(Relation<DoubleVector> relation) { if(!(relation.getDBIDs() instanceof ArrayDBIDs)) { throw new AbortException("This implementation may only be used on static databases, with ArrayDBIDs to provide a clear order."); } return new Instance(rnd.getSingleThreadedRandom()).run(relation); }
[ "public", "ChangePoints", "run", "(", "Relation", "<", "DoubleVector", ">", "relation", ")", "{", "if", "(", "!", "(", "relation", ".", "getDBIDs", "(", ")", "instanceof", "ArrayDBIDs", ")", ")", "{", "throw", "new", "AbortException", "(", "\"This implementation may only be used on static databases, with ArrayDBIDs to provide a clear order.\"", ")", ";", "}", "return", "new", "Instance", "(", "rnd", ".", "getSingleThreadedRandom", "(", ")", ")", ".", "run", "(", "relation", ")", ";", "}" ]
Executes multiple change point detection for given relation @param relation the relation to process @return list with all the detected change point for every time series
[ "Executes", "multiple", "change", "point", "detection", "for", "given", "relation" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-timeseries/src/main/java/de/lmu/ifi/dbs/elki/algorithm/timeseries/OfflineChangePointDetectionAlgorithm.java#L133-L138
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/QuadTree.java
QuadTree.getIterator
public QuadTreeIterator getIterator(Geometry query, double tolerance, boolean bSorted) { """ Gets an iterator on the QuadTree. The query will be the Envelope2D that bounds the input Geometry. To reuse the existing iterator on the same QuadTree but with a new query, use the reset_iterator function on the QuadTree_iterator. \param query The Geometry used for the query. If the Geometry is a Line segment, then the query will be the segment. Otherwise the query will be the Envelope2D bounding the Geometry. \param tolerance The tolerance used for the intersection tests. \param bSorted Put true to iterate the quad tree in the order of the Element_types. """ if (!bSorted) { QuadTreeImpl.QuadTreeIteratorImpl iterator = m_impl.getIterator(query, tolerance); return new QuadTreeIterator(iterator, false); } else { QuadTreeImpl.QuadTreeSortedIteratorImpl iterator = m_impl.getSortedIterator(query, tolerance); return new QuadTreeIterator(iterator, true); } }
java
public QuadTreeIterator getIterator(Geometry query, double tolerance, boolean bSorted) { if (!bSorted) { QuadTreeImpl.QuadTreeIteratorImpl iterator = m_impl.getIterator(query, tolerance); return new QuadTreeIterator(iterator, false); } else { QuadTreeImpl.QuadTreeSortedIteratorImpl iterator = m_impl.getSortedIterator(query, tolerance); return new QuadTreeIterator(iterator, true); } }
[ "public", "QuadTreeIterator", "getIterator", "(", "Geometry", "query", ",", "double", "tolerance", ",", "boolean", "bSorted", ")", "{", "if", "(", "!", "bSorted", ")", "{", "QuadTreeImpl", ".", "QuadTreeIteratorImpl", "iterator", "=", "m_impl", ".", "getIterator", "(", "query", ",", "tolerance", ")", ";", "return", "new", "QuadTreeIterator", "(", "iterator", ",", "false", ")", ";", "}", "else", "{", "QuadTreeImpl", ".", "QuadTreeSortedIteratorImpl", "iterator", "=", "m_impl", ".", "getSortedIterator", "(", "query", ",", "tolerance", ")", ";", "return", "new", "QuadTreeIterator", "(", "iterator", ",", "true", ")", ";", "}", "}" ]
Gets an iterator on the QuadTree. The query will be the Envelope2D that bounds the input Geometry. To reuse the existing iterator on the same QuadTree but with a new query, use the reset_iterator function on the QuadTree_iterator. \param query The Geometry used for the query. If the Geometry is a Line segment, then the query will be the segment. Otherwise the query will be the Envelope2D bounding the Geometry. \param tolerance The tolerance used for the intersection tests. \param bSorted Put true to iterate the quad tree in the order of the Element_types.
[ "Gets", "an", "iterator", "on", "the", "QuadTree", ".", "The", "query", "will", "be", "the", "Envelope2D", "that", "bounds", "the", "input", "Geometry", ".", "To", "reuse", "the", "existing", "iterator", "on", "the", "same", "QuadTree", "but", "with", "a", "new", "query", "use", "the", "reset_iterator", "function", "on", "the", "QuadTree_iterator", ".", "\\", "param", "query", "The", "Geometry", "used", "for", "the", "query", ".", "If", "the", "Geometry", "is", "a", "Line", "segment", "then", "the", "query", "will", "be", "the", "segment", ".", "Otherwise", "the", "query", "will", "be", "the", "Envelope2D", "bounding", "the", "Geometry", ".", "\\", "param", "tolerance", "The", "tolerance", "used", "for", "the", "intersection", "tests", ".", "\\", "param", "bSorted", "Put", "true", "to", "iterate", "the", "quad", "tree", "in", "the", "order", "of", "the", "Element_types", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/QuadTree.java#L295-L303
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java
AnycastOutputHandler.getStreamInfo
private final StreamInfo getStreamInfo(String streamKey, SIBUuid12 streamId) { """ Helper method used to dispatch a message received for a particular stream. Handles its own synchronization @param remoteMEId @param streamId @return the StreamInfo, if there is one that matches the parameters, else null """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getStreamInfo", new Object[]{streamKey, streamId}); StreamInfo sinfo = streamTable.get(streamKey); if ((sinfo != null) && sinfo.streamId.equals(streamId)) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getStreamInfo", sinfo); return sinfo; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getStreamInfo", null); return null; }
java
private final StreamInfo getStreamInfo(String streamKey, SIBUuid12 streamId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getStreamInfo", new Object[]{streamKey, streamId}); StreamInfo sinfo = streamTable.get(streamKey); if ((sinfo != null) && sinfo.streamId.equals(streamId)) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getStreamInfo", sinfo); return sinfo; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getStreamInfo", null); return null; }
[ "private", "final", "StreamInfo", "getStreamInfo", "(", "String", "streamKey", ",", "SIBUuid12", "streamId", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"getStreamInfo\"", ",", "new", "Object", "[", "]", "{", "streamKey", ",", "streamId", "}", ")", ";", "StreamInfo", "sinfo", "=", "streamTable", ".", "get", "(", "streamKey", ")", ";", "if", "(", "(", "sinfo", "!=", "null", ")", "&&", "sinfo", ".", "streamId", ".", "equals", "(", "streamId", ")", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getStreamInfo\"", ",", "sinfo", ")", ";", "return", "sinfo", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"getStreamInfo\"", ",", "null", ")", ";", "return", "null", ";", "}" ]
Helper method used to dispatch a message received for a particular stream. Handles its own synchronization @param remoteMEId @param streamId @return the StreamInfo, if there is one that matches the parameters, else null
[ "Helper", "method", "used", "to", "dispatch", "a", "message", "received", "for", "a", "particular", "stream", ".", "Handles", "its", "own", "synchronization" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AnycastOutputHandler.java#L1944-L1957
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.whereEqualTo
@Nonnull public Query whereEqualTo(@Nonnull FieldPath fieldPath, @Nullable Object value) { """ Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be equal to the specified value. @param fieldPath The path of the field to compare. @param value The value for comparison. @return The created Query. """ Preconditions.checkState( options.startCursor == null && options.endCursor == null, "Cannot call whereEqualTo() after defining a boundary with startAt(), " + "startAfter(), endBefore() or endAt()."); QueryOptions newOptions = new QueryOptions(options); if (isUnaryComparison(value)) { newOptions.fieldFilters.add(new UnaryFilter(fieldPath, value)); } else { if (fieldPath.equals(FieldPath.DOCUMENT_ID)) { value = this.convertReference(value); } newOptions.fieldFilters.add(new ComparisonFilter(fieldPath, EQUAL, value)); } return new Query(firestore, path, newOptions); }
java
@Nonnull public Query whereEqualTo(@Nonnull FieldPath fieldPath, @Nullable Object value) { Preconditions.checkState( options.startCursor == null && options.endCursor == null, "Cannot call whereEqualTo() after defining a boundary with startAt(), " + "startAfter(), endBefore() or endAt()."); QueryOptions newOptions = new QueryOptions(options); if (isUnaryComparison(value)) { newOptions.fieldFilters.add(new UnaryFilter(fieldPath, value)); } else { if (fieldPath.equals(FieldPath.DOCUMENT_ID)) { value = this.convertReference(value); } newOptions.fieldFilters.add(new ComparisonFilter(fieldPath, EQUAL, value)); } return new Query(firestore, path, newOptions); }
[ "@", "Nonnull", "public", "Query", "whereEqualTo", "(", "@", "Nonnull", "FieldPath", "fieldPath", ",", "@", "Nullable", "Object", "value", ")", "{", "Preconditions", ".", "checkState", "(", "options", ".", "startCursor", "==", "null", "&&", "options", ".", "endCursor", "==", "null", ",", "\"Cannot call whereEqualTo() after defining a boundary with startAt(), \"", "+", "\"startAfter(), endBefore() or endAt().\"", ")", ";", "QueryOptions", "newOptions", "=", "new", "QueryOptions", "(", "options", ")", ";", "if", "(", "isUnaryComparison", "(", "value", ")", ")", "{", "newOptions", ".", "fieldFilters", ".", "add", "(", "new", "UnaryFilter", "(", "fieldPath", ",", "value", ")", ")", ";", "}", "else", "{", "if", "(", "fieldPath", ".", "equals", "(", "FieldPath", ".", "DOCUMENT_ID", ")", ")", "{", "value", "=", "this", ".", "convertReference", "(", "value", ")", ";", "}", "newOptions", ".", "fieldFilters", ".", "add", "(", "new", "ComparisonFilter", "(", "fieldPath", ",", "EQUAL", ",", "value", ")", ")", ";", "}", "return", "new", "Query", "(", "firestore", ",", "path", ",", "newOptions", ")", ";", "}" ]
Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be equal to the specified value. @param fieldPath The path of the field to compare. @param value The value for comparison. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "with", "the", "additional", "filter", "that", "documents", "must", "contain", "the", "specified", "field", "and", "the", "value", "should", "be", "equal", "to", "the", "specified", "value", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L429-L447
JosePaumard/streams-utils
src/main/java/org/paumard/streams/StreamsUtils.java
StreamsUtils.shiftingWindowSummarizingLong
public static <E> Stream<LongSummaryStatistics> shiftingWindowSummarizingLong(Stream<E> stream, int rollingFactor, ToLongFunction<? super E> mapper) { """ <p>Generates a stream that is computed from a provided stream following two steps.</p> <p>The first steps maps this stream to an <code>LongStream</code> that is then rolled following the same principle as the <code>roll()</code> method. This steps builds a <code>Stream&lt;LongStream&gt;</code>. </p> <p>Then long summary statistics are computed on each <code>LongStream</code> using a <code>collect()</code> call, and a <code>Stream&lt;LongSummaryStatistics&gt;</code> is returned.</p> <p>The resulting stream has the same number of elements as the provided stream, minus the size of the window width, to preserve consistency of each collection. </p> <p>A <code>NullPointerException</code> will be thrown if the provided stream or the mapper is null.</p> @param stream the processed stream @param rollingFactor the size of the window to apply the collector on @param mapper the mapper applied @param <E> the type of the provided stream @return a stream in which each value is the collection of the provided stream """ Objects.requireNonNull(stream); Objects.requireNonNull(mapper); LongStream longStream = stream.mapToLong(mapper); return shiftingWindowSummarizingLong(longStream, rollingFactor); }
java
public static <E> Stream<LongSummaryStatistics> shiftingWindowSummarizingLong(Stream<E> stream, int rollingFactor, ToLongFunction<? super E> mapper) { Objects.requireNonNull(stream); Objects.requireNonNull(mapper); LongStream longStream = stream.mapToLong(mapper); return shiftingWindowSummarizingLong(longStream, rollingFactor); }
[ "public", "static", "<", "E", ">", "Stream", "<", "LongSummaryStatistics", ">", "shiftingWindowSummarizingLong", "(", "Stream", "<", "E", ">", "stream", ",", "int", "rollingFactor", ",", "ToLongFunction", "<", "?", "super", "E", ">", "mapper", ")", "{", "Objects", ".", "requireNonNull", "(", "stream", ")", ";", "Objects", ".", "requireNonNull", "(", "mapper", ")", ";", "LongStream", "longStream", "=", "stream", ".", "mapToLong", "(", "mapper", ")", ";", "return", "shiftingWindowSummarizingLong", "(", "longStream", ",", "rollingFactor", ")", ";", "}" ]
<p>Generates a stream that is computed from a provided stream following two steps.</p> <p>The first steps maps this stream to an <code>LongStream</code> that is then rolled following the same principle as the <code>roll()</code> method. This steps builds a <code>Stream&lt;LongStream&gt;</code>. </p> <p>Then long summary statistics are computed on each <code>LongStream</code> using a <code>collect()</code> call, and a <code>Stream&lt;LongSummaryStatistics&gt;</code> is returned.</p> <p>The resulting stream has the same number of elements as the provided stream, minus the size of the window width, to preserve consistency of each collection. </p> <p>A <code>NullPointerException</code> will be thrown if the provided stream or the mapper is null.</p> @param stream the processed stream @param rollingFactor the size of the window to apply the collector on @param mapper the mapper applied @param <E> the type of the provided stream @return a stream in which each value is the collection of the provided stream
[ "<p", ">", "Generates", "a", "stream", "that", "is", "computed", "from", "a", "provided", "stream", "following", "two", "steps", ".", "<", "/", "p", ">", "<p", ">", "The", "first", "steps", "maps", "this", "stream", "to", "an", "<code", ">", "LongStream<", "/", "code", ">", "that", "is", "then", "rolled", "following", "the", "same", "principle", "as", "the", "<code", ">", "roll", "()", "<", "/", "code", ">", "method", ".", "This", "steps", "builds", "a", "<code", ">", "Stream&lt", ";", "LongStream&gt", ";", "<", "/", "code", ">", ".", "<", "/", "p", ">", "<p", ">", "Then", "long", "summary", "statistics", "are", "computed", "on", "each", "<code", ">", "LongStream<", "/", "code", ">", "using", "a", "<code", ">", "collect", "()", "<", "/", "code", ">", "call", "and", "a", "<code", ">", "Stream&lt", ";", "LongSummaryStatistics&gt", ";", "<", "/", "code", ">", "is", "returned", ".", "<", "/", "p", ">", "<p", ">", "The", "resulting", "stream", "has", "the", "same", "number", "of", "elements", "as", "the", "provided", "stream", "minus", "the", "size", "of", "the", "window", "width", "to", "preserve", "consistency", "of", "each", "collection", ".", "<", "/", "p", ">", "<p", ">", "A", "<code", ">", "NullPointerException<", "/", "code", ">", "will", "be", "thrown", "if", "the", "provided", "stream", "or", "the", "mapper", "is", "null", ".", "<", "/", "p", ">" ]
train
https://github.com/JosePaumard/streams-utils/blob/56152574af0aca44c5f679761202a8f90984ab73/src/main/java/org/paumard/streams/StreamsUtils.java#L751-L757
lucee/Lucee
core/src/main/java/lucee/commons/net/HTTPUtil.java
HTTPUtil.optimizeRealPath
public static String optimizeRealPath(PageContext pc, String realPath) { """ /* public static URL toURL(HttpMethod httpMethod) { HostConfiguration config = httpMethod.getHostConfiguration(); try { String qs = httpMethod.getQueryString(); if(StringUtil.isEmpty(qs)) return new URL(config.getProtocol().getScheme(),config.getHost(),config.getPort(),httpMethod.getPath()); return new URL(config.getProtocol().getScheme(),config.getHost(),config.getPort(),httpMethod.getPath()+"?"+ qs); } catch (MalformedURLException e) { return null; } } """ int index; String requestURI = realPath, queryString = null; if ((index = realPath.indexOf('?')) != -1) { requestURI = realPath.substring(0, index); queryString = realPath.substring(index + 1); } PageSource ps = PageSourceImpl.best(((PageContextImpl) pc).getRelativePageSources(requestURI)); requestURI = ps.getRealpathWithVirtual(); if (queryString != null) return requestURI + "?" + queryString; return requestURI; }
java
public static String optimizeRealPath(PageContext pc, String realPath) { int index; String requestURI = realPath, queryString = null; if ((index = realPath.indexOf('?')) != -1) { requestURI = realPath.substring(0, index); queryString = realPath.substring(index + 1); } PageSource ps = PageSourceImpl.best(((PageContextImpl) pc).getRelativePageSources(requestURI)); requestURI = ps.getRealpathWithVirtual(); if (queryString != null) return requestURI + "?" + queryString; return requestURI; }
[ "public", "static", "String", "optimizeRealPath", "(", "PageContext", "pc", ",", "String", "realPath", ")", "{", "int", "index", ";", "String", "requestURI", "=", "realPath", ",", "queryString", "=", "null", ";", "if", "(", "(", "index", "=", "realPath", ".", "indexOf", "(", "'", "'", ")", ")", "!=", "-", "1", ")", "{", "requestURI", "=", "realPath", ".", "substring", "(", "0", ",", "index", ")", ";", "queryString", "=", "realPath", ".", "substring", "(", "index", "+", "1", ")", ";", "}", "PageSource", "ps", "=", "PageSourceImpl", ".", "best", "(", "(", "(", "PageContextImpl", ")", "pc", ")", ".", "getRelativePageSources", "(", "requestURI", ")", ")", ";", "requestURI", "=", "ps", ".", "getRealpathWithVirtual", "(", ")", ";", "if", "(", "queryString", "!=", "null", ")", "return", "requestURI", "+", "\"?\"", "+", "queryString", ";", "return", "requestURI", ";", "}" ]
/* public static URL toURL(HttpMethod httpMethod) { HostConfiguration config = httpMethod.getHostConfiguration(); try { String qs = httpMethod.getQueryString(); if(StringUtil.isEmpty(qs)) return new URL(config.getProtocol().getScheme(),config.getHost(),config.getPort(),httpMethod.getPath()); return new URL(config.getProtocol().getScheme(),config.getHost(),config.getPort(),httpMethod.getPath()+"?"+ qs); } catch (MalformedURLException e) { return null; } }
[ "/", "*", "public", "static", "URL", "toURL", "(", "HttpMethod", "httpMethod", ")", "{", "HostConfiguration", "config", "=", "httpMethod", ".", "getHostConfiguration", "()", ";" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/net/HTTPUtil.java#L388-L399
lisicnu/droidUtil
src/main/java/com/github/lisicnu/libDroid/util/ShellUtils.java
ShellUtils.execCommand
public static CommandResult execCommand(String command, boolean isRoot) { """ execute shell command, default return result msg @param command command @param isRoot whether need to run with root @return @see ShellUtils#execCommand(String[], boolean, boolean) """ return execCommand(new String[]{command}, isRoot, true); }
java
public static CommandResult execCommand(String command, boolean isRoot) { return execCommand(new String[]{command}, isRoot, true); }
[ "public", "static", "CommandResult", "execCommand", "(", "String", "command", ",", "boolean", "isRoot", ")", "{", "return", "execCommand", "(", "new", "String", "[", "]", "{", "command", "}", ",", "isRoot", ",", "true", ")", ";", "}" ]
execute shell command, default return result msg @param command command @param isRoot whether need to run with root @return @see ShellUtils#execCommand(String[], boolean, boolean)
[ "execute", "shell", "command", "default", "return", "result", "msg" ]
train
https://github.com/lisicnu/droidUtil/blob/e4d6cf3e3f60e5efb5a75672607ded94d1725519/src/main/java/com/github/lisicnu/libDroid/util/ShellUtils.java#L44-L46
syphr42/prom
src/main/java/org/syphr/prom/ManagedProperties.java
ManagedProperties.getProperties
public Properties getProperties(boolean includeDefaults, String propertyName) { """ Retrieve a {@link Properties} object that contains the properties managed by this instance. If a non-<code>null</code> property name is given, the values will be the last saved value for each property except the given one. Otherwise, the properties will all be the current values. This is useful for saving a change to a single property to disk without also saving any other changes that have been made. <br> <br> Please note that the returned {@link Properties} object is not connected in any way to this instance and is only a snapshot of what the properties looked like at the time the request was fulfilled. @param includeDefaults if <code>true</code>, values that match the default will be stored directly in the properties map; otherwise values matching the default will only be available through the {@link Properties} concept of defaults (as a fallback and not written to the file system if this object is stored) @param propertyName the name of the property whose current value should be provided while all others will be the last saved value (if this is <code>null</code>, all values will be current) @return a {@link Properties} instance containing the properties managed by this instance (including defaults as defined by the given flag) """ Properties tmpProperties = new Properties(defaults); for (Entry<String, ChangeStack<String>> entry : properties.entrySet()) { String entryName = entry.getKey(); /* * If we are only concerned with a single property, we need to grab * the last saved value for all of the other properties. */ String value = propertyName == null || propertyName.equals(entryName) ? entry.getValue().getCurrentValue() : entry.getValue().getSyncedValue(); /* * The value could be null if the property has no default, was set * without saving, and now the saved value is requested. In which * case, like the case of a default value where defaults are not * being included, the property can be skipped. */ if (value == null || (!includeDefaults && value.equals(getDefaultValue(entryName)))) { continue; } tmpProperties.setProperty(entryName, value); } return tmpProperties; }
java
public Properties getProperties(boolean includeDefaults, String propertyName) { Properties tmpProperties = new Properties(defaults); for (Entry<String, ChangeStack<String>> entry : properties.entrySet()) { String entryName = entry.getKey(); /* * If we are only concerned with a single property, we need to grab * the last saved value for all of the other properties. */ String value = propertyName == null || propertyName.equals(entryName) ? entry.getValue().getCurrentValue() : entry.getValue().getSyncedValue(); /* * The value could be null if the property has no default, was set * without saving, and now the saved value is requested. In which * case, like the case of a default value where defaults are not * being included, the property can be skipped. */ if (value == null || (!includeDefaults && value.equals(getDefaultValue(entryName)))) { continue; } tmpProperties.setProperty(entryName, value); } return tmpProperties; }
[ "public", "Properties", "getProperties", "(", "boolean", "includeDefaults", ",", "String", "propertyName", ")", "{", "Properties", "tmpProperties", "=", "new", "Properties", "(", "defaults", ")", ";", "for", "(", "Entry", "<", "String", ",", "ChangeStack", "<", "String", ">", ">", "entry", ":", "properties", ".", "entrySet", "(", ")", ")", "{", "String", "entryName", "=", "entry", ".", "getKey", "(", ")", ";", "/*\n * If we are only concerned with a single property, we need to grab\n * the last saved value for all of the other properties.\n */", "String", "value", "=", "propertyName", "==", "null", "||", "propertyName", ".", "equals", "(", "entryName", ")", "?", "entry", ".", "getValue", "(", ")", ".", "getCurrentValue", "(", ")", ":", "entry", ".", "getValue", "(", ")", ".", "getSyncedValue", "(", ")", ";", "/*\n * The value could be null if the property has no default, was set\n * without saving, and now the saved value is requested. In which\n * case, like the case of a default value where defaults are not\n * being included, the property can be skipped.\n */", "if", "(", "value", "==", "null", "||", "(", "!", "includeDefaults", "&&", "value", ".", "equals", "(", "getDefaultValue", "(", "entryName", ")", ")", ")", ")", "{", "continue", ";", "}", "tmpProperties", ".", "setProperty", "(", "entryName", ",", "value", ")", ";", "}", "return", "tmpProperties", ";", "}" ]
Retrieve a {@link Properties} object that contains the properties managed by this instance. If a non-<code>null</code> property name is given, the values will be the last saved value for each property except the given one. Otherwise, the properties will all be the current values. This is useful for saving a change to a single property to disk without also saving any other changes that have been made. <br> <br> Please note that the returned {@link Properties} object is not connected in any way to this instance and is only a snapshot of what the properties looked like at the time the request was fulfilled. @param includeDefaults if <code>true</code>, values that match the default will be stored directly in the properties map; otherwise values matching the default will only be available through the {@link Properties} concept of defaults (as a fallback and not written to the file system if this object is stored) @param propertyName the name of the property whose current value should be provided while all others will be the last saved value (if this is <code>null</code>, all values will be current) @return a {@link Properties} instance containing the properties managed by this instance (including defaults as defined by the given flag)
[ "Retrieve", "a", "{", "@link", "Properties", "}", "object", "that", "contains", "the", "properties", "managed", "by", "this", "instance", ".", "If", "a", "non", "-", "<code", ">", "null<", "/", "code", ">", "property", "name", "is", "given", "the", "values", "will", "be", "the", "last", "saved", "value", "for", "each", "property", "except", "the", "given", "one", ".", "Otherwise", "the", "properties", "will", "all", "be", "the", "current", "values", ".", "This", "is", "useful", "for", "saving", "a", "change", "to", "a", "single", "property", "to", "disk", "without", "also", "saving", "any", "other", "changes", "that", "have", "been", "made", ".", "<br", ">", "<br", ">", "Please", "note", "that", "the", "returned", "{", "@link", "Properties", "}", "object", "is", "not", "connected", "in", "any", "way", "to", "this", "instance", "and", "is", "only", "a", "snapshot", "of", "what", "the", "properties", "looked", "like", "at", "the", "time", "the", "request", "was", "fulfilled", "." ]
train
https://github.com/syphr42/prom/blob/074d67c4ebb3afb0b163fcb0bc4826ee577ac803/src/main/java/org/syphr/prom/ManagedProperties.java#L589-L622
moparisthebest/beehive
beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java
ReflectionFragment.hasComplexValue
protected boolean hasComplexValue(ControlBeanContext context, Method m, Object[] args) { """ A reflection fragment may evaluate to an JdbcControl.ComplexSqlFragment type, which requires additional steps to evaluate after reflection. @param context Control bean context. @param m Method. @param args Method args. @return true or false. """ Object val = getParameterValue(context, m, args); return val instanceof JdbcControl.ComplexSqlFragment; }
java
protected boolean hasComplexValue(ControlBeanContext context, Method m, Object[] args) { Object val = getParameterValue(context, m, args); return val instanceof JdbcControl.ComplexSqlFragment; }
[ "protected", "boolean", "hasComplexValue", "(", "ControlBeanContext", "context", ",", "Method", "m", ",", "Object", "[", "]", "args", ")", "{", "Object", "val", "=", "getParameterValue", "(", "context", ",", "m", ",", "args", ")", ";", "return", "val", "instanceof", "JdbcControl", ".", "ComplexSqlFragment", ";", "}" ]
A reflection fragment may evaluate to an JdbcControl.ComplexSqlFragment type, which requires additional steps to evaluate after reflection. @param context Control bean context. @param m Method. @param args Method args. @return true or false.
[ "A", "reflection", "fragment", "may", "evaluate", "to", "an", "JdbcControl", ".", "ComplexSqlFragment", "type", "which", "requires", "additional", "steps", "to", "evaluate", "after", "reflection", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-jdbc-control/src/main/java/org/apache/beehive/controls/system/jdbc/parser/ReflectionFragment.java#L101-L104
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/converter/json/JsonSchema.java
JsonSchema.getTypeOfArrayItems
public Type getTypeOfArrayItems() throws DataConversionException { """ Fetches the nested or primitive array items type from schema. @return @throws DataConversionException """ JsonSchema arrayValues = getItemsWithinDataType(); if (arrayValues == null) { throw new DataConversionException("Array types only allow values as primitive, null or JsonObject"); } return arrayValues.getType(); }
java
public Type getTypeOfArrayItems() throws DataConversionException { JsonSchema arrayValues = getItemsWithinDataType(); if (arrayValues == null) { throw new DataConversionException("Array types only allow values as primitive, null or JsonObject"); } return arrayValues.getType(); }
[ "public", "Type", "getTypeOfArrayItems", "(", ")", "throws", "DataConversionException", "{", "JsonSchema", "arrayValues", "=", "getItemsWithinDataType", "(", ")", ";", "if", "(", "arrayValues", "==", "null", ")", "{", "throw", "new", "DataConversionException", "(", "\"Array types only allow values as primitive, null or JsonObject\"", ")", ";", "}", "return", "arrayValues", ".", "getType", "(", ")", ";", "}" ]
Fetches the nested or primitive array items type from schema. @return @throws DataConversionException
[ "Fetches", "the", "nested", "or", "primitive", "array", "items", "type", "from", "schema", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/converter/json/JsonSchema.java#L232-L239
liyiorg/weixin-popular
src/main/java/weixin/popular/api/ShakeAroundAPI.java
ShakeAroundAPI.pageUpdate
public static PageUpdateResult pageUpdate(String accessToken, PageUpdate pageUpdate) { """ 页面管理-编辑页面信息 @param accessToken accessToken @param pageUpdate pageUpdate @return result """ return pageUpdate(accessToken, JsonUtil.toJSONString(pageUpdate)); }
java
public static PageUpdateResult pageUpdate(String accessToken, PageUpdate pageUpdate) { return pageUpdate(accessToken, JsonUtil.toJSONString(pageUpdate)); }
[ "public", "static", "PageUpdateResult", "pageUpdate", "(", "String", "accessToken", ",", "PageUpdate", "pageUpdate", ")", "{", "return", "pageUpdate", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "pageUpdate", ")", ")", ";", "}" ]
页面管理-编辑页面信息 @param accessToken accessToken @param pageUpdate pageUpdate @return result
[ "页面管理-编辑页面信息" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ShakeAroundAPI.java#L820-L823
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_historyRepaymentConsumption_date_GET
public OvhHistoryRepaymentConsumption billingAccount_historyRepaymentConsumption_date_GET(String billingAccount, java.util.Date date) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/historyRepaymentConsumption/{date} @param billingAccount [required] The name of your billingAccount @param date [required] date of the bill """ String qPath = "/telephony/{billingAccount}/historyRepaymentConsumption/{date}"; StringBuilder sb = path(qPath, billingAccount, date); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhHistoryRepaymentConsumption.class); }
java
public OvhHistoryRepaymentConsumption billingAccount_historyRepaymentConsumption_date_GET(String billingAccount, java.util.Date date) throws IOException { String qPath = "/telephony/{billingAccount}/historyRepaymentConsumption/{date}"; StringBuilder sb = path(qPath, billingAccount, date); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhHistoryRepaymentConsumption.class); }
[ "public", "OvhHistoryRepaymentConsumption", "billingAccount_historyRepaymentConsumption_date_GET", "(", "String", "billingAccount", ",", "java", ".", "util", ".", "Date", "date", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/historyRepaymentConsumption/{date}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "date", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhHistoryRepaymentConsumption", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /telephony/{billingAccount}/historyRepaymentConsumption/{date} @param billingAccount [required] The name of your billingAccount @param date [required] date of the bill
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L8428-L8433
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ResultUtil.java
ResultUtil.getAggBuckets
public static Object getAggBuckets(Map<String,?> map ,String metrics) { """ { "key": "demoproject", "doc_count": 30, "successsums": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [ { "key": 0, "doc_count": 30 } ] } }, @param map @param metrics successsums->buckets @return """ if(map != null){ Map<String,Object> metrics_ = (Map<String,Object>)map.get(metrics); if(metrics_ != null){ return metrics_.get("buckets"); } } return null; }
java
public static Object getAggBuckets(Map<String,?> map ,String metrics){ if(map != null){ Map<String,Object> metrics_ = (Map<String,Object>)map.get(metrics); if(metrics_ != null){ return metrics_.get("buckets"); } } return null; }
[ "public", "static", "Object", "getAggBuckets", "(", "Map", "<", "String", ",", "?", ">", "map", ",", "String", "metrics", ")", "{", "if", "(", "map", "!=", "null", ")", "{", "Map", "<", "String", ",", "Object", ">", "metrics_", "=", "(", "Map", "<", "String", ",", "Object", ">", ")", "map", ".", "get", "(", "metrics", ")", ";", "if", "(", "metrics_", "!=", "null", ")", "{", "return", "metrics_", ".", "get", "(", "\"buckets\"", ")", ";", "}", "}", "return", "null", ";", "}" ]
{ "key": "demoproject", "doc_count": 30, "successsums": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [ { "key": 0, "doc_count": 30 } ] } }, @param map @param metrics successsums->buckets @return
[ "{", "key", ":", "demoproject", "doc_count", ":", "30", "successsums", ":", "{", "doc_count_error_upper_bound", ":", "0", "sum_other_doc_count", ":", "0", "buckets", ":", "[", "{", "key", ":", "0", "doc_count", ":", "30", "}", "]", "}", "}", "@param", "map", "@param", "metrics", "successsums", "-", ">", "buckets" ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ResultUtil.java#L723-L731
mgormley/pacaya
src/main/java/edu/jhu/pacaya/parse/cky/data/NaryTree.java
NaryTree.leftBinarize
public BinaryTree leftBinarize() { """ Get a left-binarized form of this tree. This returns a binarized form that relabels the nodes just as in the Berkeley parser. """ BinaryTree leftChild; BinaryTree rightChild; if (isLeaf()) { leftChild = null; rightChild = null; } else if (children.size() == 1) { leftChild = children.get(0).leftBinarize(); rightChild = null; } else if (children.size() == 2) { leftChild = children.get(0).leftBinarize(); rightChild = children.get(1).leftBinarize(); } else { // Define the label of the new parent node as in the Berkeley grammar. String xbarParent = GrammarConstants.getBinarizedTag(symbol); LinkedList<NaryTree> queue = new LinkedList<NaryTree>(children); // Start by binarizing the left-most child, and store as L. leftChild = queue.removeFirst().leftBinarize(); while (true) { // Working left-to-right, remove and binarize the next-left-most child, and store as R. rightChild = queue.removeFirst().leftBinarize(); // Break once we've acquired the right-most child. if (queue.isEmpty()) { break; } // Then form a new binary node that has left/right children: L and R. // That is, a node (@symbolStr --> (L) (R)). // Store this new node as L and repeat. leftChild = new BinaryTree(xbarParent, leftChild.getStart(), rightChild.getEnd(), leftChild, rightChild, isLexical); } } return new BinaryTree(symbol, start, end, leftChild, rightChild , isLexical); }
java
public BinaryTree leftBinarize() { BinaryTree leftChild; BinaryTree rightChild; if (isLeaf()) { leftChild = null; rightChild = null; } else if (children.size() == 1) { leftChild = children.get(0).leftBinarize(); rightChild = null; } else if (children.size() == 2) { leftChild = children.get(0).leftBinarize(); rightChild = children.get(1).leftBinarize(); } else { // Define the label of the new parent node as in the Berkeley grammar. String xbarParent = GrammarConstants.getBinarizedTag(symbol); LinkedList<NaryTree> queue = new LinkedList<NaryTree>(children); // Start by binarizing the left-most child, and store as L. leftChild = queue.removeFirst().leftBinarize(); while (true) { // Working left-to-right, remove and binarize the next-left-most child, and store as R. rightChild = queue.removeFirst().leftBinarize(); // Break once we've acquired the right-most child. if (queue.isEmpty()) { break; } // Then form a new binary node that has left/right children: L and R. // That is, a node (@symbolStr --> (L) (R)). // Store this new node as L and repeat. leftChild = new BinaryTree(xbarParent, leftChild.getStart(), rightChild.getEnd(), leftChild, rightChild, isLexical); } } return new BinaryTree(symbol, start, end, leftChild, rightChild , isLexical); }
[ "public", "BinaryTree", "leftBinarize", "(", ")", "{", "BinaryTree", "leftChild", ";", "BinaryTree", "rightChild", ";", "if", "(", "isLeaf", "(", ")", ")", "{", "leftChild", "=", "null", ";", "rightChild", "=", "null", ";", "}", "else", "if", "(", "children", ".", "size", "(", ")", "==", "1", ")", "{", "leftChild", "=", "children", ".", "get", "(", "0", ")", ".", "leftBinarize", "(", ")", ";", "rightChild", "=", "null", ";", "}", "else", "if", "(", "children", ".", "size", "(", ")", "==", "2", ")", "{", "leftChild", "=", "children", ".", "get", "(", "0", ")", ".", "leftBinarize", "(", ")", ";", "rightChild", "=", "children", ".", "get", "(", "1", ")", ".", "leftBinarize", "(", ")", ";", "}", "else", "{", "// Define the label of the new parent node as in the Berkeley grammar.", "String", "xbarParent", "=", "GrammarConstants", ".", "getBinarizedTag", "(", "symbol", ")", ";", "LinkedList", "<", "NaryTree", ">", "queue", "=", "new", "LinkedList", "<", "NaryTree", ">", "(", "children", ")", ";", "// Start by binarizing the left-most child, and store as L.", "leftChild", "=", "queue", ".", "removeFirst", "(", ")", ".", "leftBinarize", "(", ")", ";", "while", "(", "true", ")", "{", "// Working left-to-right, remove and binarize the next-left-most child, and store as R.", "rightChild", "=", "queue", ".", "removeFirst", "(", ")", ".", "leftBinarize", "(", ")", ";", "// Break once we've acquired the right-most child.", "if", "(", "queue", ".", "isEmpty", "(", ")", ")", "{", "break", ";", "}", "// Then form a new binary node that has left/right children: L and R.", "// That is, a node (@symbolStr --> (L) (R)).", "// Store this new node as L and repeat.", "leftChild", "=", "new", "BinaryTree", "(", "xbarParent", ",", "leftChild", ".", "getStart", "(", ")", ",", "rightChild", ".", "getEnd", "(", ")", ",", "leftChild", ",", "rightChild", ",", "isLexical", ")", ";", "}", "}", "return", "new", "BinaryTree", "(", "symbol", ",", "start", ",", "end", ",", "leftChild", ",", "rightChild", ",", "isLexical", ")", ";", "}" ]
Get a left-binarized form of this tree. This returns a binarized form that relabels the nodes just as in the Berkeley parser.
[ "Get", "a", "left", "-", "binarized", "form", "of", "this", "tree", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/cky/data/NaryTree.java#L417-L451
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/windows/CreateTableDialog.java
CreateTableDialog.isCreateTableAppropriate
public static boolean isCreateTableAppropriate(final Datastore datastore, final Schema schema) { """ Determines if it is appropriate/possible to create a table in a particular schema or a particular datastore. @param datastore @param schema @return """ if (datastore == null || schema == null) { return false; } if (!(datastore instanceof UpdateableDatastore)) { return false; } if (datastore instanceof CsvDatastore) { // see issue https://issues.apache.org/jira/browse/METAMODEL-31 - as // long as this is an issue we do not want to expose "create table" // functionality to CSV datastores. return false; } if (MetaModelHelper.isInformationSchema(schema)) { return false; } return true; }
java
public static boolean isCreateTableAppropriate(final Datastore datastore, final Schema schema) { if (datastore == null || schema == null) { return false; } if (!(datastore instanceof UpdateableDatastore)) { return false; } if (datastore instanceof CsvDatastore) { // see issue https://issues.apache.org/jira/browse/METAMODEL-31 - as // long as this is an issue we do not want to expose "create table" // functionality to CSV datastores. return false; } if (MetaModelHelper.isInformationSchema(schema)) { return false; } return true; }
[ "public", "static", "boolean", "isCreateTableAppropriate", "(", "final", "Datastore", "datastore", ",", "final", "Schema", "schema", ")", "{", "if", "(", "datastore", "==", "null", "||", "schema", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "!", "(", "datastore", "instanceof", "UpdateableDatastore", ")", ")", "{", "return", "false", ";", "}", "if", "(", "datastore", "instanceof", "CsvDatastore", ")", "{", "// see issue https://issues.apache.org/jira/browse/METAMODEL-31 - as", "// long as this is an issue we do not want to expose \"create table\"", "// functionality to CSV datastores.", "return", "false", ";", "}", "if", "(", "MetaModelHelper", ".", "isInformationSchema", "(", "schema", ")", ")", "{", "return", "false", ";", "}", "return", "true", ";", "}" ]
Determines if it is appropriate/possible to create a table in a particular schema or a particular datastore. @param datastore @param schema @return
[ "Determines", "if", "it", "is", "appropriate", "/", "possible", "to", "create", "a", "table", "in", "a", "particular", "schema", "or", "a", "particular", "datastore", "." ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/windows/CreateTableDialog.java#L117-L134
devnied/Bit-lib4j
src/main/java/fr/devnied/bitlib/BytesUtils.java
BytesUtils.setBit
public static byte setBit(final byte pData, final int pBitIndex, final boolean pOn) { """ Method used to set a bit index to 1 or 0. @param pData data to modify @param pBitIndex index to set @param pOn set bit at specified index to 1 or 0 @return the modified byte """ if (pBitIndex < 0 || pBitIndex > 7) { throw new IllegalArgumentException("parameter 'pBitIndex' must be between 0 and 7. pBitIndex=" + pBitIndex); } byte ret = pData; if (pOn) { // Set bit ret |= 1 << pBitIndex; } else { // Unset bit ret &= ~(1 << pBitIndex); } return ret; }
java
public static byte setBit(final byte pData, final int pBitIndex, final boolean pOn) { if (pBitIndex < 0 || pBitIndex > 7) { throw new IllegalArgumentException("parameter 'pBitIndex' must be between 0 and 7. pBitIndex=" + pBitIndex); } byte ret = pData; if (pOn) { // Set bit ret |= 1 << pBitIndex; } else { // Unset bit ret &= ~(1 << pBitIndex); } return ret; }
[ "public", "static", "byte", "setBit", "(", "final", "byte", "pData", ",", "final", "int", "pBitIndex", ",", "final", "boolean", "pOn", ")", "{", "if", "(", "pBitIndex", "<", "0", "||", "pBitIndex", ">", "7", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"parameter 'pBitIndex' must be between 0 and 7. pBitIndex=\"", "+", "pBitIndex", ")", ";", "}", "byte", "ret", "=", "pData", ";", "if", "(", "pOn", ")", "{", "// Set bit\r", "ret", "|=", "1", "<<", "pBitIndex", ";", "}", "else", "{", "// Unset bit\r", "ret", "&=", "~", "(", "1", "<<", "pBitIndex", ")", ";", "}", "return", "ret", ";", "}" ]
Method used to set a bit index to 1 or 0. @param pData data to modify @param pBitIndex index to set @param pOn set bit at specified index to 1 or 0 @return the modified byte
[ "Method", "used", "to", "set", "a", "bit", "index", "to", "1", "or", "0", "." ]
train
https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BytesUtils.java#L265-L276
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java
SpiderSession.objectQuery
public QueryResult objectQuery(String tableName, String queryText, String fieldNames, int pageSize, String afterObjID, String sortOrder) { """ Perform an object query for the given table and query parameters. This is a convenience method for Spider applications that bundles the given parameters into a Map<String,String> and calls {@link #objectQuery(String, Map)}. String parameters should *not* be URL-encoded. Optional, unused parameters can be null or empty (for strings) or -1 (for integers). @param tableName Name of table to query. Must belong to this session's application. @param queryText Query expression ('q') parameter. Required. @param fieldNames Comma-separated field names to retrieve. Optional. @param pageSize Page size ('s'). Optional. @param afterObjID Continue-after continuation token ('g'). Optional. @param sortOrder Sort order parameter ('o'). Optional. @return Query results as a {@link QueryResult} object. """ Map<String, String> params = new HashMap<>(); if (!Utils.isEmpty(queryText)) { params.put("q", queryText); } if (!Utils.isEmpty(fieldNames)) { params.put("f", fieldNames); } if (pageSize >= 0) { params.put("s", Integer.toString(pageSize)); } if (!Utils.isEmpty(afterObjID)) { params.put("g", afterObjID); } if (!Utils.isEmpty(sortOrder)) { params.put("o", sortOrder); } return objectQuery(tableName, params); }
java
public QueryResult objectQuery(String tableName, String queryText, String fieldNames, int pageSize, String afterObjID, String sortOrder) { Map<String, String> params = new HashMap<>(); if (!Utils.isEmpty(queryText)) { params.put("q", queryText); } if (!Utils.isEmpty(fieldNames)) { params.put("f", fieldNames); } if (pageSize >= 0) { params.put("s", Integer.toString(pageSize)); } if (!Utils.isEmpty(afterObjID)) { params.put("g", afterObjID); } if (!Utils.isEmpty(sortOrder)) { params.put("o", sortOrder); } return objectQuery(tableName, params); }
[ "public", "QueryResult", "objectQuery", "(", "String", "tableName", ",", "String", "queryText", ",", "String", "fieldNames", ",", "int", "pageSize", ",", "String", "afterObjID", ",", "String", "sortOrder", ")", "{", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "HashMap", "<>", "(", ")", ";", "if", "(", "!", "Utils", ".", "isEmpty", "(", "queryText", ")", ")", "{", "params", ".", "put", "(", "\"q\"", ",", "queryText", ")", ";", "}", "if", "(", "!", "Utils", ".", "isEmpty", "(", "fieldNames", ")", ")", "{", "params", ".", "put", "(", "\"f\"", ",", "fieldNames", ")", ";", "}", "if", "(", "pageSize", ">=", "0", ")", "{", "params", ".", "put", "(", "\"s\"", ",", "Integer", ".", "toString", "(", "pageSize", ")", ")", ";", "}", "if", "(", "!", "Utils", ".", "isEmpty", "(", "afterObjID", ")", ")", "{", "params", ".", "put", "(", "\"g\"", ",", "afterObjID", ")", ";", "}", "if", "(", "!", "Utils", ".", "isEmpty", "(", "sortOrder", ")", ")", "{", "params", ".", "put", "(", "\"o\"", ",", "sortOrder", ")", ";", "}", "return", "objectQuery", "(", "tableName", ",", "params", ")", ";", "}" ]
Perform an object query for the given table and query parameters. This is a convenience method for Spider applications that bundles the given parameters into a Map<String,String> and calls {@link #objectQuery(String, Map)}. String parameters should *not* be URL-encoded. Optional, unused parameters can be null or empty (for strings) or -1 (for integers). @param tableName Name of table to query. Must belong to this session's application. @param queryText Query expression ('q') parameter. Required. @param fieldNames Comma-separated field names to retrieve. Optional. @param pageSize Page size ('s'). Optional. @param afterObjID Continue-after continuation token ('g'). Optional. @param sortOrder Sort order parameter ('o'). Optional. @return Query results as a {@link QueryResult} object.
[ "Perform", "an", "object", "query", "for", "the", "given", "table", "and", "query", "parameters", ".", "This", "is", "a", "convenience", "method", "for", "Spider", "applications", "that", "bundles", "the", "given", "parameters", "into", "a", "Map<String", "String", ">", "and", "calls", "{", "@link", "#objectQuery", "(", "String", "Map", ")", "}", ".", "String", "parameters", "should", "*", "not", "*", "be", "URL", "-", "encoded", ".", "Optional", "unused", "parameters", "can", "be", "null", "or", "empty", "(", "for", "strings", ")", "or", "-", "1", "(", "for", "integers", ")", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/SpiderSession.java#L506-L529
softindex/datakernel
cloud-fs/src/main/java/io/datakernel/remotefs/LocalFsClient.java
LocalFsClient.create
public static LocalFsClient create(Eventloop eventloop, Path storageDir, Object lock) { """ Use this to synchronize multiple LocalFsClient's over some filesystem space that they may all try to access (same storage folder, one storage is subfolder of another etc.) """ return new LocalFsClient(eventloop, storageDir, Executors.newSingleThreadExecutor(), lock); }
java
public static LocalFsClient create(Eventloop eventloop, Path storageDir, Object lock) { return new LocalFsClient(eventloop, storageDir, Executors.newSingleThreadExecutor(), lock); }
[ "public", "static", "LocalFsClient", "create", "(", "Eventloop", "eventloop", ",", "Path", "storageDir", ",", "Object", "lock", ")", "{", "return", "new", "LocalFsClient", "(", "eventloop", ",", "storageDir", ",", "Executors", ".", "newSingleThreadExecutor", "(", ")", ",", "lock", ")", ";", "}" ]
Use this to synchronize multiple LocalFsClient's over some filesystem space that they may all try to access (same storage folder, one storage is subfolder of another etc.)
[ "Use", "this", "to", "synchronize", "multiple", "LocalFsClient", "s", "over", "some", "filesystem", "space", "that", "they", "may", "all", "try", "to", "access", "(", "same", "storage", "folder", "one", "storage", "is", "subfolder", "of", "another", "etc", ".", ")" ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/cloud-fs/src/main/java/io/datakernel/remotefs/LocalFsClient.java#L168-L170
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.scale
public static void scale(Image srcImage, ImageOutputStream destImageStream, int width, int height, Color fixedColor) throws IORuntimeException { """ 缩放图像(按高度和宽度缩放)<br> 缩放后默认为jpeg格式,此方法并不关闭流 @param srcImage 源图像 @param destImageStream 缩放后的图像目标流 @param width 缩放后的宽度 @param height 缩放后的高度 @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code> @throws IORuntimeException IO异常 """ writeJpg(scale(srcImage, width, height, fixedColor), destImageStream); }
java
public static void scale(Image srcImage, ImageOutputStream destImageStream, int width, int height, Color fixedColor) throws IORuntimeException { writeJpg(scale(srcImage, width, height, fixedColor), destImageStream); }
[ "public", "static", "void", "scale", "(", "Image", "srcImage", ",", "ImageOutputStream", "destImageStream", ",", "int", "width", ",", "int", "height", ",", "Color", "fixedColor", ")", "throws", "IORuntimeException", "{", "writeJpg", "(", "scale", "(", "srcImage", ",", "width", ",", "height", ",", "fixedColor", ")", ",", "destImageStream", ")", ";", "}" ]
缩放图像(按高度和宽度缩放)<br> 缩放后默认为jpeg格式,此方法并不关闭流 @param srcImage 源图像 @param destImageStream 缩放后的图像目标流 @param width 缩放后的宽度 @param height 缩放后的高度 @param fixedColor 比例不对时补充的颜色,不补充为<code>null</code> @throws IORuntimeException IO异常
[ "缩放图像(按高度和宽度缩放)<br", ">", "缩放后默认为jpeg格式,此方法并不关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L229-L231
strator-dev/greenpepper
greenpepper-maven-plugin/src/main/java/com/greenpepper/maven/plugin/FixtureCompilerMojo.java
FixtureCompilerMojo.getSourceInclusionScanner
@SuppressWarnings("unchecked") protected SourceInclusionScanner getSourceInclusionScanner( int staleMillis ) { """ <p>getSourceInclusionScanner.</p> @param staleMillis a int. @return a {@link org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner} object. """ SourceInclusionScanner scanner; if ( testIncludes.isEmpty() && testExcludes.isEmpty() ) { scanner = new StaleSourceScanner( staleMillis ); } else { if ( testIncludes.isEmpty() ) { testIncludes.add( "**/*.java" ); } scanner = new StaleSourceScanner( staleMillis, testIncludes, testExcludes ); } return scanner; }
java
@SuppressWarnings("unchecked") protected SourceInclusionScanner getSourceInclusionScanner( int staleMillis ) { SourceInclusionScanner scanner; if ( testIncludes.isEmpty() && testExcludes.isEmpty() ) { scanner = new StaleSourceScanner( staleMillis ); } else { if ( testIncludes.isEmpty() ) { testIncludes.add( "**/*.java" ); } scanner = new StaleSourceScanner( staleMillis, testIncludes, testExcludes ); } return scanner; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "SourceInclusionScanner", "getSourceInclusionScanner", "(", "int", "staleMillis", ")", "{", "SourceInclusionScanner", "scanner", ";", "if", "(", "testIncludes", ".", "isEmpty", "(", ")", "&&", "testExcludes", ".", "isEmpty", "(", ")", ")", "{", "scanner", "=", "new", "StaleSourceScanner", "(", "staleMillis", ")", ";", "}", "else", "{", "if", "(", "testIncludes", ".", "isEmpty", "(", ")", ")", "{", "testIncludes", ".", "add", "(", "\"**/*.java\"", ")", ";", "}", "scanner", "=", "new", "StaleSourceScanner", "(", "staleMillis", ",", "testIncludes", ",", "testExcludes", ")", ";", "}", "return", "scanner", ";", "}" ]
<p>getSourceInclusionScanner.</p> @param staleMillis a int. @return a {@link org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner} object.
[ "<p", ">", "getSourceInclusionScanner", ".", "<", "/", "p", ">" ]
train
https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper-maven-plugin/src/main/java/com/greenpepper/maven/plugin/FixtureCompilerMojo.java#L144-L163
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java
ObjectReader.buildWhereClause
private String buildWhereClause(String[] pKeys, Hashtable pMapping) { """ Builds extra SQL WHERE clause @param keys An array of ID names @param mapping The hashtable containing the object mapping @return A string containing valid SQL """ StringBuilder sqlBuf = new StringBuilder(); for (int i = 0; i < pKeys.length; i++) { String column = (String) pMapping.get(pKeys[i]); sqlBuf.append(" AND "); sqlBuf.append(column); sqlBuf.append(" = ?"); } return sqlBuf.toString(); }
java
private String buildWhereClause(String[] pKeys, Hashtable pMapping) { StringBuilder sqlBuf = new StringBuilder(); for (int i = 0; i < pKeys.length; i++) { String column = (String) pMapping.get(pKeys[i]); sqlBuf.append(" AND "); sqlBuf.append(column); sqlBuf.append(" = ?"); } return sqlBuf.toString(); }
[ "private", "String", "buildWhereClause", "(", "String", "[", "]", "pKeys", ",", "Hashtable", "pMapping", ")", "{", "StringBuilder", "sqlBuf", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "pKeys", ".", "length", ";", "i", "++", ")", "{", "String", "column", "=", "(", "String", ")", "pMapping", ".", "get", "(", "pKeys", "[", "i", "]", ")", ";", "sqlBuf", ".", "append", "(", "\" AND \"", ")", ";", "sqlBuf", ".", "append", "(", "column", ")", ";", "sqlBuf", ".", "append", "(", "\" = ?\"", ")", ";", "}", "return", "sqlBuf", ".", "toString", "(", ")", ";", "}" ]
Builds extra SQL WHERE clause @param keys An array of ID names @param mapping The hashtable containing the object mapping @return A string containing valid SQL
[ "Builds", "extra", "SQL", "WHERE", "clause" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L524-L536
redkale/redkale
src/org/redkale/net/http/HttpRequest.java
HttpRequest.getIntHeader
public int getIntHeader(int radix, String name, int defaultValue) { """ 获取指定的header的int值, 没有返回默认int值 @param radix 进制数 @param name header名 @param defaultValue 默认int值 @return header值 """ return header.getIntValue(radix, name, defaultValue); }
java
public int getIntHeader(int radix, String name, int defaultValue) { return header.getIntValue(radix, name, defaultValue); }
[ "public", "int", "getIntHeader", "(", "int", "radix", ",", "String", "name", ",", "int", "defaultValue", ")", "{", "return", "header", ".", "getIntValue", "(", "radix", ",", "name", ",", "defaultValue", ")", ";", "}" ]
获取指定的header的int值, 没有返回默认int值 @param radix 进制数 @param name header名 @param defaultValue 默认int值 @return header值
[ "获取指定的header的int值", "没有返回默认int值" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L1132-L1134
aws/aws-sdk-java
aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java
WeeklyAutoScalingSchedule.withWednesday
public WeeklyAutoScalingSchedule withWednesday(java.util.Map<String, String> wednesday) { """ <p> The schedule for Wednesday. </p> @param wednesday The schedule for Wednesday. @return Returns a reference to this object so that method calls can be chained together. """ setWednesday(wednesday); return this; }
java
public WeeklyAutoScalingSchedule withWednesday(java.util.Map<String, String> wednesday) { setWednesday(wednesday); return this; }
[ "public", "WeeklyAutoScalingSchedule", "withWednesday", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "wednesday", ")", "{", "setWednesday", "(", "wednesday", ")", ";", "return", "this", ";", "}" ]
<p> The schedule for Wednesday. </p> @param wednesday The schedule for Wednesday. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "schedule", "for", "Wednesday", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java#L265-L268
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/PersistenceDelegator.java
PersistenceDelegator.createQuery
Query createQuery(String jpaQuery, final String persistenceUnit) { """ Creates the query. @param jpaQuery the jpa query @return the query """ Client client = getClient(persistenceUnit); EntityMetadata metadata = null; try { metadata = KunderaMetadataManager.getMetamodel(kunderaMetadata, client.getPersistenceUnit()) .getEntityMetadataMap().values().iterator().next(); } catch (Exception e) { log.info("Entity metadata is null. Proceeding as Scalar Query."); } Query query = new QueryResolver().getQueryImplementation(jpaQuery, getClient(persistenceUnit) .getQueryImplementor(), this, metadata, persistenceUnit); return query; }
java
Query createQuery(String jpaQuery, final String persistenceUnit) { Client client = getClient(persistenceUnit); EntityMetadata metadata = null; try { metadata = KunderaMetadataManager.getMetamodel(kunderaMetadata, client.getPersistenceUnit()) .getEntityMetadataMap().values().iterator().next(); } catch (Exception e) { log.info("Entity metadata is null. Proceeding as Scalar Query."); } Query query = new QueryResolver().getQueryImplementation(jpaQuery, getClient(persistenceUnit) .getQueryImplementor(), this, metadata, persistenceUnit); return query; }
[ "Query", "createQuery", "(", "String", "jpaQuery", ",", "final", "String", "persistenceUnit", ")", "{", "Client", "client", "=", "getClient", "(", "persistenceUnit", ")", ";", "EntityMetadata", "metadata", "=", "null", ";", "try", "{", "metadata", "=", "KunderaMetadataManager", ".", "getMetamodel", "(", "kunderaMetadata", ",", "client", ".", "getPersistenceUnit", "(", ")", ")", ".", "getEntityMetadataMap", "(", ")", ".", "values", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "info", "(", "\"Entity metadata is null. Proceeding as Scalar Query.\"", ")", ";", "}", "Query", "query", "=", "new", "QueryResolver", "(", ")", ".", "getQueryImplementation", "(", "jpaQuery", ",", "getClient", "(", "persistenceUnit", ")", ".", "getQueryImplementor", "(", ")", ",", "this", ",", "metadata", ",", "persistenceUnit", ")", ";", "return", "query", ";", "}" ]
Creates the query. @param jpaQuery the jpa query @return the query
[ "Creates", "the", "query", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/PersistenceDelegator.java#L531-L548
Javacord/Javacord
javacord-api/src/main/java/org/javacord/api/AccountUpdater.java
AccountUpdater.setAvatar
public AccountUpdater setAvatar(InputStream avatar, String fileType) { """ Queues the avatar of the connected account to get updated. @param avatar The avatar to set. @param fileType The type of the avatar, e.g. "png" or "jpg". @return The current instance in order to chain call methods. """ delegate.setAvatar(avatar, fileType); return this; }
java
public AccountUpdater setAvatar(InputStream avatar, String fileType) { delegate.setAvatar(avatar, fileType); return this; }
[ "public", "AccountUpdater", "setAvatar", "(", "InputStream", "avatar", ",", "String", "fileType", ")", "{", "delegate", ".", "setAvatar", "(", "avatar", ",", "fileType", ")", ";", "return", "this", ";", "}" ]
Queues the avatar of the connected account to get updated. @param avatar The avatar to set. @param fileType The type of the avatar, e.g. "png" or "jpg". @return The current instance in order to chain call methods.
[ "Queues", "the", "avatar", "of", "the", "connected", "account", "to", "get", "updated", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-api/src/main/java/org/javacord/api/AccountUpdater.java#L143-L146
drewwills/cernunnos
cernunnos-core/src/main/java/org/danann/cernunnos/CurrentDirectoryUrlPhrase.java
CurrentDirectoryUrlPhrase.evaluate
public Object evaluate(TaskRequest req, TaskResponse res) { """ Always returns a <code>URL</code> representation of the filesystem directory from which Java is executing. @param req Representations the input to the current task. @param res Representations the output of the current task. @return The final, actual value of this <code>Phrase</code>. """ String rslt = null; try { rslt = new File(".").toURI().toURL().toExternalForm(); } catch (Throwable t) { String msg = "Unable to represent the current directory as a URL."; throw new RuntimeException(msg, t); } return rslt; }
java
public Object evaluate(TaskRequest req, TaskResponse res) { String rslt = null; try { rslt = new File(".").toURI().toURL().toExternalForm(); } catch (Throwable t) { String msg = "Unable to represent the current directory as a URL."; throw new RuntimeException(msg, t); } return rslt; }
[ "public", "Object", "evaluate", "(", "TaskRequest", "req", ",", "TaskResponse", "res", ")", "{", "String", "rslt", "=", "null", ";", "try", "{", "rslt", "=", "new", "File", "(", "\".\"", ")", ".", "toURI", "(", ")", ".", "toURL", "(", ")", ".", "toExternalForm", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "String", "msg", "=", "\"Unable to represent the current directory as a URL.\"", ";", "throw", "new", "RuntimeException", "(", "msg", ",", "t", ")", ";", "}", "return", "rslt", ";", "}" ]
Always returns a <code>URL</code> representation of the filesystem directory from which Java is executing. @param req Representations the input to the current task. @param res Representations the output of the current task. @return The final, actual value of this <code>Phrase</code>.
[ "Always", "returns", "a", "<code", ">", "URL<", "/", "code", ">", "representation", "of", "the", "filesystem", "directory", "from", "which", "Java", "is", "executing", "." ]
train
https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/CurrentDirectoryUrlPhrase.java#L51-L60
jsonld-java/jsonld-java
core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java
JsonUtils.fromInputStream
public static Object fromInputStream(InputStream input, String enc) throws IOException { """ Parses a JSON-LD document from the given {@link InputStream} to an object that can be used as input for the {@link JsonLdApi} and {@link JsonLdProcessor} methods. @param input The JSON-LD document in an InputStream. @param enc The character encoding to use when interpreting the characters in the InputStream. @return A JSON Object. @throws JsonParseException If there was a JSON related error during parsing. @throws IOException If there was an IO error during parsing. """ return fromInputStream(input, Charset.forName(enc)); }
java
public static Object fromInputStream(InputStream input, String enc) throws IOException { return fromInputStream(input, Charset.forName(enc)); }
[ "public", "static", "Object", "fromInputStream", "(", "InputStream", "input", ",", "String", "enc", ")", "throws", "IOException", "{", "return", "fromInputStream", "(", "input", ",", "Charset", ".", "forName", "(", "enc", ")", ")", ";", "}" ]
Parses a JSON-LD document from the given {@link InputStream} to an object that can be used as input for the {@link JsonLdApi} and {@link JsonLdProcessor} methods. @param input The JSON-LD document in an InputStream. @param enc The character encoding to use when interpreting the characters in the InputStream. @return A JSON Object. @throws JsonParseException If there was a JSON related error during parsing. @throws IOException If there was an IO error during parsing.
[ "Parses", "a", "JSON", "-", "LD", "document", "from", "the", "given", "{", "@link", "InputStream", "}", "to", "an", "object", "that", "can", "be", "used", "as", "input", "for", "the", "{", "@link", "JsonLdApi", "}", "and", "{", "@link", "JsonLdProcessor", "}", "methods", "." ]
train
https://github.com/jsonld-java/jsonld-java/blob/efeef6ee96029a0011649633457035fa6be42da1/core/src/main/java/com/github/jsonldjava/utils/JsonUtils.java#L131-L133
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/core/PGStream.java
PGStream.receive
public void receive(byte[] buf, int off, int siz) throws IOException { """ Reads in a given number of bytes from the backend. @param buf buffer to store result @param off offset in buffer @param siz number of bytes to read @throws IOException if a data I/O error occurs """ int s = 0; while (s < siz) { int w = pgInput.read(buf, off + s, siz - s); if (w < 0) { throw new EOFException(); } s += w; } }
java
public void receive(byte[] buf, int off, int siz) throws IOException { int s = 0; while (s < siz) { int w = pgInput.read(buf, off + s, siz - s); if (w < 0) { throw new EOFException(); } s += w; } }
[ "public", "void", "receive", "(", "byte", "[", "]", "buf", ",", "int", "off", ",", "int", "siz", ")", "throws", "IOException", "{", "int", "s", "=", "0", ";", "while", "(", "s", "<", "siz", ")", "{", "int", "w", "=", "pgInput", ".", "read", "(", "buf", ",", "off", "+", "s", ",", "siz", "-", "s", ")", ";", "if", "(", "w", "<", "0", ")", "{", "throw", "new", "EOFException", "(", ")", ";", "}", "s", "+=", "w", ";", "}", "}" ]
Reads in a given number of bytes from the backend. @param buf buffer to store result @param off offset in buffer @param siz number of bytes to read @throws IOException if a data I/O error occurs
[ "Reads", "in", "a", "given", "number", "of", "bytes", "from", "the", "backend", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/PGStream.java#L473-L483
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/SetOptions.java
SetOptions.mergeFields
@Nonnull public static SetOptions mergeFields(List<String> fields) { """ Changes the behavior of set() calls to only replace the fields under fieldPaths. Any field that is not specified in fieldPaths is ignored and remains untouched. <p>It is an error to pass a SetOptions object to a set() call that is missing a value for any of the fields specified here. @param fields The list of fields to merge. Fields can contain dots to reference nested fields within the document. """ List<FieldPath> fieldPaths = new ArrayList<>(); for (String field : fields) { fieldPaths.add(FieldPath.fromDotSeparatedString(field)); } return new SetOptions(true, fieldPaths); }
java
@Nonnull public static SetOptions mergeFields(List<String> fields) { List<FieldPath> fieldPaths = new ArrayList<>(); for (String field : fields) { fieldPaths.add(FieldPath.fromDotSeparatedString(field)); } return new SetOptions(true, fieldPaths); }
[ "@", "Nonnull", "public", "static", "SetOptions", "mergeFields", "(", "List", "<", "String", ">", "fields", ")", "{", "List", "<", "FieldPath", ">", "fieldPaths", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "String", "field", ":", "fields", ")", "{", "fieldPaths", ".", "add", "(", "FieldPath", ".", "fromDotSeparatedString", "(", "field", ")", ")", ";", "}", "return", "new", "SetOptions", "(", "true", ",", "fieldPaths", ")", ";", "}" ]
Changes the behavior of set() calls to only replace the fields under fieldPaths. Any field that is not specified in fieldPaths is ignored and remains untouched. <p>It is an error to pass a SetOptions object to a set() call that is missing a value for any of the fields specified here. @param fields The list of fields to merge. Fields can contain dots to reference nested fields within the document.
[ "Changes", "the", "behavior", "of", "set", "()", "calls", "to", "only", "replace", "the", "fields", "under", "fieldPaths", ".", "Any", "field", "that", "is", "not", "specified", "in", "fieldPaths", "is", "ignored", "and", "remains", "untouched", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/SetOptions.java#L76-L85
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/search/queries/DateRangeQuery.java
DateRangeQuery.start
public DateRangeQuery start(Date start, boolean inclusive) { """ Sets the lower boundary of the range, inclusive or not depending on the second parameter. Works with a {@link Date} object, which is converted to RFC 3339 format using {@link SearchUtils#toFtsUtcString(Date)}, so you shouldn't use a non-default {@link #dateTimeParser(String)} after that. """ this.start = SearchUtils.toFtsUtcString(start); this.inclusiveStart = inclusive; return this; }
java
public DateRangeQuery start(Date start, boolean inclusive) { this.start = SearchUtils.toFtsUtcString(start); this.inclusiveStart = inclusive; return this; }
[ "public", "DateRangeQuery", "start", "(", "Date", "start", ",", "boolean", "inclusive", ")", "{", "this", ".", "start", "=", "SearchUtils", ".", "toFtsUtcString", "(", "start", ")", ";", "this", ".", "inclusiveStart", "=", "inclusive", ";", "return", "this", ";", "}" ]
Sets the lower boundary of the range, inclusive or not depending on the second parameter. Works with a {@link Date} object, which is converted to RFC 3339 format using {@link SearchUtils#toFtsUtcString(Date)}, so you shouldn't use a non-default {@link #dateTimeParser(String)} after that.
[ "Sets", "the", "lower", "boundary", "of", "the", "range", "inclusive", "or", "not", "depending", "on", "the", "second", "parameter", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/search/queries/DateRangeQuery.java#L96-L100
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/LinearEquationSystem.java
LinearEquationSystem.equationsToString
public String equationsToString(String prefix, int fractionDigits) { """ Returns a string representation of this equation system. @param prefix the prefix of each line @param fractionDigits the number of fraction digits for output accuracy @return a string representation of this equation system """ DecimalFormat nf = new DecimalFormat(); nf.setMinimumFractionDigits(fractionDigits); nf.setMaximumFractionDigits(fractionDigits); nf.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US)); nf.setNegativePrefix(""); nf.setPositivePrefix(""); return equationsToString(prefix, nf); }
java
public String equationsToString(String prefix, int fractionDigits) { DecimalFormat nf = new DecimalFormat(); nf.setMinimumFractionDigits(fractionDigits); nf.setMaximumFractionDigits(fractionDigits); nf.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US)); nf.setNegativePrefix(""); nf.setPositivePrefix(""); return equationsToString(prefix, nf); }
[ "public", "String", "equationsToString", "(", "String", "prefix", ",", "int", "fractionDigits", ")", "{", "DecimalFormat", "nf", "=", "new", "DecimalFormat", "(", ")", ";", "nf", ".", "setMinimumFractionDigits", "(", "fractionDigits", ")", ";", "nf", ".", "setMaximumFractionDigits", "(", "fractionDigits", ")", ";", "nf", ".", "setDecimalFormatSymbols", "(", "new", "DecimalFormatSymbols", "(", "Locale", ".", "US", ")", ")", ";", "nf", ".", "setNegativePrefix", "(", "\"\"", ")", ";", "nf", ".", "setPositivePrefix", "(", "\"\"", ")", ";", "return", "equationsToString", "(", "prefix", ",", "nf", ")", ";", "}" ]
Returns a string representation of this equation system. @param prefix the prefix of each line @param fractionDigits the number of fraction digits for output accuracy @return a string representation of this equation system
[ "Returns", "a", "string", "representation", "of", "this", "equation", "system", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/LinearEquationSystem.java#L275-L283
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/workspace/WorkspaceUtils.java
WorkspaceUtils.assertNoWorkspacesOpen
public static void assertNoWorkspacesOpen(String msg, boolean allowScopedOut) throws ND4JWorkspaceException { """ Assert that no workspaces are currently open @param msg Message to include in the exception, if required @param allowScopedOut If true: don't fail if we have an open workspace but are currently scoped out """ if (Nd4j.getWorkspaceManager().anyWorkspaceActiveForCurrentThread()) { MemoryWorkspace currWs = Nd4j.getMemoryManager().getCurrentWorkspace(); if(allowScopedOut && (currWs == null || currWs instanceof DummyWorkspace)) return; //Open WS but we've scoped out List<MemoryWorkspace> l = Nd4j.getWorkspaceManager().getAllWorkspacesForCurrentThread(); List<String> workspaces = new ArrayList<>(l.size()); for (MemoryWorkspace ws : l) { if(ws.isScopeActive()) { workspaces.add(ws.getId()); } } throw new ND4JWorkspaceException(msg + " - Open/active workspaces: " + workspaces); } }
java
public static void assertNoWorkspacesOpen(String msg, boolean allowScopedOut) throws ND4JWorkspaceException { if (Nd4j.getWorkspaceManager().anyWorkspaceActiveForCurrentThread()) { MemoryWorkspace currWs = Nd4j.getMemoryManager().getCurrentWorkspace(); if(allowScopedOut && (currWs == null || currWs instanceof DummyWorkspace)) return; //Open WS but we've scoped out List<MemoryWorkspace> l = Nd4j.getWorkspaceManager().getAllWorkspacesForCurrentThread(); List<String> workspaces = new ArrayList<>(l.size()); for (MemoryWorkspace ws : l) { if(ws.isScopeActive()) { workspaces.add(ws.getId()); } } throw new ND4JWorkspaceException(msg + " - Open/active workspaces: " + workspaces); } }
[ "public", "static", "void", "assertNoWorkspacesOpen", "(", "String", "msg", ",", "boolean", "allowScopedOut", ")", "throws", "ND4JWorkspaceException", "{", "if", "(", "Nd4j", ".", "getWorkspaceManager", "(", ")", ".", "anyWorkspaceActiveForCurrentThread", "(", ")", ")", "{", "MemoryWorkspace", "currWs", "=", "Nd4j", ".", "getMemoryManager", "(", ")", ".", "getCurrentWorkspace", "(", ")", ";", "if", "(", "allowScopedOut", "&&", "(", "currWs", "==", "null", "||", "currWs", "instanceof", "DummyWorkspace", ")", ")", "return", ";", "//Open WS but we've scoped out", "List", "<", "MemoryWorkspace", ">", "l", "=", "Nd4j", ".", "getWorkspaceManager", "(", ")", ".", "getAllWorkspacesForCurrentThread", "(", ")", ";", "List", "<", "String", ">", "workspaces", "=", "new", "ArrayList", "<>", "(", "l", ".", "size", "(", ")", ")", ";", "for", "(", "MemoryWorkspace", "ws", ":", "l", ")", "{", "if", "(", "ws", ".", "isScopeActive", "(", ")", ")", "{", "workspaces", ".", "add", "(", "ws", ".", "getId", "(", ")", ")", ";", "}", "}", "throw", "new", "ND4JWorkspaceException", "(", "msg", "+", "\" - Open/active workspaces: \"", "+", "workspaces", ")", ";", "}", "}" ]
Assert that no workspaces are currently open @param msg Message to include in the exception, if required @param allowScopedOut If true: don't fail if we have an open workspace but are currently scoped out
[ "Assert", "that", "no", "workspaces", "are", "currently", "open" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/workspace/WorkspaceUtils.java#L56-L72
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java
NumberUtil.toStr
public static String toStr(Number number, String defaultValue) { """ 数字转字符串<br> 调用{@link Number#toString()},并去除尾小数点儿后多余的0 @param number A Number @param defaultValue 如果number参数为{@code null},返回此默认值 @return A String. @since 3.0.9 """ return (null == number) ? defaultValue : toStr(number); }
java
public static String toStr(Number number, String defaultValue) { return (null == number) ? defaultValue : toStr(number); }
[ "public", "static", "String", "toStr", "(", "Number", "number", ",", "String", "defaultValue", ")", "{", "return", "(", "null", "==", "number", ")", "?", "defaultValue", ":", "toStr", "(", "number", ")", ";", "}" ]
数字转字符串<br> 调用{@link Number#toString()},并去除尾小数点儿后多余的0 @param number A Number @param defaultValue 如果number参数为{@code null},返回此默认值 @return A String. @since 3.0.9
[ "数字转字符串<br", ">", "调用", "{", "@link", "Number#toString", "()", "}", ",并去除尾小数点儿后多余的0" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L1856-L1858
snowtide/lucene-pdf
src/java/com/snowtide/pdf/lucene/LucenePDFConfiguration.java
LucenePDFConfiguration.setBodyTextSettings
public void setBodyTextSettings (boolean store, boolean index, boolean token) { """ Sets Field attributes that will be used when creating the Field object for the main text content of a PDF document. These attributes correspond to the <code>store</code>, <code>index</code>, and <code>token</code> parameters of the {@link org.apache.lucene.document.Field} constructor before Lucene v4.x and the same-named attributes of {@link org.apache.lucene.document.FieldType} afterwards. """ indexBodyText = index; storeBodyText = store; tokenizeBodyText = token; }
java
public void setBodyTextSettings (boolean store, boolean index, boolean token) { indexBodyText = index; storeBodyText = store; tokenizeBodyText = token; }
[ "public", "void", "setBodyTextSettings", "(", "boolean", "store", ",", "boolean", "index", ",", "boolean", "token", ")", "{", "indexBodyText", "=", "index", ";", "storeBodyText", "=", "store", ";", "tokenizeBodyText", "=", "token", ";", "}" ]
Sets Field attributes that will be used when creating the Field object for the main text content of a PDF document. These attributes correspond to the <code>store</code>, <code>index</code>, and <code>token</code> parameters of the {@link org.apache.lucene.document.Field} constructor before Lucene v4.x and the same-named attributes of {@link org.apache.lucene.document.FieldType} afterwards.
[ "Sets", "Field", "attributes", "that", "will", "be", "used", "when", "creating", "the", "Field", "object", "for", "the", "main", "text", "content", "of", "a", "PDF", "document", ".", "These", "attributes", "correspond", "to", "the", "<code", ">", "store<", "/", "code", ">", "<code", ">", "index<", "/", "code", ">", "and", "<code", ">", "token<", "/", "code", ">", "parameters", "of", "the", "{" ]
train
https://github.com/snowtide/lucene-pdf/blob/1d97a877912bcfb354d3e8bff8275c92397db133/src/java/com/snowtide/pdf/lucene/LucenePDFConfiguration.java#L123-L127
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelUtilsBase.java
ChannelUtilsBase.traceChains
protected final void traceChains(Object logTool, ChannelFramework cfw, Class<?> factory, String message, String prefix) { """ Display configured channel chains. @param logTool Caller's LogTool (should be Logger OR TraceComponent) @param cfw Reference to channel framework service @param factory Factory class that chains to be traced are associated with (e.g. ORBInboundChannelFactory.. ) @param message Description to accompany trace, e.g. "CFW Channel Configuration" @param prefix Component-type prefix used to associate traces together, e.g. "XMEM", "ZIOP", "TCP", "SOAP" """ ChainData[] chains = null; String fstring = "(" + (factory == null ? "no factory specified" : factory.getName()) + ")"; if (cfw == null) { debugTrace(logTool, prefix + " - No cfw to test factory " + fstring); return; } try { if (factory != null) chains = cfw.getAllChains(factory); else chains = cfw.getAllChains(); } catch (Exception e) { debugTrace(logTool, "Caught Exception while trying to display configured chains: ", e); return; } if (chains == null || chains.length <= 0) debugTrace(logTool, prefix + " - No chains found for factory " + fstring); else traceChains(logTool, Arrays.asList(chains), message, prefix); }
java
protected final void traceChains(Object logTool, ChannelFramework cfw, Class<?> factory, String message, String prefix) { ChainData[] chains = null; String fstring = "(" + (factory == null ? "no factory specified" : factory.getName()) + ")"; if (cfw == null) { debugTrace(logTool, prefix + " - No cfw to test factory " + fstring); return; } try { if (factory != null) chains = cfw.getAllChains(factory); else chains = cfw.getAllChains(); } catch (Exception e) { debugTrace(logTool, "Caught Exception while trying to display configured chains: ", e); return; } if (chains == null || chains.length <= 0) debugTrace(logTool, prefix + " - No chains found for factory " + fstring); else traceChains(logTool, Arrays.asList(chains), message, prefix); }
[ "protected", "final", "void", "traceChains", "(", "Object", "logTool", ",", "ChannelFramework", "cfw", ",", "Class", "<", "?", ">", "factory", ",", "String", "message", ",", "String", "prefix", ")", "{", "ChainData", "[", "]", "chains", "=", "null", ";", "String", "fstring", "=", "\"(\"", "+", "(", "factory", "==", "null", "?", "\"no factory specified\"", ":", "factory", ".", "getName", "(", ")", ")", "+", "\")\"", ";", "if", "(", "cfw", "==", "null", ")", "{", "debugTrace", "(", "logTool", ",", "prefix", "+", "\" - No cfw to test factory \"", "+", "fstring", ")", ";", "return", ";", "}", "try", "{", "if", "(", "factory", "!=", "null", ")", "chains", "=", "cfw", ".", "getAllChains", "(", "factory", ")", ";", "else", "chains", "=", "cfw", ".", "getAllChains", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "debugTrace", "(", "logTool", ",", "\"Caught Exception while trying to display configured chains: \"", ",", "e", ")", ";", "return", ";", "}", "if", "(", "chains", "==", "null", "||", "chains", ".", "length", "<=", "0", ")", "debugTrace", "(", "logTool", ",", "prefix", "+", "\" - No chains found for factory \"", "+", "fstring", ")", ";", "else", "traceChains", "(", "logTool", ",", "Arrays", ".", "asList", "(", "chains", ")", ",", "message", ",", "prefix", ")", ";", "}" ]
Display configured channel chains. @param logTool Caller's LogTool (should be Logger OR TraceComponent) @param cfw Reference to channel framework service @param factory Factory class that chains to be traced are associated with (e.g. ORBInboundChannelFactory.. ) @param message Description to accompany trace, e.g. "CFW Channel Configuration" @param prefix Component-type prefix used to associate traces together, e.g. "XMEM", "ZIOP", "TCP", "SOAP"
[ "Display", "configured", "channel", "chains", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/ChannelUtilsBase.java#L62-L85
GumTreeDiff/gumtree
core/src/main/java/com/github/gumtreediff/matchers/optimal/rted/RtedAlgorithm.java
RtedAlgorithm.spfR
private double spfR(InfoTree it1, InfoTree it2) { """ Single-path function for right-most path based on symmetric version of Zhang and Shasha algorithm. @param it1 @param it2 @return distance between subtrees it1 and it2 """ int fReversedPostorder = it1.getSize() - 1 - it1.info[POST2_PRE][it1.getCurrentNode()]; int gReversedPostorder = it2.getSize() - 1 - it2.info[POST2_PRE][it2.getCurrentNode()]; int minRKR = it2.info[RPOST2_MIN_RKR][gReversedPostorder]; int[] rkr = it2.info[RKR]; if (minRKR > -1) for (int j = minRKR; rkr[j] < gReversedPostorder; j++) treeEditDistRev(it1, it2, fReversedPostorder, rkr[j]); treeEditDistRev(it1, it2, fReversedPostorder, gReversedPostorder); return it1.isSwitched() ? delta[it2.getCurrentNode()][it1 .getCurrentNode()] + deltaBit[it2.getCurrentNode()][it1.getCurrentNode()] * costMatch : delta[it1.getCurrentNode()][it2.getCurrentNode()] + deltaBit[it1.getCurrentNode()][it2.getCurrentNode()] * costMatch; }
java
private double spfR(InfoTree it1, InfoTree it2) { int fReversedPostorder = it1.getSize() - 1 - it1.info[POST2_PRE][it1.getCurrentNode()]; int gReversedPostorder = it2.getSize() - 1 - it2.info[POST2_PRE][it2.getCurrentNode()]; int minRKR = it2.info[RPOST2_MIN_RKR][gReversedPostorder]; int[] rkr = it2.info[RKR]; if (minRKR > -1) for (int j = minRKR; rkr[j] < gReversedPostorder; j++) treeEditDistRev(it1, it2, fReversedPostorder, rkr[j]); treeEditDistRev(it1, it2, fReversedPostorder, gReversedPostorder); return it1.isSwitched() ? delta[it2.getCurrentNode()][it1 .getCurrentNode()] + deltaBit[it2.getCurrentNode()][it1.getCurrentNode()] * costMatch : delta[it1.getCurrentNode()][it2.getCurrentNode()] + deltaBit[it1.getCurrentNode()][it2.getCurrentNode()] * costMatch; }
[ "private", "double", "spfR", "(", "InfoTree", "it1", ",", "InfoTree", "it2", ")", "{", "int", "fReversedPostorder", "=", "it1", ".", "getSize", "(", ")", "-", "1", "-", "it1", ".", "info", "[", "POST2_PRE", "]", "[", "it1", ".", "getCurrentNode", "(", ")", "]", ";", "int", "gReversedPostorder", "=", "it2", ".", "getSize", "(", ")", "-", "1", "-", "it2", ".", "info", "[", "POST2_PRE", "]", "[", "it2", ".", "getCurrentNode", "(", ")", "]", ";", "int", "minRKR", "=", "it2", ".", "info", "[", "RPOST2_MIN_RKR", "]", "[", "gReversedPostorder", "]", ";", "int", "[", "]", "rkr", "=", "it2", ".", "info", "[", "RKR", "]", ";", "if", "(", "minRKR", ">", "-", "1", ")", "for", "(", "int", "j", "=", "minRKR", ";", "rkr", "[", "j", "]", "<", "gReversedPostorder", ";", "j", "++", ")", "treeEditDistRev", "(", "it1", ",", "it2", ",", "fReversedPostorder", ",", "rkr", "[", "j", "]", ")", ";", "treeEditDistRev", "(", "it1", ",", "it2", ",", "fReversedPostorder", ",", "gReversedPostorder", ")", ";", "return", "it1", ".", "isSwitched", "(", ")", "?", "delta", "[", "it2", ".", "getCurrentNode", "(", ")", "]", "[", "it1", ".", "getCurrentNode", "(", ")", "]", "+", "deltaBit", "[", "it2", ".", "getCurrentNode", "(", ")", "]", "[", "it1", ".", "getCurrentNode", "(", ")", "]", "*", "costMatch", ":", "delta", "[", "it1", ".", "getCurrentNode", "(", ")", "]", "[", "it2", ".", "getCurrentNode", "(", ")", "]", "+", "deltaBit", "[", "it1", ".", "getCurrentNode", "(", ")", "]", "[", "it2", ".", "getCurrentNode", "(", ")", "]", "*", "costMatch", ";", "}" ]
Single-path function for right-most path based on symmetric version of Zhang and Shasha algorithm. @param it1 @param it2 @return distance between subtrees it1 and it2
[ "Single", "-", "path", "function", "for", "right", "-", "most", "path", "based", "on", "symmetric", "version", "of", "Zhang", "and", "Shasha", "algorithm", "." ]
train
https://github.com/GumTreeDiff/gumtree/blob/a772d4d652af44bff22c38a234ddffbfbd365a37/core/src/main/java/com/github/gumtreediff/matchers/optimal/rted/RtedAlgorithm.java#L494-L510
RestComm/media-core
rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpHandler.java
RtcpHandler.scheduleRtcp
private void scheduleRtcp(long timestamp, RtcpPacketType packetType) { """ Schedules an event to occur at a certain time. @param timestamp The time (in milliseconds) when the event should be fired @param packet The RTCP packet to be sent when the timer expires """ // Create the task and schedule it long interval = resolveInterval(timestamp); this.scheduledTask = new TxTask(packetType); try { this.reportTaskFuture = this.scheduler.schedule(this.scheduledTask, interval, TimeUnit.MILLISECONDS); // Let the RTP handler know what is the type of scheduled packet this.statistics.setRtcpPacketType(packetType); } catch (IllegalStateException e) { logger.warn("RTCP timer already canceled. No more reports will be scheduled."); } }
java
private void scheduleRtcp(long timestamp, RtcpPacketType packetType) { // Create the task and schedule it long interval = resolveInterval(timestamp); this.scheduledTask = new TxTask(packetType); try { this.reportTaskFuture = this.scheduler.schedule(this.scheduledTask, interval, TimeUnit.MILLISECONDS); // Let the RTP handler know what is the type of scheduled packet this.statistics.setRtcpPacketType(packetType); } catch (IllegalStateException e) { logger.warn("RTCP timer already canceled. No more reports will be scheduled."); } }
[ "private", "void", "scheduleRtcp", "(", "long", "timestamp", ",", "RtcpPacketType", "packetType", ")", "{", "// Create the task and schedule it", "long", "interval", "=", "resolveInterval", "(", "timestamp", ")", ";", "this", ".", "scheduledTask", "=", "new", "TxTask", "(", "packetType", ")", ";", "try", "{", "this", ".", "reportTaskFuture", "=", "this", ".", "scheduler", ".", "schedule", "(", "this", ".", "scheduledTask", ",", "interval", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "// Let the RTP handler know what is the type of scheduled packet", "this", ".", "statistics", ".", "setRtcpPacketType", "(", "packetType", ")", ";", "}", "catch", "(", "IllegalStateException", "e", ")", "{", "logger", ".", "warn", "(", "\"RTCP timer already canceled. No more reports will be scheduled.\"", ")", ";", "}", "}" ]
Schedules an event to occur at a certain time. @param timestamp The time (in milliseconds) when the event should be fired @param packet The RTCP packet to be sent when the timer expires
[ "Schedules", "an", "event", "to", "occur", "at", "a", "certain", "time", "." ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtcp/RtcpHandler.java#L225-L237
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractQueryImpl.java
AbstractQueryImpl.bindValue
public void bindValue(InternalQName varName, Value value) throws IllegalArgumentException, RepositoryException { """ Binds the given <code>value</code> to the variable named <code>varName</code>. @param varName name of variable in query @param value value to bind @throws IllegalArgumentException if <code>varName</code> is not a valid variable in this query. @throws RepositoryException if an error occurs. """ if (!variableNames.contains(varName)) { throw new IllegalArgumentException("not a valid variable in this query"); } else { bindValues.put(varName, value); } }
java
public void bindValue(InternalQName varName, Value value) throws IllegalArgumentException, RepositoryException { if (!variableNames.contains(varName)) { throw new IllegalArgumentException("not a valid variable in this query"); } else { bindValues.put(varName, value); } }
[ "public", "void", "bindValue", "(", "InternalQName", "varName", ",", "Value", "value", ")", "throws", "IllegalArgumentException", ",", "RepositoryException", "{", "if", "(", "!", "variableNames", ".", "contains", "(", "varName", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"not a valid variable in this query\"", ")", ";", "}", "else", "{", "bindValues", ".", "put", "(", "varName", ",", "value", ")", ";", "}", "}" ]
Binds the given <code>value</code> to the variable named <code>varName</code>. @param varName name of variable in query @param value value to bind @throws IllegalArgumentException if <code>varName</code> is not a valid variable in this query. @throws RepositoryException if an error occurs.
[ "Binds", "the", "given", "<code", ">", "value<", "/", "code", ">", "to", "the", "variable", "named", "<code", ">", "varName<", "/", "code", ">", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractQueryImpl.java#L153-L163
sailthru/sailthru-java-client
src/main/com/sailthru/client/SailthruClient.java
SailthruClient.getTemplate
public JsonResponse getTemplate(String template) throws IOException { """ Get template information @param template template name @throws IOException """ Map<String, Object> data = new HashMap<String, Object>(); data.put(Template.PARAM_TEMPLATE, template); return apiGet(ApiAction.template, data); }
java
public JsonResponse getTemplate(String template) throws IOException { Map<String, Object> data = new HashMap<String, Object>(); data.put(Template.PARAM_TEMPLATE, template); return apiGet(ApiAction.template, data); }
[ "public", "JsonResponse", "getTemplate", "(", "String", "template", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "Object", ">", "data", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "data", ".", "put", "(", "Template", ".", "PARAM_TEMPLATE", ",", "template", ")", ";", "return", "apiGet", "(", "ApiAction", ".", "template", ",", "data", ")", ";", "}" ]
Get template information @param template template name @throws IOException
[ "Get", "template", "information" ]
train
https://github.com/sailthru/sailthru-java-client/blob/62b491f6a39b41b836bfc021779200d29b6d2069/src/main/com/sailthru/client/SailthruClient.java#L281-L285
UrielCh/ovh-java-sdk
ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java
ApiOvhVrack.serviceName_dedicatedServer_dedicatedServer_GET
public OvhDedicatedServer serviceName_dedicatedServer_dedicatedServer_GET(String serviceName, String dedicatedServer) throws IOException { """ Get this object properties REST: GET /vrack/{serviceName}/dedicatedServer/{dedicatedServer} @param serviceName [required] The internal name of your vrack @param dedicatedServer [required] Dedicated Server """ String qPath = "/vrack/{serviceName}/dedicatedServer/{dedicatedServer}"; StringBuilder sb = path(qPath, serviceName, dedicatedServer); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDedicatedServer.class); }
java
public OvhDedicatedServer serviceName_dedicatedServer_dedicatedServer_GET(String serviceName, String dedicatedServer) throws IOException { String qPath = "/vrack/{serviceName}/dedicatedServer/{dedicatedServer}"; StringBuilder sb = path(qPath, serviceName, dedicatedServer); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDedicatedServer.class); }
[ "public", "OvhDedicatedServer", "serviceName_dedicatedServer_dedicatedServer_GET", "(", "String", "serviceName", ",", "String", "dedicatedServer", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/vrack/{serviceName}/dedicatedServer/{dedicatedServer}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "dedicatedServer", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhDedicatedServer", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /vrack/{serviceName}/dedicatedServer/{dedicatedServer} @param serviceName [required] The internal name of your vrack @param dedicatedServer [required] Dedicated Server
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vrack/src/main/java/net/minidev/ovh/api/ApiOvhVrack.java#L292-L297
ahome-it/lienzo-core
src/main/java/com/ait/lienzo/client/core/shape/Shape.java
Shape.setScale
@Override public T setScale(final double x, final double y) { """ Sets this shape's scale, starting at the given x and y @param x @param y @return T """ getAttributes().setScale(x, y); return cast(); }
java
@Override public T setScale(final double x, final double y) { getAttributes().setScale(x, y); return cast(); }
[ "@", "Override", "public", "T", "setScale", "(", "final", "double", "x", ",", "final", "double", "y", ")", "{", "getAttributes", "(", ")", ".", "setScale", "(", "x", ",", "y", ")", ";", "return", "cast", "(", ")", ";", "}" ]
Sets this shape's scale, starting at the given x and y @param x @param y @return T
[ "Sets", "this", "shape", "s", "scale", "starting", "at", "the", "given", "x", "and", "y" ]
train
https://github.com/ahome-it/lienzo-core/blob/8e03723700dec366f77064d12fb8676d8cd6be99/src/main/java/com/ait/lienzo/client/core/shape/Shape.java#L1154-L1160
rahulsom/genealogy
src/main/java/com/github/rahulsom/genealogy/DataUtil.java
DataUtil.processResource
private static void processResource(String resourceName, AbstractProcessor processor) { """ Processes a given resource using provided closure @param resourceName resource to fetch from classpath @param processor how to process the resource """ InputStream lastNameStream = NameDbUsa.class.getClassLoader().getResourceAsStream(resourceName); BufferedReader lastNameReader = new BufferedReader(new InputStreamReader(lastNameStream)); try { int index = 0; while (lastNameReader.ready()) { String line = lastNameReader.readLine(); processor.processLine(line, index++); } } catch (IOException e) { e.printStackTrace(); } }
java
private static void processResource(String resourceName, AbstractProcessor processor) { InputStream lastNameStream = NameDbUsa.class.getClassLoader().getResourceAsStream(resourceName); BufferedReader lastNameReader = new BufferedReader(new InputStreamReader(lastNameStream)); try { int index = 0; while (lastNameReader.ready()) { String line = lastNameReader.readLine(); processor.processLine(line, index++); } } catch (IOException e) { e.printStackTrace(); } }
[ "private", "static", "void", "processResource", "(", "String", "resourceName", ",", "AbstractProcessor", "processor", ")", "{", "InputStream", "lastNameStream", "=", "NameDbUsa", ".", "class", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream", "(", "resourceName", ")", ";", "BufferedReader", "lastNameReader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "lastNameStream", ")", ")", ";", "try", "{", "int", "index", "=", "0", ";", "while", "(", "lastNameReader", ".", "ready", "(", ")", ")", "{", "String", "line", "=", "lastNameReader", ".", "readLine", "(", ")", ";", "processor", ".", "processLine", "(", "line", ",", "index", "++", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Processes a given resource using provided closure @param resourceName resource to fetch from classpath @param processor how to process the resource
[ "Processes", "a", "given", "resource", "using", "provided", "closure" ]
train
https://github.com/rahulsom/genealogy/blob/2beb35ab9c6e03080328aa08b18f0a3c5d3f5c12/src/main/java/com/github/rahulsom/genealogy/DataUtil.java#L97-L109
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java
ClustersInner.checkNameAvailability
public CheckNameResultInner checkNameAvailability(String location, String name) { """ Checks that the cluster name is valid and is not already in use. @param location Azure location. @param name Cluster name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the CheckNameResultInner object if successful. """ return checkNameAvailabilityWithServiceResponseAsync(location, name).toBlocking().single().body(); }
java
public CheckNameResultInner checkNameAvailability(String location, String name) { return checkNameAvailabilityWithServiceResponseAsync(location, name).toBlocking().single().body(); }
[ "public", "CheckNameResultInner", "checkNameAvailability", "(", "String", "location", ",", "String", "name", ")", "{", "return", "checkNameAvailabilityWithServiceResponseAsync", "(", "location", ",", "name", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Checks that the cluster name is valid and is not already in use. @param location Azure location. @param name Cluster name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the CheckNameResultInner object if successful.
[ "Checks", "that", "the", "cluster", "name", "is", "valid", "and", "is", "not", "already", "in", "use", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java#L1289-L1291
maochen/NLP
CoreNLP-Experiment/src/main/java/org/maochen/nlp/ml/classifier/knn/KNNClassifier.java
KNNClassifier.setParameter
@Override public void setParameter(Map<String, String> paraMap) { """ k: k nearest neighbors. mode: 0 - EuclideanDistance, 1 - ChebyshevDistance, 2 - ManhattanDistance @param paraMap Parameters Map. """ if (paraMap.containsKey("k")) { this.k = Integer.parseInt(paraMap.get("k")); } if (paraMap.containsKey("mode")) { this.mode = Integer.parseInt(paraMap.get("mode")); } }
java
@Override public void setParameter(Map<String, String> paraMap) { if (paraMap.containsKey("k")) { this.k = Integer.parseInt(paraMap.get("k")); } if (paraMap.containsKey("mode")) { this.mode = Integer.parseInt(paraMap.get("mode")); } }
[ "@", "Override", "public", "void", "setParameter", "(", "Map", "<", "String", ",", "String", ">", "paraMap", ")", "{", "if", "(", "paraMap", ".", "containsKey", "(", "\"k\"", ")", ")", "{", "this", ".", "k", "=", "Integer", ".", "parseInt", "(", "paraMap", ".", "get", "(", "\"k\"", ")", ")", ";", "}", "if", "(", "paraMap", ".", "containsKey", "(", "\"mode\"", ")", ")", "{", "this", ".", "mode", "=", "Integer", ".", "parseInt", "(", "paraMap", ".", "get", "(", "\"mode\"", ")", ")", ";", "}", "}" ]
k: k nearest neighbors. mode: 0 - EuclideanDistance, 1 - ChebyshevDistance, 2 - ManhattanDistance @param paraMap Parameters Map.
[ "k", ":", "k", "nearest", "neighbors", ".", "mode", ":", "0", "-", "EuclideanDistance", "1", "-", "ChebyshevDistance", "2", "-", "ManhattanDistance" ]
train
https://github.com/maochen/NLP/blob/38ae7b384d5295334d9efa9dc4cd901b19d9c27e/CoreNLP-Experiment/src/main/java/org/maochen/nlp/ml/classifier/knn/KNNClassifier.java#L33-L41
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java
AbstractExtraLanguageGenerator.toFilename
protected String toFilename(QualifiedName name, String separator) { """ Replies the filename for the qualified name. @param name the qualified name. @param separator the filename separator. @return the filename. """ final List<String> segments = name.getSegments(); if (segments.isEmpty()) { return ""; //$NON-NLS-1$ } final StringBuilder builder = new StringBuilder(); builder.append(name.toString(separator)); builder.append(getFilenameExtension()); return builder.toString(); }
java
protected String toFilename(QualifiedName name, String separator) { final List<String> segments = name.getSegments(); if (segments.isEmpty()) { return ""; //$NON-NLS-1$ } final StringBuilder builder = new StringBuilder(); builder.append(name.toString(separator)); builder.append(getFilenameExtension()); return builder.toString(); }
[ "protected", "String", "toFilename", "(", "QualifiedName", "name", ",", "String", "separator", ")", "{", "final", "List", "<", "String", ">", "segments", "=", "name", ".", "getSegments", "(", ")", ";", "if", "(", "segments", ".", "isEmpty", "(", ")", ")", "{", "return", "\"\"", ";", "//$NON-NLS-1$", "}", "final", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "name", ".", "toString", "(", "separator", ")", ")", ";", "builder", ".", "append", "(", "getFilenameExtension", "(", ")", ")", ";", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Replies the filename for the qualified name. @param name the qualified name. @param separator the filename separator. @return the filename.
[ "Replies", "the", "filename", "for", "the", "qualified", "name", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/AbstractExtraLanguageGenerator.java#L438-L447
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/utils/HttpRequestUtils.java
HttpRequestUtils.getShortRequestDump
public static String getShortRequestDump(String fromMethod, boolean includeHeaders, HttpServletRequest request) { """ Build a String containing a short multi-line dump of an HTTP request. @param fromMethod the method that this method was called from @param request the HTTP request build the request dump from @param includeHeaders if true will include the HTTP headers in the dump @return a String containing a short multi-line dump of the HTTP request """ StringBuilder dump = new StringBuilder(); dump.append("Timestamp : ").append(ISO8601.getTimestamp()).append("\n"); dump.append("fromMethod : ").append(fromMethod).append("\n"); dump.append("Method : ").append(request.getMethod()).append('\n'); dump.append("Scheme : ").append(request.getScheme()).append('\n'); dump.append("URI : ").append(request.getRequestURI()).append('\n'); dump.append("Query-String : ").append(request.getQueryString()).append('\n'); dump.append("Auth-Type : ").append(request.getAuthType()).append('\n'); dump.append("Remote-Addr : ").append(request.getRemoteAddr()).append('\n'); dump.append("Scheme : ").append(request.getScheme()).append('\n'); dump.append("Content-Type : ").append(request.getContentType()).append('\n'); dump.append("Content-Length: ").append(request.getContentLength()).append('\n'); if (includeHeaders) { dump.append("Headers :\n"); Enumeration<String> headers = request.getHeaderNames(); while (headers.hasMoreElements()) { String header = headers.nextElement(); dump.append("\t").append(header).append(": ").append(request.getHeader(header)).append('\n'); } } return (dump.toString()); }
java
public static String getShortRequestDump(String fromMethod, boolean includeHeaders, HttpServletRequest request) { StringBuilder dump = new StringBuilder(); dump.append("Timestamp : ").append(ISO8601.getTimestamp()).append("\n"); dump.append("fromMethod : ").append(fromMethod).append("\n"); dump.append("Method : ").append(request.getMethod()).append('\n'); dump.append("Scheme : ").append(request.getScheme()).append('\n'); dump.append("URI : ").append(request.getRequestURI()).append('\n'); dump.append("Query-String : ").append(request.getQueryString()).append('\n'); dump.append("Auth-Type : ").append(request.getAuthType()).append('\n'); dump.append("Remote-Addr : ").append(request.getRemoteAddr()).append('\n'); dump.append("Scheme : ").append(request.getScheme()).append('\n'); dump.append("Content-Type : ").append(request.getContentType()).append('\n'); dump.append("Content-Length: ").append(request.getContentLength()).append('\n'); if (includeHeaders) { dump.append("Headers :\n"); Enumeration<String> headers = request.getHeaderNames(); while (headers.hasMoreElements()) { String header = headers.nextElement(); dump.append("\t").append(header).append(": ").append(request.getHeader(header)).append('\n'); } } return (dump.toString()); }
[ "public", "static", "String", "getShortRequestDump", "(", "String", "fromMethod", ",", "boolean", "includeHeaders", ",", "HttpServletRequest", "request", ")", "{", "StringBuilder", "dump", "=", "new", "StringBuilder", "(", ")", ";", "dump", ".", "append", "(", "\"Timestamp : \"", ")", ".", "append", "(", "ISO8601", ".", "getTimestamp", "(", ")", ")", ".", "append", "(", "\"\\n\"", ")", ";", "dump", ".", "append", "(", "\"fromMethod : \"", ")", ".", "append", "(", "fromMethod", ")", ".", "append", "(", "\"\\n\"", ")", ";", "dump", ".", "append", "(", "\"Method : \"", ")", ".", "append", "(", "request", ".", "getMethod", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "dump", ".", "append", "(", "\"Scheme : \"", ")", ".", "append", "(", "request", ".", "getScheme", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "dump", ".", "append", "(", "\"URI : \"", ")", ".", "append", "(", "request", ".", "getRequestURI", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "dump", ".", "append", "(", "\"Query-String : \"", ")", ".", "append", "(", "request", ".", "getQueryString", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "dump", ".", "append", "(", "\"Auth-Type : \"", ")", ".", "append", "(", "request", ".", "getAuthType", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "dump", ".", "append", "(", "\"Remote-Addr : \"", ")", ".", "append", "(", "request", ".", "getRemoteAddr", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "dump", ".", "append", "(", "\"Scheme : \"", ")", ".", "append", "(", "request", ".", "getScheme", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "dump", ".", "append", "(", "\"Content-Type : \"", ")", ".", "append", "(", "request", ".", "getContentType", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "dump", ".", "append", "(", "\"Content-Length: \"", ")", ".", "append", "(", "request", ".", "getContentLength", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "if", "(", "includeHeaders", ")", "{", "dump", ".", "append", "(", "\"Headers :\\n\"", ")", ";", "Enumeration", "<", "String", ">", "headers", "=", "request", ".", "getHeaderNames", "(", ")", ";", "while", "(", "headers", ".", "hasMoreElements", "(", ")", ")", "{", "String", "header", "=", "headers", ".", "nextElement", "(", ")", ";", "dump", ".", "append", "(", "\"\\t\"", ")", ".", "append", "(", "header", ")", ".", "append", "(", "\": \"", ")", ".", "append", "(", "request", ".", "getHeader", "(", "header", ")", ")", ".", "append", "(", "'", "'", ")", ";", "}", "}", "return", "(", "dump", ".", "toString", "(", ")", ")", ";", "}" ]
Build a String containing a short multi-line dump of an HTTP request. @param fromMethod the method that this method was called from @param request the HTTP request build the request dump from @param includeHeaders if true will include the HTTP headers in the dump @return a String containing a short multi-line dump of the HTTP request
[ "Build", "a", "String", "containing", "a", "short", "multi", "-", "line", "dump", "of", "an", "HTTP", "request", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/utils/HttpRequestUtils.java#L32-L57
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java
VirtualNetworkGatewaysInner.beginGetAdvertisedRoutes
public GatewayRouteListResultInner beginGetAdvertisedRoutes(String resourceGroupName, String virtualNetworkGatewayName, String peer) { """ This operation retrieves a list of routes the virtual network gateway is advertising to the specified peer. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param peer The IP address of the peer @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 GatewayRouteListResultInner object if successful. """ return beginGetAdvertisedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, peer).toBlocking().single().body(); }
java
public GatewayRouteListResultInner beginGetAdvertisedRoutes(String resourceGroupName, String virtualNetworkGatewayName, String peer) { return beginGetAdvertisedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, peer).toBlocking().single().body(); }
[ "public", "GatewayRouteListResultInner", "beginGetAdvertisedRoutes", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayName", ",", "String", "peer", ")", "{", "return", "beginGetAdvertisedRoutesWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayName", ",", "peer", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
This operation retrieves a list of routes the virtual network gateway is advertising to the specified peer. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayName The name of the virtual network gateway. @param peer The IP address of the peer @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 GatewayRouteListResultInner object if successful.
[ "This", "operation", "retrieves", "a", "list", "of", "routes", "the", "virtual", "network", "gateway", "is", "advertising", "to", "the", "specified", "peer", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L2567-L2569
weld/core
impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java
AnnotatedTypes.compareAnnotatedParameters
private static boolean compareAnnotatedParameters(List<? extends AnnotatedParameter<?>> p1, List<? extends AnnotatedParameter<?>> p2) { """ compares two annotated elements to see if they have the same annotations """ if (p1.size() != p2.size()) { return false; } for (int i = 0; i < p1.size(); ++i) { if (!compareAnnotated(p1.get(i), p2.get(i))) { return false; } } return true; }
java
private static boolean compareAnnotatedParameters(List<? extends AnnotatedParameter<?>> p1, List<? extends AnnotatedParameter<?>> p2) { if (p1.size() != p2.size()) { return false; } for (int i = 0; i < p1.size(); ++i) { if (!compareAnnotated(p1.get(i), p2.get(i))) { return false; } } return true; }
[ "private", "static", "boolean", "compareAnnotatedParameters", "(", "List", "<", "?", "extends", "AnnotatedParameter", "<", "?", ">", ">", "p1", ",", "List", "<", "?", "extends", "AnnotatedParameter", "<", "?", ">", ">", "p2", ")", "{", "if", "(", "p1", ".", "size", "(", ")", "!=", "p2", ".", "size", "(", ")", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "p1", ".", "size", "(", ")", ";", "++", "i", ")", "{", "if", "(", "!", "compareAnnotated", "(", "p1", ".", "get", "(", "i", ")", ",", "p2", ".", "get", "(", "i", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
compares two annotated elements to see if they have the same annotations
[ "compares", "two", "annotated", "elements", "to", "see", "if", "they", "have", "the", "same", "annotations" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/util/AnnotatedTypes.java#L435-L445
spring-projects/spring-hateoas
src/main/java/org/springframework/hateoas/server/mvc/WebMvcLinkBuilder.java
WebMvcLinkBuilder.methodOn
public static <T> T methodOn(Class<T> controller, Object... parameters) { """ Wrapper for {@link DummyInvocationUtils#methodOn(Class, Object...)} to be available in case you work with static imports of {@link WebMvcLinkBuilder}. @param controller must not be {@literal null}. @param parameters parameters to extend template variables in the type level mapping. @return """ return DummyInvocationUtils.methodOn(controller, parameters); }
java
public static <T> T methodOn(Class<T> controller, Object... parameters) { return DummyInvocationUtils.methodOn(controller, parameters); }
[ "public", "static", "<", "T", ">", "T", "methodOn", "(", "Class", "<", "T", ">", "controller", ",", "Object", "...", "parameters", ")", "{", "return", "DummyInvocationUtils", ".", "methodOn", "(", "controller", ",", "parameters", ")", ";", "}" ]
Wrapper for {@link DummyInvocationUtils#methodOn(Class, Object...)} to be available in case you work with static imports of {@link WebMvcLinkBuilder}. @param controller must not be {@literal null}. @param parameters parameters to extend template variables in the type level mapping. @return
[ "Wrapper", "for", "{", "@link", "DummyInvocationUtils#methodOn", "(", "Class", "Object", "...", ")", "}", "to", "be", "available", "in", "case", "you", "work", "with", "static", "imports", "of", "{", "@link", "WebMvcLinkBuilder", "}", "." ]
train
https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/server/mvc/WebMvcLinkBuilder.java#L209-L211
Netflix/servo
servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java
Monitors.newThreadPoolMonitor
public static CompositeMonitor<?> newThreadPoolMonitor(String id, ThreadPoolExecutor pool) { """ Creates a new monitor for a thread pool with standard metrics for the pool size, queue size, task counts, etc. @param id id to differentiate metrics for this pool from others. @param pool thread pool instance to monitor. @return composite monitor based on stats provided for the pool """ return newObjectMonitor(id, new MonitoredThreadPool(pool)); }
java
public static CompositeMonitor<?> newThreadPoolMonitor(String id, ThreadPoolExecutor pool) { return newObjectMonitor(id, new MonitoredThreadPool(pool)); }
[ "public", "static", "CompositeMonitor", "<", "?", ">", "newThreadPoolMonitor", "(", "String", "id", ",", "ThreadPoolExecutor", "pool", ")", "{", "return", "newObjectMonitor", "(", "id", ",", "new", "MonitoredThreadPool", "(", "pool", ")", ")", ";", "}" ]
Creates a new monitor for a thread pool with standard metrics for the pool size, queue size, task counts, etc. @param id id to differentiate metrics for this pool from others. @param pool thread pool instance to monitor. @return composite monitor based on stats provided for the pool
[ "Creates", "a", "new", "monitor", "for", "a", "thread", "pool", "with", "standard", "metrics", "for", "the", "pool", "size", "queue", "size", "task", "counts", "etc", "." ]
train
https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L168-L170
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.setFormatsByArgumentName
public void setFormatsByArgumentName(Map<String, Format> newFormats) { """ <strong>[icu]</strong> Sets the Format objects to use for the values passed into <code>format</code> methods or returned from <code>parse</code> methods. The keys in <code>newFormats</code> are the argument names in the previously set pattern string, and the values are the formats. <p> Only argument names from the pattern string are considered. Extra keys in <code>newFormats</code> that do not correspond to an argument name are ignored. Similarly, if there is no format in newFormats for an argument name, the formatter for that argument remains unchanged. <p> This may be called on formats that do not use named arguments. In this case the map will be queried for key Strings that represent argument indices, e.g. "0", "1", "2" etc. @param newFormats a map from String to Format providing new formats for named arguments. """ for (int partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) { String key = getArgName(partIndex + 1); if (newFormats.containsKey(key)) { setCustomArgStartFormat(partIndex, newFormats.get(key)); } } }
java
public void setFormatsByArgumentName(Map<String, Format> newFormats) { for (int partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) { String key = getArgName(partIndex + 1); if (newFormats.containsKey(key)) { setCustomArgStartFormat(partIndex, newFormats.get(key)); } } }
[ "public", "void", "setFormatsByArgumentName", "(", "Map", "<", "String", ",", "Format", ">", "newFormats", ")", "{", "for", "(", "int", "partIndex", "=", "0", ";", "(", "partIndex", "=", "nextTopLevelArgStart", "(", "partIndex", ")", ")", ">=", "0", ";", ")", "{", "String", "key", "=", "getArgName", "(", "partIndex", "+", "1", ")", ";", "if", "(", "newFormats", ".", "containsKey", "(", "key", ")", ")", "{", "setCustomArgStartFormat", "(", "partIndex", ",", "newFormats", ".", "get", "(", "key", ")", ")", ";", "}", "}", "}" ]
<strong>[icu]</strong> Sets the Format objects to use for the values passed into <code>format</code> methods or returned from <code>parse</code> methods. The keys in <code>newFormats</code> are the argument names in the previously set pattern string, and the values are the formats. <p> Only argument names from the pattern string are considered. Extra keys in <code>newFormats</code> that do not correspond to an argument name are ignored. Similarly, if there is no format in newFormats for an argument name, the formatter for that argument remains unchanged. <p> This may be called on formats that do not use named arguments. In this case the map will be queried for key Strings that represent argument indices, e.g. "0", "1", "2" etc. @param newFormats a map from String to Format providing new formats for named arguments.
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Sets", "the", "Format", "objects", "to", "use", "for", "the", "values", "passed", "into", "<code", ">", "format<", "/", "code", ">", "methods", "or", "returned", "from", "<code", ">", "parse<", "/", "code", ">", "methods", ".", "The", "keys", "in", "<code", ">", "newFormats<", "/", "code", ">", "are", "the", "argument", "names", "in", "the", "previously", "set", "pattern", "string", "and", "the", "values", "are", "the", "formats", ".", "<p", ">", "Only", "argument", "names", "from", "the", "pattern", "string", "are", "considered", ".", "Extra", "keys", "in", "<code", ">", "newFormats<", "/", "code", ">", "that", "do", "not", "correspond", "to", "an", "argument", "name", "are", "ignored", ".", "Similarly", "if", "there", "is", "no", "format", "in", "newFormats", "for", "an", "argument", "name", "the", "formatter", "for", "that", "argument", "remains", "unchanged", ".", "<p", ">", "This", "may", "be", "called", "on", "formats", "that", "do", "not", "use", "named", "arguments", ".", "In", "this", "case", "the", "map", "will", "be", "queried", "for", "key", "Strings", "that", "represent", "argument", "indices", "e", ".", "g", ".", "0", "1", "2", "etc", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L614-L621
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/BigtableBufferedMutator.java
BigtableBufferedMutator.getExceptions
private RetriesExhaustedWithDetailsException getExceptions() throws RetriesExhaustedWithDetailsException { """ Create a {@link RetriesExhaustedWithDetailsException} if there were any async exceptions and send it to the {@link org.apache.hadoop.hbase.client.BufferedMutator.ExceptionListener}. """ if (!hasExceptions.get()) { return null; } ArrayList<MutationException> mutationExceptions = null; synchronized (globalExceptions) { hasExceptions.set(false); if (globalExceptions.isEmpty()) { return null; } mutationExceptions = new ArrayList<>(globalExceptions); globalExceptions.clear(); } List<Throwable> problems = new ArrayList<>(mutationExceptions.size()); ArrayList<String> hostnames = new ArrayList<>(mutationExceptions.size()); List<Row> failedMutations = new ArrayList<>(mutationExceptions.size()); if (!mutationExceptions.isEmpty()) { LOG.warn("Exception occurred in BufferedMutator", mutationExceptions.get(0).throwable); } for (MutationException mutationException : mutationExceptions) { problems.add(mutationException.throwable); failedMutations.add(mutationException.mutation); hostnames.add(host); LOG.debug("Exception occurred in BufferedMutator", mutationException.throwable); } return new RetriesExhaustedWithDetailsException(problems, failedMutations, hostnames); }
java
private RetriesExhaustedWithDetailsException getExceptions() throws RetriesExhaustedWithDetailsException { if (!hasExceptions.get()) { return null; } ArrayList<MutationException> mutationExceptions = null; synchronized (globalExceptions) { hasExceptions.set(false); if (globalExceptions.isEmpty()) { return null; } mutationExceptions = new ArrayList<>(globalExceptions); globalExceptions.clear(); } List<Throwable> problems = new ArrayList<>(mutationExceptions.size()); ArrayList<String> hostnames = new ArrayList<>(mutationExceptions.size()); List<Row> failedMutations = new ArrayList<>(mutationExceptions.size()); if (!mutationExceptions.isEmpty()) { LOG.warn("Exception occurred in BufferedMutator", mutationExceptions.get(0).throwable); } for (MutationException mutationException : mutationExceptions) { problems.add(mutationException.throwable); failedMutations.add(mutationException.mutation); hostnames.add(host); LOG.debug("Exception occurred in BufferedMutator", mutationException.throwable); } return new RetriesExhaustedWithDetailsException(problems, failedMutations, hostnames); }
[ "private", "RetriesExhaustedWithDetailsException", "getExceptions", "(", ")", "throws", "RetriesExhaustedWithDetailsException", "{", "if", "(", "!", "hasExceptions", ".", "get", "(", ")", ")", "{", "return", "null", ";", "}", "ArrayList", "<", "MutationException", ">", "mutationExceptions", "=", "null", ";", "synchronized", "(", "globalExceptions", ")", "{", "hasExceptions", ".", "set", "(", "false", ")", ";", "if", "(", "globalExceptions", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "mutationExceptions", "=", "new", "ArrayList", "<>", "(", "globalExceptions", ")", ";", "globalExceptions", ".", "clear", "(", ")", ";", "}", "List", "<", "Throwable", ">", "problems", "=", "new", "ArrayList", "<>", "(", "mutationExceptions", ".", "size", "(", ")", ")", ";", "ArrayList", "<", "String", ">", "hostnames", "=", "new", "ArrayList", "<>", "(", "mutationExceptions", ".", "size", "(", ")", ")", ";", "List", "<", "Row", ">", "failedMutations", "=", "new", "ArrayList", "<>", "(", "mutationExceptions", ".", "size", "(", ")", ")", ";", "if", "(", "!", "mutationExceptions", ".", "isEmpty", "(", ")", ")", "{", "LOG", ".", "warn", "(", "\"Exception occurred in BufferedMutator\"", ",", "mutationExceptions", ".", "get", "(", "0", ")", ".", "throwable", ")", ";", "}", "for", "(", "MutationException", "mutationException", ":", "mutationExceptions", ")", "{", "problems", ".", "add", "(", "mutationException", ".", "throwable", ")", ";", "failedMutations", ".", "add", "(", "mutationException", ".", "mutation", ")", ";", "hostnames", ".", "add", "(", "host", ")", ";", "LOG", ".", "debug", "(", "\"Exception occurred in BufferedMutator\"", ",", "mutationException", ".", "throwable", ")", ";", "}", "return", "new", "RetriesExhaustedWithDetailsException", "(", "problems", ",", "failedMutations", ",", "hostnames", ")", ";", "}" ]
Create a {@link RetriesExhaustedWithDetailsException} if there were any async exceptions and send it to the {@link org.apache.hadoop.hbase.client.BufferedMutator.ExceptionListener}.
[ "Create", "a", "{" ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/BigtableBufferedMutator.java#L166-L198
JetBrains/xodus
vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java
VirtualFileSystem.appendFile
public OutputStream appendFile(@NotNull final Transaction txn, @NotNull final File file) { """ Returns {@linkplain OutputStream} to write the contents of the specified file from the end of the file. If the file is empty the contents is written from the beginning. @param txn {@linkplain Transaction} instance @param file {@linkplain File} instance @return @linkplain OutputStream} to write the contents of the specified file from the end of the file @see #readFile(Transaction, File) @see #readFile(Transaction, long) @see #readFile(Transaction, File, long) @see #writeFile(Transaction, File) @see #writeFile(Transaction, long) @see #writeFile(Transaction, File, long) @see #writeFile(Transaction, long, long) @see #touchFile(Transaction, File) """ return new VfsAppendingStream(this, txn, file, new LastModifiedTrigger(txn, file, pathnames)); }
java
public OutputStream appendFile(@NotNull final Transaction txn, @NotNull final File file) { return new VfsAppendingStream(this, txn, file, new LastModifiedTrigger(txn, file, pathnames)); }
[ "public", "OutputStream", "appendFile", "(", "@", "NotNull", "final", "Transaction", "txn", ",", "@", "NotNull", "final", "File", "file", ")", "{", "return", "new", "VfsAppendingStream", "(", "this", ",", "txn", ",", "file", ",", "new", "LastModifiedTrigger", "(", "txn", ",", "file", ",", "pathnames", ")", ")", ";", "}" ]
Returns {@linkplain OutputStream} to write the contents of the specified file from the end of the file. If the file is empty the contents is written from the beginning. @param txn {@linkplain Transaction} instance @param file {@linkplain File} instance @return @linkplain OutputStream} to write the contents of the specified file from the end of the file @see #readFile(Transaction, File) @see #readFile(Transaction, long) @see #readFile(Transaction, File, long) @see #writeFile(Transaction, File) @see #writeFile(Transaction, long) @see #writeFile(Transaction, File, long) @see #writeFile(Transaction, long, long) @see #touchFile(Transaction, File)
[ "Returns", "{", "@linkplain", "OutputStream", "}", "to", "write", "the", "contents", "of", "the", "specified", "file", "from", "the", "end", "of", "the", "file", ".", "If", "the", "file", "is", "empty", "the", "contents", "is", "written", "from", "the", "beginning", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/vfs/src/main/java/jetbrains/exodus/vfs/VirtualFileSystem.java#L585-L587
ralscha/wampspring
src/main/java/ch/rasc/wampspring/user/UserEventMessenger.java
UserEventMessenger.sendToUser
public void sendToUser(String topicURI, Object event, String eligibleUser) { """ Send an {@link EventMessage} to one client that is subscribed to the given topicURI. If the client with the given user name is not subscribed to the topicURI nothing happens. @param topicURI the name of the topic @param event the payload of the {@link EventMessage} @param eligibleUser only the user listed here will receive the message """ sendToUsers(topicURI, event, Collections.singleton(eligibleUser)); }
java
public void sendToUser(String topicURI, Object event, String eligibleUser) { sendToUsers(topicURI, event, Collections.singleton(eligibleUser)); }
[ "public", "void", "sendToUser", "(", "String", "topicURI", ",", "Object", "event", ",", "String", "eligibleUser", ")", "{", "sendToUsers", "(", "topicURI", ",", "event", ",", "Collections", ".", "singleton", "(", "eligibleUser", ")", ")", ";", "}" ]
Send an {@link EventMessage} to one client that is subscribed to the given topicURI. If the client with the given user name is not subscribed to the topicURI nothing happens. @param topicURI the name of the topic @param event the payload of the {@link EventMessage} @param eligibleUser only the user listed here will receive the message
[ "Send", "an", "{", "@link", "EventMessage", "}", "to", "one", "client", "that", "is", "subscribed", "to", "the", "given", "topicURI", ".", "If", "the", "client", "with", "the", "given", "user", "name", "is", "not", "subscribed", "to", "the", "topicURI", "nothing", "happens", "." ]
train
https://github.com/ralscha/wampspring/blob/7571bb6773b848c580b29890587eb35397bfe5b5/src/main/java/ch/rasc/wampspring/user/UserEventMessenger.java#L171-L173
mfornos/humanize
humanize-icu/src/main/java/humanize/ICUHumanize.java
ICUHumanize.naturalTime
public static String naturalTime(final Date reference, final Date duration, final Locale locale) { """ <p> Same as {@link #naturalTime(Date, Date) naturalTime} for the specified locale. </p> @param reference Date to be used as reference @param duration Date to be used as duration from reference @param locale Target locale @return String representing the relative date """ return withinLocale(new Callable<String>() { public String call() { return naturalTime(reference, duration); } }, locale); }
java
public static String naturalTime(final Date reference, final Date duration, final Locale locale) { return withinLocale(new Callable<String>() { public String call() { return naturalTime(reference, duration); } }, locale); }
[ "public", "static", "String", "naturalTime", "(", "final", "Date", "reference", ",", "final", "Date", "duration", ",", "final", "Locale", "locale", ")", "{", "return", "withinLocale", "(", "new", "Callable", "<", "String", ">", "(", ")", "{", "public", "String", "call", "(", ")", "{", "return", "naturalTime", "(", "reference", ",", "duration", ")", ";", "}", "}", ",", "locale", ")", ";", "}" ]
<p> Same as {@link #naturalTime(Date, Date) naturalTime} for the specified locale. </p> @param reference Date to be used as reference @param duration Date to be used as duration from reference @param locale Target locale @return String representing the relative date
[ "<p", ">", "Same", "as", "{", "@link", "#naturalTime", "(", "Date", "Date", ")", "naturalTime", "}", "for", "the", "specified", "locale", ".", "<", "/", "p", ">" ]
train
https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-icu/src/main/java/humanize/ICUHumanize.java#L1356-L1365
Alluxio/alluxio
core/server/proxy/src/main/java/alluxio/proxy/s3/S3RestServiceHandler.java
S3RestServiceHandler.completeMultipartUpload
private Response completeMultipartUpload(final String bucket, final String object, final long uploadId) { """ under the temporary multipart upload directory are combined into the final object. """ return S3RestUtils.call(bucket, new S3RestUtils.RestCallable<CompleteMultipartUploadResult>() { @Override public CompleteMultipartUploadResult call() throws S3Exception { String bucketPath = parseBucketPath(AlluxioURI.SEPARATOR + bucket); checkBucketIsAlluxioDirectory(bucketPath); String objectPath = bucketPath + AlluxioURI.SEPARATOR + object; AlluxioURI multipartTemporaryDir = new AlluxioURI(S3RestUtils.getMultipartTemporaryDirForObject(bucketPath, object)); checkUploadId(multipartTemporaryDir, uploadId); try { List<URIStatus> parts = mFileSystem.listStatus(multipartTemporaryDir); Collections.sort(parts, new URIStatusNameComparator()); CreateFilePOptions options = CreateFilePOptions.newBuilder().setRecursive(true) .setWriteType(getS3WriteType()).build(); FileOutStream os = mFileSystem.createFile(new AlluxioURI(objectPath), options); MessageDigest md5 = MessageDigest.getInstance("MD5"); DigestOutputStream digestOutputStream = new DigestOutputStream(os, md5); try { for (URIStatus part : parts) { try (FileInStream is = mFileSystem.openFile(new AlluxioURI(part.getPath()))) { ByteStreams.copy(is, digestOutputStream); } } } finally { digestOutputStream.close(); } mFileSystem.delete(multipartTemporaryDir, DeletePOptions.newBuilder().setRecursive(true).build()); String entityTag = Hex.encodeHexString(md5.digest()); return new CompleteMultipartUploadResult(objectPath, bucket, object, entityTag); } catch (Exception e) { throw toObjectS3Exception(e, objectPath); } } }); }
java
private Response completeMultipartUpload(final String bucket, final String object, final long uploadId) { return S3RestUtils.call(bucket, new S3RestUtils.RestCallable<CompleteMultipartUploadResult>() { @Override public CompleteMultipartUploadResult call() throws S3Exception { String bucketPath = parseBucketPath(AlluxioURI.SEPARATOR + bucket); checkBucketIsAlluxioDirectory(bucketPath); String objectPath = bucketPath + AlluxioURI.SEPARATOR + object; AlluxioURI multipartTemporaryDir = new AlluxioURI(S3RestUtils.getMultipartTemporaryDirForObject(bucketPath, object)); checkUploadId(multipartTemporaryDir, uploadId); try { List<URIStatus> parts = mFileSystem.listStatus(multipartTemporaryDir); Collections.sort(parts, new URIStatusNameComparator()); CreateFilePOptions options = CreateFilePOptions.newBuilder().setRecursive(true) .setWriteType(getS3WriteType()).build(); FileOutStream os = mFileSystem.createFile(new AlluxioURI(objectPath), options); MessageDigest md5 = MessageDigest.getInstance("MD5"); DigestOutputStream digestOutputStream = new DigestOutputStream(os, md5); try { for (URIStatus part : parts) { try (FileInStream is = mFileSystem.openFile(new AlluxioURI(part.getPath()))) { ByteStreams.copy(is, digestOutputStream); } } } finally { digestOutputStream.close(); } mFileSystem.delete(multipartTemporaryDir, DeletePOptions.newBuilder().setRecursive(true).build()); String entityTag = Hex.encodeHexString(md5.digest()); return new CompleteMultipartUploadResult(objectPath, bucket, object, entityTag); } catch (Exception e) { throw toObjectS3Exception(e, objectPath); } } }); }
[ "private", "Response", "completeMultipartUpload", "(", "final", "String", "bucket", ",", "final", "String", "object", ",", "final", "long", "uploadId", ")", "{", "return", "S3RestUtils", ".", "call", "(", "bucket", ",", "new", "S3RestUtils", ".", "RestCallable", "<", "CompleteMultipartUploadResult", ">", "(", ")", "{", "@", "Override", "public", "CompleteMultipartUploadResult", "call", "(", ")", "throws", "S3Exception", "{", "String", "bucketPath", "=", "parseBucketPath", "(", "AlluxioURI", ".", "SEPARATOR", "+", "bucket", ")", ";", "checkBucketIsAlluxioDirectory", "(", "bucketPath", ")", ";", "String", "objectPath", "=", "bucketPath", "+", "AlluxioURI", ".", "SEPARATOR", "+", "object", ";", "AlluxioURI", "multipartTemporaryDir", "=", "new", "AlluxioURI", "(", "S3RestUtils", ".", "getMultipartTemporaryDirForObject", "(", "bucketPath", ",", "object", ")", ")", ";", "checkUploadId", "(", "multipartTemporaryDir", ",", "uploadId", ")", ";", "try", "{", "List", "<", "URIStatus", ">", "parts", "=", "mFileSystem", ".", "listStatus", "(", "multipartTemporaryDir", ")", ";", "Collections", ".", "sort", "(", "parts", ",", "new", "URIStatusNameComparator", "(", ")", ")", ";", "CreateFilePOptions", "options", "=", "CreateFilePOptions", ".", "newBuilder", "(", ")", ".", "setRecursive", "(", "true", ")", ".", "setWriteType", "(", "getS3WriteType", "(", ")", ")", ".", "build", "(", ")", ";", "FileOutStream", "os", "=", "mFileSystem", ".", "createFile", "(", "new", "AlluxioURI", "(", "objectPath", ")", ",", "options", ")", ";", "MessageDigest", "md5", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ";", "DigestOutputStream", "digestOutputStream", "=", "new", "DigestOutputStream", "(", "os", ",", "md5", ")", ";", "try", "{", "for", "(", "URIStatus", "part", ":", "parts", ")", "{", "try", "(", "FileInStream", "is", "=", "mFileSystem", ".", "openFile", "(", "new", "AlluxioURI", "(", "part", ".", "getPath", "(", ")", ")", ")", ")", "{", "ByteStreams", ".", "copy", "(", "is", ",", "digestOutputStream", ")", ";", "}", "}", "}", "finally", "{", "digestOutputStream", ".", "close", "(", ")", ";", "}", "mFileSystem", ".", "delete", "(", "multipartTemporaryDir", ",", "DeletePOptions", ".", "newBuilder", "(", ")", ".", "setRecursive", "(", "true", ")", ".", "build", "(", ")", ")", ";", "String", "entityTag", "=", "Hex", ".", "encodeHexString", "(", "md5", ".", "digest", "(", ")", ")", ";", "return", "new", "CompleteMultipartUploadResult", "(", "objectPath", ",", "bucket", ",", "object", ",", "entityTag", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "toObjectS3Exception", "(", "e", ",", "objectPath", ")", ";", "}", "}", "}", ")", ";", "}" ]
under the temporary multipart upload directory are combined into the final object.
[ "under", "the", "temporary", "multipart", "upload", "directory", "are", "combined", "into", "the", "final", "object", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/proxy/src/main/java/alluxio/proxy/s3/S3RestServiceHandler.java#L330-L372
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/bond/Bond.java
Bond.getValueWithGivenYield
public double getValueWithGivenYield(double evaluationTime, double rate, AnalyticModel model) { """ Returns the value of the sum of discounted cash flows of the bond where the discounting is done with the given yield curve. This method can be used for optimizer. @param evaluationTime The evaluation time as double. Cash flows prior and including this time are not considered. @param rate The yield which is used for discounted the coupon payments. @param model The model under which the product is valued. @return The value of the bond for the given yield. """ DiscountCurve referenceCurve = DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors("referenceCurve", new double[] {0.0, 1.0}, new double[] {1.0, 1.0}); return getValueWithGivenSpreadOverCurve(evaluationTime, referenceCurve, rate, model); }
java
public double getValueWithGivenYield(double evaluationTime, double rate, AnalyticModel model) { DiscountCurve referenceCurve = DiscountCurveInterpolation.createDiscountCurveFromDiscountFactors("referenceCurve", new double[] {0.0, 1.0}, new double[] {1.0, 1.0}); return getValueWithGivenSpreadOverCurve(evaluationTime, referenceCurve, rate, model); }
[ "public", "double", "getValueWithGivenYield", "(", "double", "evaluationTime", ",", "double", "rate", ",", "AnalyticModel", "model", ")", "{", "DiscountCurve", "referenceCurve", "=", "DiscountCurveInterpolation", ".", "createDiscountCurveFromDiscountFactors", "(", "\"referenceCurve\"", ",", "new", "double", "[", "]", "{", "0.0", ",", "1.0", "}", ",", "new", "double", "[", "]", "{", "1.0", ",", "1.0", "}", ")", ";", "return", "getValueWithGivenSpreadOverCurve", "(", "evaluationTime", ",", "referenceCurve", ",", "rate", ",", "model", ")", ";", "}" ]
Returns the value of the sum of discounted cash flows of the bond where the discounting is done with the given yield curve. This method can be used for optimizer. @param evaluationTime The evaluation time as double. Cash flows prior and including this time are not considered. @param rate The yield which is used for discounted the coupon payments. @param model The model under which the product is valued. @return The value of the bond for the given yield.
[ "Returns", "the", "value", "of", "the", "sum", "of", "discounted", "cash", "flows", "of", "the", "bond", "where", "the", "discounting", "is", "done", "with", "the", "given", "yield", "curve", ".", "This", "method", "can", "be", "used", "for", "optimizer", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L256-L259
knowm/XChange
xchange-core/src/main/java/org/knowm/xchange/utils/CertHelper.java
CertHelper.createIncorrectHostnameVerifier
public static HostnameVerifier createIncorrectHostnameVerifier( final String requestHostname, final String certPrincipalName) { """ Creates a custom {@link HostnameVerifier} that allows a specific certificate to be accepted for a mismatching hostname. @param requestHostname hostname used to access the service which offers the incorrectly named certificate @param certPrincipalName RFC 2253 name on the certificate @return A {@link HostnameVerifier} that will accept the provided combination of names """ return new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { try { String principalName = session.getPeerPrincipal().getName(); if (hostname.equals(requestHostname) && principalName.equals(certPrincipalName)) return true; } catch (SSLPeerUnverifiedException e) { } return HttpsURLConnection.getDefaultHostnameVerifier().verify(hostname, session); } }; }
java
public static HostnameVerifier createIncorrectHostnameVerifier( final String requestHostname, final String certPrincipalName) { return new HostnameVerifier() { @Override public boolean verify(String hostname, SSLSession session) { try { String principalName = session.getPeerPrincipal().getName(); if (hostname.equals(requestHostname) && principalName.equals(certPrincipalName)) return true; } catch (SSLPeerUnverifiedException e) { } return HttpsURLConnection.getDefaultHostnameVerifier().verify(hostname, session); } }; }
[ "public", "static", "HostnameVerifier", "createIncorrectHostnameVerifier", "(", "final", "String", "requestHostname", ",", "final", "String", "certPrincipalName", ")", "{", "return", "new", "HostnameVerifier", "(", ")", "{", "@", "Override", "public", "boolean", "verify", "(", "String", "hostname", ",", "SSLSession", "session", ")", "{", "try", "{", "String", "principalName", "=", "session", ".", "getPeerPrincipal", "(", ")", ".", "getName", "(", ")", ";", "if", "(", "hostname", ".", "equals", "(", "requestHostname", ")", "&&", "principalName", ".", "equals", "(", "certPrincipalName", ")", ")", "return", "true", ";", "}", "catch", "(", "SSLPeerUnverifiedException", "e", ")", "{", "}", "return", "HttpsURLConnection", ".", "getDefaultHostnameVerifier", "(", ")", ".", "verify", "(", "hostname", ",", "session", ")", ";", "}", "}", ";", "}" ]
Creates a custom {@link HostnameVerifier} that allows a specific certificate to be accepted for a mismatching hostname. @param requestHostname hostname used to access the service which offers the incorrectly named certificate @param certPrincipalName RFC 2253 name on the certificate @return A {@link HostnameVerifier} that will accept the provided combination of names
[ "Creates", "a", "custom", "{", "@link", "HostnameVerifier", "}", "that", "allows", "a", "specific", "certificate", "to", "be", "accepted", "for", "a", "mismatching", "hostname", "." ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-core/src/main/java/org/knowm/xchange/utils/CertHelper.java#L220-L241
messagebird/java-rest-api
api/src/main/java/com/messagebird/MessageBirdClient.java
MessageBirdClient.updateConversation
public Conversation updateConversation(final String id, final ConversationStatus status) throws UnauthorizedException, GeneralException { """ Updates a conversation. @param id Conversation to update. @param status New status for the conversation. @return The updated Conversation. """ if (id == null) { throw new IllegalArgumentException("Id must be specified."); } String url = String.format("%s%s/%s", CONVERSATIONS_BASE_URL, CONVERSATION_PATH, id); return messageBirdService.sendPayLoad("PATCH", url, status, Conversation.class); }
java
public Conversation updateConversation(final String id, final ConversationStatus status) throws UnauthorizedException, GeneralException { if (id == null) { throw new IllegalArgumentException("Id must be specified."); } String url = String.format("%s%s/%s", CONVERSATIONS_BASE_URL, CONVERSATION_PATH, id); return messageBirdService.sendPayLoad("PATCH", url, status, Conversation.class); }
[ "public", "Conversation", "updateConversation", "(", "final", "String", "id", ",", "final", "ConversationStatus", "status", ")", "throws", "UnauthorizedException", ",", "GeneralException", "{", "if", "(", "id", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Id must be specified.\"", ")", ";", "}", "String", "url", "=", "String", ".", "format", "(", "\"%s%s/%s\"", ",", "CONVERSATIONS_BASE_URL", ",", "CONVERSATION_PATH", ",", "id", ")", ";", "return", "messageBirdService", ".", "sendPayLoad", "(", "\"PATCH\"", ",", "url", ",", "status", ",", "Conversation", ".", "class", ")", ";", "}" ]
Updates a conversation. @param id Conversation to update. @param status New status for the conversation. @return The updated Conversation.
[ "Updates", "a", "conversation", "." ]
train
https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L724-L731
VoltDB/voltdb
src/frontend/org/voltdb/utils/CatalogUtil.java
CatalogUtil.isSnapshotablePersistentTableView
public static boolean isSnapshotablePersistentTableView(Database db, Table table) { """ Test if a table is a persistent table view and should be included in the snapshot. @param db The database catalog @param table The table to test.</br> @return If the table is a persistent table view that should be snapshotted. """ Table materializer = table.getMaterializer(); if (materializer == null) { // Return false if it is not a materialized view. return false; } if (CatalogUtil.isTableExportOnly(db, materializer)) { // The view source table should not be a streamed table. return false; } if (! table.getIsreplicated() && table.getPartitioncolumn() == null) { // If the view table is implicitly partitioned (maybe was not in snapshot), // its maintenance is not turned off during the snapshot restore process. // Let it take care of its own data by itself. // Do not attempt to restore data for it. return false; } return true; }
java
public static boolean isSnapshotablePersistentTableView(Database db, Table table) { Table materializer = table.getMaterializer(); if (materializer == null) { // Return false if it is not a materialized view. return false; } if (CatalogUtil.isTableExportOnly(db, materializer)) { // The view source table should not be a streamed table. return false; } if (! table.getIsreplicated() && table.getPartitioncolumn() == null) { // If the view table is implicitly partitioned (maybe was not in snapshot), // its maintenance is not turned off during the snapshot restore process. // Let it take care of its own data by itself. // Do not attempt to restore data for it. return false; } return true; }
[ "public", "static", "boolean", "isSnapshotablePersistentTableView", "(", "Database", "db", ",", "Table", "table", ")", "{", "Table", "materializer", "=", "table", ".", "getMaterializer", "(", ")", ";", "if", "(", "materializer", "==", "null", ")", "{", "// Return false if it is not a materialized view.", "return", "false", ";", "}", "if", "(", "CatalogUtil", ".", "isTableExportOnly", "(", "db", ",", "materializer", ")", ")", "{", "// The view source table should not be a streamed table.", "return", "false", ";", "}", "if", "(", "!", "table", ".", "getIsreplicated", "(", ")", "&&", "table", ".", "getPartitioncolumn", "(", ")", "==", "null", ")", "{", "// If the view table is implicitly partitioned (maybe was not in snapshot),", "// its maintenance is not turned off during the snapshot restore process.", "// Let it take care of its own data by itself.", "// Do not attempt to restore data for it.", "return", "false", ";", "}", "return", "true", ";", "}" ]
Test if a table is a persistent table view and should be included in the snapshot. @param db The database catalog @param table The table to test.</br> @return If the table is a persistent table view that should be snapshotted.
[ "Test", "if", "a", "table", "is", "a", "persistent", "table", "view", "and", "should", "be", "included", "in", "the", "snapshot", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CatalogUtil.java#L418-L436
pravega/pravega
controller/src/main/java/io/pravega/controller/task/Stream/StreamMetadataTasks.java
StreamMetadataTasks.truncateStream
public CompletableFuture<UpdateStreamStatus.Status> truncateStream(final String scope, final String stream, final Map<Long, Long> streamCut, final OperationContext contextOpt) { """ Truncate a stream. @param scope scope. @param stream stream name. @param streamCut stream cut. @param contextOpt optional context @return update status. """ final OperationContext context = contextOpt == null ? streamMetadataStore.createContext(scope, stream) : contextOpt; final long requestId = requestTracker.getRequestIdFor("truncateStream", scope, stream); // 1. get stream cut return startTruncation(scope, stream, streamCut, context, requestId) // 4. check for truncation to complete .thenCompose(truncationStarted -> { if (truncationStarted) { return checkDone(() -> isTruncated(scope, stream, streamCut, context), 1000L) .thenApply(y -> UpdateStreamStatus.Status.SUCCESS); } else { log.warn(requestId, "Unable to start truncation for {}/{}", scope, stream); return CompletableFuture.completedFuture(UpdateStreamStatus.Status.FAILURE); } }) .exceptionally(ex -> { log.warn(requestId, "Exception thrown in trying to update stream configuration {}", ex); return handleUpdateStreamError(ex, requestId); }); }
java
public CompletableFuture<UpdateStreamStatus.Status> truncateStream(final String scope, final String stream, final Map<Long, Long> streamCut, final OperationContext contextOpt) { final OperationContext context = contextOpt == null ? streamMetadataStore.createContext(scope, stream) : contextOpt; final long requestId = requestTracker.getRequestIdFor("truncateStream", scope, stream); // 1. get stream cut return startTruncation(scope, stream, streamCut, context, requestId) // 4. check for truncation to complete .thenCompose(truncationStarted -> { if (truncationStarted) { return checkDone(() -> isTruncated(scope, stream, streamCut, context), 1000L) .thenApply(y -> UpdateStreamStatus.Status.SUCCESS); } else { log.warn(requestId, "Unable to start truncation for {}/{}", scope, stream); return CompletableFuture.completedFuture(UpdateStreamStatus.Status.FAILURE); } }) .exceptionally(ex -> { log.warn(requestId, "Exception thrown in trying to update stream configuration {}", ex); return handleUpdateStreamError(ex, requestId); }); }
[ "public", "CompletableFuture", "<", "UpdateStreamStatus", ".", "Status", ">", "truncateStream", "(", "final", "String", "scope", ",", "final", "String", "stream", ",", "final", "Map", "<", "Long", ",", "Long", ">", "streamCut", ",", "final", "OperationContext", "contextOpt", ")", "{", "final", "OperationContext", "context", "=", "contextOpt", "==", "null", "?", "streamMetadataStore", ".", "createContext", "(", "scope", ",", "stream", ")", ":", "contextOpt", ";", "final", "long", "requestId", "=", "requestTracker", ".", "getRequestIdFor", "(", "\"truncateStream\"", ",", "scope", ",", "stream", ")", ";", "// 1. get stream cut", "return", "startTruncation", "(", "scope", ",", "stream", ",", "streamCut", ",", "context", ",", "requestId", ")", "// 4. check for truncation to complete", ".", "thenCompose", "(", "truncationStarted", "->", "{", "if", "(", "truncationStarted", ")", "{", "return", "checkDone", "(", "(", ")", "->", "isTruncated", "(", "scope", ",", "stream", ",", "streamCut", ",", "context", ")", ",", "1000L", ")", ".", "thenApply", "(", "y", "->", "UpdateStreamStatus", ".", "Status", ".", "SUCCESS", ")", ";", "}", "else", "{", "log", ".", "warn", "(", "requestId", ",", "\"Unable to start truncation for {}/{}\"", ",", "scope", ",", "stream", ")", ";", "return", "CompletableFuture", ".", "completedFuture", "(", "UpdateStreamStatus", ".", "Status", ".", "FAILURE", ")", ";", "}", "}", ")", ".", "exceptionally", "(", "ex", "->", "{", "log", ".", "warn", "(", "requestId", ",", "\"Exception thrown in trying to update stream configuration {}\"", ",", "ex", ")", ";", "return", "handleUpdateStreamError", "(", "ex", ",", "requestId", ")", ";", "}", ")", ";", "}" ]
Truncate a stream. @param scope scope. @param stream stream name. @param streamCut stream cut. @param contextOpt optional context @return update status.
[ "Truncate", "a", "stream", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/task/Stream/StreamMetadataTasks.java#L364-L386
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/files/StaticFileServerHandler.java
StaticFileServerHandler.setContentTypeHeader
public static void setContentTypeHeader(HttpResponse response, File file) { """ Sets the content type header for the HTTP Response. @param response HTTP response @param file file to extract content type """ String mimeType = MimeTypes.getMimeTypeForFileName(file.getName()); String mimeFinal = mimeType != null ? mimeType : MimeTypes.getDefaultMimeType(); response.headers().set(CONTENT_TYPE, mimeFinal); }
java
public static void setContentTypeHeader(HttpResponse response, File file) { String mimeType = MimeTypes.getMimeTypeForFileName(file.getName()); String mimeFinal = mimeType != null ? mimeType : MimeTypes.getDefaultMimeType(); response.headers().set(CONTENT_TYPE, mimeFinal); }
[ "public", "static", "void", "setContentTypeHeader", "(", "HttpResponse", "response", ",", "File", "file", ")", "{", "String", "mimeType", "=", "MimeTypes", ".", "getMimeTypeForFileName", "(", "file", ".", "getName", "(", ")", ")", ";", "String", "mimeFinal", "=", "mimeType", "!=", "null", "?", "mimeType", ":", "MimeTypes", ".", "getDefaultMimeType", "(", ")", ";", "response", ".", "headers", "(", ")", ".", "set", "(", "CONTENT_TYPE", ",", "mimeFinal", ")", ";", "}" ]
Sets the content type header for the HTTP Response. @param response HTTP response @param file file to extract content type
[ "Sets", "the", "content", "type", "header", "for", "the", "HTTP", "Response", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rest/handler/legacy/files/StaticFileServerHandler.java#L372-L376
deephacks/confit
api-model/src/main/java/org/deephacks/confit/model/Bean.java
Bean.setProperty
public void setProperty(final String propertyName, final String value) { """ Overwrite the current values with the provided value. @param propertyName name of the property as defined by the bean's schema. @param value final String representations of the property that conforms to its type as defined by the bean's schema. """ Preconditions.checkNotNull(propertyName); if (value == null) { properties.put(propertyName, null); return; } List<String> values = new ArrayList<>(); values.add(value); properties.put(propertyName, values); }
java
public void setProperty(final String propertyName, final String value) { Preconditions.checkNotNull(propertyName); if (value == null) { properties.put(propertyName, null); return; } List<String> values = new ArrayList<>(); values.add(value); properties.put(propertyName, values); }
[ "public", "void", "setProperty", "(", "final", "String", "propertyName", ",", "final", "String", "value", ")", "{", "Preconditions", ".", "checkNotNull", "(", "propertyName", ")", ";", "if", "(", "value", "==", "null", ")", "{", "properties", ".", "put", "(", "propertyName", ",", "null", ")", ";", "return", ";", "}", "List", "<", "String", ">", "values", "=", "new", "ArrayList", "<>", "(", ")", ";", "values", ".", "add", "(", "value", ")", ";", "properties", ".", "put", "(", "propertyName", ",", "values", ")", ";", "}" ]
Overwrite the current values with the provided value. @param propertyName name of the property as defined by the bean's schema. @param value final String representations of the property that conforms to its type as defined by the bean's schema.
[ "Overwrite", "the", "current", "values", "with", "the", "provided", "value", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/api-model/src/main/java/org/deephacks/confit/model/Bean.java#L183-L192
awslabs/amazon-sqs-java-messaging-lib
src/main/java/com/amazon/sqs/javamessaging/message/SQSBytesMessage.java
SQSBytesMessage.readBytes
@Override public int readBytes(byte[] value, int length) throws JMSException { """ Reads a portion of the bytes message stream. <P> If the length of array value is less than the number of bytes remaining to be read from the stream, the array should be filled. A subsequent call reads the next increment, and so on. <P> If the number of bytes remaining in the stream is less than the length of array value, the bytes should be read into the array. The return value of the total number of bytes read will be less than the length of the array, indicating that there are no more bytes left to be read from the stream. The next read of the stream returns -1. <P> If length is negative, then an <code>IndexOutOfBoundsException</code> is thrown. No bytes will be read from the stream for this exception case. @param value The buffer into which the data is read @param length The number of bytes to read; must be less than or equal to value.length @return the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached @throws JMSException If the JMS provider fails to read the message due to some internal error. @throws MessageNotReadableException If the message is in write-only mode. """ if (length < 0) { throw new IndexOutOfBoundsException("Length bytes to read can't be smaller than 0 but was " + length); } checkCanRead(); try { /** * Almost copy of readFully implementation except that EOFException * is not thrown if the stream is at the end of file and no byte is * available */ int n = 0; while (n < length) { int count = dataIn.read(value, n, length - n); if (count < 0) { break; } n += count; } /** * JMS specification mentions that the next read of the stream * returns -1 if the previous read consumed the byte stream and * there are no more bytes left to be read from the stream */ if (n == 0 && length > 0) { n = -1; } return n; } catch (IOException e) { throw convertExceptionToJMSException(e); } }
java
@Override public int readBytes(byte[] value, int length) throws JMSException { if (length < 0) { throw new IndexOutOfBoundsException("Length bytes to read can't be smaller than 0 but was " + length); } checkCanRead(); try { /** * Almost copy of readFully implementation except that EOFException * is not thrown if the stream is at the end of file and no byte is * available */ int n = 0; while (n < length) { int count = dataIn.read(value, n, length - n); if (count < 0) { break; } n += count; } /** * JMS specification mentions that the next read of the stream * returns -1 if the previous read consumed the byte stream and * there are no more bytes left to be read from the stream */ if (n == 0 && length > 0) { n = -1; } return n; } catch (IOException e) { throw convertExceptionToJMSException(e); } }
[ "@", "Override", "public", "int", "readBytes", "(", "byte", "[", "]", "value", ",", "int", "length", ")", "throws", "JMSException", "{", "if", "(", "length", "<", "0", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"Length bytes to read can't be smaller than 0 but was \"", "+", "length", ")", ";", "}", "checkCanRead", "(", ")", ";", "try", "{", "/**\n * Almost copy of readFully implementation except that EOFException\n * is not thrown if the stream is at the end of file and no byte is\n * available\n */", "int", "n", "=", "0", ";", "while", "(", "n", "<", "length", ")", "{", "int", "count", "=", "dataIn", ".", "read", "(", "value", ",", "n", ",", "length", "-", "n", ")", ";", "if", "(", "count", "<", "0", ")", "{", "break", ";", "}", "n", "+=", "count", ";", "}", "/**\n * JMS specification mentions that the next read of the stream\n * returns -1 if the previous read consumed the byte stream and\n * there are no more bytes left to be read from the stream\n */", "if", "(", "n", "==", "0", "&&", "length", ">", "0", ")", "{", "n", "=", "-", "1", ";", "}", "return", "n", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "convertExceptionToJMSException", "(", "e", ")", ";", "}", "}" ]
Reads a portion of the bytes message stream. <P> If the length of array value is less than the number of bytes remaining to be read from the stream, the array should be filled. A subsequent call reads the next increment, and so on. <P> If the number of bytes remaining in the stream is less than the length of array value, the bytes should be read into the array. The return value of the total number of bytes read will be less than the length of the array, indicating that there are no more bytes left to be read from the stream. The next read of the stream returns -1. <P> If length is negative, then an <code>IndexOutOfBoundsException</code> is thrown. No bytes will be read from the stream for this exception case. @param value The buffer into which the data is read @param length The number of bytes to read; must be less than or equal to value.length @return the total number of bytes read into the buffer, or -1 if there is no more data because the end of the stream has been reached @throws JMSException If the JMS provider fails to read the message due to some internal error. @throws MessageNotReadableException If the message is in write-only mode.
[ "Reads", "a", "portion", "of", "the", "bytes", "message", "stream", ".", "<P", ">", "If", "the", "length", "of", "array", "value", "is", "less", "than", "the", "number", "of", "bytes", "remaining", "to", "be", "read", "from", "the", "stream", "the", "array", "should", "be", "filled", ".", "A", "subsequent", "call", "reads", "the", "next", "increment", "and", "so", "on", ".", "<P", ">", "If", "the", "number", "of", "bytes", "remaining", "in", "the", "stream", "is", "less", "than", "the", "length", "of", "array", "value", "the", "bytes", "should", "be", "read", "into", "the", "array", ".", "The", "return", "value", "of", "the", "total", "number", "of", "bytes", "read", "will", "be", "less", "than", "the", "length", "of", "the", "array", "indicating", "that", "there", "are", "no", "more", "bytes", "left", "to", "be", "read", "from", "the", "stream", ".", "The", "next", "read", "of", "the", "stream", "returns", "-", "1", ".", "<P", ">", "If", "length", "is", "negative", "then", "an", "<code", ">", "IndexOutOfBoundsException<", "/", "code", ">", "is", "thrown", ".", "No", "bytes", "will", "be", "read", "from", "the", "stream", "for", "this", "exception", "case", "." ]
train
https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/message/SQSBytesMessage.java#L428-L461
Stratio/stratio-cassandra
src/java/org/apache/cassandra/cql3/ErrorCollector.java
ErrorCollector.appendQuerySnippet
private void appendQuerySnippet(Parser parser, StringBuilder builder) { """ Appends a query snippet to the message to help the user to understand the problem. @param parser the parser used to parse the query @param builder the <code>StringBuilder</code> used to build the error message """ TokenStream tokenStream = parser.getTokenStream(); int index = tokenStream.index(); int size = tokenStream.size(); Token from = tokenStream.get(getSnippetFirstTokenIndex(index)); Token to = tokenStream.get(getSnippetLastTokenIndex(index, size)); Token offending = tokenStream.get(getOffendingTokenIndex(index, size)); appendSnippet(builder, from, to, offending); }
java
private void appendQuerySnippet(Parser parser, StringBuilder builder) { TokenStream tokenStream = parser.getTokenStream(); int index = tokenStream.index(); int size = tokenStream.size(); Token from = tokenStream.get(getSnippetFirstTokenIndex(index)); Token to = tokenStream.get(getSnippetLastTokenIndex(index, size)); Token offending = tokenStream.get(getOffendingTokenIndex(index, size)); appendSnippet(builder, from, to, offending); }
[ "private", "void", "appendQuerySnippet", "(", "Parser", "parser", ",", "StringBuilder", "builder", ")", "{", "TokenStream", "tokenStream", "=", "parser", ".", "getTokenStream", "(", ")", ";", "int", "index", "=", "tokenStream", ".", "index", "(", ")", ";", "int", "size", "=", "tokenStream", ".", "size", "(", ")", ";", "Token", "from", "=", "tokenStream", ".", "get", "(", "getSnippetFirstTokenIndex", "(", "index", ")", ")", ";", "Token", "to", "=", "tokenStream", ".", "get", "(", "getSnippetLastTokenIndex", "(", "index", ",", "size", ")", ")", ";", "Token", "offending", "=", "tokenStream", ".", "get", "(", "getOffendingTokenIndex", "(", "index", ",", "size", ")", ")", ";", "appendSnippet", "(", "builder", ",", "from", ",", "to", ",", "offending", ")", ";", "}" ]
Appends a query snippet to the message to help the user to understand the problem. @param parser the parser used to parse the query @param builder the <code>StringBuilder</code> used to build the error message
[ "Appends", "a", "query", "snippet", "to", "the", "message", "to", "help", "the", "user", "to", "understand", "the", "problem", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cql3/ErrorCollector.java#L110-L121
apache/groovy
src/main/groovy/groovy/lang/ProxyMetaClass.java
ProxyMetaClass.invokeMethod
@Override public Object invokeMethod(final Class sender, final Object object, final String methodName, final Object[] arguments, final boolean isCallToSuper, final boolean fromInsideClass) { """ Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor. With Interceptor the call is nested in its beforeInvoke and afterInvoke methods. The method call is suppressed if Interceptor.doInvoke() returns false. See Interceptor for details. """ return doCall(object, methodName, arguments, interceptor, new Callable() { public Object call() { return adaptee.invokeMethod(sender, object, methodName, arguments, isCallToSuper, fromInsideClass); } }); }
java
@Override public Object invokeMethod(final Class sender, final Object object, final String methodName, final Object[] arguments, final boolean isCallToSuper, final boolean fromInsideClass) { return doCall(object, methodName, arguments, interceptor, new Callable() { public Object call() { return adaptee.invokeMethod(sender, object, methodName, arguments, isCallToSuper, fromInsideClass); } }); }
[ "@", "Override", "public", "Object", "invokeMethod", "(", "final", "Class", "sender", ",", "final", "Object", "object", ",", "final", "String", "methodName", ",", "final", "Object", "[", "]", "arguments", ",", "final", "boolean", "isCallToSuper", ",", "final", "boolean", "fromInsideClass", ")", "{", "return", "doCall", "(", "object", ",", "methodName", ",", "arguments", ",", "interceptor", ",", "new", "Callable", "(", ")", "{", "public", "Object", "call", "(", ")", "{", "return", "adaptee", ".", "invokeMethod", "(", "sender", ",", "object", ",", "methodName", ",", "arguments", ",", "isCallToSuper", ",", "fromInsideClass", ")", ";", "}", "}", ")", ";", "}" ]
Call invokeMethod on adaptee with logic like in MetaClass unless we have an Interceptor. With Interceptor the call is nested in its beforeInvoke and afterInvoke methods. The method call is suppressed if Interceptor.doInvoke() returns false. See Interceptor for details.
[ "Call", "invokeMethod", "on", "adaptee", "with", "logic", "like", "in", "MetaClass", "unless", "we", "have", "an", "Interceptor", ".", "With", "Interceptor", "the", "call", "is", "nested", "in", "its", "beforeInvoke", "and", "afterInvoke", "methods", ".", "The", "method", "call", "is", "suppressed", "if", "Interceptor", ".", "doInvoke", "()", "returns", "false", ".", "See", "Interceptor", "for", "details", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/ProxyMetaClass.java#L131-L138
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java
ValueFileIOHelper.copyClose
protected long copyClose(InputStream in, OutputStream out) throws IOException { """ Copy input to output data using NIO. Input and output streams will be closed after the operation. @param in InputStream @param out OutputStream @return The number of bytes, possibly zero, that were actually copied @throws IOException if error occurs """ try { try { return copy(in, out); } finally { in.close(); } } finally { out.close(); } }
java
protected long copyClose(InputStream in, OutputStream out) throws IOException { try { try { return copy(in, out); } finally { in.close(); } } finally { out.close(); } }
[ "protected", "long", "copyClose", "(", "InputStream", "in", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "try", "{", "try", "{", "return", "copy", "(", "in", ",", "out", ")", ";", "}", "finally", "{", "in", ".", "close", "(", ")", ";", "}", "}", "finally", "{", "out", ".", "close", "(", ")", ";", "}", "}" ]
Copy input to output data using NIO. Input and output streams will be closed after the operation. @param in InputStream @param out OutputStream @return The number of bytes, possibly zero, that were actually copied @throws IOException if error occurs
[ "Copy", "input", "to", "output", "data", "using", "NIO", ".", "Input", "and", "output", "streams", "will", "be", "closed", "after", "the", "operation", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/value/fs/operations/ValueFileIOHelper.java#L310-L327
briandilley/jsonrpc4j
src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java
JsonRpcClient.readResponse
private Object readResponse(Type returnType, InputStream input, String id) throws Throwable { """ Reads a JSON-PRC response from the server. This blocks until a response is received. If an id is given, responses that do not correspond, are disregarded. @param returnType the expected return type @param input the {@link InputStream} to read from @param id The id used to compare the response with. @return the object returned by the JSON-RPC response @throws Throwable on error """ ReadContext context = ReadContext.getReadContext(input, mapper); ObjectNode jsonObject = getValidResponse(id, context); notifyAnswerListener(jsonObject); handleErrorResponse(jsonObject); if (hasResult(jsonObject)) { if (isReturnTypeInvalid(returnType)) { return null; } return constructResponseObject(returnType, jsonObject); } // no return type return null; }
java
private Object readResponse(Type returnType, InputStream input, String id) throws Throwable { ReadContext context = ReadContext.getReadContext(input, mapper); ObjectNode jsonObject = getValidResponse(id, context); notifyAnswerListener(jsonObject); handleErrorResponse(jsonObject); if (hasResult(jsonObject)) { if (isReturnTypeInvalid(returnType)) { return null; } return constructResponseObject(returnType, jsonObject); } // no return type return null; }
[ "private", "Object", "readResponse", "(", "Type", "returnType", ",", "InputStream", "input", ",", "String", "id", ")", "throws", "Throwable", "{", "ReadContext", "context", "=", "ReadContext", ".", "getReadContext", "(", "input", ",", "mapper", ")", ";", "ObjectNode", "jsonObject", "=", "getValidResponse", "(", "id", ",", "context", ")", ";", "notifyAnswerListener", "(", "jsonObject", ")", ";", "handleErrorResponse", "(", "jsonObject", ")", ";", "if", "(", "hasResult", "(", "jsonObject", ")", ")", "{", "if", "(", "isReturnTypeInvalid", "(", "returnType", ")", ")", "{", "return", "null", ";", "}", "return", "constructResponseObject", "(", "returnType", ",", "jsonObject", ")", ";", "}", "// no return type", "return", "null", ";", "}" ]
Reads a JSON-PRC response from the server. This blocks until a response is received. If an id is given, responses that do not correspond, are disregarded. @param returnType the expected return type @param input the {@link InputStream} to read from @param id The id used to compare the response with. @return the object returned by the JSON-RPC response @throws Throwable on error
[ "Reads", "a", "JSON", "-", "PRC", "response", "from", "the", "server", ".", "This", "blocks", "until", "a", "response", "is", "received", ".", "If", "an", "id", "is", "given", "responses", "that", "do", "not", "correspond", "are", "disregarded", "." ]
train
https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java#L191-L207
apache/incubator-druid
sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java
Calcites.calciteDateToJoda
public static DateTime calciteDateToJoda(final int date, final DateTimeZone timeZone) { """ The inverse of {@link #jodaToCalciteDate(DateTime, DateTimeZone)}. @param date Calcite style date @param timeZone session time zone @return joda timestamp, with time zone set to the session time zone """ return DateTimes.EPOCH.plusDays(date).withZoneRetainFields(timeZone); }
java
public static DateTime calciteDateToJoda(final int date, final DateTimeZone timeZone) { return DateTimes.EPOCH.plusDays(date).withZoneRetainFields(timeZone); }
[ "public", "static", "DateTime", "calciteDateToJoda", "(", "final", "int", "date", ",", "final", "DateTimeZone", "timeZone", ")", "{", "return", "DateTimes", ".", "EPOCH", ".", "plusDays", "(", "date", ")", ".", "withZoneRetainFields", "(", "timeZone", ")", ";", "}" ]
The inverse of {@link #jodaToCalciteDate(DateTime, DateTimeZone)}. @param date Calcite style date @param timeZone session time zone @return joda timestamp, with time zone set to the session time zone
[ "The", "inverse", "of", "{", "@link", "#jodaToCalciteDate", "(", "DateTime", "DateTimeZone", ")", "}", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L338-L341
ugli/jocote
src/main/java/se/ugli/jocote/lpr/SocketFactory.java
SocketFactory.create
static Socket create(String hostName, int port, boolean useOutOfBoundsPorts) throws IOException { """ /* The RFC for lpr specifies the use of local ports numbered 721 - 731, however TCP/IP also requires that any port that is used will not be released for 3 minutes which means that it get stuck on the 12th job if prints are sent quickly. To resolve this issue you can use out of bounds ports which most print servers will support """ if (useOutOfBoundsPorts) { return IntStream.rangeClosed(721, 731).mapToObj(localPort -> { try { return Optional.of(new Socket(hostName, port, InetAddress.getLocalHost(), localPort)); } catch (IOException e) { return Optional.<Socket>empty(); } }).filter(Optional::isPresent).map(Optional::get).findFirst().orElseThrow(() -> new BindException("Can't bind to local port/address")); } return new Socket(hostName, port); }
java
static Socket create(String hostName, int port, boolean useOutOfBoundsPorts) throws IOException { if (useOutOfBoundsPorts) { return IntStream.rangeClosed(721, 731).mapToObj(localPort -> { try { return Optional.of(new Socket(hostName, port, InetAddress.getLocalHost(), localPort)); } catch (IOException e) { return Optional.<Socket>empty(); } }).filter(Optional::isPresent).map(Optional::get).findFirst().orElseThrow(() -> new BindException("Can't bind to local port/address")); } return new Socket(hostName, port); }
[ "static", "Socket", "create", "(", "String", "hostName", ",", "int", "port", ",", "boolean", "useOutOfBoundsPorts", ")", "throws", "IOException", "{", "if", "(", "useOutOfBoundsPorts", ")", "{", "return", "IntStream", ".", "rangeClosed", "(", "721", ",", "731", ")", ".", "mapToObj", "(", "localPort", "->", "{", "try", "{", "return", "Optional", ".", "of", "(", "new", "Socket", "(", "hostName", ",", "port", ",", "InetAddress", ".", "getLocalHost", "(", ")", ",", "localPort", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "Optional", ".", "<", "Socket", ">", "empty", "(", ")", ";", "}", "}", ")", ".", "filter", "(", "Optional", "::", "isPresent", ")", ".", "map", "(", "Optional", "::", "get", ")", ".", "findFirst", "(", ")", ".", "orElseThrow", "(", "(", ")", "->", "new", "BindException", "(", "\"Can't bind to local port/address\"", ")", ")", ";", "}", "return", "new", "Socket", "(", "hostName", ",", "port", ")", ";", "}" ]
/* The RFC for lpr specifies the use of local ports numbered 721 - 731, however TCP/IP also requires that any port that is used will not be released for 3 minutes which means that it get stuck on the 12th job if prints are sent quickly. To resolve this issue you can use out of bounds ports which most print servers will support
[ "/", "*", "The", "RFC", "for", "lpr", "specifies", "the", "use", "of", "local", "ports", "numbered", "721", "-", "731", "however", "TCP", "/", "IP", "also", "requires", "that", "any", "port", "that", "is", "used", "will", "not", "be", "released", "for", "3", "minutes", "which", "means", "that", "it", "get", "stuck", "on", "the", "12th", "job", "if", "prints", "are", "sent", "quickly", "." ]
train
https://github.com/ugli/jocote/blob/28c34eb5aadbca6597bf006bb92d4fc340c71b41/src/main/java/se/ugli/jocote/lpr/SocketFactory.java#L22-L33
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/SerializerSwitcher.java
SerializerSwitcher.getOutputPropertyNoDefault
private static String getOutputPropertyNoDefault(String qnameString, Properties props) throws IllegalArgumentException { """ Get the value of a property, without using the default properties. This can be used to test if a property has been explicitly set by the stylesheet or user. @param name The property name, which is a fully-qualified URI. @return The value of the property, or null if not found. @throws IllegalArgumentException If the property is not supported, and is not namespaced. """ String value = (String)props.get(qnameString); return value; }
java
private static String getOutputPropertyNoDefault(String qnameString, Properties props) throws IllegalArgumentException { String value = (String)props.get(qnameString); return value; }
[ "private", "static", "String", "getOutputPropertyNoDefault", "(", "String", "qnameString", ",", "Properties", "props", ")", "throws", "IllegalArgumentException", "{", "String", "value", "=", "(", "String", ")", "props", ".", "get", "(", "qnameString", ")", ";", "return", "value", ";", "}" ]
Get the value of a property, without using the default properties. This can be used to test if a property has been explicitly set by the stylesheet or user. @param name The property name, which is a fully-qualified URI. @return The value of the property, or null if not found. @throws IllegalArgumentException If the property is not supported, and is not namespaced.
[ "Get", "the", "value", "of", "a", "property", "without", "using", "the", "default", "properties", ".", "This", "can", "be", "used", "to", "test", "if", "a", "property", "has", "been", "explicitly", "set", "by", "the", "stylesheet", "or", "user", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/SerializerSwitcher.java#L131-L137
hdecarne/java-default
src/main/java/de/carne/util/ManifestInfos.java
ManifestInfos.getMainAttribute
public String getMainAttribute(String attributeName, String defaultValue) { """ Gets a manifest's main attribute. @param attributeName the attribute name to get. @param defaultValue the default value to return in case the attribute undefined. @return the found attribute value or the submitted default value in case the attribute is undefined. """ Attributes attributes = this.manifest.getMainAttributes(); String attributeValue = (attributes != null ? attributes.getValue(attributeName) : null); return (attributeValue != null ? attributeValue : defaultValue); }
java
public String getMainAttribute(String attributeName, String defaultValue) { Attributes attributes = this.manifest.getMainAttributes(); String attributeValue = (attributes != null ? attributes.getValue(attributeName) : null); return (attributeValue != null ? attributeValue : defaultValue); }
[ "public", "String", "getMainAttribute", "(", "String", "attributeName", ",", "String", "defaultValue", ")", "{", "Attributes", "attributes", "=", "this", ".", "manifest", ".", "getMainAttributes", "(", ")", ";", "String", "attributeValue", "=", "(", "attributes", "!=", "null", "?", "attributes", ".", "getValue", "(", "attributeName", ")", ":", "null", ")", ";", "return", "(", "attributeValue", "!=", "null", "?", "attributeValue", ":", "defaultValue", ")", ";", "}" ]
Gets a manifest's main attribute. @param attributeName the attribute name to get. @param defaultValue the default value to return in case the attribute undefined. @return the found attribute value or the submitted default value in case the attribute is undefined.
[ "Gets", "a", "manifest", "s", "main", "attribute", "." ]
train
https://github.com/hdecarne/java-default/blob/ca16f6fdb0436e90e9e2df3106055e320bb3c9e3/src/main/java/de/carne/util/ManifestInfos.java#L68-L73
twitter/finagle
finagle-serversets/src/main/java/com/twitter/finagle/common/zookeeper/ZooKeeperClient.java
ZooKeeperClient.get
public synchronized ZooKeeper get(Duration connectionTimeout) throws ZooKeeperConnectionException, InterruptedException, TimeoutException { """ Returns the current active ZK connection or establishes a new one if none has yet been established or a previous connection was disconnected or had its session time out. This method will attempt to re-use sessions when possible. @param connectionTimeout the maximum amount of time to wait for the connection to the ZK cluster to be established; 0 to wait forever @return a connected ZooKeeper client @throws ZooKeeperConnectionException if there was a problem connecting to the ZK cluster @throws InterruptedException if interrupted while waiting for a connection to be established @throws TimeoutException if a connection could not be established within the configured session timeout """ if (zooKeeper == null) { final CountDownLatch connected = new CountDownLatch(1); Watcher watcher = new Watcher() { @Override public void process(WatchedEvent event) { switch (event.getType()) { // Guard the None type since this watch may be used as the default watch on calls by // the client outside our control. case None: switch (event.getState()) { case Expired: LOG.info("Zookeeper session expired. Event: " + event); close(); break; case SyncConnected: connected.countDown(); break; default: break; // nop } break; default: break; // nop } eventQueue.offer(event); } }; try { zooKeeper = (sessionState != null) ? new ZooKeeper(connectString, sessionTimeoutMs, watcher, sessionState.sessionId, sessionState.sessionPasswd) : new ZooKeeper(connectString, sessionTimeoutMs, watcher); } catch (IOException e) { throw new ZooKeeperConnectionException( "Problem connecting to servers: " + zooKeeperServers, e); } if (connectionTimeout.inMillis() > 0) { if (!connected.await(connectionTimeout.inMillis(), TimeUnit.MILLISECONDS)) { close(); throw new TimeoutException("Timed out waiting for a ZK connection after " + connectionTimeout); } } else { try { connected.await(); } catch (InterruptedException ex) { LOG.info("Interrupted while waiting to connect to zooKeeper"); close(); throw ex; } } credentials.authenticate(zooKeeper); sessionState = new SessionState(zooKeeper.getSessionId(), zooKeeper.getSessionPasswd()); } return zooKeeper; }
java
public synchronized ZooKeeper get(Duration connectionTimeout) throws ZooKeeperConnectionException, InterruptedException, TimeoutException { if (zooKeeper == null) { final CountDownLatch connected = new CountDownLatch(1); Watcher watcher = new Watcher() { @Override public void process(WatchedEvent event) { switch (event.getType()) { // Guard the None type since this watch may be used as the default watch on calls by // the client outside our control. case None: switch (event.getState()) { case Expired: LOG.info("Zookeeper session expired. Event: " + event); close(); break; case SyncConnected: connected.countDown(); break; default: break; // nop } break; default: break; // nop } eventQueue.offer(event); } }; try { zooKeeper = (sessionState != null) ? new ZooKeeper(connectString, sessionTimeoutMs, watcher, sessionState.sessionId, sessionState.sessionPasswd) : new ZooKeeper(connectString, sessionTimeoutMs, watcher); } catch (IOException e) { throw new ZooKeeperConnectionException( "Problem connecting to servers: " + zooKeeperServers, e); } if (connectionTimeout.inMillis() > 0) { if (!connected.await(connectionTimeout.inMillis(), TimeUnit.MILLISECONDS)) { close(); throw new TimeoutException("Timed out waiting for a ZK connection after " + connectionTimeout); } } else { try { connected.await(); } catch (InterruptedException ex) { LOG.info("Interrupted while waiting to connect to zooKeeper"); close(); throw ex; } } credentials.authenticate(zooKeeper); sessionState = new SessionState(zooKeeper.getSessionId(), zooKeeper.getSessionPasswd()); } return zooKeeper; }
[ "public", "synchronized", "ZooKeeper", "get", "(", "Duration", "connectionTimeout", ")", "throws", "ZooKeeperConnectionException", ",", "InterruptedException", ",", "TimeoutException", "{", "if", "(", "zooKeeper", "==", "null", ")", "{", "final", "CountDownLatch", "connected", "=", "new", "CountDownLatch", "(", "1", ")", ";", "Watcher", "watcher", "=", "new", "Watcher", "(", ")", "{", "@", "Override", "public", "void", "process", "(", "WatchedEvent", "event", ")", "{", "switch", "(", "event", ".", "getType", "(", ")", ")", "{", "// Guard the None type since this watch may be used as the default watch on calls by", "// the client outside our control.", "case", "None", ":", "switch", "(", "event", ".", "getState", "(", ")", ")", "{", "case", "Expired", ":", "LOG", ".", "info", "(", "\"Zookeeper session expired. Event: \"", "+", "event", ")", ";", "close", "(", ")", ";", "break", ";", "case", "SyncConnected", ":", "connected", ".", "countDown", "(", ")", ";", "break", ";", "default", ":", "break", ";", "// nop", "}", "break", ";", "default", ":", "break", ";", "// nop", "}", "eventQueue", ".", "offer", "(", "event", ")", ";", "}", "}", ";", "try", "{", "zooKeeper", "=", "(", "sessionState", "!=", "null", ")", "?", "new", "ZooKeeper", "(", "connectString", ",", "sessionTimeoutMs", ",", "watcher", ",", "sessionState", ".", "sessionId", ",", "sessionState", ".", "sessionPasswd", ")", ":", "new", "ZooKeeper", "(", "connectString", ",", "sessionTimeoutMs", ",", "watcher", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "ZooKeeperConnectionException", "(", "\"Problem connecting to servers: \"", "+", "zooKeeperServers", ",", "e", ")", ";", "}", "if", "(", "connectionTimeout", ".", "inMillis", "(", ")", ">", "0", ")", "{", "if", "(", "!", "connected", ".", "await", "(", "connectionTimeout", ".", "inMillis", "(", ")", ",", "TimeUnit", ".", "MILLISECONDS", ")", ")", "{", "close", "(", ")", ";", "throw", "new", "TimeoutException", "(", "\"Timed out waiting for a ZK connection after \"", "+", "connectionTimeout", ")", ";", "}", "}", "else", "{", "try", "{", "connected", ".", "await", "(", ")", ";", "}", "catch", "(", "InterruptedException", "ex", ")", "{", "LOG", ".", "info", "(", "\"Interrupted while waiting to connect to zooKeeper\"", ")", ";", "close", "(", ")", ";", "throw", "ex", ";", "}", "}", "credentials", ".", "authenticate", "(", "zooKeeper", ")", ";", "sessionState", "=", "new", "SessionState", "(", "zooKeeper", ".", "getSessionId", "(", ")", ",", "zooKeeper", ".", "getSessionPasswd", "(", ")", ")", ";", "}", "return", "zooKeeper", ";", "}" ]
Returns the current active ZK connection or establishes a new one if none has yet been established or a previous connection was disconnected or had its session time out. This method will attempt to re-use sessions when possible. @param connectionTimeout the maximum amount of time to wait for the connection to the ZK cluster to be established; 0 to wait forever @return a connected ZooKeeper client @throws ZooKeeperConnectionException if there was a problem connecting to the ZK cluster @throws InterruptedException if interrupted while waiting for a connection to be established @throws TimeoutException if a connection could not be established within the configured session timeout
[ "Returns", "the", "current", "active", "ZK", "connection", "or", "establishes", "a", "new", "one", "if", "none", "has", "yet", "been", "established", "or", "a", "previous", "connection", "was", "disconnected", "or", "had", "its", "session", "time", "out", ".", "This", "method", "will", "attempt", "to", "re", "-", "use", "sessions", "when", "possible", "." ]
train
https://github.com/twitter/finagle/blob/872be5f2b147fa50351bdbf08b003a26745e1df8/finagle-serversets/src/main/java/com/twitter/finagle/common/zookeeper/ZooKeeperClient.java#L357-L418
loldevs/riotapi
rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java
ThrottledApiHandler.getLeagues
public Future<Map<String, List<LeagueList>>> getLeagues(String... teamIds) { """ Get a listing of leagues for the specified teams @param teamIds The ids of the team @return A mapping of team ids to lists of leagues @see <a href=https://developer.riotgames.com/api/methods#!/593/1860>Official API documentation</a> """ return new ApiFuture<>(() -> handler.getLeagues(teamIds)); }
java
public Future<Map<String, List<LeagueList>>> getLeagues(String... teamIds) { return new ApiFuture<>(() -> handler.getLeagues(teamIds)); }
[ "public", "Future", "<", "Map", "<", "String", ",", "List", "<", "LeagueList", ">", ">", ">", "getLeagues", "(", "String", "...", "teamIds", ")", "{", "return", "new", "ApiFuture", "<>", "(", "(", ")", "->", "handler", ".", "getLeagues", "(", "teamIds", ")", ")", ";", "}" ]
Get a listing of leagues for the specified teams @param teamIds The ids of the team @return A mapping of team ids to lists of leagues @see <a href=https://developer.riotgames.com/api/methods#!/593/1860>Official API documentation</a>
[ "Get", "a", "listing", "of", "leagues", "for", "the", "specified", "teams" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L275-L277