repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java
Path3d.getClosestPointTo
public static Point3d getClosestPointTo(PathIterator3d pathIterator, double x, double y, double z) { Point3d closest = null; double bestDist = Double.POSITIVE_INFINITY; Point3d candidate; AbstractPathElement3D pe = pathIterator.next(); Path3d subPath; if (pe.type != PathElementType.MOVE_TO) { throw new IllegalArgumentException("missing initial moveto in path definition"); } candidate = new Point3d(pe.getToX(), pe.getToY(), pe.getToZ()); while (pathIterator.hasNext()) { pe = pathIterator.next(); candidate = null; switch(pe.type) { case MOVE_TO: candidate = new Point3d(pe.getToX(), pe.getToY(), pe.getToZ()); break; case LINE_TO: candidate = new Point3d((new Segment3d(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3d(x,y,z))); break; case CLOSE: if (!pe.isEmpty()) { candidate = new Point3d((new Segment3d(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3d(x,y,z))); } break; case QUAD_TO: subPath = new Path3d(); subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ()); subPath.quadTo( pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(), pe.getToX(), pe.getToY(), pe.getToZ()); candidate = subPath.getClosestPointTo(new Point3d(x,y,z)); break; case CURVE_TO: subPath = new Path3d(); subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ()); subPath.curveTo( pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(), pe.getCtrlX2(), pe.getCtrlY2(), pe.getCtrlZ2(), pe.getToX(), pe.getToY(), pe.getToZ()); candidate = subPath.getClosestPointTo(new Point3d(x,y,z)); break; default: throw new IllegalStateException( pe.type==null ? null : pe.type.toString()); } if (candidate!=null) { double d = candidate.getDistanceSquared(new Point3d(x,y,z)); if (d<bestDist) { bestDist = d; closest = candidate; } } } return closest; }
java
public static Point3d getClosestPointTo(PathIterator3d pathIterator, double x, double y, double z) { Point3d closest = null; double bestDist = Double.POSITIVE_INFINITY; Point3d candidate; AbstractPathElement3D pe = pathIterator.next(); Path3d subPath; if (pe.type != PathElementType.MOVE_TO) { throw new IllegalArgumentException("missing initial moveto in path definition"); } candidate = new Point3d(pe.getToX(), pe.getToY(), pe.getToZ()); while (pathIterator.hasNext()) { pe = pathIterator.next(); candidate = null; switch(pe.type) { case MOVE_TO: candidate = new Point3d(pe.getToX(), pe.getToY(), pe.getToZ()); break; case LINE_TO: candidate = new Point3d((new Segment3d(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3d(x,y,z))); break; case CLOSE: if (!pe.isEmpty()) { candidate = new Point3d((new Segment3d(pe.getFromX(), pe.getFromY(), pe.getFromZ(), pe.getToX(), pe.getToY(), pe.getToZ())).getClosestPointTo(new Point3d(x,y,z))); } break; case QUAD_TO: subPath = new Path3d(); subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ()); subPath.quadTo( pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(), pe.getToX(), pe.getToY(), pe.getToZ()); candidate = subPath.getClosestPointTo(new Point3d(x,y,z)); break; case CURVE_TO: subPath = new Path3d(); subPath.moveTo(pe.getFromX(), pe.getFromY(), pe.getFromZ()); subPath.curveTo( pe.getCtrlX1(), pe.getCtrlY1(), pe.getCtrlZ1(), pe.getCtrlX2(), pe.getCtrlY2(), pe.getCtrlZ2(), pe.getToX(), pe.getToY(), pe.getToZ()); candidate = subPath.getClosestPointTo(new Point3d(x,y,z)); break; default: throw new IllegalStateException( pe.type==null ? null : pe.type.toString()); } if (candidate!=null) { double d = candidate.getDistanceSquared(new Point3d(x,y,z)); if (d<bestDist) { bestDist = d; closest = candidate; } } } return closest; }
[ "public", "static", "Point3d", "getClosestPointTo", "(", "PathIterator3d", "pathIterator", ",", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "Point3d", "closest", "=", "null", ";", "double", "bestDist", "=", "Double", ".", "POSITIVE_INFINIT...
Replies the point on the path that is closest to the given point. <p> <strong>CAUTION:</strong> This function works only on path iterators that are replying polyline primitives, ie. if the {@link PathIterator3d#isPolyline()} of <var>pi</var> is replying <code>true</code>. {@link #getClosestPointTo(Point3D)} avoids this restriction. @param pi is the iterator on the elements of the path. @param x @param y @param z @return the closest point on the shape; or the point itself if it is inside the shape.
[ "Replies", "the", "point", "on", "the", "path", "that", "is", "closest", "to", "the", "given", "point", ".", "<p", ">", "<strong", ">", "CAUTION", ":", "<", "/", "strong", ">", "This", "function", "works", "only", "on", "path", "iterators", "that", "ar...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L106-L172
mabe02/lanterna
src/main/java/com/googlecode/lanterna/TerminalTextUtils.java
TerminalTextUtils.getANSIControlSequenceLength
public static int getANSIControlSequenceLength(String string, int index) { int len = 0, restlen = string.length() - index; if (restlen >= 3) { // Control sequences require a minimum of three characters char esc = string.charAt(index), bracket = string.charAt(index+1); if (esc == 0x1B && bracket == '[') { // escape & open bracket len = 3; // esc,bracket and (later)terminator. // digits or semicolons can still precede the terminator: for (int i = 2; i < restlen; i++) { char ch = string.charAt(i + index); // only ascii-digits or semicolons allowed here: if ( (ch >= '0' && ch <= '9') || ch == ';') { len++; } else { break; } } // if string ends in digits/semicolons, then it's not a sequence. if (len > restlen) { len = 0; } } } return len; }
java
public static int getANSIControlSequenceLength(String string, int index) { int len = 0, restlen = string.length() - index; if (restlen >= 3) { // Control sequences require a minimum of three characters char esc = string.charAt(index), bracket = string.charAt(index+1); if (esc == 0x1B && bracket == '[') { // escape & open bracket len = 3; // esc,bracket and (later)terminator. // digits or semicolons can still precede the terminator: for (int i = 2; i < restlen; i++) { char ch = string.charAt(i + index); // only ascii-digits or semicolons allowed here: if ( (ch >= '0' && ch <= '9') || ch == ';') { len++; } else { break; } } // if string ends in digits/semicolons, then it's not a sequence. if (len > restlen) { len = 0; } } } return len; }
[ "public", "static", "int", "getANSIControlSequenceLength", "(", "String", "string", ",", "int", "index", ")", "{", "int", "len", "=", "0", ",", "restlen", "=", "string", ".", "length", "(", ")", "-", "index", ";", "if", "(", "restlen", ">=", "3", ")", ...
Given a string and an index in that string, returns the number of characters starting at index that make up a complete ANSI control sequence. If there is no control sequence starting there, the method will return 0. @param string String to scan for control sequences @param index Index in the string where the control sequence begins @return {@code 0} if there was no control sequence starting at the specified index, otherwise the length of the entire control sequence
[ "Given", "a", "string", "and", "an", "index", "in", "that", "string", "returns", "the", "number", "of", "characters", "starting", "at", "index", "that", "make", "up", "a", "complete", "ANSI", "control", "sequence", ".", "If", "there", "is", "no", "control"...
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/TerminalTextUtils.java#L64-L88
opengeospatial/teamengine
teamengine-core/src/main/java/com/occamlab/te/util/DocumentationHelper.java
DocumentationHelper.prettyprint
private void prettyprint(String xmlLogsFile, FileOutputStream htmlReportFile) throws Exception { TransformerFactory tFactory = TransformerFactory.newInstance(); // Fortify Mod: prevent external entity injection tFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); // Fortify Mod: prevent external entity injection factory.setExpandEntityReferences(false); factory.setNamespaceAware(true); factory.setXIncludeAware(true); DocumentBuilder parser = factory.newDocumentBuilder(); Document document = parser.parse(xmlLogsFile); Transformer transformer = tFactory.newTransformer(new StreamSource( xsltFileHandler)); transformer.transform(new DOMSource(document), new StreamResult( htmlReportFile)); }
java
private void prettyprint(String xmlLogsFile, FileOutputStream htmlReportFile) throws Exception { TransformerFactory tFactory = TransformerFactory.newInstance(); // Fortify Mod: prevent external entity injection tFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); // Fortify Mod: prevent external entity injection factory.setExpandEntityReferences(false); factory.setNamespaceAware(true); factory.setXIncludeAware(true); DocumentBuilder parser = factory.newDocumentBuilder(); Document document = parser.parse(xmlLogsFile); Transformer transformer = tFactory.newTransformer(new StreamSource( xsltFileHandler)); transformer.transform(new DOMSource(document), new StreamResult( htmlReportFile)); }
[ "private", "void", "prettyprint", "(", "String", "xmlLogsFile", ",", "FileOutputStream", "htmlReportFile", ")", "throws", "Exception", "{", "TransformerFactory", "tFactory", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", "// Fortify Mod: prevent external en...
Apply xslt stylesheet to xml logs file and crate an HTML report file. @param xmlLogsFile @param htmlReportFile
[ "Apply", "xslt", "stylesheet", "to", "xml", "logs", "file", "and", "crate", "an", "HTML", "report", "file", "." ]
train
https://github.com/opengeospatial/teamengine/blob/b6b890214b6784bbe19460bf753bdf28a9514bee/teamengine-core/src/main/java/com/occamlab/te/util/DocumentationHelper.java#L92-L108
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/PrincipalUser.java
PrincipalUser.createDefaultUser
private static PrincipalUser createDefaultUser() { PrincipalUser result = new PrincipalUser("default", "default@default.com"); result.id = BigInteger.valueOf(2); result.setPrivileged(false); return result; }
java
private static PrincipalUser createDefaultUser() { PrincipalUser result = new PrincipalUser("default", "default@default.com"); result.id = BigInteger.valueOf(2); result.setPrivileged(false); return result; }
[ "private", "static", "PrincipalUser", "createDefaultUser", "(", ")", "{", "PrincipalUser", "result", "=", "new", "PrincipalUser", "(", "\"default\"", ",", "\"default@default.com\"", ")", ";", "result", ".", "id", "=", "BigInteger", ".", "valueOf", "(", "2", ")",...
/* Method provided to be called using reflection to discretely create the admin user if needed.
[ "/", "*", "Method", "provided", "to", "be", "called", "using", "reflection", "to", "discretely", "create", "the", "admin", "user", "if", "needed", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/PrincipalUser.java#L281-L287
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/value/ValueStoragePlugin.java
ValueStoragePlugin.createURL
public URL createURL(String resourceId) throws MalformedURLException { StringBuilder url = new StringBuilder(64); url.append(ValueStorageURLStreamHandler.PROTOCOL); url.append(":/"); url.append(repository); url.append('/'); url.append(workspace); url.append('/'); url.append(id); url.append('/'); url.append(resourceId); return new URL(null, url.toString(), getURLStreamHandler()); }
java
public URL createURL(String resourceId) throws MalformedURLException { StringBuilder url = new StringBuilder(64); url.append(ValueStorageURLStreamHandler.PROTOCOL); url.append(":/"); url.append(repository); url.append('/'); url.append(workspace); url.append('/'); url.append(id); url.append('/'); url.append(resourceId); return new URL(null, url.toString(), getURLStreamHandler()); }
[ "public", "URL", "createURL", "(", "String", "resourceId", ")", "throws", "MalformedURLException", "{", "StringBuilder", "url", "=", "new", "StringBuilder", "(", "64", ")", ";", "url", ".", "append", "(", "ValueStorageURLStreamHandler", ".", "PROTOCOL", ")", ";"...
Creates an {@link URL} corresponding to the given resource within the context of the current {@link ValueStoragePlugin} @param resourceId the id of the resource for which we want the corresponding URL @return the URL corresponding to the given resource id @throws MalformedURLException if the URL was not properly formed
[ "Creates", "an", "{" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/storage/value/ValueStoragePlugin.java#L195-L208
JodaOrg/joda-time
src/main/java/org/joda/time/field/FieldUtils.java
FieldUtils.getWrappedValue
public static int getWrappedValue(int value, int minValue, int maxValue) { if (minValue >= maxValue) { throw new IllegalArgumentException("MIN > MAX"); } int wrapRange = maxValue - minValue + 1; value -= minValue; if (value >= 0) { return (value % wrapRange) + minValue; } int remByRange = (-value) % wrapRange; if (remByRange == 0) { return 0 + minValue; } return (wrapRange - remByRange) + minValue; }
java
public static int getWrappedValue(int value, int minValue, int maxValue) { if (minValue >= maxValue) { throw new IllegalArgumentException("MIN > MAX"); } int wrapRange = maxValue - minValue + 1; value -= minValue; if (value >= 0) { return (value % wrapRange) + minValue; } int remByRange = (-value) % wrapRange; if (remByRange == 0) { return 0 + minValue; } return (wrapRange - remByRange) + minValue; }
[ "public", "static", "int", "getWrappedValue", "(", "int", "value", ",", "int", "minValue", ",", "int", "maxValue", ")", "{", "if", "(", "minValue", ">=", "maxValue", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"MIN > MAX\"", ")", ";", "}", ...
Utility method that ensures the given value lies within the field's legal value range. @param value the value to fit into the wrapped value range @param minValue the wrap range minimum value. @param maxValue the wrap range maximum value. This must be greater than minValue (checked by the method). @return the wrapped value @throws IllegalArgumentException if minValue is greater than or equal to maxValue
[ "Utility", "method", "that", "ensures", "the", "given", "value", "lies", "within", "the", "field", "s", "legal", "value", "range", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/FieldUtils.java#L330-L348
mlhartme/sushi
src/main/java/net/oneandone/sushi/xml/Builder.java
Builder.parseString
public Document parseString(String text) throws SAXException { try { return parse(new InputSource(new StringReader(text))); } catch (IOException e) { throw new RuntimeException("unexpected world exception while reading memory stream", e); } }
java
public Document parseString(String text) throws SAXException { try { return parse(new InputSource(new StringReader(text))); } catch (IOException e) { throw new RuntimeException("unexpected world exception while reading memory stream", e); } }
[ "public", "Document", "parseString", "(", "String", "text", ")", "throws", "SAXException", "{", "try", "{", "return", "parse", "(", "new", "InputSource", "(", "new", "StringReader", "(", "text", ")", ")", ")", ";", "}", "catch", "(", "IOException", "e", ...
This method is not called "parse" to avoid confusion with file parsing methods
[ "This", "method", "is", "not", "called", "parse", "to", "avoid", "confusion", "with", "file", "parsing", "methods" ]
train
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/xml/Builder.java#L53-L59
rythmengine/rythmengine
src/main/java/org/rythmengine/RythmEngine.java
RythmEngine.registerTemplate
public void registerTemplate(String name, ITemplate template) { if (null == template) throw new NullPointerException(); // if (_templates.containsKey(name)) { // return false; // } _templates.put(name, template); return; }
java
public void registerTemplate(String name, ITemplate template) { if (null == template) throw new NullPointerException(); // if (_templates.containsKey(name)) { // return false; // } _templates.put(name, template); return; }
[ "public", "void", "registerTemplate", "(", "String", "name", ",", "ITemplate", "template", ")", "{", "if", "(", "null", "==", "template", ")", "throw", "new", "NullPointerException", "(", ")", ";", "// if (_templates.containsKey(name)) {", "// return...
Register a tag using the given name <p/> <p>Not an API for user application</p> @param name @param template
[ "Register", "a", "tag", "using", "the", "given", "name", "<p", "/", ">", "<p", ">", "Not", "an", "API", "for", "user", "application<", "/", "p", ">" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/RythmEngine.java#L1653-L1660
mnlipp/jgrapes
org.jgrapes.http/src/org/jgrapes/http/HttpServer.java
HttpServer.onPurge
@Handler(channels = NetworkChannel.class) public void onPurge(Purge event, IOSubchannel netChannel) { LinkedIOSubchannel.downstreamChannel(this, netChannel, WebAppMsgChannel.class).ifPresent(appChannel -> { appChannel.handlePurge(event); }); }
java
@Handler(channels = NetworkChannel.class) public void onPurge(Purge event, IOSubchannel netChannel) { LinkedIOSubchannel.downstreamChannel(this, netChannel, WebAppMsgChannel.class).ifPresent(appChannel -> { appChannel.handlePurge(event); }); }
[ "@", "Handler", "(", "channels", "=", "NetworkChannel", ".", "class", ")", "public", "void", "onPurge", "(", "Purge", "event", ",", "IOSubchannel", "netChannel", ")", "{", "LinkedIOSubchannel", ".", "downstreamChannel", "(", "this", ",", "netChannel", ",", "We...
Forwards a {@link Purge} event to the application channel. @param event the event @param netChannel the net channel
[ "Forwards", "a", "{", "@link", "Purge", "}", "event", "to", "the", "application", "channel", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.http/src/org/jgrapes/http/HttpServer.java#L284-L290
apache/flink
flink-core/src/main/java/org/apache/flink/util/StringUtils.java
StringUtils.getRandomString
public static String getRandomString(Random rnd, int minLength, int maxLength, char minValue, char maxValue) { int len = rnd.nextInt(maxLength - minLength + 1) + minLength; char[] data = new char[len]; int diff = maxValue - minValue + 1; for (int i = 0; i < data.length; i++) { data[i] = (char) (rnd.nextInt(diff) + minValue); } return new String(data); }
java
public static String getRandomString(Random rnd, int minLength, int maxLength, char minValue, char maxValue) { int len = rnd.nextInt(maxLength - minLength + 1) + minLength; char[] data = new char[len]; int diff = maxValue - minValue + 1; for (int i = 0; i < data.length; i++) { data[i] = (char) (rnd.nextInt(diff) + minValue); } return new String(data); }
[ "public", "static", "String", "getRandomString", "(", "Random", "rnd", ",", "int", "minLength", ",", "int", "maxLength", ",", "char", "minValue", ",", "char", "maxValue", ")", "{", "int", "len", "=", "rnd", ".", "nextInt", "(", "maxLength", "-", "minLength...
Creates a random string with a length within the given interval. The string contains only characters that can be represented as a single code point. @param rnd The random used to create the strings. @param minLength The minimum string length. @param maxLength The maximum string length (inclusive). @param minValue The minimum character value to occur. @param maxValue The maximum character value to occur. @return A random String.
[ "Creates", "a", "random", "string", "with", "a", "length", "within", "the", "given", "interval", ".", "The", "string", "contains", "only", "characters", "that", "can", "be", "represented", "as", "a", "single", "code", "point", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/StringUtils.java#L240-L250
google/j2objc
jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java
IosHttpURLConnection.secureConnectionException
static IOException secureConnectionException(String description) { try { Class<?> sslExceptionClass = Class.forName("javax.net.ssl.SSLException"); Constructor<?> constructor = sslExceptionClass.getConstructor(String.class); return (IOException) constructor.newInstance(description); } catch (ClassNotFoundException e) { return new IOException(description); } catch (Exception e) { throw new AssertionError("unexpected exception", e); } }
java
static IOException secureConnectionException(String description) { try { Class<?> sslExceptionClass = Class.forName("javax.net.ssl.SSLException"); Constructor<?> constructor = sslExceptionClass.getConstructor(String.class); return (IOException) constructor.newInstance(description); } catch (ClassNotFoundException e) { return new IOException(description); } catch (Exception e) { throw new AssertionError("unexpected exception", e); } }
[ "static", "IOException", "secureConnectionException", "(", "String", "description", ")", "{", "try", "{", "Class", "<", "?", ">", "sslExceptionClass", "=", "Class", ".", "forName", "(", "\"javax.net.ssl.SSLException\"", ")", ";", "Constructor", "<", "?", ">", "c...
Returns an SSLException if that class is linked into the application, otherwise IOException.
[ "Returns", "an", "SSLException", "if", "that", "class", "is", "linked", "into", "the", "application", "otherwise", "IOException", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/net/IosHttpURLConnection.java#L759-L769
dita-ot/dita-ot
src/main/plugins/org.dita.pdf2/src/com/idiominc/ws/opentopic/fo/index2/IndexPreprocessor.java
IndexPreprocessor.createElement
private Element createElement(final Document theTargetDocument, final String theName) { final Element indexEntryNode = theTargetDocument.createElementNS(this.namespace_url, theName); indexEntryNode.setPrefix(this.prefix); return indexEntryNode; }
java
private Element createElement(final Document theTargetDocument, final String theName) { final Element indexEntryNode = theTargetDocument.createElementNS(this.namespace_url, theName); indexEntryNode.setPrefix(this.prefix); return indexEntryNode; }
[ "private", "Element", "createElement", "(", "final", "Document", "theTargetDocument", ",", "final", "String", "theName", ")", "{", "final", "Element", "indexEntryNode", "=", "theTargetDocument", ".", "createElementNS", "(", "this", ".", "namespace_url", ",", "theNam...
Creates element with "prefix" in "namespace_url" with given name for the target document @param theTargetDocument target document @param theName name @return new element
[ "Creates", "element", "with", "prefix", "in", "namespace_url", "with", "given", "name", "for", "the", "target", "document" ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.pdf2/src/com/idiominc/ws/opentopic/fo/index2/IndexPreprocessor.java#L388-L392
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java
Location.fromBioExt
public static Location fromBioExt( int start, int length, char strand, int totalLength ) { int s= start; int e= s + length; if( !( strand == '-' || strand == '+' || strand == '.' )) { throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" ); } if( strand == '-' ) { s= s - totalLength; e= e - totalLength; } return new Location( s, e ); }
java
public static Location fromBioExt( int start, int length, char strand, int totalLength ) { int s= start; int e= s + length; if( !( strand == '-' || strand == '+' || strand == '.' )) { throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" ); } if( strand == '-' ) { s= s - totalLength; e= e - totalLength; } return new Location( s, e ); }
[ "public", "static", "Location", "fromBioExt", "(", "int", "start", ",", "int", "length", ",", "char", "strand", ",", "int", "totalLength", ")", "{", "int", "s", "=", "start", ";", "int", "e", "=", "s", "+", "length", ";", "if", "(", "!", "(", "stra...
Create a location from MAF file coordinates, which represent negative strand locations as the distance from the end of the sequence. @param start Origin 1 index of first symbol. @param length Number of symbols in range. @param strand '+' or '-' or '.' ('.' is interpreted as '+'). @param totalLength Total number of symbols in sequence. @throws IllegalArgumentException Strand must be '+', '-', '.'
[ "Create", "a", "location", "from", "MAF", "file", "coordinates", "which", "represent", "negative", "strand", "locations", "as", "the", "distance", "from", "the", "end", "of", "the", "sequence", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java#L164-L181
overview/mime-types
src/main/java/org/overviewproject/mime_types/MimeTypeDetector.java
MimeTypeDetector.detectMimeType
public String detectMimeType(String filename, final InputStream is) throws GetBytesException { Callable<byte[]> getBytes = new Callable<byte[]>() { public byte[] call() throws IOException { return inputStreamToFirstBytes(is); } }; return detectMimeType(filename, getBytes); }
java
public String detectMimeType(String filename, final InputStream is) throws GetBytesException { Callable<byte[]> getBytes = new Callable<byte[]>() { public byte[] call() throws IOException { return inputStreamToFirstBytes(is); } }; return detectMimeType(filename, getBytes); }
[ "public", "String", "detectMimeType", "(", "String", "filename", ",", "final", "InputStream", "is", ")", "throws", "GetBytesException", "{", "Callable", "<", "byte", "[", "]", ">", "getBytes", "=", "new", "Callable", "<", "byte", "[", "]", ">", "(", ")", ...
Determines the MIME type of a file with a given input stream. <p> The InputStream must exist. It must point to the beginning of the file contents. And {@link java.io.InputStream#markSupported()} must return {@literal true}. (When in doubt, pass a {@link java.io.BufferedInputStream}.) </p> @param filename Name of file. To skip filename globbing, pass {@literal ""} @param is InputStream that supports mark and reset. @return a MIME type such as {@literal "text/plain"} @throws GetBytesException if marking, reading or resetting the InputStream fails. @see #detectMimeType(String, Callable)
[ "Determines", "the", "MIME", "type", "of", "a", "file", "with", "a", "given", "input", "stream", "." ]
train
https://github.com/overview/mime-types/blob/d5c45302049c0cd5e634a50954304d8ddeb9abb4/src/main/java/org/overviewproject/mime_types/MimeTypeDetector.java#L219-L227
att/AAF
cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java
CadiAccess.buildLine
public final static StringBuilder buildLine(StringBuilder sb, Object[] elements) { sb.append(' '); String str; boolean notFirst = false; for(Object o : elements) { if(o!=null) { str = o.toString(); if(str.length()>0) { if(notFirst && shouldAddSpace(str,true) && shouldAddSpace(sb,false)) { sb.append(' '); } else { notFirst=true; } sb.append(str); } } } return sb; }
java
public final static StringBuilder buildLine(StringBuilder sb, Object[] elements) { sb.append(' '); String str; boolean notFirst = false; for(Object o : elements) { if(o!=null) { str = o.toString(); if(str.length()>0) { if(notFirst && shouldAddSpace(str,true) && shouldAddSpace(sb,false)) { sb.append(' '); } else { notFirst=true; } sb.append(str); } } } return sb; }
[ "public", "final", "static", "StringBuilder", "buildLine", "(", "StringBuilder", "sb", ",", "Object", "[", "]", "elements", ")", "{", "sb", ".", "append", "(", "'", "'", ")", ";", "String", "str", ";", "boolean", "notFirst", "=", "false", ";", "for", "...
/* Build a line of code onto a StringBuilder based on Objects. Analyze whether spaces need including. @param sb @param elements @return
[ "/", "*", "Build", "a", "line", "of", "code", "onto", "a", "StringBuilder", "based", "on", "Objects", ".", "Analyze", "whether", "spaces", "need", "including", "." ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/cadi/core/src/main/java/com/att/cadi/filter/CadiAccess.java#L93-L112
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java
SecureDfuImpl.selectObject
private ObjectInfo selectObject(final int type) throws DeviceDisconnectedException, DfuException, UploadAbortedException, RemoteDfuException, UnknownResponseException { if (!mConnected) throw new DeviceDisconnectedException("Unable to read object info: device disconnected"); OP_CODE_SELECT_OBJECT[1] = (byte) type; writeOpCode(mControlPointCharacteristic, OP_CODE_SELECT_OBJECT); final byte[] response = readNotificationResponse(); final int status = getStatusCode(response, OP_CODE_SELECT_OBJECT_KEY); if (status == SecureDfuError.EXTENDED_ERROR) throw new RemoteDfuExtendedErrorException("Selecting object failed", response[3]); if (status != DFU_STATUS_SUCCESS) throw new RemoteDfuException("Selecting object failed", status); final ObjectInfo info = new ObjectInfo(); info.maxSize = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3); info.offset = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3 + 4); info.CRC32 = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3 + 8); return info; }
java
private ObjectInfo selectObject(final int type) throws DeviceDisconnectedException, DfuException, UploadAbortedException, RemoteDfuException, UnknownResponseException { if (!mConnected) throw new DeviceDisconnectedException("Unable to read object info: device disconnected"); OP_CODE_SELECT_OBJECT[1] = (byte) type; writeOpCode(mControlPointCharacteristic, OP_CODE_SELECT_OBJECT); final byte[] response = readNotificationResponse(); final int status = getStatusCode(response, OP_CODE_SELECT_OBJECT_KEY); if (status == SecureDfuError.EXTENDED_ERROR) throw new RemoteDfuExtendedErrorException("Selecting object failed", response[3]); if (status != DFU_STATUS_SUCCESS) throw new RemoteDfuException("Selecting object failed", status); final ObjectInfo info = new ObjectInfo(); info.maxSize = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3); info.offset = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3 + 4); info.CRC32 = mControlPointCharacteristic.getIntValue(BluetoothGattCharacteristic.FORMAT_UINT32, 3 + 8); return info; }
[ "private", "ObjectInfo", "selectObject", "(", "final", "int", "type", ")", "throws", "DeviceDisconnectedException", ",", "DfuException", ",", "UploadAbortedException", ",", "RemoteDfuException", ",", "UnknownResponseException", "{", "if", "(", "!", "mConnected", ")", ...
Selects the current object and reads its metadata. The object info contains the max object size, and the offset and CRC32 of the whole object until now. @return object info. @throws DeviceDisconnectedException @throws DfuException @throws UploadAbortedException @throws RemoteDfuException thrown when the returned status code is not equal to {@link #DFU_STATUS_SUCCESS}.
[ "Selects", "the", "current", "object", "and", "reads", "its", "metadata", ".", "The", "object", "info", "contains", "the", "max", "object", "size", "and", "the", "offset", "and", "CRC32", "of", "the", "whole", "object", "until", "now", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/SecureDfuImpl.java#L836-L857
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/PCARunner.java
PCARunner.processIds
public PCAResult processIds(DBIDs ids, Relation<? extends NumberVector> database) { return processCovarMatrix(covarianceMatrixBuilder.processIds(ids, database)); }
java
public PCAResult processIds(DBIDs ids, Relation<? extends NumberVector> database) { return processCovarMatrix(covarianceMatrixBuilder.processIds(ids, database)); }
[ "public", "PCAResult", "processIds", "(", "DBIDs", "ids", ",", "Relation", "<", "?", "extends", "NumberVector", ">", "database", ")", "{", "return", "processCovarMatrix", "(", "covarianceMatrixBuilder", ".", "processIds", "(", "ids", ",", "database", ")", ")", ...
Run PCA on a collection of database IDs. @param ids a collection of ids @param database the database used @return PCA result
[ "Run", "PCA", "on", "a", "collection", "of", "database", "IDs", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/linearalgebra/pca/PCARunner.java#L73-L75
lucasr/probe
library/src/main/java/org/lucasr/probe/Interceptor.java
Interceptor.setMeasuredDimension
protected final void setMeasuredDimension(View view, int width, int height) { final ViewProxy proxy = (ViewProxy) view; proxy.invokeSetMeasuredDimension(width, height); }
java
protected final void setMeasuredDimension(View view, int width, int height) { final ViewProxy proxy = (ViewProxy) view; proxy.invokeSetMeasuredDimension(width, height); }
[ "protected", "final", "void", "setMeasuredDimension", "(", "View", "view", ",", "int", "width", ",", "int", "height", ")", "{", "final", "ViewProxy", "proxy", "=", "(", "ViewProxy", ")", "view", ";", "proxy", ".", "invokeSetMeasuredDimension", "(", "width", ...
Calls {@link View#setMeasuredDimension(int, int)} on the given {@link View}. This can be used to override {@link View#onMeasure(int, int)} calls on-the-fly in interceptors.
[ "Calls", "{" ]
train
https://github.com/lucasr/probe/blob/cd15cc04383a1bf85de2f4c345d2018415b9ddc9/library/src/main/java/org/lucasr/probe/Interceptor.java#L149-L152
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java
SessionDataManager.getItemByIdentifier
public ItemImpl getItemByIdentifier(String identifier, boolean pool, boolean apiRead) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getItemByIdentifier(" + identifier + " ) >>>>>"); } ItemImpl item = null; try { return item = readItem(getItemData(identifier), null, pool, apiRead); } finally { if (LOG.isDebugEnabled()) { LOG.debug("getItemByIdentifier(" + identifier + ") --> " + (item != null ? item.getPath() : "null") + " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
java
public ItemImpl getItemByIdentifier(String identifier, boolean pool, boolean apiRead) throws RepositoryException { long start = 0; if (LOG.isDebugEnabled()) { start = System.currentTimeMillis(); LOG.debug("getItemByIdentifier(" + identifier + " ) >>>>>"); } ItemImpl item = null; try { return item = readItem(getItemData(identifier), null, pool, apiRead); } finally { if (LOG.isDebugEnabled()) { LOG.debug("getItemByIdentifier(" + identifier + ") --> " + (item != null ? item.getPath() : "null") + " <<<<< " + ((System.currentTimeMillis() - start) / 1000d) + "sec"); } } }
[ "public", "ItemImpl", "getItemByIdentifier", "(", "String", "identifier", ",", "boolean", "pool", ",", "boolean", "apiRead", ")", "throws", "RepositoryException", "{", "long", "start", "=", "0", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{...
For internal use, required privileges. Return item by identifier in this transient storage then in workspace container. @param identifier - identifier of searched item @param pool - indicates does the item fall in pool @param apiRead - if true will call postRead Action and check permissions @return existed item data or null if not found @throws RepositoryException
[ "For", "internal", "use", "required", "privileges", ".", "Return", "item", "by", "identifier", "in", "this", "transient", "storage", "then", "in", "workspace", "container", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionDataManager.java#L667-L689
lucee/Lucee
core/src/main/java/lucee/transformer/library/tag/TagLibTag.java
TagLibTag.setTTEClassDefinition
protected void setTTEClassDefinition(String tteClass, Identification id, Attributes attr) { this.tteCD = ClassDefinitionImpl.toClassDefinition(tteClass, id, attr); }
java
protected void setTTEClassDefinition(String tteClass, Identification id, Attributes attr) { this.tteCD = ClassDefinitionImpl.toClassDefinition(tteClass, id, attr); }
[ "protected", "void", "setTTEClassDefinition", "(", "String", "tteClass", ",", "Identification", "id", ",", "Attributes", "attr", ")", "{", "this", ".", "tteCD", "=", "ClassDefinitionImpl", ".", "toClassDefinition", "(", "tteClass", ",", "id", ",", "attr", ")", ...
Setzt die implementierende Klassendefinition des Evaluator. Diese Methode wird durch die Klasse TagLibFactory verwendet. @param tteClass Klassendefinition der Evaluator-Implementation.
[ "Setzt", "die", "implementierende", "Klassendefinition", "des", "Evaluator", ".", "Diese", "Methode", "wird", "durch", "die", "Klasse", "TagLibFactory", "verwendet", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLibTag.java#L584-L586
OpenLiberty/open-liberty
dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/JSONAssetConverter.java
JSONAssetConverter.readValue
public static <T> T readValue(InputStream inputStream, Class<T> type) throws IOException, BadVersionException { return DataModelSerializer.deserializeObject(inputStream, type); }
java
public static <T> T readValue(InputStream inputStream, Class<T> type) throws IOException, BadVersionException { return DataModelSerializer.deserializeObject(inputStream, type); }
[ "public", "static", "<", "T", ">", "T", "readValue", "(", "InputStream", "inputStream", ",", "Class", "<", "T", ">", "type", ")", "throws", "IOException", ",", "BadVersionException", "{", "return", "DataModelSerializer", ".", "deserializeObject", "(", "inputStre...
Reads in a single object from a JSON input stream @param inputStream The input stream containing the JSON object @param type The type of the object to be read from the stream @return The object @throws IOException
[ "Reads", "in", "a", "single", "object", "from", "a", "JSON", "input", "stream" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository/src/com/ibm/ws/repository/transport/client/JSONAssetConverter.java#L100-L102
apereo/cas
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/token/BaseOidcJsonWebKeyTokenSigningAndEncryptionService.java
BaseOidcJsonWebKeyTokenSigningAndEncryptionService.signToken
protected String signToken(final OidcRegisteredService svc, final JsonWebSignature jws) throws Exception { LOGGER.debug("Fetching JSON web key to sign the token for : [{}]", svc.getClientId()); val jsonWebKey = getJsonWebKeySigningKey(); LOGGER.debug("Found JSON web key to sign the token: [{}]", jsonWebKey); if (jsonWebKey.getPrivateKey() == null) { throw new IllegalArgumentException("JSON web key used to sign the token has no associated private key"); } configureJsonWebSignatureForTokenSigning(svc, jws, jsonWebKey); return jws.getCompactSerialization(); }
java
protected String signToken(final OidcRegisteredService svc, final JsonWebSignature jws) throws Exception { LOGGER.debug("Fetching JSON web key to sign the token for : [{}]", svc.getClientId()); val jsonWebKey = getJsonWebKeySigningKey(); LOGGER.debug("Found JSON web key to sign the token: [{}]", jsonWebKey); if (jsonWebKey.getPrivateKey() == null) { throw new IllegalArgumentException("JSON web key used to sign the token has no associated private key"); } configureJsonWebSignatureForTokenSigning(svc, jws, jsonWebKey); return jws.getCompactSerialization(); }
[ "protected", "String", "signToken", "(", "final", "OidcRegisteredService", "svc", ",", "final", "JsonWebSignature", "jws", ")", "throws", "Exception", "{", "LOGGER", ".", "debug", "(", "\"Fetching JSON web key to sign the token for : [{}]\"", ",", "svc", ".", "getClient...
Sign token. @param svc the svc @param jws the jws @return the string @throws Exception the exception
[ "Sign", "token", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/token/BaseOidcJsonWebKeyTokenSigningAndEncryptionService.java#L109-L118
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/tools/FastCopy.java
FastCopy.getDirectoryListing
private static void getDirectoryListing(FileStatus root, FileSystem fs, List<CopyPath> result, Path dstPath) throws IOException { if (!root.isDir()) { result.add(new CopyPath(root.getPath(), dstPath)); return; } for (FileStatus child : fs.listStatus(root.getPath())) { getDirectoryListing(child, fs, result, new Path(dstPath, child.getPath() .getName())); } }
java
private static void getDirectoryListing(FileStatus root, FileSystem fs, List<CopyPath> result, Path dstPath) throws IOException { if (!root.isDir()) { result.add(new CopyPath(root.getPath(), dstPath)); return; } for (FileStatus child : fs.listStatus(root.getPath())) { getDirectoryListing(child, fs, result, new Path(dstPath, child.getPath() .getName())); } }
[ "private", "static", "void", "getDirectoryListing", "(", "FileStatus", "root", ",", "FileSystem", "fs", ",", "List", "<", "CopyPath", ">", "result", ",", "Path", "dstPath", ")", "throws", "IOException", "{", "if", "(", "!", "root", ".", "isDir", "(", ")", ...
Recursively lists out all the files under a given path. @param root the path under which we want to list out files @param fs the filesystem @param result the list which holds all the files. @throws IOException
[ "Recursively", "lists", "out", "all", "the", "files", "under", "a", "given", "path", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/FastCopy.java#L1179-L1190
redkale/redkale
src/org/redkale/asm/ModuleVisitor.java
ModuleVisitor.visitRequire
public void visitRequire(String module, int access, String version) { if (mv != null) { mv.visitRequire(module, access, version); } }
java
public void visitRequire(String module, int access, String version) { if (mv != null) { mv.visitRequire(module, access, version); } }
[ "public", "void", "visitRequire", "(", "String", "module", ",", "int", "access", ",", "String", "version", ")", "{", "if", "(", "mv", "!=", "null", ")", "{", "mv", ".", "visitRequire", "(", "module", ",", "access", ",", "version", ")", ";", "}", "}" ...
Visits a dependence of the current module. @param module the qualified name of the dependence. @param access the access flag of the dependence among ACC_TRANSITIVE, ACC_STATIC_PHASE, ACC_SYNTHETIC and ACC_MANDATED. @param version the module version at compile time or null.
[ "Visits", "a", "dependence", "of", "the", "current", "module", "." ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/asm/ModuleVisitor.java#L145-L149
rythmengine/rythmengine
src/main/java/org/rythmengine/template/TemplateBase.java
TemplateBase.__setRenderArgs0
protected TemplateBase __setRenderArgs0(ITag.__ParameterList params) { for (int i = 0; i < params.size(); ++i) { ITag.__Parameter param = params.get(i); if (null != param.name) __setRenderArg(param.name, param.value); else __setRenderArg(i, param.value); } return this; }
java
protected TemplateBase __setRenderArgs0(ITag.__ParameterList params) { for (int i = 0; i < params.size(); ++i) { ITag.__Parameter param = params.get(i); if (null != param.name) __setRenderArg(param.name, param.value); else __setRenderArg(i, param.value); } return this; }
[ "protected", "TemplateBase", "__setRenderArgs0", "(", "ITag", ".", "__ParameterList", "params", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "params", ".", "size", "(", ")", ";", "++", "i", ")", "{", "ITag", ".", "__Parameter", "param", ...
Set render arg from {@link org.rythmengine.template.ITag.__ParameterList tag params} Not to be used in user application or template @param params @return this template instance
[ "Set", "render", "arg", "from", "{", "@link", "org", ".", "rythmengine", ".", "template", ".", "ITag", ".", "__ParameterList", "tag", "params", "}", "Not", "to", "be", "used", "in", "user", "application", "or", "template" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/template/TemplateBase.java#L939-L946
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/S3CryptoModuleAE.java
S3CryptoModuleAE.decipherWithInstFileSuffix
private S3Object decipherWithInstFileSuffix(GetObjectRequest req, long[] desiredRange, long[] cryptoRange, S3Object retrieved, String instFileSuffix) { final S3ObjectId id = req.getS3ObjectId(); // Check if encrypted info is in an instruction file final S3ObjectWrapper ifile = fetchInstructionFile(id, instFileSuffix); if (ifile == null) { throw new SdkClientException("Instruction file with suffix " + instFileSuffix + " is not found for " + retrieved); } try { return decipherWithInstructionFile(req, desiredRange, cryptoRange, new S3ObjectWrapper(retrieved, id), ifile); } finally { closeQuietly(ifile, log); } }
java
private S3Object decipherWithInstFileSuffix(GetObjectRequest req, long[] desiredRange, long[] cryptoRange, S3Object retrieved, String instFileSuffix) { final S3ObjectId id = req.getS3ObjectId(); // Check if encrypted info is in an instruction file final S3ObjectWrapper ifile = fetchInstructionFile(id, instFileSuffix); if (ifile == null) { throw new SdkClientException("Instruction file with suffix " + instFileSuffix + " is not found for " + retrieved); } try { return decipherWithInstructionFile(req, desiredRange, cryptoRange, new S3ObjectWrapper(retrieved, id), ifile); } finally { closeQuietly(ifile, log); } }
[ "private", "S3Object", "decipherWithInstFileSuffix", "(", "GetObjectRequest", "req", ",", "long", "[", "]", "desiredRange", ",", "long", "[", "]", "cryptoRange", ",", "S3Object", "retrieved", ",", "String", "instFileSuffix", ")", "{", "final", "S3ObjectId", "id", ...
Same as {@link #decipher(GetObjectRequest, long[], long[], S3Object)} but makes use of an instruction file with the specified suffix. @param instFileSuffix never null or empty (which is assumed to have been sanitized upstream.)
[ "Same", "as", "{" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/S3CryptoModuleAE.java#L186-L202
gosu-lang/gosu-lang
gosu-lab/src/main/java/editor/util/BackgroundOperation.java
BackgroundOperation.doBackgroundOp
public void doBackgroundOp( final Runnable run, final boolean showWaitCursor ) { final Component[] key = new Component[1]; ExecutorService jobRunner = getJobRunner(); if( jobRunner != null ) { jobRunner.submit( () -> performBackgroundOp( run, key, showWaitCursor ) ); } else { run.run(); } }
java
public void doBackgroundOp( final Runnable run, final boolean showWaitCursor ) { final Component[] key = new Component[1]; ExecutorService jobRunner = getJobRunner(); if( jobRunner != null ) { jobRunner.submit( () -> performBackgroundOp( run, key, showWaitCursor ) ); } else { run.run(); } }
[ "public", "void", "doBackgroundOp", "(", "final", "Runnable", "run", ",", "final", "boolean", "showWaitCursor", ")", "{", "final", "Component", "[", "]", "key", "=", "new", "Component", "[", "1", "]", ";", "ExecutorService", "jobRunner", "=", "getJobRunner", ...
Runs a job in a background thread, using the ExecutorService, and optionally sets the cursor to the wait cursor and blocks input.
[ "Runs", "a", "job", "in", "a", "background", "thread", "using", "the", "ExecutorService", "and", "optionally", "sets", "the", "cursor", "to", "the", "wait", "cursor", "and", "blocks", "input", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-lab/src/main/java/editor/util/BackgroundOperation.java#L40-L52
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java
DocBookXMLPreProcessor.shouldAddAdditionalInfo
protected static boolean shouldAddAdditionalInfo(final BuildData buildData, final SpecTopic specTopic) { return (buildData.getBuildOptions().getInsertEditorLinks() && specTopic.getTopicType() != TopicType.AUTHOR_GROUP) || (buildData .getBuildOptions().getInsertBugLinks() && specTopic.getTopicType() == TopicType.NORMAL); }
java
protected static boolean shouldAddAdditionalInfo(final BuildData buildData, final SpecTopic specTopic) { return (buildData.getBuildOptions().getInsertEditorLinks() && specTopic.getTopicType() != TopicType.AUTHOR_GROUP) || (buildData .getBuildOptions().getInsertBugLinks() && specTopic.getTopicType() == TopicType.NORMAL); }
[ "protected", "static", "boolean", "shouldAddAdditionalInfo", "(", "final", "BuildData", "buildData", ",", "final", "SpecTopic", "specTopic", ")", "{", "return", "(", "buildData", ".", "getBuildOptions", "(", ")", ".", "getInsertEditorLinks", "(", ")", "&&", "specT...
Checks to see if additional info should be added based on the build options and the spec topic type. @param buildData @param specTopic @return
[ "Checks", "to", "see", "if", "additional", "info", "should", "be", "added", "based", "on", "the", "build", "options", "and", "the", "spec", "topic", "type", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookXMLPreProcessor.java#L413-L416
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/br/br_restart.java
br_restart.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { br_restart_responses result = (br_restart_responses) service.get_payload_formatter().string_to_resource(br_restart_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_restart_response_array); } br_restart[] result_br_restart = new br_restart[result.br_restart_response_array.length]; for(int i = 0; i < result.br_restart_response_array.length; i++) { result_br_restart[i] = result.br_restart_response_array[i].br_restart[0]; } return result_br_restart; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { br_restart_responses result = (br_restart_responses) service.get_payload_formatter().string_to_resource(br_restart_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_restart_response_array); } br_restart[] result_br_restart = new br_restart[result.br_restart_response_array.length]; for(int i = 0; i < result.br_restart_response_array.length; i++) { result_br_restart[i] = result.br_restart_response_array[i].br_restart[0]; } return result_br_restart; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "br_restart_responses", "result", "=", "(", "br_restart_responses", ")", "service", ".", "get_payload_formatte...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_restart.java#L136-L153
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/zinternaltools/InternalUtilities.java
InternalUtilities.setDefaultTableEditorsClicks
public static void setDefaultTableEditorsClicks(JTable table, int clickCountToStart) { TableCellEditor editor; editor = table.getDefaultEditor(Object.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); } editor = table.getDefaultEditor(Number.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); } editor = table.getDefaultEditor(Boolean.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); } }
java
public static void setDefaultTableEditorsClicks(JTable table, int clickCountToStart) { TableCellEditor editor; editor = table.getDefaultEditor(Object.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); } editor = table.getDefaultEditor(Number.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); } editor = table.getDefaultEditor(Boolean.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); } }
[ "public", "static", "void", "setDefaultTableEditorsClicks", "(", "JTable", "table", ",", "int", "clickCountToStart", ")", "{", "TableCellEditor", "editor", ";", "editor", "=", "table", ".", "getDefaultEditor", "(", "Object", ".", "class", ")", ";", "if", "(", ...
setDefaultTableEditorsClicks, This sets the number of clicks required to start the default table editors in the supplied table. Typically you would set the table editors to start after 1 click or 2 clicks, as desired. The default table editors of the table editors that are supplied by the JTable class, for Objects, Numbers, and Booleans. Note, the editor which is used to edit Objects, is the same editor used for editing Strings.
[ "setDefaultTableEditorsClicks", "This", "sets", "the", "number", "of", "clicks", "required", "to", "start", "the", "default", "table", "editors", "in", "the", "supplied", "table", ".", "Typically", "you", "would", "set", "the", "table", "editors", "to", "start",...
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/InternalUtilities.java#L462-L476
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/lang/DRL6Expressions.java
DRL6Expressions.xpathSeparator
public final void xpathSeparator() throws RecognitionException { try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:560:5: ( DIV | QUESTION_DIV ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g: { if ( input.LA(1)==DIV||input.LA(1)==QUESTION_DIV ) { input.consume(); state.errorRecovery=false; state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } }
java
public final void xpathSeparator() throws RecognitionException { try { // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:560:5: ( DIV | QUESTION_DIV ) // src/main/resources/org/drools/compiler/lang/DRL6Expressions.g: { if ( input.LA(1)==DIV||input.LA(1)==QUESTION_DIV ) { input.consume(); state.errorRecovery=false; state.failed=false; } else { if (state.backtracking>0) {state.failed=true; return;} MismatchedSetException mse = new MismatchedSetException(null,input); throw mse; } } } catch (RecognitionException re) { throw re; } finally { // do for sure before leaving } }
[ "public", "final", "void", "xpathSeparator", "(", ")", "throws", "RecognitionException", "{", "try", "{", "// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:560:5: ( DIV | QUESTION_DIV )", "// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:", "{", "if", "(...
src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:559:1: xpathSeparator : ( DIV | QUESTION_DIV );
[ "src", "/", "main", "/", "resources", "/", "org", "/", "drools", "/", "compiler", "/", "lang", "/", "DRL6Expressions", ".", "g", ":", "559", ":", "1", ":", "xpathSeparator", ":", "(", "DIV", "|", "QUESTION_DIV", ")", ";" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/lang/DRL6Expressions.java#L4023-L4049
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java
JDBCResultSet.updateShort
public void updateShort(int columnIndex, short x) throws SQLException { startUpdate(columnIndex); preparedStatement.setIntParameter(columnIndex, x); }
java
public void updateShort(int columnIndex, short x) throws SQLException { startUpdate(columnIndex); preparedStatement.setIntParameter(columnIndex, x); }
[ "public", "void", "updateShort", "(", "int", "columnIndex", ",", "short", "x", ")", "throws", "SQLException", "{", "startUpdate", "(", "columnIndex", ")", ";", "preparedStatement", ".", "setIntParameter", "(", "columnIndex", ",", "x", ")", ";", "}" ]
<!-- start generic documentation --> Updates the designated column with a <code>short</code> value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database. <!-- end generic documentation --> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> HSQLDB supports this feature. <p> </div> <!-- end release-specific documentation --> @param columnIndex the first column is 1, the second is 2, ... @param x the new column value @exception SQLException if a database access error occurs, the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set @exception SQLFeatureNotSupportedException if the JDBC driver does not support this method @since JDK 1.2 (JDK 1.1.x developers: read the overview for JDBCResultSet)
[ "<!", "--", "start", "generic", "documentation", "--", ">", "Updates", "the", "designated", "column", "with", "a", "<code", ">", "short<", "/", "code", ">", "value", ".", "The", "updater", "methods", "are", "used", "to", "update", "column", "values", "in",...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L2717-L2720
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java
StringIterate.rejectCodePoint
public static String rejectCodePoint(String string, CodePointPredicate predicate) { int size = string.length(); StringBuilder buffer = new StringBuilder(string.length()); for (int i = 0; i < size; ) { int codePoint = string.codePointAt(i); if (!predicate.accept(codePoint)) { buffer.appendCodePoint(codePoint); } i += Character.charCount(codePoint); } return buffer.toString(); }
java
public static String rejectCodePoint(String string, CodePointPredicate predicate) { int size = string.length(); StringBuilder buffer = new StringBuilder(string.length()); for (int i = 0; i < size; ) { int codePoint = string.codePointAt(i); if (!predicate.accept(codePoint)) { buffer.appendCodePoint(codePoint); } i += Character.charCount(codePoint); } return buffer.toString(); }
[ "public", "static", "String", "rejectCodePoint", "(", "String", "string", ",", "CodePointPredicate", "predicate", ")", "{", "int", "size", "=", "string", ".", "length", "(", ")", ";", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", "string", ".", ...
@return a new string excluding all of the code points that return true for the specified {@code predicate}. @since 7.0
[ "@return", "a", "new", "string", "excluding", "all", "of", "the", "code", "points", "that", "return", "true", "for", "the", "specified", "{", "@code", "predicate", "}", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L1075-L1089
tvesalainen/lpg
src/main/java/org/vesalainen/parser/util/Input.java
Input.getInput
protected static InputReader getInput(InputSource input, int size, Charset cs, Set<ParserFeature> fea) throws IOException { EnumSet<ParserFeature> features = EnumSet.of(UseInclude, UsePushback, UseModifiableCharset); InputReader inputReader = null; Reader reader = input.getCharacterStream(); if (reader != null) { inputReader = new ReadableInput(getFeaturedReader(reader, size, features), size, features); } else { InputStream is = input.getByteStream(); String encoding = input.getEncoding(); if (is != null) { if (encoding != null) { inputReader = getInstance(is, size, encoding, features); } else { inputReader = getInstance(is, size, StandardCharsets.US_ASCII, features); } } else { String sysId = input.getSystemId(); try { URI uri = new URI(sysId); if (encoding != null) { inputReader = getInstance(uri, size, encoding, features); } else { inputReader = getInstance(uri, size, StandardCharsets.US_ASCII, features); } } catch (URISyntaxException ex) { throw new IOException(ex); } } } inputReader.setSource(input.getSystemId()); return inputReader; }
java
protected static InputReader getInput(InputSource input, int size, Charset cs, Set<ParserFeature> fea) throws IOException { EnumSet<ParserFeature> features = EnumSet.of(UseInclude, UsePushback, UseModifiableCharset); InputReader inputReader = null; Reader reader = input.getCharacterStream(); if (reader != null) { inputReader = new ReadableInput(getFeaturedReader(reader, size, features), size, features); } else { InputStream is = input.getByteStream(); String encoding = input.getEncoding(); if (is != null) { if (encoding != null) { inputReader = getInstance(is, size, encoding, features); } else { inputReader = getInstance(is, size, StandardCharsets.US_ASCII, features); } } else { String sysId = input.getSystemId(); try { URI uri = new URI(sysId); if (encoding != null) { inputReader = getInstance(uri, size, encoding, features); } else { inputReader = getInstance(uri, size, StandardCharsets.US_ASCII, features); } } catch (URISyntaxException ex) { throw new IOException(ex); } } } inputReader.setSource(input.getSystemId()); return inputReader; }
[ "protected", "static", "InputReader", "getInput", "(", "InputSource", "input", ",", "int", "size", ",", "Charset", "cs", ",", "Set", "<", "ParserFeature", ">", "fea", ")", "throws", "IOException", "{", "EnumSet", "<", "ParserFeature", ">", "features", "=", "...
Creates an InputReader @param input @param size Ringbuffer size @return @throws IOException
[ "Creates", "an", "InputReader" ]
train
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/util/Input.java#L448-L495
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java
GeneratedDOAuth2UserDaoImpl.queryByProfileLink
public Iterable<DOAuth2User> queryByProfileLink(java.lang.String profileLink) { return queryByField(null, DOAuth2UserMapper.Field.PROFILELINK.getFieldName(), profileLink); }
java
public Iterable<DOAuth2User> queryByProfileLink(java.lang.String profileLink) { return queryByField(null, DOAuth2UserMapper.Field.PROFILELINK.getFieldName(), profileLink); }
[ "public", "Iterable", "<", "DOAuth2User", ">", "queryByProfileLink", "(", "java", ".", "lang", ".", "String", "profileLink", ")", "{", "return", "queryByField", "(", "null", ",", "DOAuth2UserMapper", ".", "Field", ".", "PROFILELINK", ".", "getFieldName", "(", ...
query-by method for field profileLink @param profileLink the specified attribute @return an Iterable of DOAuth2Users for the specified profileLink
[ "query", "-", "by", "method", "for", "field", "profileLink" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDOAuth2UserDaoImpl.java#L106-L108
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java
ExtraLanguagePreferenceAccess.getPrefixedKey
public static String getPrefixedKey(String preferenceContainerID, String preferenceName) { return getXtextKey(getPropertyPrefix(preferenceContainerID), preferenceName); }
java
public static String getPrefixedKey(String preferenceContainerID, String preferenceName) { return getXtextKey(getPropertyPrefix(preferenceContainerID), preferenceName); }
[ "public", "static", "String", "getPrefixedKey", "(", "String", "preferenceContainerID", ",", "String", "preferenceName", ")", "{", "return", "getXtextKey", "(", "getPropertyPrefix", "(", "preferenceContainerID", ")", ",", "preferenceName", ")", ";", "}" ]
Create a preference key. @param preferenceContainerID the identifier of the generator's preference container. @param preferenceName the name of the preference. @return the key.
[ "Create", "a", "preference", "key", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L111-L113
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java
DPathUtils.getValue
public static <T> T getValue(JsonNode node, String dPath, Class<T> clazz) { if (clazz == null) { throw new NullPointerException("Class parameter is null!"); } JsonNode temp = getValue(node, dPath); return ValueUtils.convertValue(temp, clazz); }
java
public static <T> T getValue(JsonNode node, String dPath, Class<T> clazz) { if (clazz == null) { throw new NullPointerException("Class parameter is null!"); } JsonNode temp = getValue(node, dPath); return ValueUtils.convertValue(temp, clazz); }
[ "public", "static", "<", "T", ">", "T", "getValue", "(", "JsonNode", "node", ",", "String", "dPath", ",", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "clazz", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Class param...
Extract a value from the target {@link JsonNode} using DPath expression (generic version). @param node @param dPath @param clazz @return @since 0.6.2
[ "Extract", "a", "value", "from", "the", "target", "{", "@link", "JsonNode", "}", "using", "DPath", "expression", "(", "generic", "version", ")", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java#L462-L468
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.translationRotateTowards
public Matrix4f translationRotateTowards(float posX, float posY, float posZ, float dirX, float dirY, float dirZ, float upX, float upY, float upZ) { // Normalize direction float invDirLength = 1.0f / (float) Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ); float ndirX = dirX * invDirLength; float ndirY = dirY * invDirLength; float ndirZ = dirZ * invDirLength; // left = up x direction float leftX, leftY, leftZ; leftX = upY * ndirZ - upZ * ndirY; leftY = upZ * ndirX - upX * ndirZ; leftZ = upX * ndirY - upY * ndirX; // normalize left float invLeftLength = 1.0f / (float) Math.sqrt(leftX * leftX + leftY * leftY + leftZ * leftZ); leftX *= invLeftLength; leftY *= invLeftLength; leftZ *= invLeftLength; // up = direction x left float upnX = ndirY * leftZ - ndirZ * leftY; float upnY = ndirZ * leftX - ndirX * leftZ; float upnZ = ndirX * leftY - ndirY * leftX; this._m00(leftX); this._m01(leftY); this._m02(leftZ); this._m03(0.0f); this._m10(upnX); this._m11(upnY); this._m12(upnZ); this._m13(0.0f); this._m20(ndirX); this._m21(ndirY); this._m22(ndirZ); this._m23(0.0f); this._m30(posX); this._m31(posY); this._m32(posZ); this._m33(1.0f); _properties(PROPERTY_AFFINE | PROPERTY_ORTHONORMAL); return this; }
java
public Matrix4f translationRotateTowards(float posX, float posY, float posZ, float dirX, float dirY, float dirZ, float upX, float upY, float upZ) { // Normalize direction float invDirLength = 1.0f / (float) Math.sqrt(dirX * dirX + dirY * dirY + dirZ * dirZ); float ndirX = dirX * invDirLength; float ndirY = dirY * invDirLength; float ndirZ = dirZ * invDirLength; // left = up x direction float leftX, leftY, leftZ; leftX = upY * ndirZ - upZ * ndirY; leftY = upZ * ndirX - upX * ndirZ; leftZ = upX * ndirY - upY * ndirX; // normalize left float invLeftLength = 1.0f / (float) Math.sqrt(leftX * leftX + leftY * leftY + leftZ * leftZ); leftX *= invLeftLength; leftY *= invLeftLength; leftZ *= invLeftLength; // up = direction x left float upnX = ndirY * leftZ - ndirZ * leftY; float upnY = ndirZ * leftX - ndirX * leftZ; float upnZ = ndirX * leftY - ndirY * leftX; this._m00(leftX); this._m01(leftY); this._m02(leftZ); this._m03(0.0f); this._m10(upnX); this._m11(upnY); this._m12(upnZ); this._m13(0.0f); this._m20(ndirX); this._m21(ndirY); this._m22(ndirZ); this._m23(0.0f); this._m30(posX); this._m31(posY); this._m32(posZ); this._m33(1.0f); _properties(PROPERTY_AFFINE | PROPERTY_ORTHONORMAL); return this; }
[ "public", "Matrix4f", "translationRotateTowards", "(", "float", "posX", ",", "float", "posY", ",", "float", "posZ", ",", "float", "dirX", ",", "float", "dirY", ",", "float", "dirZ", ",", "float", "upX", ",", "float", "upY", ",", "float", "upZ", ")", "{",...
Set this matrix to a model transformation for a right-handed coordinate system, that translates to the given <code>(posX, posY, posZ)</code> and aligns the local <code>-z</code> axis with <code>(dirX, dirY, dirZ)</code>. <p> This method is equivalent to calling: <code>translation(posX, posY, posZ).rotateTowards(dirX, dirY, dirZ, upX, upY, upZ)</code> @see #translation(float, float, float) @see #rotateTowards(float, float, float, float, float, float) @param posX the x-coordinate of the position to translate to @param posY the y-coordinate of the position to translate to @param posZ the z-coordinate of the position to translate to @param dirX the x-coordinate of the direction to rotate towards @param dirY the y-coordinate of the direction to rotate towards @param dirZ the z-coordinate of the direction to rotate towards @param upX the x-coordinate of the up vector @param upY the y-coordinate of the up vector @param upZ the z-coordinate of the up vector @return this
[ "Set", "this", "matrix", "to", "a", "model", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "that", "translates", "to", "the", "given", "<code", ">", "(", "posX", "posY", "posZ", ")", "<", "/", "code", ">", "and", "aligns",...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L14423-L14461
mapsforge/mapsforge
mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/MapFile.java
MapFile.readPoiData
@Override public MapReadResult readPoiData(Tile upperLeft, Tile lowerRight) { return readMapData(upperLeft, lowerRight, Selector.POIS); }
java
@Override public MapReadResult readPoiData(Tile upperLeft, Tile lowerRight) { return readMapData(upperLeft, lowerRight, Selector.POIS); }
[ "@", "Override", "public", "MapReadResult", "readPoiData", "(", "Tile", "upperLeft", ",", "Tile", "lowerRight", ")", "{", "return", "readMapData", "(", "upperLeft", ",", "lowerRight", ",", "Selector", ".", "POIS", ")", ";", "}" ]
Reads POI data for an area defined by the tile in the upper left and the tile in the lower right corner. This implementation takes the data storage of a MapFile into account for greater efficiency. @param upperLeft tile that defines the upper left corner of the requested area. @param lowerRight tile that defines the lower right corner of the requested area. @return map data for the tile.
[ "Reads", "POI", "data", "for", "an", "area", "defined", "by", "the", "tile", "in", "the", "upper", "left", "and", "the", "tile", "in", "the", "lower", "right", "corner", ".", "This", "implementation", "takes", "the", "data", "storage", "of", "a", "MapFil...
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/MapFile.java#L951-L954
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java
WorkflowsInner.listCallbackUrl
public WorkflowTriggerCallbackUrlInner listCallbackUrl(String resourceGroupName, String workflowName, GetCallbackUrlParameters listCallbackUrl) { return listCallbackUrlWithServiceResponseAsync(resourceGroupName, workflowName, listCallbackUrl).toBlocking().single().body(); }
java
public WorkflowTriggerCallbackUrlInner listCallbackUrl(String resourceGroupName, String workflowName, GetCallbackUrlParameters listCallbackUrl) { return listCallbackUrlWithServiceResponseAsync(resourceGroupName, workflowName, listCallbackUrl).toBlocking().single().body(); }
[ "public", "WorkflowTriggerCallbackUrlInner", "listCallbackUrl", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "GetCallbackUrlParameters", "listCallbackUrl", ")", "{", "return", "listCallbackUrlWithServiceResponseAsync", "(", "resourceGroupName", ",", "...
Get the workflow callback Url. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param listCallbackUrl Which callback url to list. @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 WorkflowTriggerCallbackUrlInner object if successful.
[ "Get", "the", "workflow", "callback", "Url", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java#L1313-L1315
lkwg82/enforcer-rules
src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java
EnforcerRuleUtils.getModelsRecursively
public List<Model> getModelsRecursively ( String groupId, String artifactId, String version, File pom ) throws ArtifactResolutionException, ArtifactNotFoundException, IOException, XmlPullParserException { List<Model> models = null; Model model = getPomModel( groupId, artifactId, version, pom ); Parent parent = model.getParent(); // recurse into the parent if ( parent != null ) { // get the relative path String relativePath = parent.getRelativePath(); if ( StringUtils.isEmpty( relativePath ) ) { relativePath = "../pom.xml"; } // calculate the recursive path File parentPom = new File( pom.getParent(), relativePath ); // if relative path is a directory, append pom.xml if ( parentPom.isDirectory() ) { parentPom = new File( parentPom, "pom.xml" ); } models = getModelsRecursively( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), parentPom ); } else { // only create it here since I'm not at the top models = new ArrayList<Model>(); } models.add( model ); return models; }
java
public List<Model> getModelsRecursively ( String groupId, String artifactId, String version, File pom ) throws ArtifactResolutionException, ArtifactNotFoundException, IOException, XmlPullParserException { List<Model> models = null; Model model = getPomModel( groupId, artifactId, version, pom ); Parent parent = model.getParent(); // recurse into the parent if ( parent != null ) { // get the relative path String relativePath = parent.getRelativePath(); if ( StringUtils.isEmpty( relativePath ) ) { relativePath = "../pom.xml"; } // calculate the recursive path File parentPom = new File( pom.getParent(), relativePath ); // if relative path is a directory, append pom.xml if ( parentPom.isDirectory() ) { parentPom = new File( parentPom, "pom.xml" ); } models = getModelsRecursively( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), parentPom ); } else { // only create it here since I'm not at the top models = new ArrayList<Model>(); } models.add( model ); return models; }
[ "public", "List", "<", "Model", ">", "getModelsRecursively", "(", "String", "groupId", ",", "String", "artifactId", ",", "String", "version", ",", "File", "pom", ")", "throws", "ArtifactResolutionException", ",", "ArtifactNotFoundException", ",", "IOException", ",",...
This method loops through all the parents, getting each pom model and then its parent. @param groupId the group id @param artifactId the artifact id @param version the version @param pom the pom @return the models recursively @throws ArtifactResolutionException the artifact resolution exception @throws ArtifactNotFoundException the artifact not found exception @throws IOException Signals that an I/O exception has occurred. @throws XmlPullParserException the xml pull parser exception
[ "This", "method", "loops", "through", "all", "the", "parents", "getting", "each", "pom", "model", "and", "then", "its", "parent", "." ]
train
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/utils/EnforcerRuleUtils.java#L237-L273
pkiraly/metadata-qa-api
src/main/java/de/gwdg/metadataqa/api/abbreviation/AbbreviationManager.java
AbbreviationManager.getPath
private Path getPath(String fileName) throws IOException, URISyntaxException { Path path; URL url = getClass().getClassLoader().getResource(fileName); if (url == null) { throw new IOException(String.format("File %s is not existing", fileName)); } URI uri = url.toURI(); Map<String, String> env = new HashMap<>(); if (uri.toString().contains("!")) { String[] parts = uri.toString().split("!"); if (fs == null) { fs = FileSystems.newFileSystem(URI.create(parts[0]), env); } path = fs.getPath(parts[1]); } else { path = Paths.get(uri); } return path; }
java
private Path getPath(String fileName) throws IOException, URISyntaxException { Path path; URL url = getClass().getClassLoader().getResource(fileName); if (url == null) { throw new IOException(String.format("File %s is not existing", fileName)); } URI uri = url.toURI(); Map<String, String> env = new HashMap<>(); if (uri.toString().contains("!")) { String[] parts = uri.toString().split("!"); if (fs == null) { fs = FileSystems.newFileSystem(URI.create(parts[0]), env); } path = fs.getPath(parts[1]); } else { path = Paths.get(uri); } return path; }
[ "private", "Path", "getPath", "(", "String", "fileName", ")", "throws", "IOException", ",", "URISyntaxException", "{", "Path", "path", ";", "URL", "url", "=", "getClass", "(", ")", ".", "getClassLoader", "(", ")", ".", "getResource", "(", "fileName", ")", ...
A get a java.nio.file.Path object from a file name. @param fileName The file name @return The Path object @throws IOException @throws URISyntaxException
[ "A", "get", "a", "java", ".", "nio", ".", "file", ".", "Path", "object", "from", "a", "file", "name", "." ]
train
https://github.com/pkiraly/metadata-qa-api/blob/622a69e7c1628ccf64047070817ecfaa68f15b1d/src/main/java/de/gwdg/metadataqa/api/abbreviation/AbbreviationManager.java#L155-L174
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java
MarkdownParser.computeHeaderId
public static String computeHeaderId(String headerNumber, String headerText) { final String fullText = Strings.emptyIfNull(headerNumber) + " " + Strings.emptyIfNull(headerText); //$NON-NLS-1$ return computeHeaderId(fullText); }
java
public static String computeHeaderId(String headerNumber, String headerText) { final String fullText = Strings.emptyIfNull(headerNumber) + " " + Strings.emptyIfNull(headerText); //$NON-NLS-1$ return computeHeaderId(fullText); }
[ "public", "static", "String", "computeHeaderId", "(", "String", "headerNumber", ",", "String", "headerText", ")", "{", "final", "String", "fullText", "=", "Strings", ".", "emptyIfNull", "(", "headerNumber", ")", "+", "\" \"", "+", "Strings", ".", "emptyIfNull", ...
Create the id of a section header. <p>The ID format follows the ReadCarpet standards. @param headerNumber the number of the header, or {@code null}. @param headerText the section header text. @return the identifier.
[ "Create", "the", "id", "of", "a", "section", "header", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L878-L881
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfPRow.java
PdfPRow.setExtraHeight
public void setExtraHeight(int cell, float height) { if (cell < 0 || cell >= cells.length) return; extraHeights[cell] = height; }
java
public void setExtraHeight(int cell, float height) { if (cell < 0 || cell >= cells.length) return; extraHeights[cell] = height; }
[ "public", "void", "setExtraHeight", "(", "int", "cell", ",", "float", "height", ")", "{", "if", "(", "cell", "<", "0", "||", "cell", ">=", "cells", ".", "length", ")", "return", ";", "extraHeights", "[", "cell", "]", "=", "height", ";", "}" ]
Sets an extra height for a cell. @param cell the index of the cell that needs an extra height @param height the extra height @since 2.1.6
[ "Sets", "an", "extra", "height", "for", "a", "cell", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfPRow.java#L169-L173
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsMessageWidget.java
CmsMessageWidget.setIcon
public void setIcon(FontOpenCms icon, String color) { if (icon != null) { m_iconCell.setInnerHTML(icon.getHtml(32, color)); } else { m_iconCell.setInnerHTML(""); } }
java
public void setIcon(FontOpenCms icon, String color) { if (icon != null) { m_iconCell.setInnerHTML(icon.getHtml(32, color)); } else { m_iconCell.setInnerHTML(""); } }
[ "public", "void", "setIcon", "(", "FontOpenCms", "icon", ",", "String", "color", ")", "{", "if", "(", "icon", "!=", "null", ")", "{", "m_iconCell", ".", "setInnerHTML", "(", "icon", ".", "getHtml", "(", "32", ",", "color", ")", ")", ";", "}", "else",...
Sets the icon CSS class.<p> @param icon the icon @param color the icon color
[ "Sets", "the", "icon", "CSS", "class", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsMessageWidget.java#L76-L83
alibaba/canal
client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java
MutablePropertySources.addAtIndex
private void addAtIndex(int index, PropertySource<?> propertySource) { removeIfPresent(propertySource); this.propertySourceList.add(index, propertySource); }
java
private void addAtIndex(int index, PropertySource<?> propertySource) { removeIfPresent(propertySource); this.propertySourceList.add(index, propertySource); }
[ "private", "void", "addAtIndex", "(", "int", "index", ",", "PropertySource", "<", "?", ">", "propertySource", ")", "{", "removeIfPresent", "(", "propertySource", ")", ";", "this", ".", "propertySourceList", ".", "add", "(", "index", ",", "propertySource", ")",...
Add the given property source at a particular index in the list.
[ "Add", "the", "given", "property", "source", "at", "a", "particular", "index", "in", "the", "list", "." ]
train
https://github.com/alibaba/canal/blob/8f088cddc0755f4350c5aaae95c6e4002d90a40f/client-adapter/common/src/main/java/com/alibaba/otter/canal/client/adapter/config/common/MutablePropertySources.java#L202-L205
haraldk/TwelveMonkeys
imageio/imageio-clippath/src/main/java/com/twelvemonkeys/imageio/path/Paths.java
Paths.readClipped
public static BufferedImage readClipped(final ImageInputStream stream) throws IOException { Shape clip = readPath(stream); stream.seek(0); BufferedImage image = ImageIO.read(stream); if (clip == null) { return image; } return applyClippingPath(clip, image); }
java
public static BufferedImage readClipped(final ImageInputStream stream) throws IOException { Shape clip = readPath(stream); stream.seek(0); BufferedImage image = ImageIO.read(stream); if (clip == null) { return image; } return applyClippingPath(clip, image); }
[ "public", "static", "BufferedImage", "readClipped", "(", "final", "ImageInputStream", "stream", ")", "throws", "IOException", "{", "Shape", "clip", "=", "readPath", "(", "stream", ")", ";", "stream", ".", "seek", "(", "0", ")", ";", "BufferedImage", "image", ...
Reads the clipping path from the given input stream, if any, and applies it to the first image in the stream. If no path was found, the image is returned without any clipping. Supports PSD, JPEG and TIFF as container formats for Photoshop resources. @param stream the stream to read from, not {@code null} @return the clipped image @throws IOException if a general I/O exception occurs during reading. @throws javax.imageio.IIOException if the input contains a bad image or path data. @throws java.lang.IllegalArgumentException is {@code stream} is {@code null}.
[ "Reads", "the", "clipping", "path", "from", "the", "given", "input", "stream", "if", "any", "and", "applies", "it", "to", "the", "first", "image", "in", "the", "stream", ".", "If", "no", "path", "was", "found", "the", "image", "is", "returned", "without"...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-clippath/src/main/java/com/twelvemonkeys/imageio/path/Paths.java#L244-L255
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java
DateUtils.rollYears
public static java.sql.Date rollYears(java.util.Date startDate, int years) { return rollDate(startDate, Calendar.YEAR, years); }
java
public static java.sql.Date rollYears(java.util.Date startDate, int years) { return rollDate(startDate, Calendar.YEAR, years); }
[ "public", "static", "java", ".", "sql", ".", "Date", "rollYears", "(", "java", ".", "util", ".", "Date", "startDate", ",", "int", "years", ")", "{", "return", "rollDate", "(", "startDate", ",", "Calendar", ".", "YEAR", ",", "years", ")", ";", "}" ]
Roll the years forward or backward. @param startDate - The start date @param years - Negative to rollbackwards.
[ "Roll", "the", "years", "forward", "or", "backward", "." ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/thirdparty/DateUtils.java#L182-L184
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java
BaseXmlParser.fromXml
protected Object fromXml(String xml, String tagName) throws Exception { Document document = XMLUtil.parseXMLFromString(xml); NodeList nodeList = document.getElementsByTagName(tagName); if (nodeList == null || nodeList.getLength() != 1) { throw new DOMException(DOMException.NOT_FOUND_ERR, "Top level tag '" + tagName + "' was not found."); } Element element = (Element) nodeList.item(0); Class<?> beanClass = getBeanClass(element); BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(beanClass); doParse(element, builder); DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); factory.setParentBeanFactory(SpringUtil.getAppContext()); AbstractBeanDefinition beanDefinition = builder.getBeanDefinition(); factory.registerBeanDefinition(tagName, beanDefinition); return factory.getBean(tagName); }
java
protected Object fromXml(String xml, String tagName) throws Exception { Document document = XMLUtil.parseXMLFromString(xml); NodeList nodeList = document.getElementsByTagName(tagName); if (nodeList == null || nodeList.getLength() != 1) { throw new DOMException(DOMException.NOT_FOUND_ERR, "Top level tag '" + tagName + "' was not found."); } Element element = (Element) nodeList.item(0); Class<?> beanClass = getBeanClass(element); BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(beanClass); doParse(element, builder); DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); factory.setParentBeanFactory(SpringUtil.getAppContext()); AbstractBeanDefinition beanDefinition = builder.getBeanDefinition(); factory.registerBeanDefinition(tagName, beanDefinition); return factory.getBean(tagName); }
[ "protected", "Object", "fromXml", "(", "String", "xml", ",", "String", "tagName", ")", "throws", "Exception", "{", "Document", "document", "=", "XMLUtil", ".", "parseXMLFromString", "(", "xml", ")", ";", "NodeList", "nodeList", "=", "document", ".", "getElemen...
Parses an xml extension from an xml string. @param xml XML containing the extension. @param tagName The top level tag name. @return Result of the parsed extension. @throws Exception Unspecified exception.
[ "Parses", "an", "xml", "extension", "from", "an", "xml", "string", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/spring/BaseXmlParser.java#L124-L141
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.updateTag
public Tag updateTag(UUID projectId, UUID tagId, Tag updatedTag) { return updateTagWithServiceResponseAsync(projectId, tagId, updatedTag).toBlocking().single().body(); }
java
public Tag updateTag(UUID projectId, UUID tagId, Tag updatedTag) { return updateTagWithServiceResponseAsync(projectId, tagId, updatedTag).toBlocking().single().body(); }
[ "public", "Tag", "updateTag", "(", "UUID", "projectId", ",", "UUID", "tagId", ",", "Tag", "updatedTag", ")", "{", "return", "updateTagWithServiceResponseAsync", "(", "projectId", ",", "tagId", ",", "updatedTag", ")", ".", "toBlocking", "(", ")", ".", "single",...
Update a tag. @param projectId The project id @param tagId The id of the target tag @param updatedTag The updated tag model @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 Tag object if successful.
[ "Update", "a", "tag", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L603-L605
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.importAccessControlEntries
public void importAccessControlEntries(CmsResource resource, List<CmsAccessControlEntry> acEntries) throws CmsException { m_securityManager.importAccessControlEntries(m_context, resource, acEntries); }
java
public void importAccessControlEntries(CmsResource resource, List<CmsAccessControlEntry> acEntries) throws CmsException { m_securityManager.importAccessControlEntries(m_context, resource, acEntries); }
[ "public", "void", "importAccessControlEntries", "(", "CmsResource", "resource", ",", "List", "<", "CmsAccessControlEntry", ">", "acEntries", ")", "throws", "CmsException", "{", "m_securityManager", ".", "importAccessControlEntries", "(", "m_context", ",", "resource", ",...
Writes a list of access control entries as new access control entries of a given resource.<p> Already existing access control entries of this resource are removed before.<p> @param resource the resource to attach the control entries to @param acEntries a list of <code>{@link CmsAccessControlEntry}</code> objects @throws CmsException if something goes wrong
[ "Writes", "a", "list", "of", "access", "control", "entries", "as", "new", "access", "control", "entries", "of", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1964-L1968
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/EntityManagerFactoryImpl.java
EntityManagerFactoryImpl.configurePersistenceUnit
private void configurePersistenceUnit(String persistenceUnit, Map props) { // Invoke Persistence unit MetaData if (persistenceUnit == null) { throw new KunderaException("Persistence unit name should not be null"); } if (logger.isInfoEnabled()) { logger.info("Loading Persistence Unit MetaData For Persistence Unit(s) {}.", persistenceUnit); } String[] persistenceUnits = persistenceUnit.split(Constants.PERSISTENCE_UNIT_SEPARATOR); new PersistenceUnitConfiguration(props, kunderaMetadata, persistenceUnits).configure(); }
java
private void configurePersistenceUnit(String persistenceUnit, Map props) { // Invoke Persistence unit MetaData if (persistenceUnit == null) { throw new KunderaException("Persistence unit name should not be null"); } if (logger.isInfoEnabled()) { logger.info("Loading Persistence Unit MetaData For Persistence Unit(s) {}.", persistenceUnit); } String[] persistenceUnits = persistenceUnit.split(Constants.PERSISTENCE_UNIT_SEPARATOR); new PersistenceUnitConfiguration(props, kunderaMetadata, persistenceUnits).configure(); }
[ "private", "void", "configurePersistenceUnit", "(", "String", "persistenceUnit", ",", "Map", "props", ")", "{", "// Invoke Persistence unit MetaData\r", "if", "(", "persistenceUnit", "==", "null", ")", "{", "throw", "new", "KunderaException", "(", "\"Persistence unit na...
One time initialization for persistence unit metadata. @param persistenceUnit Persistence Unit/ Comma separated persistence units
[ "One", "time", "initialization", "for", "persistence", "unit", "metadata", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/EntityManagerFactoryImpl.java#L645-L660
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.drawWarped
public void drawWarped(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { Color.white.bind(); texture.bind(); GL.glTranslatef(x1, y1, 0); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glBegin(SGL.GL_QUADS); init(); GL.glTexCoord2f(textureOffsetX, textureOffsetY); GL.glVertex3f(0, 0, 0); GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); GL.glVertex3f(x2 - x1, y2 - y1, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY + textureHeight); GL.glVertex3f(x3 - x1, y3 - y1, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY); GL.glVertex3f(x4 - x1, y4 - y1, 0); GL.glEnd(); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(-angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glTranslatef(-x1, -y1, 0); }
java
public void drawWarped(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { Color.white.bind(); texture.bind(); GL.glTranslatef(x1, y1, 0); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glBegin(SGL.GL_QUADS); init(); GL.glTexCoord2f(textureOffsetX, textureOffsetY); GL.glVertex3f(0, 0, 0); GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); GL.glVertex3f(x2 - x1, y2 - y1, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY + textureHeight); GL.glVertex3f(x3 - x1, y3 - y1, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY); GL.glVertex3f(x4 - x1, y4 - y1, 0); GL.glEnd(); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(-angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glTranslatef(-x1, -y1, 0); }
[ "public", "void", "drawWarped", "(", "float", "x1", ",", "float", "y1", ",", "float", "x2", ",", "float", "y2", ",", "float", "x3", ",", "float", "y3", ",", "float", "x4", ",", "float", "y4", ")", "{", "Color", ".", "white", ".", "bind", "(", ")"...
Draw the image in a warper rectangle. The effects this can have are many and varied, might be interesting though. @param x1 The top left corner x coordinate @param y1 The top left corner y coordinate @param x2 The top right corner x coordinate @param y2 The top right corner y coordinate @param x3 The bottom right corner x coordinate @param y3 The bottom right corner y coordinate @param x4 The bottom left corner x coordinate @param y4 The bottom left corner y coordinate
[ "Draw", "the", "image", "in", "a", "warper", "rectangle", ".", "The", "effects", "this", "can", "have", "are", "many", "and", "varied", "might", "be", "interesting", "though", "." ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L1139-L1170
eclipse/xtext-extras
org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java
AbstractXbaseSemanticSequencer.sequence_XRelationalExpression
protected void sequence_XRelationalExpression(ISerializationContext context, XInstanceOfExpression semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__EXPRESSION) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__EXPRESSION)); if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__TYPE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__TYPE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0(), semanticObject.getExpression()); feeder.accept(grammarAccess.getXRelationalExpressionAccess().getTypeJvmTypeReferenceParserRuleCall_1_0_1_0(), semanticObject.getType()); feeder.finish(); }
java
protected void sequence_XRelationalExpression(ISerializationContext context, XInstanceOfExpression semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__EXPRESSION) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__EXPRESSION)); if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__TYPE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__TYPE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0(), semanticObject.getExpression()); feeder.accept(grammarAccess.getXRelationalExpressionAccess().getTypeJvmTypeReferenceParserRuleCall_1_0_1_0(), semanticObject.getType()); feeder.finish(); }
[ "protected", "void", "sequence_XRelationalExpression", "(", "ISerializationContext", "context", ",", "XInstanceOfExpression", "semanticObject", ")", "{", "if", "(", "errorAcceptor", "!=", "null", ")", "{", "if", "(", "transientValues", ".", "isValueTransient", "(", "s...
Contexts: XExpression returns XInstanceOfExpression XAssignment returns XInstanceOfExpression XAssignment.XBinaryOperation_1_1_0_0_0 returns XInstanceOfExpression XOrExpression returns XInstanceOfExpression XOrExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XAndExpression returns XInstanceOfExpression XAndExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XEqualityExpression returns XInstanceOfExpression XEqualityExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XRelationalExpression returns XInstanceOfExpression XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XInstanceOfExpression XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XInstanceOfExpression XOtherOperatorExpression returns XInstanceOfExpression XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XAdditiveExpression returns XInstanceOfExpression XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XMultiplicativeExpression returns XInstanceOfExpression XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XUnaryOperation returns XInstanceOfExpression XCastedExpression returns XInstanceOfExpression XCastedExpression.XCastedExpression_1_0_0_0 returns XInstanceOfExpression XPostfixOperation returns XInstanceOfExpression XPostfixOperation.XPostfixOperation_1_0_0 returns XInstanceOfExpression XMemberFeatureCall returns XInstanceOfExpression XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XInstanceOfExpression XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XInstanceOfExpression XPrimaryExpression returns XInstanceOfExpression XParenthesizedExpression returns XInstanceOfExpression XExpressionOrVarDeclaration returns XInstanceOfExpression Constraint: (expression=XRelationalExpression_XInstanceOfExpression_1_0_0_0_0 type=JvmTypeReference)
[ "Contexts", ":", "XExpression", "returns", "XInstanceOfExpression", "XAssignment", "returns", "XInstanceOfExpression", "XAssignment", ".", "XBinaryOperation_1_1_0_0_0", "returns", "XInstanceOfExpression", "XOrExpression", "returns", "XInstanceOfExpression", "XOrExpression", ".", ...
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java#L1303-L1314
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java
SyncAgentsInner.beginCreateOrUpdate
public SyncAgentInner beginCreateOrUpdate(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).toBlocking().single().body(); }
java
public SyncAgentInner beginCreateOrUpdate(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).toBlocking().single().body(); }
[ "public", "SyncAgentInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "syncAgentName", ",", "String", "syncDatabaseId", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ...
Creates or updates a sync agent. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server on which the sync agent is hosted. @param syncAgentName The name of the sync agent. @param syncDatabaseId ARM resource id of the sync database in the sync agent. @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 SyncAgentInner object if successful.
[ "Creates", "or", "updates", "a", "sync", "agent", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java#L460-L462
networknt/light-4j
client/src/main/java/com/networknt/client/oauth/OauthHelper.java
OauthHelper.getTokenResult
public static Result<TokenResponse> getTokenResult(TokenRequest tokenRequest, String envTag) { final AtomicReference<Result<TokenResponse>> reference = new AtomicReference<>(); final Http2Client client = Http2Client.getInstance(); final CountDownLatch latch = new CountDownLatch(1); final ClientConnection connection; try { if(tokenRequest.getServerUrl() != null) { connection = client.connect(new URI(tokenRequest.getServerUrl()), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, tokenRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get(); } else if(tokenRequest.getServiceId() != null) { Cluster cluster = SingletonServiceFactory.getBean(Cluster.class); String url = cluster.serviceToUrl("https", tokenRequest.getServiceId(), envTag, null); connection = client.connect(new URI(url), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, tokenRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get(); } else { // both server_url and serviceId are empty in the config. logger.error("Error: both server_url and serviceId are not configured in client.yml for " + tokenRequest.getClass()); throw new ClientException("both server_url and serviceId are not configured in client.yml for " + tokenRequest.getClass()); } } catch (Exception e) { logger.error("cannot establish connection:", e); return Failure.of(new Status(ESTABLISH_CONNECTION_ERROR, tokenRequest.getServerUrl() != null? tokenRequest.getServerUrl() : tokenRequest.getServiceId())); } try { IClientRequestComposable requestComposer = ClientRequestComposerProvider.getInstance().getComposer(ClientRequestComposerProvider.ClientRequestComposers.CLIENT_CREDENTIAL_REQUEST_COMPOSER); connection.getIoThread().execute(new TokenRequestAction(tokenRequest, requestComposer, connection, reference, latch)); latch.await(4, TimeUnit.SECONDS); } catch (Exception e) { logger.error("IOException: ", e); return Failure.of(new Status(FAIL_TO_SEND_REQUEST)); } finally { IoUtils.safeClose(connection); } //if reference.get() is null at this point, mostly likely couldn't get token within latch.await() timeout. return reference.get() == null ? Failure.of(new Status(GET_TOKEN_TIMEOUT)) : reference.get(); }
java
public static Result<TokenResponse> getTokenResult(TokenRequest tokenRequest, String envTag) { final AtomicReference<Result<TokenResponse>> reference = new AtomicReference<>(); final Http2Client client = Http2Client.getInstance(); final CountDownLatch latch = new CountDownLatch(1); final ClientConnection connection; try { if(tokenRequest.getServerUrl() != null) { connection = client.connect(new URI(tokenRequest.getServerUrl()), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, tokenRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get(); } else if(tokenRequest.getServiceId() != null) { Cluster cluster = SingletonServiceFactory.getBean(Cluster.class); String url = cluster.serviceToUrl("https", tokenRequest.getServiceId(), envTag, null); connection = client.connect(new URI(url), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, tokenRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get(); } else { // both server_url and serviceId are empty in the config. logger.error("Error: both server_url and serviceId are not configured in client.yml for " + tokenRequest.getClass()); throw new ClientException("both server_url and serviceId are not configured in client.yml for " + tokenRequest.getClass()); } } catch (Exception e) { logger.error("cannot establish connection:", e); return Failure.of(new Status(ESTABLISH_CONNECTION_ERROR, tokenRequest.getServerUrl() != null? tokenRequest.getServerUrl() : tokenRequest.getServiceId())); } try { IClientRequestComposable requestComposer = ClientRequestComposerProvider.getInstance().getComposer(ClientRequestComposerProvider.ClientRequestComposers.CLIENT_CREDENTIAL_REQUEST_COMPOSER); connection.getIoThread().execute(new TokenRequestAction(tokenRequest, requestComposer, connection, reference, latch)); latch.await(4, TimeUnit.SECONDS); } catch (Exception e) { logger.error("IOException: ", e); return Failure.of(new Status(FAIL_TO_SEND_REQUEST)); } finally { IoUtils.safeClose(connection); } //if reference.get() is null at this point, mostly likely couldn't get token within latch.await() timeout. return reference.get() == null ? Failure.of(new Status(GET_TOKEN_TIMEOUT)) : reference.get(); }
[ "public", "static", "Result", "<", "TokenResponse", ">", "getTokenResult", "(", "TokenRequest", "tokenRequest", ",", "String", "envTag", ")", "{", "final", "AtomicReference", "<", "Result", "<", "TokenResponse", ">", ">", "reference", "=", "new", "AtomicReference"...
Get an access token from the token service. A Result of TokenResponse will be returned if the invocation is successfully. Otherwise, a Result of Status will be returned. @param tokenRequest token request constructed from the client.yml token section. @param envTag the environment tag from the server.yml for service lookup. @return Result of TokenResponse or error Status.
[ "Get", "an", "access", "token", "from", "the", "token", "service", ".", "A", "Result", "of", "TokenResponse", "will", "be", "returned", "if", "the", "invocation", "is", "successfully", ".", "Otherwise", "a", "Result", "of", "Status", "will", "be", "returned"...
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L105-L142
psamsotha/jersey-properties
src/main/java/com/github/psamsotha/jersey/properties/JerseyPropertiesFeature.java
JerseyPropertiesFeature.addUserProvidersToMap
private void addUserProvidersToMap(Map<String, String> propertiesMap) { if (userDefinedProviders.length != 0) { for (PropertiesProvider provider : userDefinedProviders) { propertiesMap.putAll(provider.getProperties()); } } }
java
private void addUserProvidersToMap(Map<String, String> propertiesMap) { if (userDefinedProviders.length != 0) { for (PropertiesProvider provider : userDefinedProviders) { propertiesMap.putAll(provider.getProperties()); } } }
[ "private", "void", "addUserProvidersToMap", "(", "Map", "<", "String", ",", "String", ">", "propertiesMap", ")", "{", "if", "(", "userDefinedProviders", ".", "length", "!=", "0", ")", "{", "for", "(", "PropertiesProvider", "provider", ":", "userDefinedProviders"...
Add user defined {@code PropertiesProvider} to global properties. @param propertiesMap the global properties map.
[ "Add", "user", "defined", "{", "@code", "PropertiesProvider", "}", "to", "global", "properties", "." ]
train
https://github.com/psamsotha/jersey-properties/blob/97ea8c5d31189c64688ca60bf3995239fce8830b/src/main/java/com/github/psamsotha/jersey/properties/JerseyPropertiesFeature.java#L125-L131
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java
SyncMembersInner.beginCreateOrUpdate
public SyncMemberInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().single().body(); }
java
public SyncMemberInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().single().body(); }
[ "public", "SyncMemberInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "syncGroupName", ",", "String", "syncMemberName", ",", "SyncMemberInner", "parameters", ")", "{", "return",...
Creates or updates a sync member. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group on which the sync member is hosted. @param syncMemberName The name of the sync member. @param parameters The requested sync member resource state. @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 SyncMemberInner object if successful.
[ "Creates", "or", "updates", "a", "sync", "member", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java#L339-L341
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/IssuesApi.java
IssuesApi.createIssue
public Issue createIssue(Object projectIdOrPath, String title, String description) throws GitLabApiException { return (createIssue(projectIdOrPath, title, description, null, null, null, null, null, null, null, null)); }
java
public Issue createIssue(Object projectIdOrPath, String title, String description) throws GitLabApiException { return (createIssue(projectIdOrPath, title, description, null, null, null, null, null, null, null, null)); }
[ "public", "Issue", "createIssue", "(", "Object", "projectIdOrPath", ",", "String", "title", ",", "String", "description", ")", "throws", "GitLabApiException", "{", "return", "(", "createIssue", "(", "projectIdOrPath", ",", "title", ",", "description", ",", "null",...
Create an issue for the project. <pre><code>GitLab Endpoint: POST /projects/:id/issues</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param title the title of an issue, required @param description the description of an issue, optional @return an instance of Issue @throws GitLabApiException if any exception occurs
[ "Create", "an", "issue", "for", "the", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/IssuesApi.java#L327-L329
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java
Director.resolveExistingAssetsFromDirectoryRepo
public boolean resolveExistingAssetsFromDirectoryRepo(Collection<String> featureNames, File repoDir, boolean isOverwrite) throws InstallException { return getResolveDirector().resolveExistingAssetsFromDirectoryRepo(featureNames, repoDir, isOverwrite); }
java
public boolean resolveExistingAssetsFromDirectoryRepo(Collection<String> featureNames, File repoDir, boolean isOverwrite) throws InstallException { return getResolveDirector().resolveExistingAssetsFromDirectoryRepo(featureNames, repoDir, isOverwrite); }
[ "public", "boolean", "resolveExistingAssetsFromDirectoryRepo", "(", "Collection", "<", "String", ">", "featureNames", ",", "File", "repoDir", ",", "boolean", "isOverwrite", ")", "throws", "InstallException", "{", "return", "getResolveDirector", "(", ")", ".", "resolve...
Resolves existing assets from a specified directory @param featureNames Collection of feature names to resolve @param repoDir Repository directory to obtain features from @param isOverwrite If features should be overwritten with fresh ones @return @throws InstallException
[ "Resolves", "existing", "assets", "from", "a", "specified", "directory" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L1811-L1813
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.serviceName_sendersAvailableForValidation_GET
public ArrayList<OvhSenderAvailable> serviceName_sendersAvailableForValidation_GET(String serviceName, OvhSenderRefererEnum referer) throws IOException { String qPath = "/sms/{serviceName}/sendersAvailableForValidation"; StringBuilder sb = path(qPath, serviceName); query(sb, "referer", referer); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
java
public ArrayList<OvhSenderAvailable> serviceName_sendersAvailableForValidation_GET(String serviceName, OvhSenderRefererEnum referer) throws IOException { String qPath = "/sms/{serviceName}/sendersAvailableForValidation"; StringBuilder sb = path(qPath, serviceName); query(sb, "referer", referer); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
[ "public", "ArrayList", "<", "OvhSenderAvailable", ">", "serviceName_sendersAvailableForValidation_GET", "(", "String", "serviceName", ",", "OvhSenderRefererEnum", "referer", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/{serviceName}/sendersAvailableForVali...
The senders that are attached to your personal informations or OVH services and that can be automatically validated REST: GET /sms/{serviceName}/sendersAvailableForValidation @param referer [required] Information type @param serviceName [required] The internal name of your SMS offer
[ "The", "senders", "that", "are", "attached", "to", "your", "personal", "informations", "or", "OVH", "services", "and", "that", "can", "be", "automatically", "validated" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1037-L1043
aws/aws-sdk-java
aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/GetIdentityPoolRolesResult.java
GetIdentityPoolRolesResult.withRoles
public GetIdentityPoolRolesResult withRoles(java.util.Map<String, String> roles) { setRoles(roles); return this; }
java
public GetIdentityPoolRolesResult withRoles(java.util.Map<String, String> roles) { setRoles(roles); return this; }
[ "public", "GetIdentityPoolRolesResult", "withRoles", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "roles", ")", "{", "setRoles", "(", "roles", ")", ";", "return", "this", ";", "}" ]
<p> The map of roles associated with this pool. Currently only authenticated and unauthenticated roles are supported. </p> @param roles The map of roles associated with this pool. Currently only authenticated and unauthenticated roles are supported. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "map", "of", "roles", "associated", "with", "this", "pool", ".", "Currently", "only", "authenticated", "and", "unauthenticated", "roles", "are", "supported", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/GetIdentityPoolRolesResult.java#L128-L131
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java
SftpSubsystemChannel.openFile
public SftpFile openFile(String absolutePath, int flags) throws SftpStatusException, SshException { return openFile(absolutePath, flags, new SftpFileAttributes(this, SftpFileAttributes.SSH_FILEXFER_TYPE_UNKNOWN)); }
java
public SftpFile openFile(String absolutePath, int flags) throws SftpStatusException, SshException { return openFile(absolutePath, flags, new SftpFileAttributes(this, SftpFileAttributes.SSH_FILEXFER_TYPE_UNKNOWN)); }
[ "public", "SftpFile", "openFile", "(", "String", "absolutePath", ",", "int", "flags", ")", "throws", "SftpStatusException", ",", "SshException", "{", "return", "openFile", "(", "absolutePath", ",", "flags", ",", "new", "SftpFileAttributes", "(", "this", ",", "Sf...
Open a file. @param absolutePath @param flags @return SftpFile @throws SftpStatusException , SshException
[ "Open", "a", "file", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpSubsystemChannel.java#L1526-L1530
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java
EventListenerSupport.createProxy
private void createProxy(final Class<L> listenerInterface, final ClassLoader classLoader) { proxy = listenerInterface.cast(Proxy.newProxyInstance(classLoader, new Class[] { listenerInterface }, createInvocationHandler())); }
java
private void createProxy(final Class<L> listenerInterface, final ClassLoader classLoader) { proxy = listenerInterface.cast(Proxy.newProxyInstance(classLoader, new Class[] { listenerInterface }, createInvocationHandler())); }
[ "private", "void", "createProxy", "(", "final", "Class", "<", "L", ">", "listenerInterface", ",", "final", "ClassLoader", "classLoader", ")", "{", "proxy", "=", "listenerInterface", ".", "cast", "(", "Proxy", ".", "newProxyInstance", "(", "classLoader", ",", "...
Create the proxy object. @param listenerInterface the class of the listener interface @param classLoader the class loader to be used
[ "Create", "the", "proxy", "object", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java#L304-L307
googleads/googleads-java-lib
modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/utils/v201809/shopping/ProductPartitionNode.java
ProductPartitionNode.putCustomParameter
public ProductPartitionNode putCustomParameter(String key, String value) { if (!nodeState.supportsCustomParameters()) { throw new IllegalStateException( String.format("Cannot set custom parameters on a %s node", nodeState.getNodeType())); } this.nodeState.getCustomParams().put(key, value); return this; }
java
public ProductPartitionNode putCustomParameter(String key, String value) { if (!nodeState.supportsCustomParameters()) { throw new IllegalStateException( String.format("Cannot set custom parameters on a %s node", nodeState.getNodeType())); } this.nodeState.getCustomParams().put(key, value); return this; }
[ "public", "ProductPartitionNode", "putCustomParameter", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "!", "nodeState", ".", "supportsCustomParameters", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "String", ".", "format...
Puts the specified key/value pair in the map of custom parameters. @throws IllegalStateException if this node is not a biddable UNIT node
[ "Puts", "the", "specified", "key", "/", "value", "pair", "in", "the", "map", "of", "custom", "parameters", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/adwords_axis/src/main/java/com/google/api/ads/adwords/axis/utils/v201809/shopping/ProductPartitionNode.java#L406-L413
ArcBees/gwtquery
samples/src/main/java/gwtquery/samples/client/GwtQueryBenchModule.java
GwtQueryBenchModule.moveHorses
private void moveHorses(Benchmark[] b, int row, double[] totalTimes) { if (!useTrack) return; double winnerTime = Double.MAX_VALUE; for (double d : totalTimes) { winnerTime = Math.min(winnerTime, d); } double winnerPos = row * (double) trackWidth / (double) ds.length; for (int i = 0; i < b.length; i++) { GQuery g = $("#" + b[i].getId() + "horse"); double pos = winnerPos * winnerTime / totalTimes[i]; g.css("left", (int)pos + "px"); } }
java
private void moveHorses(Benchmark[] b, int row, double[] totalTimes) { if (!useTrack) return; double winnerTime = Double.MAX_VALUE; for (double d : totalTimes) { winnerTime = Math.min(winnerTime, d); } double winnerPos = row * (double) trackWidth / (double) ds.length; for (int i = 0; i < b.length; i++) { GQuery g = $("#" + b[i].getId() + "horse"); double pos = winnerPos * winnerTime / totalTimes[i]; g.css("left", (int)pos + "px"); } }
[ "private", "void", "moveHorses", "(", "Benchmark", "[", "]", "b", ",", "int", "row", ",", "double", "[", "]", "totalTimes", ")", "{", "if", "(", "!", "useTrack", ")", "return", ";", "double", "winnerTime", "=", "Double", ".", "MAX_VALUE", ";", "for", ...
Update horse possition. Note that the calculated position is relative with the faster horse, so a horse could move back.
[ "Update", "horse", "possition", ".", "Note", "that", "the", "calculated", "position", "is", "relative", "with", "the", "faster", "horse", "so", "a", "horse", "could", "move", "back", "." ]
train
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/samples/src/main/java/gwtquery/samples/client/GwtQueryBenchModule.java#L488-L500
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.getDurationInMilliseconds
public long getDurationInMilliseconds(String name, long defaultValue) { TimeUnit timeUnit = extractTimeUnit(name, defaultValue + " MILLISECONDS"); long duration = getLong(name, defaultValue); return timeUnit.toMillis(duration); }
java
public long getDurationInMilliseconds(String name, long defaultValue) { TimeUnit timeUnit = extractTimeUnit(name, defaultValue + " MILLISECONDS"); long duration = getLong(name, defaultValue); return timeUnit.toMillis(duration); }
[ "public", "long", "getDurationInMilliseconds", "(", "String", "name", ",", "long", "defaultValue", ")", "{", "TimeUnit", "timeUnit", "=", "extractTimeUnit", "(", "name", ",", "defaultValue", "+", "\" MILLISECONDS\"", ")", ";", "long", "duration", "=", "getLong", ...
Gets the duration setting and converts it to milliseconds. <p/> The setting must be use one of the following conventions: <ul> <li>n MILLISECONDS <li>n SECONDS <li>n MINUTES <li>n HOURS <li>n DAYS </ul> @param name @param defaultValue in milliseconds @return milliseconds
[ "Gets", "the", "duration", "setting", "and", "converts", "it", "to", "milliseconds", ".", "<p", "/", ">", "The", "setting", "must", "be", "use", "one", "of", "the", "following", "conventions", ":", "<ul", ">", "<li", ">", "n", "MILLISECONDS", "<li", ">",...
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L803-L808
stevespringett/Alpine
alpine/src/main/java/alpine/resources/Pagination.java
Pagination.calculateStrategy
private void calculateStrategy(final Strategy strategy, final int o1, final int o2) { if (Strategy.OFFSET == strategy) { this.offset = o1; this.limit = o2; } else if (Strategy.PAGES == strategy) { this.offset = (o1 * o2) - o2; this.limit = o2; } }
java
private void calculateStrategy(final Strategy strategy, final int o1, final int o2) { if (Strategy.OFFSET == strategy) { this.offset = o1; this.limit = o2; } else if (Strategy.PAGES == strategy) { this.offset = (o1 * o2) - o2; this.limit = o2; } }
[ "private", "void", "calculateStrategy", "(", "final", "Strategy", "strategy", ",", "final", "int", "o1", ",", "final", "int", "o2", ")", "{", "if", "(", "Strategy", ".", "OFFSET", "==", "strategy", ")", "{", "this", ".", "offset", "=", "o1", ";", "this...
Determines the offset and limit based on pagination strategy. @param strategy the pagination strategy to use @param o1 the offset or page number to use @param o2 the number of results to limit a result-set to (aka, the size of the page)
[ "Determines", "the", "offset", "and", "limit", "based", "on", "pagination", "strategy", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/resources/Pagination.java#L72-L80
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/search/linear/LinearSearch.java
LinearSearch.searchLast
public static int searchLast(long[] longArray, long value, int occurrence) { if(occurrence <= 0 || occurrence > longArray.length) { throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than " + "the array length: " + occurrence); } int valuesSeen = 0; for(int i = longArray.length-1; i >=0; i--) { if(longArray[i] == value) { valuesSeen++; if(valuesSeen == occurrence) { return i; } } } return -1; }
java
public static int searchLast(long[] longArray, long value, int occurrence) { if(occurrence <= 0 || occurrence > longArray.length) { throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than " + "the array length: " + occurrence); } int valuesSeen = 0; for(int i = longArray.length-1; i >=0; i--) { if(longArray[i] == value) { valuesSeen++; if(valuesSeen == occurrence) { return i; } } } return -1; }
[ "public", "static", "int", "searchLast", "(", "long", "[", "]", "longArray", ",", "long", "value", ",", "int", "occurrence", ")", "{", "if", "(", "occurrence", "<=", "0", "||", "occurrence", ">", "longArray", ".", "length", ")", "{", "throw", "new", "I...
Search for the value in the long array and return the index of the first occurrence from the end of the array. @param longArray array that we are searching in. @param value value that is being searched in the array. @param occurrence number of times we have seen the value before returning the index. @return the index where the value is found in the array, else -1.
[ "Search", "for", "the", "value", "in", "the", "long", "array", "and", "return", "the", "index", "of", "the", "first", "occurrence", "from", "the", "end", "of", "the", "array", "." ]
train
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/search/linear/LinearSearch.java#L1650-L1669
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optLong
public static long optLong(@Nullable Bundle bundle, @Nullable String key, long fallback) { if (bundle == null) { return fallback; } return bundle.getLong(key, fallback); }
java
public static long optLong(@Nullable Bundle bundle, @Nullable String key, long fallback) { if (bundle == null) { return fallback; } return bundle.getLong(key, fallback); }
[ "public", "static", "long", "optLong", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ",", "long", "fallback", ")", "{", "if", "(", "bundle", "==", "null", ")", "{", "return", "fallback", ";", "}", "return", "bundle", ...
Returns a optional long value. In other words, returns the value mapped by key if it exists and is a long. The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns a fallback value. @param bundle a bundle. If the bundle is null, this method will return a fallback value. @param key a key for the value. @param fallback fallback value. @return a long value if exists, fallback value otherwise. @see android.os.Bundle#getLong(String, long)
[ "Returns", "a", "optional", "long", "value", ".", "In", "other", "words", "returns", "the", "value", "mapped", "by", "key", "if", "it", "exists", "and", "is", "a", "long", ".", "The", "bundle", "argument", "is", "allowed", "to", "be", "{" ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L644-L649
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java
JBossASClient.createRequest
public static ModelNode createRequest(String operation, Address address) { return createRequest(operation, address, null); }
java
public static ModelNode createRequest(String operation, Address address) { return createRequest(operation, address, null); }
[ "public", "static", "ModelNode", "createRequest", "(", "String", "operation", ",", "Address", "address", ")", "{", "return", "createRequest", "(", "operation", ",", "address", ",", "null", ")", ";", "}" ]
Convienence method that builds a partial operation request node. @param operation the operation to be requested @param address identifies the target resource @return the partial operation request node - caller should fill this in further to complete the node
[ "Convienence", "method", "that", "builds", "a", "partial", "operation", "request", "node", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java#L125-L127
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.deleteIterationAsync
public Observable<Void> deleteIterationAsync(UUID projectId, UUID iterationId) { return deleteIterationWithServiceResponseAsync(projectId, iterationId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> deleteIterationAsync(UUID projectId, UUID iterationId) { return deleteIterationWithServiceResponseAsync(projectId, iterationId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deleteIterationAsync", "(", "UUID", "projectId", ",", "UUID", "iterationId", ")", "{", "return", "deleteIterationWithServiceResponseAsync", "(", "projectId", ",", "iterationId", ")", ".", "map", "(", "new", "Func1", "<", ...
Delete a specific iteration of a project. @param projectId The project id @param iterationId The iteration id @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Delete", "a", "specific", "iteration", "of", "a", "project", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L1906-L1913
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/ParameterEditManager.java
ParameterEditManager.applyAndUpdateParmEditSet
static void applyAndUpdateParmEditSet(Document plf, Document ilf, IntegrationResult result) { Element pSet = null; try { pSet = getParmEditSet(plf, null, false); } catch (Exception e) { LOG.error("Exception occurred while getting user's DLM " + "paramter-edit-set.", e); } if (pSet == null) return; NodeList edits = pSet.getChildNodes(); for (int i = edits.getLength() - 1; i >= 0; i--) { if (applyEdit((Element) edits.item(i), ilf) == false) { pSet.removeChild(edits.item(i)); result.setChangedPLF(true); } else { result.setChangedILF(true); } } if (pSet.getChildNodes().getLength() == 0) { plf.getDocumentElement().removeChild(pSet); result.setChangedPLF(true); } }
java
static void applyAndUpdateParmEditSet(Document plf, Document ilf, IntegrationResult result) { Element pSet = null; try { pSet = getParmEditSet(plf, null, false); } catch (Exception e) { LOG.error("Exception occurred while getting user's DLM " + "paramter-edit-set.", e); } if (pSet == null) return; NodeList edits = pSet.getChildNodes(); for (int i = edits.getLength() - 1; i >= 0; i--) { if (applyEdit((Element) edits.item(i), ilf) == false) { pSet.removeChild(edits.item(i)); result.setChangedPLF(true); } else { result.setChangedILF(true); } } if (pSet.getChildNodes().getLength() == 0) { plf.getDocumentElement().removeChild(pSet); result.setChangedPLF(true); } }
[ "static", "void", "applyAndUpdateParmEditSet", "(", "Document", "plf", ",", "Document", "ilf", ",", "IntegrationResult", "result", ")", "{", "Element", "pSet", "=", "null", ";", "try", "{", "pSet", "=", "getParmEditSet", "(", "plf", ",", "null", ",", "false"...
Get the parm edit set if any from the plf and process each edit command removing any that fail from the set so that the set is self cleaning. @throws Exception
[ "Get", "the", "parm", "edit", "set", "if", "any", "from", "the", "plf", "and", "process", "each", "edit", "command", "removing", "any", "that", "fail", "from", "the", "set", "so", "that", "the", "set", "is", "self", "cleaning", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/ParameterEditManager.java#L59-L85
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilders.java
SearchBuilders.geoDistance
public static GeoDistanceConditionBuilder geoDistance(String field, double longitude, double latitude, String maxDistance) { return new GeoDistanceConditionBuilder(field, latitude, longitude, maxDistance); }
java
public static GeoDistanceConditionBuilder geoDistance(String field, double longitude, double latitude, String maxDistance) { return new GeoDistanceConditionBuilder(field, latitude, longitude, maxDistance); }
[ "public", "static", "GeoDistanceConditionBuilder", "geoDistance", "(", "String", "field", ",", "double", "longitude", ",", "double", "latitude", ",", "String", "maxDistance", ")", "{", "return", "new", "GeoDistanceConditionBuilder", "(", "field", ",", "latitude", ",...
Returns a new {@link GeoDistanceConditionBuilder} with the specified field reference point. @param field the name of the field to be matched @param longitude The longitude of the reference point. @param latitude The latitude of the reference point. @param maxDistance The max allowed distance. @return a new geo distance condition builder
[ "Returns", "a", "new", "{", "@link", "GeoDistanceConditionBuilder", "}", "with", "the", "specified", "field", "reference", "point", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilders.java#L236-L241
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/tokens/ExpressionToken.java
ExpressionToken.listLookup
protected final Object listLookup(List list, int index) { LOGGER.trace("get value in List index " + index); return list.get(index); }
java
protected final Object listLookup(List list, int index) { LOGGER.trace("get value in List index " + index); return list.get(index); }
[ "protected", "final", "Object", "listLookup", "(", "List", "list", ",", "int", "index", ")", "{", "LOGGER", ".", "trace", "(", "\"get value in List index \"", "+", "index", ")", ";", "return", "list", ".", "get", "(", "index", ")", ";", "}" ]
Get the value in a {@link List} at <code>index</code>. @param list the List @param index the index @return the value returned from <code>list.get(index)</code>
[ "Get", "the", "value", "in", "a", "{" ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/tokens/ExpressionToken.java#L72-L75
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java
SqlExecutor.queryAndClosePs
public static <T> T queryAndClosePs(PreparedStatement ps, RsHandler<T> rsh, Object... params) throws SQLException { try { return query(ps, rsh, params); } finally { DbUtil.close(ps); } }
java
public static <T> T queryAndClosePs(PreparedStatement ps, RsHandler<T> rsh, Object... params) throws SQLException { try { return query(ps, rsh, params); } finally { DbUtil.close(ps); } }
[ "public", "static", "<", "T", ">", "T", "queryAndClosePs", "(", "PreparedStatement", "ps", ",", "RsHandler", "<", "T", ">", "rsh", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "try", "{", "return", "query", "(", "ps", ",", "rsh", ...
执行查询语句并关闭PreparedStatement @param <T> 处理结果类型 @param ps PreparedStatement @param rsh 结果集处理对象 @param params 参数 @return 结果对象 @throws SQLException SQL执行异常
[ "执行查询语句并关闭PreparedStatement" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L327-L333
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java
JSONConverter.writeString
public void writeString(OutputStream out, String value) throws IOException { writeStartArray(out); writeStringInternal(out, value); writeEndArray(out); }
java
public void writeString(OutputStream out, String value) throws IOException { writeStartArray(out); writeStringInternal(out, value); writeEndArray(out); }
[ "public", "void", "writeString", "(", "OutputStream", "out", ",", "String", "value", ")", "throws", "IOException", "{", "writeStartArray", "(", "out", ")", ";", "writeStringInternal", "(", "out", ",", "value", ")", ";", "writeEndArray", "(", "out", ")", ";",...
Encode a String value as JSON. An array is used to wrap the value: [ String ] @param out The stream to write JSON to @param value The String value to encode. @throws IOException If an I/O error occurs @see #readString(InputStream)
[ "Encode", "a", "String", "value", "as", "JSON", ".", "An", "array", "is", "used", "to", "wrap", "the", "value", ":", "[", "String", "]" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java#L746-L750
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.doubleArray2WritableRaster
public static WritableRaster doubleArray2WritableRaster( double[] array, int width, int height ) { WritableRaster writableRaster = createWritableRaster(width, height, null, null, null); int index = 0;; for( int x = 0; x < width; x++ ) { for( int y = 0; y < height; y++ ) { writableRaster.setSample(x, y, 0, array[index++]); } } return writableRaster; }
java
public static WritableRaster doubleArray2WritableRaster( double[] array, int width, int height ) { WritableRaster writableRaster = createWritableRaster(width, height, null, null, null); int index = 0;; for( int x = 0; x < width; x++ ) { for( int y = 0; y < height; y++ ) { writableRaster.setSample(x, y, 0, array[index++]); } } return writableRaster; }
[ "public", "static", "WritableRaster", "doubleArray2WritableRaster", "(", "double", "[", "]", "array", ",", "int", "width", ",", "int", "height", ")", "{", "WritableRaster", "writableRaster", "=", "createWritableRaster", "(", "width", ",", "height", ",", "null", ...
Transforms an array of values into a {@link WritableRaster}. @param array the values to transform. @param divide the factor by which to divide the values. @param width the width of the resulting image. @param height the height of the resulting image. @return the raster.
[ "Transforms", "an", "array", "of", "values", "into", "a", "{", "@link", "WritableRaster", "}", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1133-L1142
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.createKey
public KeyBundle createKey(String vaultBaseUrl, String keyName, JsonWebKeyType kty) { return createKeyWithServiceResponseAsync(vaultBaseUrl, keyName, kty).toBlocking().single().body(); }
java
public KeyBundle createKey(String vaultBaseUrl, String keyName, JsonWebKeyType kty) { return createKeyWithServiceResponseAsync(vaultBaseUrl, keyName, kty).toBlocking().single().body(); }
[ "public", "KeyBundle", "createKey", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "JsonWebKeyType", "kty", ")", "{", "return", "createKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ",", "kty", ")", ".", "toBlocking", "(", ")", ...
Creates a new key, stores it, then returns key parameters and attributes to the client. The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the keys/create permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name for the new key. The system will generate the version name for the new key. @param kty The type of key to create. For valid values, see JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the KeyBundle object if successful.
[ "Creates", "a", "new", "key", "stores", "it", "then", "returns", "key", "parameters", "and", "attributes", "to", "the", "client", ".", "The", "create", "key", "operation", "can", "be", "used", "to", "create", "any", "key", "type", "in", "Azure", "Key", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L651-L653
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteClosedListAsync
public Observable<OperationStatus> deleteClosedListAsync(UUID appId, String versionId, UUID clEntityId) { return deleteClosedListWithServiceResponseAsync(appId, versionId, clEntityId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> deleteClosedListAsync(UUID appId, String versionId, UUID clEntityId) { return deleteClosedListWithServiceResponseAsync(appId, versionId, clEntityId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "deleteClosedListAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "clEntityId", ")", "{", "return", "deleteClosedListWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "clEntityId"...
Deletes a closed list model from the application. @param appId The application ID. @param versionId The version ID. @param clEntityId The closed list model ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Deletes", "a", "closed", "list", "model", "from", "the", "application", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L4625-L4632
UrielCh/ovh-java-sdk
ovh-java-sdk-caascontainers/src/main/java/net/minidev/ovh/api/ApiOvhCaascontainers.java
ApiOvhCaascontainers.serviceName_registry_credentials_credentialsId_DELETE
public void serviceName_registry_credentials_credentialsId_DELETE(String serviceName, String credentialsId) throws IOException { String qPath = "/caas/containers/{serviceName}/registry/credentials/{credentialsId}"; StringBuilder sb = path(qPath, serviceName, credentialsId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void serviceName_registry_credentials_credentialsId_DELETE(String serviceName, String credentialsId) throws IOException { String qPath = "/caas/containers/{serviceName}/registry/credentials/{credentialsId}"; StringBuilder sb = path(qPath, serviceName, credentialsId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "serviceName_registry_credentials_credentialsId_DELETE", "(", "String", "serviceName", ",", "String", "credentialsId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/caas/containers/{serviceName}/registry/credentials/{credentialsId}\"", ";", "Str...
Delete the registry credentials. REST: DELETE /caas/containers/{serviceName}/registry/credentials/{credentialsId} @param credentialsId [required] credentials id @param serviceName [required] service name API beta
[ "Delete", "the", "registry", "credentials", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caascontainers/src/main/java/net/minidev/ovh/api/ApiOvhCaascontainers.java#L311-L315
box/box-java-sdk
src/main/java/com/box/sdk/BoxFolder.java
BoxFolder.uploadFile
public BoxFile.Info uploadFile(UploadFileCallback callback, String name) { FileUploadParams uploadInfo = new FileUploadParams() .setUploadFileCallback(callback) .setName(name); return this.uploadFile(uploadInfo); }
java
public BoxFile.Info uploadFile(UploadFileCallback callback, String name) { FileUploadParams uploadInfo = new FileUploadParams() .setUploadFileCallback(callback) .setName(name); return this.uploadFile(uploadInfo); }
[ "public", "BoxFile", ".", "Info", "uploadFile", "(", "UploadFileCallback", "callback", ",", "String", "name", ")", "{", "FileUploadParams", "uploadInfo", "=", "new", "FileUploadParams", "(", ")", ".", "setUploadFileCallback", "(", "callback", ")", ".", "setName", ...
Uploads a new file to this folder. @param callback the callback which allows file content to be written on output stream. @param name the name to give the uploaded file. @return the uploaded file's info.
[ "Uploads", "a", "new", "file", "to", "this", "folder", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L466-L471
apache/flink
flink-core/src/main/java/org/apache/flink/util/IOUtils.java
IOUtils.copyBytes
public static void copyBytes(final InputStream in, final OutputStream out, final int buffSize, final boolean close) throws IOException { @SuppressWarnings("resource") final PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null; final byte[] buf = new byte[buffSize]; try { int bytesRead = in.read(buf); while (bytesRead >= 0) { out.write(buf, 0, bytesRead); if ((ps != null) && ps.checkError()) { throw new IOException("Unable to write to output stream."); } bytesRead = in.read(buf); } } finally { if (close) { out.close(); in.close(); } } }
java
public static void copyBytes(final InputStream in, final OutputStream out, final int buffSize, final boolean close) throws IOException { @SuppressWarnings("resource") final PrintStream ps = out instanceof PrintStream ? (PrintStream) out : null; final byte[] buf = new byte[buffSize]; try { int bytesRead = in.read(buf); while (bytesRead >= 0) { out.write(buf, 0, bytesRead); if ((ps != null) && ps.checkError()) { throw new IOException("Unable to write to output stream."); } bytesRead = in.read(buf); } } finally { if (close) { out.close(); in.close(); } } }
[ "public", "static", "void", "copyBytes", "(", "final", "InputStream", "in", ",", "final", "OutputStream", "out", ",", "final", "int", "buffSize", ",", "final", "boolean", "close", ")", "throws", "IOException", "{", "@", "SuppressWarnings", "(", "\"resource\"", ...
Copies from one stream to another. @param in InputStream to read from @param out OutputStream to write to @param buffSize the size of the buffer @param close whether or not close the InputStream and OutputStream at the end. The streams are closed in the finally clause. @throws IOException thrown if an error occurred while writing to the output stream
[ "Copies", "from", "one", "stream", "to", "another", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/util/IOUtils.java#L56-L77
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getCompositeEntity
public CompositeEntityExtractor getCompositeEntity(UUID appId, String versionId, UUID cEntityId) { return getCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId).toBlocking().single().body(); }
java
public CompositeEntityExtractor getCompositeEntity(UUID appId, String versionId, UUID cEntityId) { return getCompositeEntityWithServiceResponseAsync(appId, versionId, cEntityId).toBlocking().single().body(); }
[ "public", "CompositeEntityExtractor", "getCompositeEntity", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "cEntityId", ")", "{", "return", "getCompositeEntityWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "cEntityId", ")", ".", "toBlo...
Gets information about the composite entity model. @param appId The application ID. @param versionId The version ID. @param cEntityId The composite entity extractor ID. @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 @return the CompositeEntityExtractor object if successful.
[ "Gets", "information", "about", "the", "composite", "entity", "model", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L3937-L3939
aspectran/aspectran
core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java
FileSessionDataStore.restoreAttributes
private void restoreAttributes(InputStream is, int size, SessionData data) throws Exception { if (size > 0) { // input stream should not be closed here Map<String, Object> attributes = new HashMap<>(); ObjectInputStream ois = new CustomObjectInputStream(is); for (int i = 0; i < size; i++) { String key = ois.readUTF(); Object value = ois.readObject(); attributes.put(key, value); } data.putAllAttributes(attributes); } }
java
private void restoreAttributes(InputStream is, int size, SessionData data) throws Exception { if (size > 0) { // input stream should not be closed here Map<String, Object> attributes = new HashMap<>(); ObjectInputStream ois = new CustomObjectInputStream(is); for (int i = 0; i < size; i++) { String key = ois.readUTF(); Object value = ois.readObject(); attributes.put(key, value); } data.putAllAttributes(attributes); } }
[ "private", "void", "restoreAttributes", "(", "InputStream", "is", ",", "int", "size", ",", "SessionData", "data", ")", "throws", "Exception", "{", "if", "(", "size", ">", "0", ")", "{", "// input stream should not be closed here\r", "Map", "<", "String", ",", ...
Load attributes from an input stream that contains session data. @param is the input stream containing session data @param size number of attributes @param data the data to restore to @throws Exception if the input stream is invalid or fails to read
[ "Load", "attributes", "from", "an", "input", "stream", "that", "contains", "session", "data", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/component/session/FileSessionDataStore.java#L394-L406
haifengl/smile
math/src/main/java/smile/math/special/Gamma.java
Gamma.regularizedUpperIncompleteGamma
public static double regularizedUpperIncompleteGamma(double s, double x) { if (s < 0.0) { throw new IllegalArgumentException("Invalid s: " + s); } if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } double igf = 0.0; if (x != 0.0) { if (x == 1.0 / 0.0) { igf = 1.0; } else { if (x < s + 1.0) { // Series representation igf = 1.0 - regularizedIncompleteGammaSeries(s, x); } else { // Continued fraction representation igf = 1.0 - regularizedIncompleteGammaFraction(s, x); } } } return igf; }
java
public static double regularizedUpperIncompleteGamma(double s, double x) { if (s < 0.0) { throw new IllegalArgumentException("Invalid s: " + s); } if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } double igf = 0.0; if (x != 0.0) { if (x == 1.0 / 0.0) { igf = 1.0; } else { if (x < s + 1.0) { // Series representation igf = 1.0 - regularizedIncompleteGammaSeries(s, x); } else { // Continued fraction representation igf = 1.0 - regularizedIncompleteGammaFraction(s, x); } } } return igf; }
[ "public", "static", "double", "regularizedUpperIncompleteGamma", "(", "double", "s", ",", "double", "x", ")", "{", "if", "(", "s", "<", "0.0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Invalid s: \"", "+", "s", ")", ";", "}", "if", "(",...
Regularized Upper/Complementary Incomplete Gamma Function Q(s,x) = 1 - P(s,x) = 1 - <i><big>&#8747;</big><sub><small>0</small></sub><sup><small>x</small></sup> e<sup>-t</sup> t<sup>(s-1)</sup> dt</i>
[ "Regularized", "Upper", "/", "Complementary", "Incomplete", "Gamma", "Function", "Q", "(", "s", "x", ")", "=", "1", "-", "P", "(", "s", "x", ")", "=", "1", "-", "<i", ">", "<big", ">", "&#8747", ";", "<", "/", "big", ">", "<sub", ">", "<small", ...
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/special/Gamma.java#L148-L173
kkopacz/agiso-tempel
templates/abstract-velocityDirectoryExtendEngine/src/main/java/org/agiso/tempel/engine/VelocityDirectoryExtendEngine.java
VelocityDirectoryExtendEngine.processVelocityResource
@Override protected void processVelocityResource(ITemplateSource source, VelocityContext context, String target) throws Exception { if(source.isFile()) { super.processVelocityFile(source.getEntry(source.getResource()), context, target); } else if(source.isDirectory()) { for(ITemplateSourceEntry entry : source.listEntries()) { if(entry.isFile()) { processVelocityFile(entry, context, target); } else if(entry.isDirectory()) { processVelocityDirectory(entry, context, target); } } } }
java
@Override protected void processVelocityResource(ITemplateSource source, VelocityContext context, String target) throws Exception { if(source.isFile()) { super.processVelocityFile(source.getEntry(source.getResource()), context, target); } else if(source.isDirectory()) { for(ITemplateSourceEntry entry : source.listEntries()) { if(entry.isFile()) { processVelocityFile(entry, context, target); } else if(entry.isDirectory()) { processVelocityDirectory(entry, context, target); } } } }
[ "@", "Override", "protected", "void", "processVelocityResource", "(", "ITemplateSource", "source", ",", "VelocityContext", "context", ",", "String", "target", ")", "throws", "Exception", "{", "if", "(", "source", ".", "isFile", "(", ")", ")", "{", "super", "."...
Szablon może być pojedynczym plikiem (wówczas silnik działa tak jak silnik {@link VelocityFileEngine}, lub katalogiem. W takiej sytuacji przetwarzane są wszsytkie jego wpisy.
[ "Szablon", "może", "być", "pojedynczym", "plikiem", "(", "wówczas", "silnik", "działa", "tak", "jak", "silnik", "{" ]
train
https://github.com/kkopacz/agiso-tempel/blob/ff7a96153153b6bc07212d776816b87d9538f6fa/templates/abstract-velocityDirectoryExtendEngine/src/main/java/org/agiso/tempel/engine/VelocityDirectoryExtendEngine.java#L44-L57
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/PeerGroup.java
PeerGroup.addConnectedEventListener
public void addConnectedEventListener(Executor executor, PeerConnectedEventListener listener) { peerConnectedEventListeners.add(new ListenerRegistration<>(checkNotNull(listener), executor)); for (Peer peer : getConnectedPeers()) peer.addConnectedEventListener(executor, listener); for (Peer peer : getPendingPeers()) peer.addConnectedEventListener(executor, listener); }
java
public void addConnectedEventListener(Executor executor, PeerConnectedEventListener listener) { peerConnectedEventListeners.add(new ListenerRegistration<>(checkNotNull(listener), executor)); for (Peer peer : getConnectedPeers()) peer.addConnectedEventListener(executor, listener); for (Peer peer : getPendingPeers()) peer.addConnectedEventListener(executor, listener); }
[ "public", "void", "addConnectedEventListener", "(", "Executor", "executor", ",", "PeerConnectedEventListener", "listener", ")", "{", "peerConnectedEventListeners", ".", "add", "(", "new", "ListenerRegistration", "<>", "(", "checkNotNull", "(", "listener", ")", ",", "e...
<p>Adds a listener that will be notified on the given executor when new peers are connected to.</p>
[ "<p", ">", "Adds", "a", "listener", "that", "will", "be", "notified", "on", "the", "given", "executor", "when", "new", "peers", "are", "connected", "to", ".", "<", "/", "p", ">" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/PeerGroup.java#L673-L679
grycap/coreutils
coreutils-fiber/src/main/java/es/upv/grycap/coreutils/fiber/http/Http2Client.java
Http2Client.asyncGet
public void asyncGet(final String url, final @Nullable List<String> acceptableMediaTypes, final boolean nocache, final Callback callback) { final String url2 = requireNonNull(trimToNull(url), "A non-empty URL expected"); requireNonNull(callback, "A valid callback expected"); // configure cache final CacheControl.Builder cacheControlBuilder = new CacheControl.Builder(); if (nocache) cacheControlBuilder.noCache().noStore(); else cacheControlBuilder.maxStale(3600, TimeUnit.SECONDS); // prepare request final Request.Builder requestBuilder = new Request.Builder().cacheControl(cacheControlBuilder.build()).url(url2); ofNullable(acceptableMediaTypes).orElse(emptyList()).stream().filter(Objects::nonNull).forEach(type -> requestBuilder.addHeader("Accept", type)); // submit request client.newCall(requestBuilder.build()).enqueue(callback); }
java
public void asyncGet(final String url, final @Nullable List<String> acceptableMediaTypes, final boolean nocache, final Callback callback) { final String url2 = requireNonNull(trimToNull(url), "A non-empty URL expected"); requireNonNull(callback, "A valid callback expected"); // configure cache final CacheControl.Builder cacheControlBuilder = new CacheControl.Builder(); if (nocache) cacheControlBuilder.noCache().noStore(); else cacheControlBuilder.maxStale(3600, TimeUnit.SECONDS); // prepare request final Request.Builder requestBuilder = new Request.Builder().cacheControl(cacheControlBuilder.build()).url(url2); ofNullable(acceptableMediaTypes).orElse(emptyList()).stream().filter(Objects::nonNull).forEach(type -> requestBuilder.addHeader("Accept", type)); // submit request client.newCall(requestBuilder.build()).enqueue(callback); }
[ "public", "void", "asyncGet", "(", "final", "String", "url", ",", "final", "@", "Nullable", "List", "<", "String", ">", "acceptableMediaTypes", ",", "final", "boolean", "nocache", ",", "final", "Callback", "callback", ")", "{", "final", "String", "url2", "="...
Retrieve information from a server via a HTTP GET request. @param url - URL target of this request @param acceptableMediaTypes - Content-Types that are acceptable for this request @param nocache - don't accept an invalidated cached response, and don't store the server's response in any cache @param callback - is called back when the response is readable
[ "Retrieve", "information", "from", "a", "server", "via", "a", "HTTP", "GET", "request", "." ]
train
https://github.com/grycap/coreutils/blob/e6db61dc50b49ea7276c0c29c7401204681a10c2/coreutils-fiber/src/main/java/es/upv/grycap/coreutils/fiber/http/Http2Client.java#L93-L105
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java
TmdbMovies.getReleaseDates
public ResultList<ReleaseDates> getReleaseDates(int movieId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RELEASE_DATES).buildUrl(parameters); WrapperGenericList<ReleaseDates> wrapper = processWrapper(getTypeReference(ReleaseDates.class), url, "release dates"); return wrapper.getResultsList(); }
java
public ResultList<ReleaseDates> getReleaseDates(int movieId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.ID, movieId); URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RELEASE_DATES).buildUrl(parameters); WrapperGenericList<ReleaseDates> wrapper = processWrapper(getTypeReference(ReleaseDates.class), url, "release dates"); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "ReleaseDates", ">", "getReleaseDates", "(", "int", "movieId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(", "Param", ".", "ID", ...
Get the release dates, certifications and related information by country for a specific movie id. The results are keyed by country code and contain a type value. @param movieId @return @throws MovieDbException
[ "Get", "the", "release", "dates", "certifications", "and", "related", "information", "by", "country", "for", "a", "specific", "movie", "id", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L346-L353
VoltDB/voltdb
src/frontend/org/voltdb/expressions/ExpressionUtil.java
ExpressionUtil.collectTerminals
private static void collectTerminals(AbstractExpression expr, Set<AbstractExpression> accum) { if (expr != null) { collectTerminals(expr.getLeft(), accum); collectTerminals(expr.getRight(), accum); if (expr.getArgs() != null) { expr.getArgs().forEach(e -> collectTerminals(e, accum)); } else if (expr.getLeft() == null && expr.getRight() == null) { accum.add(expr); } } }
java
private static void collectTerminals(AbstractExpression expr, Set<AbstractExpression> accum) { if (expr != null) { collectTerminals(expr.getLeft(), accum); collectTerminals(expr.getRight(), accum); if (expr.getArgs() != null) { expr.getArgs().forEach(e -> collectTerminals(e, accum)); } else if (expr.getLeft() == null && expr.getRight() == null) { accum.add(expr); } } }
[ "private", "static", "void", "collectTerminals", "(", "AbstractExpression", "expr", ",", "Set", "<", "AbstractExpression", ">", "accum", ")", "{", "if", "(", "expr", "!=", "null", ")", "{", "collectTerminals", "(", "expr", ".", "getLeft", "(", ")", ",", "a...
A terminal node of an expression is the one that does not have left/right child, nor any parameters;
[ "A", "terminal", "node", "of", "an", "expression", "is", "the", "one", "that", "does", "not", "have", "left", "/", "right", "child", "nor", "any", "parameters", ";" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/ExpressionUtil.java#L281-L291
OpenTSDB/opentsdb
src/utils/JSON.java
JSON.serializeToJSONPBytes
public static final byte[] serializeToJSONPBytes(final String callback, final Object object) { if (callback == null || callback.isEmpty()) throw new IllegalArgumentException("Missing callback name"); if (object == null) throw new IllegalArgumentException("Object was null"); try { return jsonMapper.writeValueAsBytes(new JSONPObject(callback, object)); } catch (JsonProcessingException e) { throw new JSONException(e); } }
java
public static final byte[] serializeToJSONPBytes(final String callback, final Object object) { if (callback == null || callback.isEmpty()) throw new IllegalArgumentException("Missing callback name"); if (object == null) throw new IllegalArgumentException("Object was null"); try { return jsonMapper.writeValueAsBytes(new JSONPObject(callback, object)); } catch (JsonProcessingException e) { throw new JSONException(e); } }
[ "public", "static", "final", "byte", "[", "]", "serializeToJSONPBytes", "(", "final", "String", "callback", ",", "final", "Object", "object", ")", "{", "if", "(", "callback", "==", "null", "||", "callback", ".", "isEmpty", "(", ")", ")", "throw", "new", ...
Serializes the given object and wraps it in a callback function i.e. &lt;callback&gt;(&lt;json&gt;) Note: This will not append a trailing semicolon @param callback The name of the Javascript callback to prepend @param object The object to serialize @return A JSONP formatted byte array @throws IllegalArgumentException if the callback method name was missing or object was null @throws JSONException if the object could not be serialized
[ "Serializes", "the", "given", "object", "and", "wraps", "it", "in", "a", "callback", "function", "i", ".", "e", ".", "&lt", ";", "callback&gt", ";", "(", "&lt", ";", "json&gt", ";", ")", "Note", ":", "This", "will", "not", "append", "a", "trailing", ...
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/JSON.java#L335-L346
tvesalainen/util
util/src/main/java/d3/env/TSAGeoMag.java
TSAGeoMag.getVerticalIntensity
public double getVerticalIntensity( double dlat, double dlong, double year, double altitude ) { calcGeoMag( dlat, dlong, year, altitude ); return bz; }
java
public double getVerticalIntensity( double dlat, double dlong, double year, double altitude ) { calcGeoMag( dlat, dlong, year, altitude ); return bz; }
[ "public", "double", "getVerticalIntensity", "(", "double", "dlat", ",", "double", "dlong", ",", "double", "year", ",", "double", "altitude", ")", "{", "calcGeoMag", "(", "dlat", ",", "dlong", ",", "year", ",", "altitude", ")", ";", "return", "bz", ";", "...
Returns the vertical magnetic field intensity from the Department of Defense geomagnetic model and data in nano Tesla. @param dlat Latitude in decimal degrees. @param dlong Longitude in decimal degrees. @param year Date of the calculation in decimal years. @param altitude Altitude of the calculation in kilometers. @return The vertical magnetic field strength in nano Tesla.
[ "Returns", "the", "vertical", "magnetic", "field", "intensity", "from", "the", "Department", "of", "Defense", "geomagnetic", "model", "and", "data", "in", "nano", "Tesla", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/d3/env/TSAGeoMag.java#L1038-L1042
mlhartme/sushi
src/main/java/net/oneandone/sushi/util/IntBitRelation.java
IntBitRelation.contains
public boolean contains(int left, int right) { if (line[left] == null) { return false; } return line[left].contains(right); }
java
public boolean contains(int left, int right) { if (line[left] == null) { return false; } return line[left].contains(right); }
[ "public", "boolean", "contains", "(", "int", "left", ",", "int", "right", ")", "{", "if", "(", "line", "[", "left", "]", "==", "null", ")", "{", "return", "false", ";", "}", "return", "line", "[", "left", "]", ".", "contains", "(", "right", ")", ...
Element test. @param left left value of the pair to test. @param right right value of the pair to test. @return true, if (left, right) is element of the relation.
[ "Element", "test", "." ]
train
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitRelation.java#L99-L104
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java
GeometryDeserializer.setCrsIds
private String setCrsIds(String json, CrsId crsId) throws IOException, JsonException { /* Prepare a geojson crs structure "crs": { "type": "name", "properties": { "name": "EPSG:xxxx" } } */ HashMap<String, Object> properties = new HashMap<String, Object>(); properties.put("name", crsId.getAuthority() + ":" + crsId.getCode()); HashMap<String, Object> type = new HashMap<String, Object>(); type.put("type", "name"); type.put("properties", properties); List<HashMap> result = parent.collectionFromJson(json, HashMap.class); for (HashMap geometryJson : result) { geometryJson.put("crs", type); } return parent.toJson(result); }
java
private String setCrsIds(String json, CrsId crsId) throws IOException, JsonException { /* Prepare a geojson crs structure "crs": { "type": "name", "properties": { "name": "EPSG:xxxx" } } */ HashMap<String, Object> properties = new HashMap<String, Object>(); properties.put("name", crsId.getAuthority() + ":" + crsId.getCode()); HashMap<String, Object> type = new HashMap<String, Object>(); type.put("type", "name"); type.put("properties", properties); List<HashMap> result = parent.collectionFromJson(json, HashMap.class); for (HashMap geometryJson : result) { geometryJson.put("crs", type); } return parent.toJson(result); }
[ "private", "String", "setCrsIds", "(", "String", "json", ",", "CrsId", "crsId", ")", "throws", "IOException", ",", "JsonException", "{", "/* Prepare a geojson crs structure\n \"crs\": {\n \"type\": \"name\",\n \"properties\": {\n \"na...
Adds the given crs to all json objects. Used in {@link #asGeomCollection(org.geolatte.geom.crs.CrsId)}. @param json the json string representing an array of geometry objects without crs property. @param crsId the crsId @return the same json string with the crs property filled in for each of the geometries.
[ "Adds", "the", "given", "crs", "to", "all", "json", "objects", ".", "Used", "in", "{", "@link", "#asGeomCollection", "(", "org", ".", "geolatte", ".", "geom", ".", "crs", ".", "CrsId", ")", "}", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/GeometryDeserializer.java#L181-L204
fcrepo4/fcrepo4
fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraBaseResource.java
FedoraBaseResource.setUpJMSInfo
protected void setUpJMSInfo(final UriInfo uriInfo, final HttpHeaders headers) { try { String baseURL = getBaseUrlProperty(uriInfo); if (baseURL.length() == 0) { baseURL = uriInfo.getBaseUri().toString(); } LOGGER.debug("setting baseURL = " + baseURL); session.getFedoraSession().addSessionData(BASE_URL, baseURL); if (!StringUtils.isBlank(headers.getHeaderString("user-agent"))) { session.getFedoraSession().addSessionData(USER_AGENT, headers.getHeaderString("user-agent")); } } catch (final Exception ex) { LOGGER.warn("Error setting baseURL", ex.getMessage()); } }
java
protected void setUpJMSInfo(final UriInfo uriInfo, final HttpHeaders headers) { try { String baseURL = getBaseUrlProperty(uriInfo); if (baseURL.length() == 0) { baseURL = uriInfo.getBaseUri().toString(); } LOGGER.debug("setting baseURL = " + baseURL); session.getFedoraSession().addSessionData(BASE_URL, baseURL); if (!StringUtils.isBlank(headers.getHeaderString("user-agent"))) { session.getFedoraSession().addSessionData(USER_AGENT, headers.getHeaderString("user-agent")); } } catch (final Exception ex) { LOGGER.warn("Error setting baseURL", ex.getMessage()); } }
[ "protected", "void", "setUpJMSInfo", "(", "final", "UriInfo", "uriInfo", ",", "final", "HttpHeaders", "headers", ")", "{", "try", "{", "String", "baseURL", "=", "getBaseUrlProperty", "(", "uriInfo", ")", ";", "if", "(", "baseURL", ".", "length", "(", ")", ...
Set the baseURL for JMS events. @param uriInfo the uri info @param headers HTTP headers
[ "Set", "the", "baseURL", "for", "JMS", "events", "." ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-api/src/main/java/org/fcrepo/http/api/FedoraBaseResource.java#L109-L123
Talend/tesb-rt-se
locator/src/main/java/org/talend/esb/servicelocator/cxf/internal/CXFEndpointProvider.java
CXFEndpointProvider.addProperties
private static void addProperties(EndpointReferenceType epr, SLProperties props) { MetadataType metadata = WSAEndpointReferenceUtils.getSetMetadata(epr); ServiceLocatorPropertiesType jaxbProps = SLPropertiesConverter.toServiceLocatorPropertiesType(props); JAXBElement<ServiceLocatorPropertiesType> slp = SL_OBJECT_FACTORY.createServiceLocatorProperties(jaxbProps); metadata.getAny().add(slp); }
java
private static void addProperties(EndpointReferenceType epr, SLProperties props) { MetadataType metadata = WSAEndpointReferenceUtils.getSetMetadata(epr); ServiceLocatorPropertiesType jaxbProps = SLPropertiesConverter.toServiceLocatorPropertiesType(props); JAXBElement<ServiceLocatorPropertiesType> slp = SL_OBJECT_FACTORY.createServiceLocatorProperties(jaxbProps); metadata.getAny().add(slp); }
[ "private", "static", "void", "addProperties", "(", "EndpointReferenceType", "epr", ",", "SLProperties", "props", ")", "{", "MetadataType", "metadata", "=", "WSAEndpointReferenceUtils", ".", "getSetMetadata", "(", "epr", ")", ";", "ServiceLocatorPropertiesType", "jaxbPro...
Adds service locator properties to an endpoint reference. @param epr @param props
[ "Adds", "service", "locator", "properties", "to", "an", "endpoint", "reference", "." ]
train
https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/locator/src/main/java/org/talend/esb/servicelocator/cxf/internal/CXFEndpointProvider.java#L310-L317
contentful/contentful.java
src/main/java/com/contentful/java/cda/image/ImageOption.java
ImageOption.jpegQualityOf
public static ImageOption jpegQualityOf(int quality) { if (quality < 1 || quality > 100) { throw new IllegalArgumentException("Quality has to be in the range from 1 to 100."); } return new ImageOption("q", Integer.toString(quality)); }
java
public static ImageOption jpegQualityOf(int quality) { if (quality < 1 || quality > 100) { throw new IllegalArgumentException("Quality has to be in the range from 1 to 100."); } return new ImageOption("q", Integer.toString(quality)); }
[ "public", "static", "ImageOption", "jpegQualityOf", "(", "int", "quality", ")", "{", "if", "(", "quality", "<", "1", "||", "quality", ">", "100", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Quality has to be in the range from 1 to 100.\"", ")", "...
Define the quality of the jpg image to be returned. @param quality an positive integer between 1 and 100. @return an image option for updating the url. @throws IllegalArgumentException if quality is not between 1 and 100.
[ "Define", "the", "quality", "of", "the", "jpg", "image", "to", "be", "returned", "." ]
train
https://github.com/contentful/contentful.java/blob/6ecc2ace454c674b218b99489dc50697b1dbffcb/src/main/java/com/contentful/java/cda/image/ImageOption.java#L161-L167
sd4324530/fastweixin
src/main/java/com/github/sd4324530/fastweixin/api/OauthAPI.java
OauthAPI.getOauthPageUrl
public String getOauthPageUrl(String redirectUrl, OauthScope scope, String state) { BeanUtil.requireNonNull(redirectUrl, "redirectUrl is null"); BeanUtil.requireNonNull(scope, "scope is null"); String userState = StrUtil.isBlank(state) ? "STATE" : state; String url = null; try { url = URLEncoder.encode(redirectUrl, "UTF-8"); } catch (UnsupportedEncodingException e) { LOG.error("异常", e); } StringBuilder stringBuilder = new StringBuilder("https://open.weixin.qq.com/connect/oauth2/authorize?"); stringBuilder.append("appid=").append(this.config.getAppid()) .append("&redirect_uri=").append(url) .append("&response_type=code&scope=").append(scope.toString()) .append("&state=") .append(userState) .append("#wechat_redirect"); return stringBuilder.toString(); }
java
public String getOauthPageUrl(String redirectUrl, OauthScope scope, String state) { BeanUtil.requireNonNull(redirectUrl, "redirectUrl is null"); BeanUtil.requireNonNull(scope, "scope is null"); String userState = StrUtil.isBlank(state) ? "STATE" : state; String url = null; try { url = URLEncoder.encode(redirectUrl, "UTF-8"); } catch (UnsupportedEncodingException e) { LOG.error("异常", e); } StringBuilder stringBuilder = new StringBuilder("https://open.weixin.qq.com/connect/oauth2/authorize?"); stringBuilder.append("appid=").append(this.config.getAppid()) .append("&redirect_uri=").append(url) .append("&response_type=code&scope=").append(scope.toString()) .append("&state=") .append(userState) .append("#wechat_redirect"); return stringBuilder.toString(); }
[ "public", "String", "getOauthPageUrl", "(", "String", "redirectUrl", ",", "OauthScope", "scope", ",", "String", "state", ")", "{", "BeanUtil", ".", "requireNonNull", "(", "redirectUrl", ",", "\"redirectUrl is null\"", ")", ";", "BeanUtil", ".", "requireNonNull", "...
生成回调url,这个结果要求用户在微信中打开,即可获得token,并指向redirectUrl @param redirectUrl 用户自己设置的回调地址 @param scope 授权作用域 @param state 用户自带参数 @return 回调url,用户在微信中打开即可开始授权
[ "生成回调url,这个结果要求用户在微信中打开,即可获得token,并指向redirectUrl" ]
train
https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/api/OauthAPI.java#L38-L56
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arrays/DoubleIntegerArrayQuickSort.java
DoubleIntegerArrayQuickSort.insertionSortReverse
private static void insertionSortReverse(double[] keys, int[] vals, final int start, final int end) { // Classic insertion sort. for(int i = start + 1; i < end; i++) { for(int j = i; j > start; j--) { if(keys[j] <= keys[j - 1]) { break; } swap(keys, vals, j, j - 1); } } }
java
private static void insertionSortReverse(double[] keys, int[] vals, final int start, final int end) { // Classic insertion sort. for(int i = start + 1; i < end; i++) { for(int j = i; j > start; j--) { if(keys[j] <= keys[j - 1]) { break; } swap(keys, vals, j, j - 1); } } }
[ "private", "static", "void", "insertionSortReverse", "(", "double", "[", "]", "keys", ",", "int", "[", "]", "vals", ",", "final", "int", "start", ",", "final", "int", "end", ")", "{", "// Classic insertion sort.", "for", "(", "int", "i", "=", "start", "+...
Sort via insertion sort. @param keys Keys @param vals Values @param start Interval start @param end Interval end
[ "Sort", "via", "insertion", "sort", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/arrays/DoubleIntegerArrayQuickSort.java#L359-L369