repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
BoltsFramework/Bolts-Android
bolts-applinks/src/main/java/bolts/AppLinkNavigation.java
AppLinkNavigation.navigateInBackground
public static Task<NavigationResult> navigateInBackground(Context context, String destinationUrl, AppLinkResolver resolver) { return navigateInBackground(context, Uri.parse(destinationUrl), resolver); }
java
public static Task<NavigationResult> navigateInBackground(Context context, String destinationUrl, AppLinkResolver resolver) { return navigateInBackground(context, Uri.parse(destinationUrl), resolver); }
[ "public", "static", "Task", "<", "NavigationResult", ">", "navigateInBackground", "(", "Context", "context", ",", "String", "destinationUrl", ",", "AppLinkResolver", "resolver", ")", "{", "return", "navigateInBackground", "(", "context", ",", "Uri", ".", "parse", ...
Navigates to an {@link AppLink} for the given destination using the App Link resolution strategy specified. @param context the Context from which the navigation should be performed. @param destinationUrl the destination URL for the App Link. @param resolver the resolver to use for fetching App Link metadata. @return the {@link NavigationResult} performed by navigating.
[ "Navigates", "to", "an", "{", "@link", "AppLink", "}", "for", "the", "given", "destination", "using", "the", "App", "Link", "resolution", "strategy", "specified", "." ]
train
https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-applinks/src/main/java/bolts/AppLinkNavigation.java#L422-L426
op4j/op4j
src/main/java/org/op4j/Op.java
Op.onArray
public static <T> Level0ArrayOperator<String[],String> onArray(final String[] target) { return onArrayOf(Types.STRING, target); }
java
public static <T> Level0ArrayOperator<String[],String> onArray(final String[] target) { return onArrayOf(Types.STRING, target); }
[ "public", "static", "<", "T", ">", "Level0ArrayOperator", "<", "String", "[", "]", ",", "String", ">", "onArray", "(", "final", "String", "[", "]", "target", ")", "{", "return", "onArrayOf", "(", "Types", ".", "STRING", ",", "target", ")", ";", "}" ]
<p> Creates an <i>operation expression</i> on the specified target object. </p> @param target the target object on which the expression will execute @return an operator, ready for chaining
[ "<p", ">", "Creates", "an", "<i", ">", "operation", "expression<", "/", "i", ">", "on", "the", "specified", "target", "object", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L767-L769
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/UnImplNode.java
UnImplNode.getAttributeNodeNS
public Attr getAttributeNodeNS(String namespaceURI, String localName) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNodeNS not supported!"); return null; }
java
public Attr getAttributeNodeNS(String namespaceURI, String localName) { error(XMLErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNodeNS not supported!"); return null; }
[ "public", "Attr", "getAttributeNodeNS", "(", "String", "namespaceURI", ",", "String", "localName", ")", "{", "error", "(", "XMLErrorResources", ".", "ER_FUNCTION_NOT_SUPPORTED", ")", ";", "//\"getAttributeNodeNS not supported!\");", "return", "null", ";", "}" ]
Unimplemented. See org.w3c.dom.Element @param namespaceURI Namespace URI of attribute node to get @param localName Local part of qualified name of attribute node to get @return null
[ "Unimplemented", ".", "See", "org", ".", "w3c", ".", "dom", ".", "Element" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/UnImplNode.java#L459-L465
michel-kraemer/citeproc-java
citeproc-java/src/main/java/de/undercouch/citeproc/CSL.java
CSL.makeBibliography
public Bibliography makeBibliography(SelectionMode mode, CSLItemData... selection) { return makeBibliography(mode, selection, null); }
java
public Bibliography makeBibliography(SelectionMode mode, CSLItemData... selection) { return makeBibliography(mode, selection, null); }
[ "public", "Bibliography", "makeBibliography", "(", "SelectionMode", "mode", ",", "CSLItemData", "...", "selection", ")", "{", "return", "makeBibliography", "(", "mode", ",", "selection", ",", "null", ")", ";", "}" ]
Generates a bibliography for the registered citations. Depending on the selection mode selects, includes, or excludes bibliography items whose fields and field values match the fields and field values from the given example item data objects. @param mode the selection mode @param selection the example item data objects that contain the fields and field values to match @return the bibliography
[ "Generates", "a", "bibliography", "for", "the", "registered", "citations", ".", "Depending", "on", "the", "selection", "mode", "selects", "includes", "or", "excludes", "bibliography", "items", "whose", "fields", "and", "field", "values", "match", "the", "fields", ...
train
https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/CSL.java#L739-L741
OpenLiberty/open-liberty
dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/TaskInfo.java
TaskInfo.deserializeThreadContext
public ThreadContextDescriptor deserializeThreadContext(Map<String, String> execProps) throws IOException, ClassNotFoundException { return threadContextBytes == null ? null : ThreadContextDeserializer.deserialize(threadContextBytes, execProps); }
java
public ThreadContextDescriptor deserializeThreadContext(Map<String, String> execProps) throws IOException, ClassNotFoundException { return threadContextBytes == null ? null : ThreadContextDeserializer.deserialize(threadContextBytes, execProps); }
[ "public", "ThreadContextDescriptor", "deserializeThreadContext", "(", "Map", "<", "String", ",", "String", ">", "execProps", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "return", "threadContextBytes", "==", "null", "?", "null", ":", "ThreadContex...
Returns the thread context that was captured at the point when the task was submitted. @param execProps execution properties for the persistent task. @return the thread context that was captured at the point when the task was submitted. @throws IOException @throws ClassNotFoundException
[ "Returns", "the", "thread", "context", "that", "was", "captured", "at", "the", "point", "when", "the", "task", "was", "submitted", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.concurrent.persistent/src/com/ibm/ws/concurrent/persistent/internal/TaskInfo.java#L151-L153
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java
VirtualJarFileInputStream.bufferLocalFileHeader
private boolean bufferLocalFileHeader() throws IOException { buffer.reset(); JarEntry jarEntry = virtualJarInputStream.getNextJarEntry(); if (jarEntry == null) { return false; } currentEntry = new ProcessedEntry(jarEntry, totalRead); processedEntries.add(currentEntry); bufferInt(ZipEntry.LOCSIG); // Local file header signature bufferShort(10); // Extraction version bufferShort(0); // Flags bufferShort(ZipEntry.STORED); // Compression type bufferInt(jarEntry.getTime()); // Entry time bufferInt(0); // CRC bufferInt(0); // Compressed size bufferInt(0); // Uncompressed size byte[] nameBytes = jarEntry.getName().getBytes("UTF8"); bufferShort(nameBytes.length); // Entry name length bufferShort(0); // Extra length buffer(nameBytes); return true; }
java
private boolean bufferLocalFileHeader() throws IOException { buffer.reset(); JarEntry jarEntry = virtualJarInputStream.getNextJarEntry(); if (jarEntry == null) { return false; } currentEntry = new ProcessedEntry(jarEntry, totalRead); processedEntries.add(currentEntry); bufferInt(ZipEntry.LOCSIG); // Local file header signature bufferShort(10); // Extraction version bufferShort(0); // Flags bufferShort(ZipEntry.STORED); // Compression type bufferInt(jarEntry.getTime()); // Entry time bufferInt(0); // CRC bufferInt(0); // Compressed size bufferInt(0); // Uncompressed size byte[] nameBytes = jarEntry.getName().getBytes("UTF8"); bufferShort(nameBytes.length); // Entry name length bufferShort(0); // Extra length buffer(nameBytes); return true; }
[ "private", "boolean", "bufferLocalFileHeader", "(", ")", "throws", "IOException", "{", "buffer", ".", "reset", "(", ")", ";", "JarEntry", "jarEntry", "=", "virtualJarInputStream", ".", "getNextJarEntry", "(", ")", ";", "if", "(", "jarEntry", "==", "null", ")",...
Buffer the content of the local file header for a single entry. @return true if the next local file header was buffered @throws IOException if any problems occur
[ "Buffer", "the", "content", "of", "the", "local", "file", "header", "for", "a", "single", "entry", "." ]
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualJarFileInputStream.java#L120-L143
cryptomator/native-functions
JNI/src/main/java/org/cryptomator/jni/MacKeychainAccess.java
MacKeychainAccess.storePassword
public void storePassword(String account, CharSequence password) { ByteBuffer pwBuf = UTF_8.encode(CharBuffer.wrap(password)); byte[] pwBytes = new byte[pwBuf.remaining()]; pwBuf.get(pwBytes); int errorCode = storePassword0(account.getBytes(UTF_8), pwBytes); Arrays.fill(pwBytes, (byte) 0x00); Arrays.fill(pwBuf.array(), (byte) 0x00); if (errorCode != OSSTATUS_SUCCESS) { throw new JniException("Failed to store password. Error code " + errorCode); } }
java
public void storePassword(String account, CharSequence password) { ByteBuffer pwBuf = UTF_8.encode(CharBuffer.wrap(password)); byte[] pwBytes = new byte[pwBuf.remaining()]; pwBuf.get(pwBytes); int errorCode = storePassword0(account.getBytes(UTF_8), pwBytes); Arrays.fill(pwBytes, (byte) 0x00); Arrays.fill(pwBuf.array(), (byte) 0x00); if (errorCode != OSSTATUS_SUCCESS) { throw new JniException("Failed to store password. Error code " + errorCode); } }
[ "public", "void", "storePassword", "(", "String", "account", ",", "CharSequence", "password", ")", "{", "ByteBuffer", "pwBuf", "=", "UTF_8", ".", "encode", "(", "CharBuffer", ".", "wrap", "(", "password", ")", ")", ";", "byte", "[", "]", "pwBytes", "=", ...
Associates the specified password with the specified key in the system keychain. @param account Unique account identifier @param password Passphrase to store
[ "Associates", "the", "specified", "password", "with", "the", "specified", "key", "in", "the", "system", "keychain", "." ]
train
https://github.com/cryptomator/native-functions/blob/764cb1edbffbc2a4129c71011941adcbd4c12292/JNI/src/main/java/org/cryptomator/jni/MacKeychainAccess.java#L28-L38
JOML-CI/JOML
src/org/joml/Matrix4x3d.java
Matrix4x3d.rotateLocalX
public Matrix4x3d rotateLocalX(double ang, Matrix4x3d dest) { double sin = Math.sin(ang); double cos = Math.cosFromSin(sin, ang); double nm01 = cos * m01 - sin * m02; double nm02 = sin * m01 + cos * m02; double nm11 = cos * m11 - sin * m12; double nm12 = sin * m11 + cos * m12; double nm21 = cos * m21 - sin * m22; double nm22 = sin * m21 + cos * m22; double nm31 = cos * m31 - sin * m32; double nm32 = sin * m31 + cos * m32; dest.m00 = m00; dest.m01 = nm01; dest.m02 = nm02; dest.m10 = m10; dest.m11 = nm11; dest.m12 = nm12; dest.m20 = m20; dest.m21 = nm21; dest.m22 = nm22; dest.m30 = m30; dest.m31 = nm31; dest.m32 = nm32; dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
java
public Matrix4x3d rotateLocalX(double ang, Matrix4x3d dest) { double sin = Math.sin(ang); double cos = Math.cosFromSin(sin, ang); double nm01 = cos * m01 - sin * m02; double nm02 = sin * m01 + cos * m02; double nm11 = cos * m11 - sin * m12; double nm12 = sin * m11 + cos * m12; double nm21 = cos * m21 - sin * m22; double nm22 = sin * m21 + cos * m22; double nm31 = cos * m31 - sin * m32; double nm32 = sin * m31 + cos * m32; dest.m00 = m00; dest.m01 = nm01; dest.m02 = nm02; dest.m10 = m10; dest.m11 = nm11; dest.m12 = nm12; dest.m20 = m20; dest.m21 = nm21; dest.m22 = nm22; dest.m30 = m30; dest.m31 = nm31; dest.m32 = nm32; dest.properties = properties & ~(PROPERTY_IDENTITY | PROPERTY_TRANSLATION); return dest; }
[ "public", "Matrix4x3d", "rotateLocalX", "(", "double", "ang", ",", "Matrix4x3d", "dest", ")", "{", "double", "sin", "=", "Math", ".", "sin", "(", "ang", ")", ";", "double", "cos", "=", "Math", ".", "cosFromSin", "(", "sin", ",", "ang", ")", ";", "dou...
Pre-multiply a rotation around the X axis to this matrix by rotating the given amount of radians about the X axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationX(double) rotationX()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationX(double) @param ang the angle in radians to rotate about the X axis @param dest will hold the result @return dest
[ "Pre", "-", "multiply", "a", "rotation", "around", "the", "X", "axis", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "X", "axis", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L3584-L3609
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_line_serviceName_calls_id_eavesdrop_POST
public OvhTask billingAccount_line_serviceName_calls_id_eavesdrop_POST(String billingAccount, String serviceName, Long id, String number) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/calls/{id}/eavesdrop"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "number", number); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask billingAccount_line_serviceName_calls_id_eavesdrop_POST(String billingAccount, String serviceName, Long id, String number) throws IOException { String qPath = "/telephony/{billingAccount}/line/{serviceName}/calls/{id}/eavesdrop"; StringBuilder sb = path(qPath, billingAccount, serviceName, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "number", number); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "billingAccount_line_serviceName_calls_id_eavesdrop_POST", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "id", ",", "String", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAcco...
Eavesdrop on a call REST: POST /telephony/{billingAccount}/line/{serviceName}/calls/{id}/eavesdrop @param number [required] Phone number that will be called and bridged in the communication @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param id [required] Id of the object
[ "Eavesdrop", "on", "a", "call" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L1932-L1939
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_scatter.java
DZcs_scatter.cs_scatter
public static int cs_scatter(DZcs A, int j, double[] beta, int[] w, DZcsa x, int mark, DZcs C, int nz) { int i, p, Ap[], Ai[], Ci[] ; DZcsa Ax = new DZcsa() ; if (!CS_CSC(A) || (w == null) || !CS_CSC(C)) return (-1) ; /* check inputs */ Ap = A.p ; Ai = A.i ; Ax.x = A.x ; Ci = C.i ; for (p = Ap [j]; p < Ap [j+1] ; p++) { i = Ai [p] ; /* A(i,j) is nonzero */ if (w [i] < mark) { w [i] = mark ; /* i is new entry in column j */ Ci [nz++] = i ; /* add i to pattern of C(:,j) */ if (x != null) x.set(i, cs_cmult(beta, Ax.get(p))) ; /* x(i) = beta*A(i,j) */ } else if (x != null) { x.set(i, cs_cplus(x.get(i), cs_cmult(beta, Ax.get(p)))); /* i exists in C(:,j) already */ } } return (nz) ; }
java
public static int cs_scatter(DZcs A, int j, double[] beta, int[] w, DZcsa x, int mark, DZcs C, int nz) { int i, p, Ap[], Ai[], Ci[] ; DZcsa Ax = new DZcsa() ; if (!CS_CSC(A) || (w == null) || !CS_CSC(C)) return (-1) ; /* check inputs */ Ap = A.p ; Ai = A.i ; Ax.x = A.x ; Ci = C.i ; for (p = Ap [j]; p < Ap [j+1] ; p++) { i = Ai [p] ; /* A(i,j) is nonzero */ if (w [i] < mark) { w [i] = mark ; /* i is new entry in column j */ Ci [nz++] = i ; /* add i to pattern of C(:,j) */ if (x != null) x.set(i, cs_cmult(beta, Ax.get(p))) ; /* x(i) = beta*A(i,j) */ } else if (x != null) { x.set(i, cs_cplus(x.get(i), cs_cmult(beta, Ax.get(p)))); /* i exists in C(:,j) already */ } } return (nz) ; }
[ "public", "static", "int", "cs_scatter", "(", "DZcs", "A", ",", "int", "j", ",", "double", "[", "]", "beta", ",", "int", "[", "]", "w", ",", "DZcsa", "x", ",", "int", "mark", ",", "DZcs", "C", ",", "int", "nz", ")", "{", "int", "i", ",", "p",...
Scatters and sums a sparse vector A(:,j) into a dense vector, x = x + beta * A(:,j). @param A the sparse vector is A(:,j) @param j the column of A to use @param beta scalar multiplied by A(:,j) @param w size m, node i is marked if w[i] = mark @param x size m, ignored if null @param mark mark value of w @param C pattern of x accumulated in C.i @param nz pattern of x placed in C starting at C.i[nz] @return new value of nz, -1 on error
[ "Scatters", "and", "sums", "a", "sparse", "vector", "A", "(", ":", "j", ")", "into", "a", "dense", "vector", "x", "=", "x", "+", "beta", "*", "A", "(", ":", "j", ")", "." ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_scatter.java#L65-L87
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java
AbstractTreeWriter.addTree
protected void addTree(SortedSet<TypeElement> sset, String heading, HtmlTree div) { addTree(sset, heading, div, false); }
java
protected void addTree(SortedSet<TypeElement> sset, String heading, HtmlTree div) { addTree(sset, heading, div, false); }
[ "protected", "void", "addTree", "(", "SortedSet", "<", "TypeElement", ">", "sset", ",", "String", "heading", ",", "HtmlTree", "div", ")", "{", "addTree", "(", "sset", ",", "heading", ",", "div", ",", "false", ")", ";", "}" ]
Add the heading for the tree depending upon tree type if it's a Class Tree or Interface tree. @param sset classes which are at the most base level, all the other classes in this run will derive from these classes @param heading heading for the tree @param div the content tree to which the tree will be added
[ "Add", "the", "heading", "for", "the", "tree", "depending", "upon", "tree", "type", "if", "it", "s", "a", "Class", "Tree", "or", "Interface", "tree", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java#L111-L113
codahale/xsalsa20poly1305
src/main/java/com/codahale/xsalsa20poly1305/SecretBox.java
SecretBox.open
public Optional<byte[]> open(byte[] nonce, byte[] ciphertext) { final XSalsa20Engine xsalsa20 = new XSalsa20Engine(); final Poly1305 poly1305 = new Poly1305(); // initialize XSalsa20 xsalsa20.init(false, new ParametersWithIV(new KeyParameter(key), nonce)); // generate mac subkey final byte[] sk = new byte[Keys.KEY_LEN]; xsalsa20.processBytes(sk, 0, sk.length, sk, 0); // hash ciphertext poly1305.init(new KeyParameter(sk)); final int len = Math.max(ciphertext.length - poly1305.getMacSize(), 0); poly1305.update(ciphertext, poly1305.getMacSize(), len); final byte[] calculatedMAC = new byte[poly1305.getMacSize()]; poly1305.doFinal(calculatedMAC, 0); // extract mac final byte[] presentedMAC = new byte[poly1305.getMacSize()]; System.arraycopy( ciphertext, 0, presentedMAC, 0, Math.min(ciphertext.length, poly1305.getMacSize())); // compare macs if (!MessageDigest.isEqual(calculatedMAC, presentedMAC)) { return Optional.empty(); } // decrypt ciphertext final byte[] plaintext = new byte[len]; xsalsa20.processBytes(ciphertext, poly1305.getMacSize(), plaintext.length, plaintext, 0); return Optional.of(plaintext); }
java
public Optional<byte[]> open(byte[] nonce, byte[] ciphertext) { final XSalsa20Engine xsalsa20 = new XSalsa20Engine(); final Poly1305 poly1305 = new Poly1305(); // initialize XSalsa20 xsalsa20.init(false, new ParametersWithIV(new KeyParameter(key), nonce)); // generate mac subkey final byte[] sk = new byte[Keys.KEY_LEN]; xsalsa20.processBytes(sk, 0, sk.length, sk, 0); // hash ciphertext poly1305.init(new KeyParameter(sk)); final int len = Math.max(ciphertext.length - poly1305.getMacSize(), 0); poly1305.update(ciphertext, poly1305.getMacSize(), len); final byte[] calculatedMAC = new byte[poly1305.getMacSize()]; poly1305.doFinal(calculatedMAC, 0); // extract mac final byte[] presentedMAC = new byte[poly1305.getMacSize()]; System.arraycopy( ciphertext, 0, presentedMAC, 0, Math.min(ciphertext.length, poly1305.getMacSize())); // compare macs if (!MessageDigest.isEqual(calculatedMAC, presentedMAC)) { return Optional.empty(); } // decrypt ciphertext final byte[] plaintext = new byte[len]; xsalsa20.processBytes(ciphertext, poly1305.getMacSize(), plaintext.length, plaintext, 0); return Optional.of(plaintext); }
[ "public", "Optional", "<", "byte", "[", "]", ">", "open", "(", "byte", "[", "]", "nonce", ",", "byte", "[", "]", "ciphertext", ")", "{", "final", "XSalsa20Engine", "xsalsa20", "=", "new", "XSalsa20Engine", "(", ")", ";", "final", "Poly1305", "poly1305", ...
Decrypt a ciphertext using the given key and nonce. @param nonce a 24-byte nonce @param ciphertext the encrypted message @return an {@link Optional} of the original plaintext, or if either the key, nonce, or ciphertext was modified, an empty {@link Optional} @see #nonce(byte[]) @see #nonce()
[ "Decrypt", "a", "ciphertext", "using", "the", "given", "key", "and", "nonce", "." ]
train
https://github.com/codahale/xsalsa20poly1305/blob/f3c1ab2f05b17df137ed8fbb66da2b417066729a/src/main/java/com/codahale/xsalsa20poly1305/SecretBox.java#L104-L136
beangle/beangle3
commons/model/src/main/java/org/beangle/commons/transfer/importer/MultiEntityImporter.java
MultiEntityImporter.addEntity
public void addEntity(String alias, Class<?> entityClass) { EntityType entityType = Model.getType(entityClass); if (null == entityType) { throw new RuntimeException("cannot find entity type for " + entityClass); } entityTypes.put(alias, entityType); }
java
public void addEntity(String alias, Class<?> entityClass) { EntityType entityType = Model.getType(entityClass); if (null == entityType) { throw new RuntimeException("cannot find entity type for " + entityClass); } entityTypes.put(alias, entityType); }
[ "public", "void", "addEntity", "(", "String", "alias", ",", "Class", "<", "?", ">", "entityClass", ")", "{", "EntityType", "entityType", "=", "Model", ".", "getType", "(", "entityClass", ")", ";", "if", "(", "null", "==", "entityType", ")", "{", "throw",...
<p> addEntity. </p> @param alias a {@link java.lang.String} object. @param entityClass a {@link java.lang.Class} object.
[ "<p", ">", "addEntity", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/transfer/importer/MultiEntityImporter.java#L169-L173
kaazing/java.client
net.api/src/main/java/org/kaazing/net/URLFactory.java
URLFactory.createURL
public static URL createURL(String protocol, String host, int port, String file) throws MalformedURLException { URLStreamHandlerFactory factory = _factories.get(protocol); // If there is no URLStreamHandlerFactory registered for the // scheme/protocol, then we just use the regular URL constructor. if (factory == null) { return new URL(protocol, host, port, file); } // If there is a URLStreamHandlerFactory associated for the // scheme/protocol, then we create a URLStreamHandler. And, then use // then use the URLStreamHandler to create a URL. URLStreamHandler handler = factory.createURLStreamHandler(protocol); return new URL(protocol, host, port, file, handler); }
java
public static URL createURL(String protocol, String host, int port, String file) throws MalformedURLException { URLStreamHandlerFactory factory = _factories.get(protocol); // If there is no URLStreamHandlerFactory registered for the // scheme/protocol, then we just use the regular URL constructor. if (factory == null) { return new URL(protocol, host, port, file); } // If there is a URLStreamHandlerFactory associated for the // scheme/protocol, then we create a URLStreamHandler. And, then use // then use the URLStreamHandler to create a URL. URLStreamHandler handler = factory.createURLStreamHandler(protocol); return new URL(protocol, host, port, file, handler); }
[ "public", "static", "URL", "createURL", "(", "String", "protocol", ",", "String", "host", ",", "int", "port", ",", "String", "file", ")", "throws", "MalformedURLException", "{", "URLStreamHandlerFactory", "factory", "=", "_factories", ".", "get", "(", "protocol"...
Creates a URL from the specified protocol name, host name, port number, and file name. <p/> No validation of the inputs is performed by this method. @param protocol the name of the protocol to use @param host the name of the host @param port the port number @param file the file on the host @return URL created using specified protocol, host, and file @throws MalformedURLException if an unknown protocol is specified
[ "Creates", "a", "URL", "from", "the", "specified", "protocol", "name", "host", "name", "port", "number", "and", "file", "name", ".", "<p", "/", ">", "No", "validation", "of", "the", "inputs", "is", "performed", "by", "this", "method", "." ]
train
https://github.com/kaazing/java.client/blob/25ad2ae5bb24aa9d6b79400fce649b518dcfbe26/net.api/src/main/java/org/kaazing/net/URLFactory.java#L182-L199
lucee/Lucee
core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java
ResourceUtil.toResourceExistingParent
public static Resource toResourceExistingParent(PageContext pc, String destination) throws ExpressionException { return toResourceExistingParent(pc, destination, pc.getConfig().allowRealPath()); }
java
public static Resource toResourceExistingParent(PageContext pc, String destination) throws ExpressionException { return toResourceExistingParent(pc, destination, pc.getConfig().allowRealPath()); }
[ "public", "static", "Resource", "toResourceExistingParent", "(", "PageContext", "pc", ",", "String", "destination", ")", "throws", "ExpressionException", "{", "return", "toResourceExistingParent", "(", "pc", ",", "destination", ",", "pc", ".", "getConfig", "(", ")",...
cast a String (argument destination) to a File Object, if destination is not a absolute, file object will be relative to current position (get from PageContext) at least parent must exist @param pc Page Context to the current position in filesystem @param destination relative or absolute path for file object @return file object from destination @throws ExpressionException
[ "cast", "a", "String", "(", "argument", "destination", ")", "to", "a", "File", "Object", "if", "destination", "is", "not", "a", "absolute", "file", "object", "will", "be", "relative", "to", "current", "position", "(", "get", "from", "PageContext", ")", "at...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/util/ResourceUtil.java#L261-L263
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponseDefaultSettings.java
UnifiedResponseDefaultSettings.setXFrameOptions
public static void setXFrameOptions (@Nullable final EXFrameOptionType eType, @Nullable final ISimpleURL aDomain) { if (eType != null && eType.isURLRequired ()) ValueEnforcer.notNull (aDomain, "Domain"); if (eType == null) { removeResponseHeaders (CHttpHeader.X_FRAME_OPTIONS); } else { final String sHeaderValue = eType.isURLRequired () ? eType.getID () + " " + aDomain.getAsStringWithEncodedParameters () : eType.getID (); setResponseHeader (CHttpHeader.X_FRAME_OPTIONS, sHeaderValue); } }
java
public static void setXFrameOptions (@Nullable final EXFrameOptionType eType, @Nullable final ISimpleURL aDomain) { if (eType != null && eType.isURLRequired ()) ValueEnforcer.notNull (aDomain, "Domain"); if (eType == null) { removeResponseHeaders (CHttpHeader.X_FRAME_OPTIONS); } else { final String sHeaderValue = eType.isURLRequired () ? eType.getID () + " " + aDomain.getAsStringWithEncodedParameters () : eType.getID (); setResponseHeader (CHttpHeader.X_FRAME_OPTIONS, sHeaderValue); } }
[ "public", "static", "void", "setXFrameOptions", "(", "@", "Nullable", "final", "EXFrameOptionType", "eType", ",", "@", "Nullable", "final", "ISimpleURL", "aDomain", ")", "{", "if", "(", "eType", "!=", "null", "&&", "eType", ".", "isURLRequired", "(", ")", ")...
The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a &lt;frame&gt;, &lt;iframe&gt; or &lt;object&gt; . Sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites. Example: <pre> X-Frame-Options: DENY X-Frame-Options: SAMEORIGIN X-Frame-Options: ALLOW-FROM https://example.com/ </pre> @param eType The X-Frame-Options type to be set. May not be <code>null</code>. @param aDomain The domain URL to be used in "ALLOW-FROM". May be <code>null</code> for the other cases.
[ "The", "X", "-", "Frame", "-", "Options", "HTTP", "response", "header", "can", "be", "used", "to", "indicate", "whether", "or", "not", "a", "browser", "should", "be", "allowed", "to", "render", "a", "page", "in", "a", "&lt", ";", "frame&gt", ";", "&lt"...
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/response/UnifiedResponseDefaultSettings.java#L174-L191
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java
DataFrameJoiner.inner
public Table inner(Table table2, String col2Name) { return inner(table2, false, col2Name); }
java
public Table inner(Table table2, String col2Name) { return inner(table2, false, col2Name); }
[ "public", "Table", "inner", "(", "Table", "table2", ",", "String", "col2Name", ")", "{", "return", "inner", "(", "table2", ",", "false", ",", "col2Name", ")", ";", "}" ]
Joins the joiner to the table2, using the given column for the second table and returns the resulting table @param table2 The table to join with @param col2Name The column to join on. If col2Name refers to a double column, the join is performed after rounding to integers. @return The resulting table
[ "Joins", "the", "joiner", "to", "the", "table2", "using", "the", "given", "column", "for", "the", "second", "table", "and", "returns", "the", "resulting", "table" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L103-L105
99soft/lifegycle
src/main/java/org/nnsoft/guice/lifegycle/AbstractMethodTypeListener.java
AbstractMethodTypeListener.hear
private <I> void hear( Class<? super I> type, TypeEncounter<I> encounter ) { if ( type == null || type.getPackage().getName().startsWith( JAVA_PACKAGE ) ) { return; } for ( Method method : type.getDeclaredMethods() ) { if ( method.isAnnotationPresent( annotationType ) ) { if ( method.getParameterTypes().length != 0 ) { encounter.addError( "Annotated methods with @%s must not accept any argument, found %s", annotationType.getName(), method ); } hear( method, encounter ); } } hear( type.getSuperclass(), encounter ); }
java
private <I> void hear( Class<? super I> type, TypeEncounter<I> encounter ) { if ( type == null || type.getPackage().getName().startsWith( JAVA_PACKAGE ) ) { return; } for ( Method method : type.getDeclaredMethods() ) { if ( method.isAnnotationPresent( annotationType ) ) { if ( method.getParameterTypes().length != 0 ) { encounter.addError( "Annotated methods with @%s must not accept any argument, found %s", annotationType.getName(), method ); } hear( method, encounter ); } } hear( type.getSuperclass(), encounter ); }
[ "private", "<", "I", ">", "void", "hear", "(", "Class", "<", "?", "super", "I", ">", "type", ",", "TypeEncounter", "<", "I", ">", "encounter", ")", "{", "if", "(", "type", "==", "null", "||", "type", ".", "getPackage", "(", ")", ".", "getName", "...
Allows traverse the input type hierarchy. @param type encountered by Guice. @param encounter the injection context.
[ "Allows", "traverse", "the", "input", "type", "hierarchy", "." ]
train
https://github.com/99soft/lifegycle/blob/0adde20bcf32e90fe995bb493630b77fa6ce6361/src/main/java/org/nnsoft/guice/lifegycle/AbstractMethodTypeListener.java#L67-L89
xiaosunzhu/resource-utils
src/main/java/net/sunyijun/resource/config/Configs.java
Configs.isHavePathSelfConfig
public static boolean isHavePathSelfConfig(IConfigKeyWithPath key) { String configAbsoluteClassPath = key.getConfigPath(); return isSelfConfig(configAbsoluteClassPath, key); }
java
public static boolean isHavePathSelfConfig(IConfigKeyWithPath key) { String configAbsoluteClassPath = key.getConfigPath(); return isSelfConfig(configAbsoluteClassPath, key); }
[ "public", "static", "boolean", "isHavePathSelfConfig", "(", "IConfigKeyWithPath", "key", ")", "{", "String", "configAbsoluteClassPath", "=", "key", ".", "getConfigPath", "(", ")", ";", "return", "isSelfConfig", "(", "configAbsoluteClassPath", ",", "key", ")", ";", ...
Get self config boolean value @param key config key with configAbsoluteClassPath in config file @return true/false. If not add config file or not config in config file, return false. @see #addSelfConfigs(String, OneProperties)
[ "Get", "self", "config", "boolean", "value" ]
train
https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L365-L368
ModeShape/modeshape
connectors/modeshape-connector-cmis/src/main/java/org/modeshape/connector/cmis/CmisConnector.java
CmisConnector.jcrBinaryContent
private ContentStream jcrBinaryContent( Document document ) { // pickup node properties Document props = document.getDocument("properties").getDocument(JcrLexicon.Namespace.URI); // extract binary value and content Binary value = props.getBinary("data"); if (value == null) { return null; } byte[] content = value.getBytes(); String fileName = props.getString("fileName"); String mimeType = props.getString("mimeType"); // wrap with input stream ByteArrayInputStream bin = new ByteArrayInputStream(content); bin.reset(); // create content stream return new ContentStreamImpl(fileName, BigInteger.valueOf(content.length), mimeType, bin); }
java
private ContentStream jcrBinaryContent( Document document ) { // pickup node properties Document props = document.getDocument("properties").getDocument(JcrLexicon.Namespace.URI); // extract binary value and content Binary value = props.getBinary("data"); if (value == null) { return null; } byte[] content = value.getBytes(); String fileName = props.getString("fileName"); String mimeType = props.getString("mimeType"); // wrap with input stream ByteArrayInputStream bin = new ByteArrayInputStream(content); bin.reset(); // create content stream return new ContentStreamImpl(fileName, BigInteger.valueOf(content.length), mimeType, bin); }
[ "private", "ContentStream", "jcrBinaryContent", "(", "Document", "document", ")", "{", "// pickup node properties", "Document", "props", "=", "document", ".", "getDocument", "(", "\"properties\"", ")", ".", "getDocument", "(", "JcrLexicon", ".", "Namespace", ".", "U...
Creates content stream using JCR node. @param document JCR node representation @return CMIS content stream object
[ "Creates", "content", "stream", "using", "JCR", "node", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/connectors/modeshape-connector-cmis/src/main/java/org/modeshape/connector/cmis/CmisConnector.java#L952-L973
radkovo/jStyleParser
src/main/java/cz/vutbr/web/css/CSSFactory.java
CSSFactory.assignDOM
public static final StyleMap assignDOM(Document doc, String encoding, URL base, String media, boolean useInheritance, final MatchCondition matchCond) { return assignDOM(doc, encoding, base, new MediaSpec(media), useInheritance, matchCond); }
java
public static final StyleMap assignDOM(Document doc, String encoding, URL base, String media, boolean useInheritance, final MatchCondition matchCond) { return assignDOM(doc, encoding, base, new MediaSpec(media), useInheritance, matchCond); }
[ "public", "static", "final", "StyleMap", "assignDOM", "(", "Document", "doc", ",", "String", "encoding", ",", "URL", "base", ",", "String", "media", ",", "boolean", "useInheritance", ",", "final", "MatchCondition", "matchCond", ")", "{", "return", "assignDOM", ...
This is the same as {@link CSSFactory#assignDOM(Document, String, URL, MediaSpec, boolean)} but only the media type is provided instead of the complete media specification. @param doc DOM tree @param encoding The default encoding used for the referenced style sheets @param base Base URL against which all files are searched @param media Selected media type for style sheet @param useInheritance Whether inheritance will be used to determine values @param matchCond The match condition to match the against. @return Map between DOM element nodes and data structure containing CSS information
[ "This", "is", "the", "same", "as", "{", "@link", "CSSFactory#assignDOM", "(", "Document", "String", "URL", "MediaSpec", "boolean", ")", "}", "but", "only", "the", "media", "type", "is", "provided", "instead", "of", "the", "complete", "media", "specification", ...
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L770-L774
line/armeria
core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java
ArmeriaHttpUtil.toNettyHttp2
public static Http2Headers toNettyHttp2(HttpHeaders in, boolean server) { final Http2Headers out = new DefaultHttp2Headers(false, in.size()); // Trailing headers if it does not have :status. if (server && in.status() == null) { for (Entry<AsciiString, String> entry : in) { final AsciiString name = entry.getKey(); final String value = entry.getValue(); if (name.isEmpty() || HTTP_TRAILER_BLACKLIST.contains(name)) { continue; } out.add(name, value); } } else { out.set(in); out.remove(HttpHeaderNames.CONNECTION); out.remove(HttpHeaderNames.TRANSFER_ENCODING); } if (!out.contains(HttpHeaderNames.COOKIE)) { return out; } // Split up cookies to allow for better compression. // https://tools.ietf.org/html/rfc7540#section-8.1.2.5 final List<CharSequence> cookies = out.getAllAndRemove(HttpHeaderNames.COOKIE); for (CharSequence c : cookies) { out.add(HttpHeaderNames.COOKIE, COOKIE_SPLITTER.split(c)); } return out; }
java
public static Http2Headers toNettyHttp2(HttpHeaders in, boolean server) { final Http2Headers out = new DefaultHttp2Headers(false, in.size()); // Trailing headers if it does not have :status. if (server && in.status() == null) { for (Entry<AsciiString, String> entry : in) { final AsciiString name = entry.getKey(); final String value = entry.getValue(); if (name.isEmpty() || HTTP_TRAILER_BLACKLIST.contains(name)) { continue; } out.add(name, value); } } else { out.set(in); out.remove(HttpHeaderNames.CONNECTION); out.remove(HttpHeaderNames.TRANSFER_ENCODING); } if (!out.contains(HttpHeaderNames.COOKIE)) { return out; } // Split up cookies to allow for better compression. // https://tools.ietf.org/html/rfc7540#section-8.1.2.5 final List<CharSequence> cookies = out.getAllAndRemove(HttpHeaderNames.COOKIE); for (CharSequence c : cookies) { out.add(HttpHeaderNames.COOKIE, COOKIE_SPLITTER.split(c)); } return out; }
[ "public", "static", "Http2Headers", "toNettyHttp2", "(", "HttpHeaders", "in", ",", "boolean", "server", ")", "{", "final", "Http2Headers", "out", "=", "new", "DefaultHttp2Headers", "(", "false", ",", "in", ".", "size", "(", ")", ")", ";", "// Trailing headers ...
Converts the specified Armeria HTTP/2 headers into Netty HTTP/2 headers.
[ "Converts", "the", "specified", "Armeria", "HTTP", "/", "2", "headers", "into", "Netty", "HTTP", "/", "2", "headers", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/ArmeriaHttpUtil.java#L748-L779
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.serviceName_envVar_key_PUT
public void serviceName_envVar_key_PUT(String serviceName, String key, OvhEnvVar body) throws IOException { String qPath = "/hosting/web/{serviceName}/envVar/{key}"; StringBuilder sb = path(qPath, serviceName, key); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_envVar_key_PUT(String serviceName, String key, OvhEnvVar body) throws IOException { String qPath = "/hosting/web/{serviceName}/envVar/{key}"; StringBuilder sb = path(qPath, serviceName, key); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_envVar_key_PUT", "(", "String", "serviceName", ",", "String", "key", ",", "OvhEnvVar", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/{serviceName}/envVar/{key}\"", ";", "StringBuilder", "sb", "=", "pa...
Alter this object properties REST: PUT /hosting/web/{serviceName}/envVar/{key} @param body [required] New object properties @param serviceName [required] The internal name of your hosting @param key [required] Name of the variable
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L1787-L1791
microfocus-idol/java-parametric-databases
hod/src/main/java/com/hp/autonomy/hod/databases/AbstractResourceMapper.java
AbstractResourceMapper.databaseForResource
protected Database databaseForResource(final TokenProxy<?, TokenType.Simple> tokenProxy, final Resource resource, final String domain) throws HodErrorException { final ResourceIdentifier resourceIdentifier = new ResourceIdentifier(domain, resource.getResource()); final Set<String> parametricFields; if (tokenProxy == null) { parametricFields = indexFieldsService.getParametricFields(resourceIdentifier); } else { parametricFields = indexFieldsService.getParametricFields(tokenProxy, resourceIdentifier); } return new Database.Builder() .setName(resource.getResource()) .setDisplayName(resource.getDisplayName()) .setIsPublic(ResourceIdentifier.PUBLIC_INDEXES_DOMAIN.equals(domain)) .setDomain(domain) .setIndexFields(parametricFields) .build(); }
java
protected Database databaseForResource(final TokenProxy<?, TokenType.Simple> tokenProxy, final Resource resource, final String domain) throws HodErrorException { final ResourceIdentifier resourceIdentifier = new ResourceIdentifier(domain, resource.getResource()); final Set<String> parametricFields; if (tokenProxy == null) { parametricFields = indexFieldsService.getParametricFields(resourceIdentifier); } else { parametricFields = indexFieldsService.getParametricFields(tokenProxy, resourceIdentifier); } return new Database.Builder() .setName(resource.getResource()) .setDisplayName(resource.getDisplayName()) .setIsPublic(ResourceIdentifier.PUBLIC_INDEXES_DOMAIN.equals(domain)) .setDomain(domain) .setIndexFields(parametricFields) .build(); }
[ "protected", "Database", "databaseForResource", "(", "final", "TokenProxy", "<", "?", ",", "TokenType", ".", "Simple", ">", "tokenProxy", ",", "final", "Resource", "resource", ",", "final", "String", "domain", ")", "throws", "HodErrorException", "{", "final", "R...
Converts the given resource name to a database @param tokenProxy The token proxy to use to retrieve parametric fields @param resource The resource @param domain The domain of the resource @return A database representation of the resource @throws HodErrorException
[ "Converts", "the", "given", "resource", "name", "to", "a", "database" ]
train
https://github.com/microfocus-idol/java-parametric-databases/blob/378a246a1857f911587106241712d16c2e118af2/hod/src/main/java/com/hp/autonomy/hod/databases/AbstractResourceMapper.java#L36-L54
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
ConsoleMenu.addMenuItem
public void addMenuItem(final String menuDisplay, final String methodName, final boolean repeat) { menu.add(menuDisplay); methods.add(methodName); askForRepeat.add(Boolean.valueOf(repeat)); }
java
public void addMenuItem(final String menuDisplay, final String methodName, final boolean repeat) { menu.add(menuDisplay); methods.add(methodName); askForRepeat.add(Boolean.valueOf(repeat)); }
[ "public", "void", "addMenuItem", "(", "final", "String", "menuDisplay", ",", "final", "String", "methodName", ",", "final", "boolean", "repeat", ")", "{", "menu", ".", "add", "(", "menuDisplay", ")", ";", "methods", ".", "add", "(", "methodName", ")", ";",...
add an entry in the menu, sequentially @param menuDisplay how the entry will be displayed in the menu @param methodName name of the public method @param repeat call back for repeat
[ "add", "an", "entry", "in", "the", "menu", "sequentially" ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L94-L98
VoltDB/voltdb
src/frontend/org/voltdb/types/GeographyPointValue.java
GeographyPointValue.unflattenFromBuffer
public static GeographyPointValue unflattenFromBuffer(ByteBuffer inBuffer, int offset) { double lng = inBuffer.getDouble(offset); double lat = inBuffer.getDouble(offset + BYTES_IN_A_COORD); if (lat == 360.0 && lng == 360.0) { // This is a null point. return null; } return new GeographyPointValue(lng, lat); }
java
public static GeographyPointValue unflattenFromBuffer(ByteBuffer inBuffer, int offset) { double lng = inBuffer.getDouble(offset); double lat = inBuffer.getDouble(offset + BYTES_IN_A_COORD); if (lat == 360.0 && lng == 360.0) { // This is a null point. return null; } return new GeographyPointValue(lng, lat); }
[ "public", "static", "GeographyPointValue", "unflattenFromBuffer", "(", "ByteBuffer", "inBuffer", ",", "int", "offset", ")", "{", "double", "lng", "=", "inBuffer", ".", "getDouble", "(", "offset", ")", ";", "double", "lat", "=", "inBuffer", ".", "getDouble", "(...
Deserializes a point from a ByteBuffer, at an absolute offset. @param inBuffer The ByteBuffer from which to read the bytes for a point. @param offset Absolute offset of point data in buffer. @return A new instance of GeographyPointValue.
[ "Deserializes", "a", "point", "from", "a", "ByteBuffer", "at", "an", "absolute", "offset", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyPointValue.java#L230-L239
filosganga/geogson
core/src/main/java/com/github/filosganga/geogson/model/Polygon.java
Polygon.of
public static Polygon of(LinearRing perimeter, Stream<LinearRing> holes) { return new Polygon(AreaPositions.builder() .addLinearPosition(perimeter.positions()) .addLinearPositions(holes .map(LinearRing::positions)::iterator) .build()); }
java
public static Polygon of(LinearRing perimeter, Stream<LinearRing> holes) { return new Polygon(AreaPositions.builder() .addLinearPosition(perimeter.positions()) .addLinearPositions(holes .map(LinearRing::positions)::iterator) .build()); }
[ "public", "static", "Polygon", "of", "(", "LinearRing", "perimeter", ",", "Stream", "<", "LinearRing", ">", "holes", ")", "{", "return", "new", "Polygon", "(", "AreaPositions", ".", "builder", "(", ")", ".", "addLinearPosition", "(", "perimeter", ".", "posit...
Creates a Polygon from the given perimeter and holes. @param perimeter The perimeter {@link LinearRing}. @param holes The holes {@link LinearRing} Stream. @return Polygon
[ "Creates", "a", "Polygon", "from", "the", "given", "perimeter", "and", "holes", "." ]
train
https://github.com/filosganga/geogson/blob/f0c7b0adfecc174caa8a03a6c19d301c7a47d4a0/core/src/main/java/com/github/filosganga/geogson/model/Polygon.java#L76-L83
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/Util.java
Util.checkIfMultipleOf8AndGT0
public static void checkIfMultipleOf8AndGT0(final long v, final String argName) { if (((v & 0X7L) == 0L) && (v > 0L)) { return; } throw new SketchesArgumentException("The value of the parameter \"" + argName + "\" must be a positive multiple of 8 and greater than zero: " + v); }
java
public static void checkIfMultipleOf8AndGT0(final long v, final String argName) { if (((v & 0X7L) == 0L) && (v > 0L)) { return; } throw new SketchesArgumentException("The value of the parameter \"" + argName + "\" must be a positive multiple of 8 and greater than zero: " + v); }
[ "public", "static", "void", "checkIfMultipleOf8AndGT0", "(", "final", "long", "v", ",", "final", "String", "argName", ")", "{", "if", "(", "(", "(", "v", "&", "0X7", "L", ")", "==", "0L", ")", "&&", "(", "v", ">", "0L", ")", ")", "{", "return", "...
Checks if parameter v is a multiple of 8 and greater than zero. @param v The parameter to check @param argName This name will be part of the error message if the check fails.
[ "Checks", "if", "parameter", "v", "is", "a", "multiple", "of", "8", "and", "greater", "than", "zero", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/Util.java#L330-L336
jinahya/hex-codec
src/main/java/com/github/jinahya/codec/HexDecoder.java
HexDecoder.decodeToString
public String decodeToString(final byte[] input, final String outputCharset) throws UnsupportedEncodingException { return new String(decode(input), outputCharset); }
java
public String decodeToString(final byte[] input, final String outputCharset) throws UnsupportedEncodingException { return new String(decode(input), outputCharset); }
[ "public", "String", "decodeToString", "(", "final", "byte", "[", "]", "input", ",", "final", "String", "outputCharset", ")", "throws", "UnsupportedEncodingException", "{", "return", "new", "String", "(", "decode", "(", "input", ")", ",", "outputCharset", ")", ...
Decodes given sequence of nibbles into a string. @param input the nibbles to decode @param outputCharset the charset name to encode output string @return the decoded string. @throws UnsupportedEncodingException if outputCharset is not supported
[ "Decodes", "given", "sequence", "of", "nibbles", "into", "a", "string", "." ]
train
https://github.com/jinahya/hex-codec/blob/159aa54010821655496177e76a3ef35a49fbd433/src/main/java/com/github/jinahya/codec/HexDecoder.java#L218-L222
redkale/redkale
src/org/redkale/net/http/HttpRequest.java
HttpRequest.getRequstURIPath
public float getRequstURIPath(String prefix, float defvalue) { String val = getRequstURIPath(prefix, null); try { return val == null ? defvalue : Float.parseFloat(val); } catch (NumberFormatException e) { return defvalue; } }
java
public float getRequstURIPath(String prefix, float defvalue) { String val = getRequstURIPath(prefix, null); try { return val == null ? defvalue : Float.parseFloat(val); } catch (NumberFormatException e) { return defvalue; } }
[ "public", "float", "getRequstURIPath", "(", "String", "prefix", ",", "float", "defvalue", ")", "{", "String", "val", "=", "getRequstURIPath", "(", "prefix", ",", "null", ")", ";", "try", "{", "return", "val", "==", "null", "?", "defvalue", ":", "Float", ...
获取请求URL分段中含prefix段的float值 <br> 例如请求URL /pipes/record/query/point:40.0 <br> 获取time参数: float point = request.getRequstURIPath("point:", 0.0f); @param prefix prefix段前缀 @param defvalue 默认float值 @return float值
[ "获取请求URL分段中含prefix段的float值", "<br", ">", "例如请求URL", "/", "pipes", "/", "record", "/", "query", "/", "point", ":", "40", ".", "0", "<br", ">", "获取time参数", ":", "float", "point", "=", "request", ".", "getRequstURIPath", "(", "point", ":", "0", ".", "0f", ...
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L897-L904
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java
HadoopUtils.deleteIfExists
public static void deleteIfExists(FileSystem fs, Path path, boolean recursive) throws IOException { if (fs.exists(path)) { deletePath(fs, path, recursive); } }
java
public static void deleteIfExists(FileSystem fs, Path path, boolean recursive) throws IOException { if (fs.exists(path)) { deletePath(fs, path, recursive); } }
[ "public", "static", "void", "deleteIfExists", "(", "FileSystem", "fs", ",", "Path", "path", ",", "boolean", "recursive", ")", "throws", "IOException", "{", "if", "(", "fs", ".", "exists", "(", "path", ")", ")", "{", "deletePath", "(", "fs", ",", "path", ...
A wrapper around {@link FileSystem#delete(Path, boolean)} that only deletes a given {@link Path} if it is present on the given {@link FileSystem}.
[ "A", "wrapper", "around", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L171-L175
lets-blade/blade
src/main/java/com/blade/kit/AsmKit.java
AsmKit.sameType
private static boolean sameType(Type[] types, Class<?>[] classes) { if (types.length != classes.length) return false; for (int i = 0; i < types.length; i++) { if (!Type.getType(classes[i]).equals(types[i])) return false; } return true; }
java
private static boolean sameType(Type[] types, Class<?>[] classes) { if (types.length != classes.length) return false; for (int i = 0; i < types.length; i++) { if (!Type.getType(classes[i]).equals(types[i])) return false; } return true; }
[ "private", "static", "boolean", "sameType", "(", "Type", "[", "]", "types", ",", "Class", "<", "?", ">", "[", "]", "classes", ")", "{", "if", "(", "types", ".", "length", "!=", "classes", ".", "length", ")", "return", "false", ";", "for", "(", "int...
Compare whether the parameter type is consistent @param types the type of the asm({@link Type}) @param classes java type({@link Class}) @return return param type equals
[ "Compare", "whether", "the", "parameter", "type", "is", "consistent" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/AsmKit.java#L49-L55
respoke/respoke-sdk-android
respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java
RespokeClient.buildGroupMessage
private RespokeGroupMessage buildGroupMessage(JSONObject source) throws JSONException { if (source == null) { throw new IllegalArgumentException("source cannot be null"); } final JSONObject header = source.getJSONObject("header"); final String endpointID = header.getString("from"); final RespokeEndpoint endpoint = getEndpoint(endpointID, false); final String groupID = header.getString("channel"); RespokeGroup group = getGroup(groupID); if (group == null) { group = new RespokeGroup(groupID, signalingChannel, this, false); groups.put(groupID, group); } final String message = source.getString("message"); final Date timestamp; if (!header.isNull("timestamp")) { timestamp = new Date(header.getLong("timestamp")); } else { // Just use the current time if no date is specified in the header data timestamp = new Date(); } return new RespokeGroupMessage(message, group, endpoint, timestamp); }
java
private RespokeGroupMessage buildGroupMessage(JSONObject source) throws JSONException { if (source == null) { throw new IllegalArgumentException("source cannot be null"); } final JSONObject header = source.getJSONObject("header"); final String endpointID = header.getString("from"); final RespokeEndpoint endpoint = getEndpoint(endpointID, false); final String groupID = header.getString("channel"); RespokeGroup group = getGroup(groupID); if (group == null) { group = new RespokeGroup(groupID, signalingChannel, this, false); groups.put(groupID, group); } final String message = source.getString("message"); final Date timestamp; if (!header.isNull("timestamp")) { timestamp = new Date(header.getLong("timestamp")); } else { // Just use the current time if no date is specified in the header data timestamp = new Date(); } return new RespokeGroupMessage(message, group, endpoint, timestamp); }
[ "private", "RespokeGroupMessage", "buildGroupMessage", "(", "JSONObject", "source", ")", "throws", "JSONException", "{", "if", "(", "source", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"source cannot be null\"", ")", ";", "}", "final"...
Build a group message from a JSON object. The format of the JSON object would be the format that comes over the wire from Respoke when receiving a pubsub message. This same format is used when retrieving message history. @param source The source JSON object to build the RespokeGroupMessage from @return The built RespokeGroupMessage @throws JSONException
[ "Build", "a", "group", "message", "from", "a", "JSON", "object", ".", "The", "format", "of", "the", "JSON", "object", "would", "be", "the", "format", "that", "comes", "over", "the", "wire", "from", "Respoke", "when", "receiving", "a", "pubsub", "message", ...
train
https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java#L1576-L1604
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerState.java
PaymentChannelServerState.storeChannelInWallet
public synchronized void storeChannelInWallet(@Nullable PaymentChannelServer connectedHandler) { stateMachine.checkState(State.READY); if (storedServerChannel != null) return; log.info("Storing state with contract hash {}.", getContract().getTxId()); StoredPaymentChannelServerStates channels = (StoredPaymentChannelServerStates) wallet.addOrGetExistingExtension(new StoredPaymentChannelServerStates(wallet, broadcaster)); storedServerChannel = new StoredServerChannel(this, getMajorVersion(), getContract(), getClientOutput(), getExpiryTime(), serverKey, getClientKey(), bestValueToMe, bestValueSignature); if (connectedHandler != null) checkState(storedServerChannel.setConnectedHandler(connectedHandler, false) == connectedHandler); channels.putChannel(storedServerChannel); }
java
public synchronized void storeChannelInWallet(@Nullable PaymentChannelServer connectedHandler) { stateMachine.checkState(State.READY); if (storedServerChannel != null) return; log.info("Storing state with contract hash {}.", getContract().getTxId()); StoredPaymentChannelServerStates channels = (StoredPaymentChannelServerStates) wallet.addOrGetExistingExtension(new StoredPaymentChannelServerStates(wallet, broadcaster)); storedServerChannel = new StoredServerChannel(this, getMajorVersion(), getContract(), getClientOutput(), getExpiryTime(), serverKey, getClientKey(), bestValueToMe, bestValueSignature); if (connectedHandler != null) checkState(storedServerChannel.setConnectedHandler(connectedHandler, false) == connectedHandler); channels.putChannel(storedServerChannel); }
[ "public", "synchronized", "void", "storeChannelInWallet", "(", "@", "Nullable", "PaymentChannelServer", "connectedHandler", ")", "{", "stateMachine", ".", "checkState", "(", "State", ".", "READY", ")", ";", "if", "(", "storedServerChannel", "!=", "null", ")", "ret...
Stores this channel's state in the wallet as a part of a {@link StoredPaymentChannelServerStates} wallet extension and keeps it up-to-date each time payment is incremented. This will be automatically removed when a call to {@link PaymentChannelV1ServerState#close()} completes successfully. A channel may only be stored after it has fully opened (ie state == State.READY). @param connectedHandler Optional {@link PaymentChannelServer} object that manages this object. This will set the appropriate pointer in the newly created {@link StoredServerChannel} before it is committed to wallet. If set, closing the state object will propagate the close to the handler which can then do a TCP disconnect.
[ "Stores", "this", "channel", "s", "state", "in", "the", "wallet", "as", "a", "part", "of", "a", "{", "@link", "StoredPaymentChannelServerStates", "}", "wallet", "extension", "and", "keeps", "it", "up", "-", "to", "-", "date", "each", "time", "payment", "is...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelServerState.java#L366-L378
james-hu/jabb-core
src/main/java/net/sf/jabb/util/text/word/TextAnalyzer.java
TextAnalyzer.createInstance
static public TextAnalyzer createInstance(int type, String dictionaryPath, Map<String, ? extends Object> keywordDefinitions, Map<Integer, ? extends Object> lengthDefinitions){ switch(type){ case TYPE_MMSEG_COMPLEX: case TYPE_MMSEG_MAXWORD: case TYPE_MMSEG_SIMPLE: return new MmsegTextAnalyzer(type, dictionaryPath, keywordDefinitions, lengthDefinitions); case TYPE_FAST: return new FastTextAnalyzer(dictionaryPath, keywordDefinitions, lengthDefinitions); default: throw new IllegalArgumentException("Not supported TextAnalyzer type: " + type); } }
java
static public TextAnalyzer createInstance(int type, String dictionaryPath, Map<String, ? extends Object> keywordDefinitions, Map<Integer, ? extends Object> lengthDefinitions){ switch(type){ case TYPE_MMSEG_COMPLEX: case TYPE_MMSEG_MAXWORD: case TYPE_MMSEG_SIMPLE: return new MmsegTextAnalyzer(type, dictionaryPath, keywordDefinitions, lengthDefinitions); case TYPE_FAST: return new FastTextAnalyzer(dictionaryPath, keywordDefinitions, lengthDefinitions); default: throw new IllegalArgumentException("Not supported TextAnalyzer type: " + type); } }
[ "static", "public", "TextAnalyzer", "createInstance", "(", "int", "type", ",", "String", "dictionaryPath", ",", "Map", "<", "String", ",", "?", "extends", "Object", ">", "keywordDefinitions", ",", "Map", "<", "Integer", ",", "?", "extends", "Object", ">", "l...
Create an instance of TextAnalyzer.<br> 创建一个文本分析器实例。 @param type {@link #TYPE_MMSEG_SIMPLE} | {@link #TYPE_MMSEG_COMPLEX} | {@link #TYPE_MMSEG_MAXWORD} | {@link #TYPE_FAST} @param dictionaryPath 字典文件路径,如果为null,则表示使用缺省位置的字典文件 @param keywordDefinitions 关键词字的定义 @param lengthDefinitions 文本长度类别定义 @return A new instance of TextAnalyzer.<br>TextAnalyzer的一个实例。
[ "Create", "an", "instance", "of", "TextAnalyzer", ".", "<br", ">", "创建一个文本分析器实例。" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/text/word/TextAnalyzer.java#L61-L75
dnsjava/dnsjava
org/xbill/DNS/ZoneTransferIn.java
ZoneTransferIn.newAXFR
public static ZoneTransferIn newAXFR(Name zone, String host, TSIG key) throws UnknownHostException { return newAXFR(zone, host, 0, key); }
java
public static ZoneTransferIn newAXFR(Name zone, String host, TSIG key) throws UnknownHostException { return newAXFR(zone, host, 0, key); }
[ "public", "static", "ZoneTransferIn", "newAXFR", "(", "Name", "zone", ",", "String", "host", ",", "TSIG", "key", ")", "throws", "UnknownHostException", "{", "return", "newAXFR", "(", "zone", ",", "host", ",", "0", ",", "key", ")", ";", "}" ]
Instantiates a ZoneTransferIn object to do an AXFR (full zone transfer). @param zone The zone to transfer. @param host The host from which to transfer the zone. @param key The TSIG key used to authenticate the transfer, or null. @return The ZoneTransferIn object. @throws UnknownHostException The host does not exist.
[ "Instantiates", "a", "ZoneTransferIn", "object", "to", "do", "an", "AXFR", "(", "full", "zone", "transfer", ")", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/ZoneTransferIn.java#L231-L236
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
GrafeasV1Beta1Client.listNoteOccurrences
public final ListNoteOccurrencesPagedResponse listNoteOccurrences(String name, String filter) { ListNoteOccurrencesRequest request = ListNoteOccurrencesRequest.newBuilder().setName(name).setFilter(filter).build(); return listNoteOccurrences(request); }
java
public final ListNoteOccurrencesPagedResponse listNoteOccurrences(String name, String filter) { ListNoteOccurrencesRequest request = ListNoteOccurrencesRequest.newBuilder().setName(name).setFilter(filter).build(); return listNoteOccurrences(request); }
[ "public", "final", "ListNoteOccurrencesPagedResponse", "listNoteOccurrences", "(", "String", "name", ",", "String", "filter", ")", "{", "ListNoteOccurrencesRequest", "request", "=", "ListNoteOccurrencesRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", ...
Lists occurrences referencing the specified note. Provider projects can use this method to get all occurrences across consumer projects referencing the specified note. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { NoteName name = NoteName.of("[PROJECT]", "[NOTE]"); String filter = ""; for (Occurrence element : grafeasV1Beta1Client.listNoteOccurrences(name.toString(), filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param name The name of the note to list occurrences for in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. @param filter The filter expression. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "occurrences", "referencing", "the", "specified", "note", ".", "Provider", "projects", "can", "use", "this", "method", "to", "get", "all", "occurrences", "across", "consumer", "projects", "referencing", "the", "specified", "note", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L1649-L1653
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.matchesFingerprint
private boolean matchesFingerprint(byte[] buffer, Pattern fingerprint) { return fingerprint.matcher(m_charset == null ? new String(buffer) : new String(buffer, m_charset)).matches(); }
java
private boolean matchesFingerprint(byte[] buffer, Pattern fingerprint) { return fingerprint.matcher(m_charset == null ? new String(buffer) : new String(buffer, m_charset)).matches(); }
[ "private", "boolean", "matchesFingerprint", "(", "byte", "[", "]", "buffer", ",", "Pattern", "fingerprint", ")", "{", "return", "fingerprint", ".", "matcher", "(", "m_charset", "==", "null", "?", "new", "String", "(", "buffer", ")", ":", "new", "String", "...
Determine if the buffer, when expressed as text, matches a fingerprint regular expression. @param buffer bytes from file @param fingerprint fingerprint regular expression @return true if the file matches the fingerprint
[ "Determine", "if", "the", "buffer", "when", "expressed", "as", "text", "matches", "a", "fingerprint", "regular", "expression", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L341-L344
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/descriptors/ClasspathScanDescriptorProvider.java
ClasspathScanDescriptorProvider.scanPackage
public ClasspathScanDescriptorProvider scanPackage(final String packageName, final boolean recursive, final ClassLoader classLoader) { return scanPackage(packageName, recursive, classLoader, true); }
java
public ClasspathScanDescriptorProvider scanPackage(final String packageName, final boolean recursive, final ClassLoader classLoader) { return scanPackage(packageName, recursive, classLoader, true); }
[ "public", "ClasspathScanDescriptorProvider", "scanPackage", "(", "final", "String", "packageName", ",", "final", "boolean", "recursive", ",", "final", "ClassLoader", "classLoader", ")", "{", "return", "scanPackage", "(", "packageName", ",", "recursive", ",", "classLoa...
Scans a package in the classpath (of a particular classloader) for annotated components. @param packageName the package name to scan @param recursive whether or not to scan subpackages recursively @param classLoader the classloader to use @return
[ "Scans", "a", "package", "in", "the", "classpath", "(", "of", "a", "particular", "classloader", ")", "for", "annotated", "components", "." ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/descriptors/ClasspathScanDescriptorProvider.java#L191-L194
upwork/java-upwork
src/com/Upwork/api/Routers/Hr/Submissions.java
Submissions.requestApproval
public JSONObject requestApproval(HashMap<String, String> params) throws JSONException { return oClient.post("/hr/v3/fp/submissions", params); }
java
public JSONObject requestApproval(HashMap<String, String> params) throws JSONException { return oClient.post("/hr/v3/fp/submissions", params); }
[ "public", "JSONObject", "requestApproval", "(", "HashMap", "<", "String", ",", "String", ">", "params", ")", "throws", "JSONException", "{", "return", "oClient", ".", "post", "(", "\"/hr/v3/fp/submissions\"", ",", "params", ")", ";", "}" ]
Freelancer submits work for the client to approve @param params Parameters @throws JSONException If error occurred @return {@link JSONObject}
[ "Freelancer", "submits", "work", "for", "the", "client", "to", "approve" ]
train
https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Hr/Submissions.java#L53-L55
looly/hutool
hutool-db/src/main/java/cn/hutool/db/AbstractDb.java
AbstractDb.execute
public int execute(String sql, Object... params) throws SQLException { Connection conn = null; try { conn = this.getConnection(); return SqlExecutor.execute(conn, sql, params); } catch (SQLException e) { throw e; } finally { this.closeConnection(conn); } }
java
public int execute(String sql, Object... params) throws SQLException { Connection conn = null; try { conn = this.getConnection(); return SqlExecutor.execute(conn, sql, params); } catch (SQLException e) { throw e; } finally { this.closeConnection(conn); } }
[ "public", "int", "execute", "(", "String", "sql", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "Connection", "conn", "=", "null", ";", "try", "{", "conn", "=", "this", ".", "getConnection", "(", ")", ";", "return", "SqlExecutor", "...
执行非查询语句<br> 语句包括 插入、更新、删除 @param sql SQL @param params 参数 @return 影响行数 @throws SQLException SQL执行异常
[ "执行非查询语句<br", ">", "语句包括", "插入、更新、删除" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L165-L175
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/ShareIntents.java
ShareIntents.newShareTextIntent
public static Intent newShareTextIntent(String subject, String message, String chooserDialogTitle) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_TEXT, message); shareIntent.putExtra(Intent.EXTRA_SUBJECT, subject); shareIntent.setType(MIME_TYPE_TEXT); return Intent.createChooser(shareIntent, chooserDialogTitle); }
java
public static Intent newShareTextIntent(String subject, String message, String chooserDialogTitle) { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_TEXT, message); shareIntent.putExtra(Intent.EXTRA_SUBJECT, subject); shareIntent.setType(MIME_TYPE_TEXT); return Intent.createChooser(shareIntent, chooserDialogTitle); }
[ "public", "static", "Intent", "newShareTextIntent", "(", "String", "subject", ",", "String", "message", ",", "String", "chooserDialogTitle", ")", "{", "Intent", "shareIntent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_SEND", ")", ";", "shareIntent", ".",...
Creates a chooser to share some data. @param subject The subject to share (might be discarded, for instance if the user picks an SMS app) @param message The message to share @param chooserDialogTitle The title for the chooser dialog @return the intent
[ "Creates", "a", "chooser", "to", "share", "some", "data", "." ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/ShareIntents.java#L36-L42
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.withDefault
public static <T> List<T> withDefault(List<T> self, Closure init) { return withLazyDefault(self, init); }
java
public static <T> List<T> withDefault(List<T> self, Closure init) { return withLazyDefault(self, init); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "withDefault", "(", "List", "<", "T", ">", "self", ",", "Closure", "init", ")", "{", "return", "withLazyDefault", "(", "self", ",", "init", ")", ";", "}" ]
An alias for <code>withLazyDefault</code> which decorates a list allowing it to grow when called with index values outside the normal list bounds. @param self a List @param init a Closure with the target index as parameter which generates the default value @return the decorated List @see #withLazyDefault(java.util.List, groovy.lang.Closure) @see #withEagerDefault(java.util.List, groovy.lang.Closure) @since 1.8.7
[ "An", "alias", "for", "<code", ">", "withLazyDefault<", "/", "code", ">", "which", "decorates", "a", "list", "allowing", "it", "to", "grow", "when", "called", "with", "index", "values", "outside", "the", "normal", "list", "bounds", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L7764-L7766
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/features/FeatureUtilities.java
FeatureUtilities.doVectorize
@SuppressWarnings("unchecked") public static Collection<Polygon> doVectorize( GridCoverage2D src, Map<String, Object> args ) { if (args == null) { args = new HashMap<String, Object>(); } ParameterBlockJAI pb = new ParameterBlockJAI("Vectorize"); pb.setSource("source0", src.getRenderedImage()); // Set any parameters that were passed in for( Entry<String, Object> e : args.entrySet() ) { pb.setParameter(e.getKey(), e.getValue()); } // Get the desintation image: this is the unmodified source image data // plus a property for the generated vectors RenderedOp dest = JAI.create("Vectorize", pb); // Get the vectors Collection<Polygon> polygons = (Collection<Polygon>) dest.getProperty(VectorizeDescriptor.VECTOR_PROPERTY_NAME); RegionMap regionParams = CoverageUtilities.getRegionParamsFromGridCoverage(src); double xRes = regionParams.getXres(); double yRes = regionParams.getYres(); final AffineTransform mt2D = (AffineTransform) src.getGridGeometry().getGridToCRS2D(PixelOrientation.CENTER); final AffineTransformation jtsTransformation = new AffineTransformation(mt2D.getScaleX(), mt2D.getShearX(), mt2D.getTranslateX() - xRes / 2.0, mt2D.getShearY(), mt2D.getScaleY(), mt2D.getTranslateY() + yRes / 2.0); for( Polygon polygon : polygons ) { polygon.apply(jtsTransformation); } return polygons; }
java
@SuppressWarnings("unchecked") public static Collection<Polygon> doVectorize( GridCoverage2D src, Map<String, Object> args ) { if (args == null) { args = new HashMap<String, Object>(); } ParameterBlockJAI pb = new ParameterBlockJAI("Vectorize"); pb.setSource("source0", src.getRenderedImage()); // Set any parameters that were passed in for( Entry<String, Object> e : args.entrySet() ) { pb.setParameter(e.getKey(), e.getValue()); } // Get the desintation image: this is the unmodified source image data // plus a property for the generated vectors RenderedOp dest = JAI.create("Vectorize", pb); // Get the vectors Collection<Polygon> polygons = (Collection<Polygon>) dest.getProperty(VectorizeDescriptor.VECTOR_PROPERTY_NAME); RegionMap regionParams = CoverageUtilities.getRegionParamsFromGridCoverage(src); double xRes = regionParams.getXres(); double yRes = regionParams.getYres(); final AffineTransform mt2D = (AffineTransform) src.getGridGeometry().getGridToCRS2D(PixelOrientation.CENTER); final AffineTransformation jtsTransformation = new AffineTransformation(mt2D.getScaleX(), mt2D.getShearX(), mt2D.getTranslateX() - xRes / 2.0, mt2D.getShearY(), mt2D.getScaleY(), mt2D.getTranslateY() + yRes / 2.0); for( Polygon polygon : polygons ) { polygon.apply(jtsTransformation); } return polygons; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Collection", "<", "Polygon", ">", "doVectorize", "(", "GridCoverage2D", "src", ",", "Map", "<", "String", ",", "Object", ">", "args", ")", "{", "if", "(", "args", "==", "null", ")", ...
Helper function to run the Vectorize operation with given parameters and retrieve the vectors. @param src the source {@link GridCoverage2D}. @param args a {@code Map} of parameter names and values or <code>null</code>. @return the generated vectors as JTS Polygons
[ "Helper", "function", "to", "run", "the", "Vectorize", "operation", "with", "given", "parameters", "and", "retrieve", "the", "vectors", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/features/FeatureUtilities.java#L729-L760
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/URLMatchingUtils.java
URLMatchingUtils.isPathNameMatch
public static boolean isPathNameMatch(String uri, String urlPattern) { if (urlPattern.startsWith("/") && urlPattern.endsWith("/*")) { String s = urlPattern.substring(0, urlPattern.length() - 1); /** * First case,urlPattern * /a/b/c/ matches /a/b/c/* **/ if (s.equalsIgnoreCase(uri)) { return true; } /** * Second case * /a/b/c matches /a/b/c/* **/ if (uri.equalsIgnoreCase(s.substring(0, s.length() - 1))) { return true; } /** * Third case * /a/b/c/d/e matches /a/b/c/* **/ if (uri.startsWith(s)) { return true; } } return false; }
java
public static boolean isPathNameMatch(String uri, String urlPattern) { if (urlPattern.startsWith("/") && urlPattern.endsWith("/*")) { String s = urlPattern.substring(0, urlPattern.length() - 1); /** * First case,urlPattern * /a/b/c/ matches /a/b/c/* **/ if (s.equalsIgnoreCase(uri)) { return true; } /** * Second case * /a/b/c matches /a/b/c/* **/ if (uri.equalsIgnoreCase(s.substring(0, s.length() - 1))) { return true; } /** * Third case * /a/b/c/d/e matches /a/b/c/* **/ if (uri.startsWith(s)) { return true; } } return false; }
[ "public", "static", "boolean", "isPathNameMatch", "(", "String", "uri", ",", "String", "urlPattern", ")", "{", "if", "(", "urlPattern", ".", "startsWith", "(", "\"/\"", ")", "&&", "urlPattern", ".", "endsWith", "(", "\"/*\"", ")", ")", "{", "String", "s", ...
Determine if the urlPattern is a path name match for the uri. @param uri @param urlPattern @return
[ "Determine", "if", "the", "urlPattern", "is", "a", "path", "name", "match", "for", "the", "uri", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/metadata/URLMatchingUtils.java#L85-L113
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/cluster/topology/TopologyComparators.java
TopologyComparators.isChanged
public static boolean isChanged(Partitions o1, Partitions o2) { if (o1.size() != o2.size()) { return true; } for (RedisClusterNode base : o2) { if (!essentiallyEqualsTo(base, o1.getPartitionByNodeId(base.getNodeId()))) { return true; } } return false; }
java
public static boolean isChanged(Partitions o1, Partitions o2) { if (o1.size() != o2.size()) { return true; } for (RedisClusterNode base : o2) { if (!essentiallyEqualsTo(base, o1.getPartitionByNodeId(base.getNodeId()))) { return true; } } return false; }
[ "public", "static", "boolean", "isChanged", "(", "Partitions", "o1", ",", "Partitions", "o2", ")", "{", "if", "(", "o1", ".", "size", "(", ")", "!=", "o2", ".", "size", "(", ")", ")", "{", "return", "true", ";", "}", "for", "(", "RedisClusterNode", ...
Check if properties changed which are essential for cluster operations. @param o1 the first object to be compared. @param o2 the second object to be compared. @return {@literal true} if {@code MASTER} or {@code SLAVE} flags changed or the responsible slots changed.
[ "Check", "if", "properties", "changed", "which", "are", "essential", "for", "cluster", "operations", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/topology/TopologyComparators.java#L121-L134
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkTapsInner.java
VirtualNetworkTapsInner.getByResourceGroupAsync
public Observable<VirtualNetworkTapInner> getByResourceGroupAsync(String resourceGroupName, String tapName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, tapName).map(new Func1<ServiceResponse<VirtualNetworkTapInner>, VirtualNetworkTapInner>() { @Override public VirtualNetworkTapInner call(ServiceResponse<VirtualNetworkTapInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkTapInner> getByResourceGroupAsync(String resourceGroupName, String tapName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, tapName).map(new Func1<ServiceResponse<VirtualNetworkTapInner>, VirtualNetworkTapInner>() { @Override public VirtualNetworkTapInner call(ServiceResponse<VirtualNetworkTapInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkTapInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "tapName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "tapName", ")", ".", "map"...
Gets information about the specified virtual network tap. @param resourceGroupName The name of the resource group. @param tapName The name of virtual network tap. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkTapInner object
[ "Gets", "information", "about", "the", "specified", "virtual", "network", "tap", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VirtualNetworkTapsInner.java#L302-L309
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/NormOps_DDRM.java
NormOps_DDRM.fastNormP
public static double fastNormP(DMatrixRMaj A , double p ) { if( p == 1 ) { return normP1(A); } else if( p == 2 ) { return fastNormP2(A); } else if( Double.isInfinite(p)) { return normPInf(A); } if( MatrixFeatures_DDRM.isVector(A) ) { return fastElementP(A,p); } else { throw new IllegalArgumentException("Doesn't support induced norms yet."); } }
java
public static double fastNormP(DMatrixRMaj A , double p ) { if( p == 1 ) { return normP1(A); } else if( p == 2 ) { return fastNormP2(A); } else if( Double.isInfinite(p)) { return normPInf(A); } if( MatrixFeatures_DDRM.isVector(A) ) { return fastElementP(A,p); } else { throw new IllegalArgumentException("Doesn't support induced norms yet."); } }
[ "public", "static", "double", "fastNormP", "(", "DMatrixRMaj", "A", ",", "double", "p", ")", "{", "if", "(", "p", "==", "1", ")", "{", "return", "normP1", "(", "A", ")", ";", "}", "else", "if", "(", "p", "==", "2", ")", "{", "return", "fastNormP2...
An unsafe but faster version of {@link #normP} that calls routines which are faster but more prone to overflow/underflow problems. @param A Vector or matrix whose norm is to be computed. @param p The p value of the p-norm. @return The computed norm.
[ "An", "unsafe", "but", "faster", "version", "of", "{", "@link", "#normP", "}", "that", "calls", "routines", "which", "are", "faster", "but", "more", "prone", "to", "overflow", "/", "underflow", "problems", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/NormOps_DDRM.java#L308-L321
LearnLib/automatalib
commons/smartcollections/src/main/java/net/automatalib/commons/smartcollections/ArrayUtil.java
ArrayUtil.computeNewCapacity
public static int computeNewCapacity(int length, int requiredCapacity, int nextCapacityHint) { if (requiredCapacity < length) { return length; } int newCapacity = (length * 3) / 2 + 1; if (newCapacity < nextCapacityHint) { newCapacity = nextCapacityHint; } if (newCapacity < requiredCapacity) { newCapacity = requiredCapacity; } return newCapacity; }
java
public static int computeNewCapacity(int length, int requiredCapacity, int nextCapacityHint) { if (requiredCapacity < length) { return length; } int newCapacity = (length * 3) / 2 + 1; if (newCapacity < nextCapacityHint) { newCapacity = nextCapacityHint; } if (newCapacity < requiredCapacity) { newCapacity = requiredCapacity; } return newCapacity; }
[ "public", "static", "int", "computeNewCapacity", "(", "int", "length", ",", "int", "requiredCapacity", ",", "int", "nextCapacityHint", ")", "{", "if", "(", "requiredCapacity", "<", "length", ")", "{", "return", "length", ";", "}", "int", "newCapacity", "=", ...
Computes the size of an array that is required to hold {@code requiredCapacity} number of elements. <p> This method first tries to increase the size of the array by a factor of 1.5 to prevent a sequence of successive increases by 1. It then evaluates the {@code nextCapacityHint} parameter as well as the {@code requiredCapacity} parameter to determine the next size. @param length the current length of the array @param requiredCapacity the immediately required capacity @param nextCapacityHint a hint for future capacity requirements that may not be required as of now @return the size of an array that is guaranteed to hold {@code requiredCapacity} number of elements.
[ "Computes", "the", "size", "of", "an", "array", "that", "is", "required", "to", "hold", "{", "@code", "requiredCapacity", "}", "number", "of", "elements", ".", "<p", ">", "This", "method", "first", "tries", "to", "increase", "the", "size", "of", "the", "...
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/smartcollections/src/main/java/net/automatalib/commons/smartcollections/ArrayUtil.java#L61-L77
VoltDB/voltdb
src/frontend/org/voltdb/importer/ImporterStatsCollector.java
ImporterStatsCollector.reportFailure
public void reportFailure(String importerName, String procName, boolean decrementPending) { StatsInfo statsInfo = getStatsInfo(importerName, procName); if (decrementPending) { statsInfo.m_pendingCount.decrementAndGet(); } statsInfo.m_failureCount.incrementAndGet(); }
java
public void reportFailure(String importerName, String procName, boolean decrementPending) { StatsInfo statsInfo = getStatsInfo(importerName, procName); if (decrementPending) { statsInfo.m_pendingCount.decrementAndGet(); } statsInfo.m_failureCount.incrementAndGet(); }
[ "public", "void", "reportFailure", "(", "String", "importerName", ",", "String", "procName", ",", "boolean", "decrementPending", ")", "{", "StatsInfo", "statsInfo", "=", "getStatsInfo", "(", "importerName", ",", "procName", ")", ";", "if", "(", "decrementPending",...
Use this when the insert fails even before the request is queued by the InternalConnectionHandler
[ "Use", "this", "when", "the", "insert", "fails", "even", "before", "the", "request", "is", "queued", "by", "the", "InternalConnectionHandler" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/importer/ImporterStatsCollector.java#L85-L91
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java
CacheProxy.deleteAllToCacheWriter
private @Nullable CacheWriterException deleteAllToCacheWriter(Set<? extends K> keys) { if (!configuration.isWriteThrough() || keys.isEmpty()) { return null; } List<K> keysToDelete = new ArrayList<>(keys); try { writer.deleteAll(keysToDelete); return null; } catch (CacheWriterException e) { keys.removeAll(keysToDelete); throw e; } catch (RuntimeException e) { keys.removeAll(keysToDelete); return new CacheWriterException("Exception in CacheWriter", e); } }
java
private @Nullable CacheWriterException deleteAllToCacheWriter(Set<? extends K> keys) { if (!configuration.isWriteThrough() || keys.isEmpty()) { return null; } List<K> keysToDelete = new ArrayList<>(keys); try { writer.deleteAll(keysToDelete); return null; } catch (CacheWriterException e) { keys.removeAll(keysToDelete); throw e; } catch (RuntimeException e) { keys.removeAll(keysToDelete); return new CacheWriterException("Exception in CacheWriter", e); } }
[ "private", "@", "Nullable", "CacheWriterException", "deleteAllToCacheWriter", "(", "Set", "<", "?", "extends", "K", ">", "keys", ")", "{", "if", "(", "!", "configuration", ".", "isWriteThrough", "(", ")", "||", "keys", ".", "isEmpty", "(", ")", ")", "{", ...
Deletes all of the entries using the cache writer, retaining only the keys that succeeded.
[ "Deletes", "all", "of", "the", "entries", "using", "the", "cache", "writer", "retaining", "only", "the", "keys", "that", "succeeded", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java#L1032-L1047
wwadge/bonecp
bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java
MemorizeTransactionProxy.runWithPossibleProxySwap
private Object runWithPossibleProxySwap(Method method, Object target, Object[] args) throws IllegalAccessException, InvocationTargetException { Object result; // swap with proxies to these too. if (method.getName().equals("createStatement")){ result = memorize((Statement)method.invoke(target, args), this.connectionHandle.get()); } else if (method.getName().equals("prepareStatement")){ result = memorize((PreparedStatement)method.invoke(target, args), this.connectionHandle.get()); } else if (method.getName().equals("prepareCall")){ result = memorize((CallableStatement)method.invoke(target, args), this.connectionHandle.get()); } else result = method.invoke(target, args); return result; }
java
private Object runWithPossibleProxySwap(Method method, Object target, Object[] args) throws IllegalAccessException, InvocationTargetException { Object result; // swap with proxies to these too. if (method.getName().equals("createStatement")){ result = memorize((Statement)method.invoke(target, args), this.connectionHandle.get()); } else if (method.getName().equals("prepareStatement")){ result = memorize((PreparedStatement)method.invoke(target, args), this.connectionHandle.get()); } else if (method.getName().equals("prepareCall")){ result = memorize((CallableStatement)method.invoke(target, args), this.connectionHandle.get()); } else result = method.invoke(target, args); return result; }
[ "private", "Object", "runWithPossibleProxySwap", "(", "Method", "method", ",", "Object", "target", ",", "Object", "[", "]", "args", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", "{", "Object", "result", ";", "// swap with proxies to these to...
Runs the given method with the specified arguments, substituting with proxies where necessary @param method @param target proxy target @param args @return Proxy-fied result for statements, actual call result otherwise @throws IllegalAccessException @throws InvocationTargetException
[ "Runs", "the", "given", "method", "with", "the", "specified", "arguments", "substituting", "with", "proxies", "where", "necessary" ]
train
https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java#L246-L261
aws/aws-sdk-java
aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateRouteResult.java
UpdateRouteResult.withRequestModels
public UpdateRouteResult withRequestModels(java.util.Map<String, String> requestModels) { setRequestModels(requestModels); return this; }
java
public UpdateRouteResult withRequestModels(java.util.Map<String, String> requestModels) { setRequestModels(requestModels); return this; }
[ "public", "UpdateRouteResult", "withRequestModels", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "requestModels", ")", "{", "setRequestModels", "(", "requestModels", ")", ";", "return", "this", ";", "}" ]
<p> The request models for the route. </p> @param requestModels The request models for the route. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "request", "models", "for", "the", "route", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/UpdateRouteResult.java#L486-L489
structurizr/java
structurizr-core/src/com/structurizr/model/Model.java
Model.addPerson
@Nonnull public Person addPerson(Location location, @Nonnull String name, @Nullable String description) { if (getPersonWithName(name) == null) { Person person = new Person(); person.setLocation(location); person.setName(name); person.setDescription(description); people.add(person); person.setId(idGenerator.generateId(person)); addElementToInternalStructures(person); return person; } else { throw new IllegalArgumentException("A person named '" + name + "' already exists."); } }
java
@Nonnull public Person addPerson(Location location, @Nonnull String name, @Nullable String description) { if (getPersonWithName(name) == null) { Person person = new Person(); person.setLocation(location); person.setName(name); person.setDescription(description); people.add(person); person.setId(idGenerator.generateId(person)); addElementToInternalStructures(person); return person; } else { throw new IllegalArgumentException("A person named '" + name + "' already exists."); } }
[ "@", "Nonnull", "public", "Person", "addPerson", "(", "Location", "location", ",", "@", "Nonnull", "String", "name", ",", "@", "Nullable", "String", "description", ")", "{", "if", "(", "getPersonWithName", "(", "name", ")", "==", "null", ")", "{", "Person"...
Creates a person and adds it to the model. @param location the location of the person (e.g. internal, external, etc) @param name the name of the person (e.g. "Admin User" or "Bob the Business User") @param description a short description of the person @return the Person instance created and added to the model (or null) @throws IllegalArgumentException if a person with the same name already exists
[ "Creates", "a", "person", "and", "adds", "it", "to", "the", "model", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/model/Model.java#L109-L126
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.summarizeForResourceGroupLevelPolicyAssignmentAsync
public Observable<SummarizeResultsInner> summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) { return response.body(); } }); }
java
public Observable<SummarizeResultsInner> summarizeForResourceGroupLevelPolicyAssignmentAsync(String subscriptionId, String resourceGroupName, String policyAssignmentName) { return summarizeForResourceGroupLevelPolicyAssignmentWithServiceResponseAsync(subscriptionId, resourceGroupName, policyAssignmentName).map(new Func1<ServiceResponse<SummarizeResultsInner>, SummarizeResultsInner>() { @Override public SummarizeResultsInner call(ServiceResponse<SummarizeResultsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SummarizeResultsInner", ">", "summarizeForResourceGroupLevelPolicyAssignmentAsync", "(", "String", "subscriptionId", ",", "String", "resourceGroupName", ",", "String", "policyAssignmentName", ")", "{", "return", "summarizeForResourceGroupLevelPolicyA...
Summarizes policy states for the resource group level policy assignment. @param subscriptionId Microsoft Azure subscription ID. @param resourceGroupName Resource group name. @param policyAssignmentName Policy assignment name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SummarizeResultsInner object
[ "Summarizes", "policy", "states", "for", "the", "resource", "group", "level", "policy", "assignment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L3136-L3143
rimerosolutions/ant-git-tasks
src/main/java/com/rimerosolutions/ant/git/tasks/TagListTask.java
TagListTask.processReferencesAndOutput
protected void processReferencesAndOutput(List<Ref> refList) { List<String> refNames = new ArrayList<String>(refList.size()); for (Ref ref : refList) { refNames.add(GitTaskUtils.sanitizeRefName(ref.getName())); } if (!namesToCheck.isEmpty()) { if (!refNames.containsAll(namesToCheck)) { List<String> namesCopy = new ArrayList<String>(namesToCheck); namesCopy.removeAll(refNames); throw new GitBuildException(String.format(MISSING_REFS_TEMPLATE, namesCopy.toString())); } } if (!GitTaskUtils.isNullOrBlankString(outputFilename)) { FileUtils fileUtils = FileUtils.getFileUtils(); Echo echo = new Echo(); echo.setProject(getProject()); echo.setFile(fileUtils.resolveFile(getProject().getBaseDir(), outputFilename)); for (int i = 0; i < refNames.size(); i++) { String refName = refNames.get(i); echo.addText(String.format(REF_NAME_TEMPLATE, refName)); } echo.perform(); } }
java
protected void processReferencesAndOutput(List<Ref> refList) { List<String> refNames = new ArrayList<String>(refList.size()); for (Ref ref : refList) { refNames.add(GitTaskUtils.sanitizeRefName(ref.getName())); } if (!namesToCheck.isEmpty()) { if (!refNames.containsAll(namesToCheck)) { List<String> namesCopy = new ArrayList<String>(namesToCheck); namesCopy.removeAll(refNames); throw new GitBuildException(String.format(MISSING_REFS_TEMPLATE, namesCopy.toString())); } } if (!GitTaskUtils.isNullOrBlankString(outputFilename)) { FileUtils fileUtils = FileUtils.getFileUtils(); Echo echo = new Echo(); echo.setProject(getProject()); echo.setFile(fileUtils.resolveFile(getProject().getBaseDir(), outputFilename)); for (int i = 0; i < refNames.size(); i++) { String refName = refNames.get(i); echo.addText(String.format(REF_NAME_TEMPLATE, refName)); } echo.perform(); } }
[ "protected", "void", "processReferencesAndOutput", "(", "List", "<", "Ref", ">", "refList", ")", "{", "List", "<", "String", ">", "refNames", "=", "new", "ArrayList", "<", "String", ">", "(", "refList", ".", "size", "(", ")", ")", ";", "for", "(", "Ref...
Processes a list of references, check references names and output to a file if requested. @param refList The list of references to process
[ "Processes", "a", "list", "of", "references", "check", "references", "names", "and", "output", "to", "a", "file", "if", "requested", "." ]
train
https://github.com/rimerosolutions/ant-git-tasks/blob/bfb32fe68afe6b9dcfd0a5194497d748ef3e8a6f/src/main/java/com/rimerosolutions/ant/git/tasks/TagListTask.java#L104-L134
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/memorymanager/CheckedMemorySegment.java
CheckedMemorySegment.putChar
public final CheckedMemorySegment putChar(int index, char value) { if (index >= 0 && index < this.size - 1) { this.memory[this.offset + index + 0] = (byte) (value >> 8); this.memory[this.offset + index + 1] = (byte) value; return this; } else { throw new IndexOutOfBoundsException(); } }
java
public final CheckedMemorySegment putChar(int index, char value) { if (index >= 0 && index < this.size - 1) { this.memory[this.offset + index + 0] = (byte) (value >> 8); this.memory[this.offset + index + 1] = (byte) value; return this; } else { throw new IndexOutOfBoundsException(); } }
[ "public", "final", "CheckedMemorySegment", "putChar", "(", "int", "index", ",", "char", "value", ")", "{", "if", "(", "index", ">=", "0", "&&", "index", "<", "this", ".", "size", "-", "1", ")", "{", "this", ".", "memory", "[", "this", ".", "offset", ...
Writes two memory containing the given char value, in the current byte order, into this buffer at the given position. @param position The position at which the memory will be written. @param value The char value to be written. @return This view itself. @throws IndexOutOfBoundsException Thrown, if the index is negative, or larger then the segment size minus 2.
[ "Writes", "two", "memory", "containing", "the", "given", "char", "value", "in", "the", "current", "byte", "order", "into", "this", "buffer", "at", "the", "given", "position", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/services/memorymanager/CheckedMemorySegment.java#L386-L394
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java
KeyChainGroup.createBasic
public static KeyChainGroup createBasic(NetworkParameters params) { return new KeyChainGroup(params, new BasicKeyChain(), null, -1, -1, null, null); }
java
public static KeyChainGroup createBasic(NetworkParameters params) { return new KeyChainGroup(params, new BasicKeyChain(), null, -1, -1, null, null); }
[ "public", "static", "KeyChainGroup", "createBasic", "(", "NetworkParameters", "params", ")", "{", "return", "new", "KeyChainGroup", "(", "params", ",", "new", "BasicKeyChain", "(", ")", ",", "null", ",", "-", "1", ",", "-", "1", ",", "null", ",", "null", ...
Creates a keychain group with just a basic chain. No deterministic chains will be created automatically.
[ "Creates", "a", "keychain", "group", "with", "just", "a", "basic", "chain", ".", "No", "deterministic", "chains", "will", "be", "created", "automatically", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L198-L200
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java
WTemplate.addParameter
public void addParameter(final String tag, final Object value) { if (Util.empty(tag)) { throw new IllegalArgumentException("A tag must be provided"); } TemplateModel model = getOrCreateComponentModel(); if (model.parameters == null) { model.parameters = new HashMap<>(); } model.parameters.put(tag, value); }
java
public void addParameter(final String tag, final Object value) { if (Util.empty(tag)) { throw new IllegalArgumentException("A tag must be provided"); } TemplateModel model = getOrCreateComponentModel(); if (model.parameters == null) { model.parameters = new HashMap<>(); } model.parameters.put(tag, value); }
[ "public", "void", "addParameter", "(", "final", "String", "tag", ",", "final", "Object", "value", ")", "{", "if", "(", "Util", ".", "empty", "(", "tag", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A tag must be provided\"", ")", ";", ...
Add a template parameter. @param tag the tag for the template parameter @param value the value for the template parameter
[ "Add", "a", "template", "parameter", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTemplate.java#L223-L233
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.license_plesk_serviceName_upgrade_GET
public ArrayList<String> license_plesk_serviceName_upgrade_GET(String serviceName, OvhOrderableAntispamEnum antispam, OvhOrderableAntivirusEnum antivirus, OvhPleskApplicationSetEnum applicationSet, OvhOrderablePleskDomainNumberEnum domainNumber, OvhOrderablePleskLanguagePackEnum languagePackNumber, Boolean powerpack, Boolean resellerManagement, OvhPleskVersionEnum version, Boolean wordpressToolkit) throws IOException { String qPath = "/order/license/plesk/{serviceName}/upgrade"; StringBuilder sb = path(qPath, serviceName); query(sb, "antispam", antispam); query(sb, "antivirus", antivirus); query(sb, "applicationSet", applicationSet); query(sb, "domainNumber", domainNumber); query(sb, "languagePackNumber", languagePackNumber); query(sb, "powerpack", powerpack); query(sb, "resellerManagement", resellerManagement); query(sb, "version", version); query(sb, "wordpressToolkit", wordpressToolkit); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> license_plesk_serviceName_upgrade_GET(String serviceName, OvhOrderableAntispamEnum antispam, OvhOrderableAntivirusEnum antivirus, OvhPleskApplicationSetEnum applicationSet, OvhOrderablePleskDomainNumberEnum domainNumber, OvhOrderablePleskLanguagePackEnum languagePackNumber, Boolean powerpack, Boolean resellerManagement, OvhPleskVersionEnum version, Boolean wordpressToolkit) throws IOException { String qPath = "/order/license/plesk/{serviceName}/upgrade"; StringBuilder sb = path(qPath, serviceName); query(sb, "antispam", antispam); query(sb, "antivirus", antivirus); query(sb, "applicationSet", applicationSet); query(sb, "domainNumber", domainNumber); query(sb, "languagePackNumber", languagePackNumber); query(sb, "powerpack", powerpack); query(sb, "resellerManagement", resellerManagement); query(sb, "version", version); query(sb, "wordpressToolkit", wordpressToolkit); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "license_plesk_serviceName_upgrade_GET", "(", "String", "serviceName", ",", "OvhOrderableAntispamEnum", "antispam", ",", "OvhOrderableAntivirusEnum", "antivirus", ",", "OvhPleskApplicationSetEnum", "applicationSet", ",", "OvhOrderableP...
Get allowed durations for 'upgrade' option REST: GET /order/license/plesk/{serviceName}/upgrade @param antispam [required] The antispam currently enabled on this Plesk License @param resellerManagement [required] Reseller management option activation @param languagePackNumber [required] The amount (between 0 and 5) of language pack numbers to include in this licences @param antivirus [required] The antivirus to enable on this Plesk license @param wordpressToolkit [required] WordpressToolkit option activation @param applicationSet [required] Wanted application set @param domainNumber [required] This license domain number @param powerpack [required] powerpack current activation state on your license @param version [required] This license version @param serviceName [required] The name of your Plesk license
[ "Get", "allowed", "durations", "for", "upgrade", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1863-L1877
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java
WebUtils.putServiceOriginalUrlIntoRequestScope
public static void putServiceOriginalUrlIntoRequestScope(final RequestContext requestContext, final WebApplicationService service) { requestContext.getRequestScope().put("originalUrl", service.getOriginalUrl()); }
java
public static void putServiceOriginalUrlIntoRequestScope(final RequestContext requestContext, final WebApplicationService service) { requestContext.getRequestScope().put("originalUrl", service.getOriginalUrl()); }
[ "public", "static", "void", "putServiceOriginalUrlIntoRequestScope", "(", "final", "RequestContext", "requestContext", ",", "final", "WebApplicationService", "service", ")", "{", "requestContext", ".", "getRequestScope", "(", ")", ".", "put", "(", "\"originalUrl\"", ","...
Put service original url into request scope. @param requestContext the request context @param service the service
[ "Put", "service", "original", "url", "into", "request", "scope", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L773-L775
forge/core
shell/impl/src/main/java/org/jboss/forge/addon/shell/util/ShellUtil.java
ShellUtil.colorizeResource
public static String colorizeResource(FileResource<?> resource) { String name = resource.getName(); if (resource.isDirectory()) { name = new TerminalString(name, new TerminalColor(Color.BLUE, Color.DEFAULT)).toString(); } else if (resource.isExecutable()) { name = new TerminalString(name, new TerminalColor(Color.GREEN, Color.DEFAULT)).toString(); } return name; }
java
public static String colorizeResource(FileResource<?> resource) { String name = resource.getName(); if (resource.isDirectory()) { name = new TerminalString(name, new TerminalColor(Color.BLUE, Color.DEFAULT)).toString(); } else if (resource.isExecutable()) { name = new TerminalString(name, new TerminalColor(Color.GREEN, Color.DEFAULT)).toString(); } return name; }
[ "public", "static", "String", "colorizeResource", "(", "FileResource", "<", "?", ">", "resource", ")", "{", "String", "name", "=", "resource", ".", "getName", "(", ")", ";", "if", "(", "resource", ".", "isDirectory", "(", ")", ")", "{", "name", "=", "n...
Applies ANSI colors in a specific resource @param resource @return
[ "Applies", "ANSI", "colors", "in", "a", "specific", "resource" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/shell/impl/src/main/java/org/jboss/forge/addon/shell/util/ShellUtil.java#L64-L76
spacecowboy/NoNonsense-FilePicker
library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerFragment.java
AbstractFilePickerFragment.onClickCheckable
public void onClickCheckable(@NonNull View view, @NonNull CheckableViewHolder viewHolder) { if (isDir(viewHolder.file)) { goToDir(viewHolder.file); } else { onLongClickCheckable(view, viewHolder); if (singleClick) { onClickOk(view); } } }
java
public void onClickCheckable(@NonNull View view, @NonNull CheckableViewHolder viewHolder) { if (isDir(viewHolder.file)) { goToDir(viewHolder.file); } else { onLongClickCheckable(view, viewHolder); if (singleClick) { onClickOk(view); } } }
[ "public", "void", "onClickCheckable", "(", "@", "NonNull", "View", "view", ",", "@", "NonNull", "CheckableViewHolder", "viewHolder", ")", "{", "if", "(", "isDir", "(", "viewHolder", ".", "file", ")", ")", "{", "goToDir", "(", "viewHolder", ".", "file", ")"...
Called when a selectable item is clicked. This might be either a file or a directory. @param view that was clicked. Not used in default implementation. @param viewHolder for the clicked view
[ "Called", "when", "a", "selectable", "item", "is", "clicked", ".", "This", "might", "be", "either", "a", "file", "or", "a", "directory", "." ]
train
https://github.com/spacecowboy/NoNonsense-FilePicker/blob/396ef7fa5e87791170791f9d94c78f6e42a7679a/library/src/main/java/com/nononsenseapps/filepicker/AbstractFilePickerFragment.java#L765-L774
GumTreeDiff/gumtree
core/src/main/java/com/github/gumtreediff/utils/SequenceAlgorithms.java
SequenceAlgorithms.longestCommonSubsequence
public static List<int[]> longestCommonSubsequence(String s0, String s1) { int[][] lengths = new int[s0.length() + 1][s1.length() + 1]; for (int i = 0; i < s0.length(); i++) for (int j = 0; j < s1.length(); j++) if (s0.charAt(i) == (s1.charAt(j))) lengths[i + 1][j + 1] = lengths[i][j] + 1; else lengths[i + 1][j + 1] = Math.max(lengths[i + 1][j], lengths[i][j + 1]); return extractIndexes(lengths, s0.length(), s1.length()); }
java
public static List<int[]> longestCommonSubsequence(String s0, String s1) { int[][] lengths = new int[s0.length() + 1][s1.length() + 1]; for (int i = 0; i < s0.length(); i++) for (int j = 0; j < s1.length(); j++) if (s0.charAt(i) == (s1.charAt(j))) lengths[i + 1][j + 1] = lengths[i][j] + 1; else lengths[i + 1][j + 1] = Math.max(lengths[i + 1][j], lengths[i][j + 1]); return extractIndexes(lengths, s0.length(), s1.length()); }
[ "public", "static", "List", "<", "int", "[", "]", ">", "longestCommonSubsequence", "(", "String", "s0", ",", "String", "s1", ")", "{", "int", "[", "]", "[", "]", "lengths", "=", "new", "int", "[", "s0", ".", "length", "(", ")", "+", "1", "]", "["...
Returns the longest common subsequence between two strings. @return a list of size 2 int arrays that corresponds to match of index in sequence 1 to index in sequence 2.
[ "Returns", "the", "longest", "common", "subsequence", "between", "two", "strings", "." ]
train
https://github.com/GumTreeDiff/gumtree/blob/a772d4d652af44bff22c38a234ddffbfbd365a37/core/src/main/java/com/github/gumtreediff/utils/SequenceAlgorithms.java#L38-L48
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java
GuildWars2.setInstance
public static void setInstance(Cache cache) throws GuildWars2Exception { if (instance != null) throw new GuildWars2Exception(ErrorCode.Other, "Instance already initialized"); instance = new GuildWars2(cache); }
java
public static void setInstance(Cache cache) throws GuildWars2Exception { if (instance != null) throw new GuildWars2Exception(ErrorCode.Other, "Instance already initialized"); instance = new GuildWars2(cache); }
[ "public", "static", "void", "setInstance", "(", "Cache", "cache", ")", "throws", "GuildWars2Exception", "{", "if", "(", "instance", "!=", "null", ")", "throw", "new", "GuildWars2Exception", "(", "ErrorCode", ".", "Other", ",", "\"Instance already initialized\"", "...
Use this to initialize instance with custom cache @param cache {@link Cache} @throws GuildWars2Exception instance already exist
[ "Use", "this", "to", "initialize", "instance", "with", "custom", "cache" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/GuildWars2.java#L74-L78
DDTH/ddth-zookeeper
src/main/java/com/github/ddth/zookeeper/ZooKeeperClient.java
ZooKeeperClient.removeNode
public boolean removeNode(String path, boolean removeChildren) throws ZooKeeperException { try { if (removeChildren) { curatorFramework.delete().deletingChildrenIfNeeded().forPath(path); } else { curatorFramework.delete().forPath(path); } } catch (KeeperException.NotEmptyException e) { return false; } catch (KeeperException.NoNodeException e) { return true; } catch (Exception e) { if (e instanceof ZooKeeperException) { throw (ZooKeeperException) e; } else { throw new ZooKeeperException(e); } } _invalidateCache(path); return true; }
java
public boolean removeNode(String path, boolean removeChildren) throws ZooKeeperException { try { if (removeChildren) { curatorFramework.delete().deletingChildrenIfNeeded().forPath(path); } else { curatorFramework.delete().forPath(path); } } catch (KeeperException.NotEmptyException e) { return false; } catch (KeeperException.NoNodeException e) { return true; } catch (Exception e) { if (e instanceof ZooKeeperException) { throw (ZooKeeperException) e; } else { throw new ZooKeeperException(e); } } _invalidateCache(path); return true; }
[ "public", "boolean", "removeNode", "(", "String", "path", ",", "boolean", "removeChildren", ")", "throws", "ZooKeeperException", "{", "try", "{", "if", "(", "removeChildren", ")", "{", "curatorFramework", ".", "delete", "(", ")", ".", "deletingChildrenIfNeeded", ...
Removes an existing node. @param path @param removeChildren {@code true} to indicate that child nodes should be removed too @return {@code true} if node has been removed successfully, {@code false} otherwise (maybe node is not empty) @since 0.4.1 @throws ZooKeeperException
[ "Removes", "an", "existing", "node", "." ]
train
https://github.com/DDTH/ddth-zookeeper/blob/0994eea8b25fa3d885f3da4579768b7d08c1c32b/src/main/java/com/github/ddth/zookeeper/ZooKeeperClient.java#L610-L630
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GradientToEdgeFeatures.java
GradientToEdgeFeatures.nonMaxSuppression8
static public GrayF32 nonMaxSuppression8(GrayF32 intensity , GrayS8 direction , GrayF32 output ) { InputSanityCheck.checkSameShape(intensity,direction); output = InputSanityCheck.checkDeclare(intensity,output); if( BoofConcurrency.USE_CONCURRENT ) { ImplEdgeNonMaxSuppression_MT.inner8(intensity, direction, output); ImplEdgeNonMaxSuppression_MT.border8(intensity, direction, output); } else { ImplEdgeNonMaxSuppression.inner8(intensity, direction, output); ImplEdgeNonMaxSuppression.border8(intensity, direction, output); } return output; }
java
static public GrayF32 nonMaxSuppression8(GrayF32 intensity , GrayS8 direction , GrayF32 output ) { InputSanityCheck.checkSameShape(intensity,direction); output = InputSanityCheck.checkDeclare(intensity,output); if( BoofConcurrency.USE_CONCURRENT ) { ImplEdgeNonMaxSuppression_MT.inner8(intensity, direction, output); ImplEdgeNonMaxSuppression_MT.border8(intensity, direction, output); } else { ImplEdgeNonMaxSuppression.inner8(intensity, direction, output); ImplEdgeNonMaxSuppression.border8(intensity, direction, output); } return output; }
[ "static", "public", "GrayF32", "nonMaxSuppression8", "(", "GrayF32", "intensity", ",", "GrayS8", "direction", ",", "GrayF32", "output", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "intensity", ",", "direction", ")", ";", "output", "=", "InputSanityCh...
<p> Sets edge intensities to zero if the pixel has an intensity which is less than either of the two adjacent pixels. Pixel adjacency is determined by the gradients discretized direction. </p> @param intensity Edge intensities. Not modified. @param direction 8-Discretized direction. See {@link #discretizeDirection8(GrayF32, GrayS8)}. Not modified. @param output Filtered intensity. If null a new image will be declared and returned. Modified. @return Filtered edge intensity.
[ "<p", ">", "Sets", "edge", "intensities", "to", "zero", "if", "the", "pixel", "has", "an", "intensity", "which", "is", "less", "than", "either", "of", "the", "two", "adjacent", "pixels", ".", "Pixel", "adjacency", "is", "determined", "by", "the", "gradient...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GradientToEdgeFeatures.java#L494-L508
buschmais/jqa-maven3-plugin
src/main/java/com/buschmais/jqassistant/plugin/maven3/api/artifact/MavenArtifactHelper.java
MavenArtifactHelper.setCoordinates
public static void setCoordinates(MavenArtifactDescriptor artifactDescriptor, Coordinates coordinates) { artifactDescriptor.setGroup(coordinates.getGroup()); artifactDescriptor.setName(coordinates.getName()); artifactDescriptor.setVersion(coordinates.getVersion()); artifactDescriptor.setClassifier(coordinates.getClassifier()); artifactDescriptor.setType(coordinates.getType()); }
java
public static void setCoordinates(MavenArtifactDescriptor artifactDescriptor, Coordinates coordinates) { artifactDescriptor.setGroup(coordinates.getGroup()); artifactDescriptor.setName(coordinates.getName()); artifactDescriptor.setVersion(coordinates.getVersion()); artifactDescriptor.setClassifier(coordinates.getClassifier()); artifactDescriptor.setType(coordinates.getType()); }
[ "public", "static", "void", "setCoordinates", "(", "MavenArtifactDescriptor", "artifactDescriptor", ",", "Coordinates", "coordinates", ")", "{", "artifactDescriptor", ".", "setGroup", "(", "coordinates", ".", "getGroup", "(", ")", ")", ";", "artifactDescriptor", ".", ...
Apply the given coordinates to an artifact descriptor. @param artifactDescriptor The artifact descriptor. @param coordinates The coordinates.
[ "Apply", "the", "given", "coordinates", "to", "an", "artifact", "descriptor", "." ]
train
https://github.com/buschmais/jqa-maven3-plugin/blob/6c6e2dca56de6d5b8ceeb2f28982fb6d7c98778f/src/main/java/com/buschmais/jqassistant/plugin/maven3/api/artifact/MavenArtifactHelper.java#L29-L35
fcrepo3/fcrepo
fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java
JRDF.sameSubject
public static boolean sameSubject(SubjectNode s1, String s2) { if (s1 instanceof URIReference) { return sameResource((URIReference) s1, s2); } else { return false; } }
java
public static boolean sameSubject(SubjectNode s1, String s2) { if (s1 instanceof URIReference) { return sameResource((URIReference) s1, s2); } else { return false; } }
[ "public", "static", "boolean", "sameSubject", "(", "SubjectNode", "s1", ",", "String", "s2", ")", "{", "if", "(", "s1", "instanceof", "URIReference", ")", "{", "return", "sameResource", "(", "(", "URIReference", ")", "s1", ",", "s2", ")", ";", "}", "else...
Tells whether the given subjects are equivalent, with one given as a URI string. @param s1 first subject. @param s2 second subject, given as a URI string. @return true if equivalent, false otherwise.
[ "Tells", "whether", "the", "given", "subjects", "are", "equivalent", "with", "one", "given", "as", "a", "URI", "string", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java#L151-L157
wcm-io/wcm-io-sling
commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java
RequestParam.getDouble
public static double getDouble(@NotNull ServletRequest request, @NotNull String param, double defaultValue) { String value = request.getParameter(param); return NumberUtils.toDouble(value, defaultValue); }
java
public static double getDouble(@NotNull ServletRequest request, @NotNull String param, double defaultValue) { String value = request.getParameter(param); return NumberUtils.toDouble(value, defaultValue); }
[ "public", "static", "double", "getDouble", "(", "@", "NotNull", "ServletRequest", "request", ",", "@", "NotNull", "String", "param", ",", "double", "defaultValue", ")", "{", "String", "value", "=", "request", ".", "getParameter", "(", "param", ")", ";", "ret...
Returns a request parameter as double. @param request Request. @param param Parameter name. @param defaultValue Default value. @return Parameter value or default value if it does not exist or is not a number.
[ "Returns", "a", "request", "parameter", "as", "double", "." ]
train
https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/request/RequestParam.java#L222-L225
craftercms/deployer
src/main/java/org/craftercms/deployer/utils/ConfigUtils.java
ConfigUtils.getConfigurationsAt
@SuppressWarnings("unchecked") public static List<HierarchicalConfiguration> getConfigurationsAt(HierarchicalConfiguration config, String key) throws DeployerConfigurationException { try { return config.configurationsAt(key); } catch (Exception e) { throw new DeployerConfigurationException("Failed to retrieve sub-configurations at '" + key + "'", e); } }
java
@SuppressWarnings("unchecked") public static List<HierarchicalConfiguration> getConfigurationsAt(HierarchicalConfiguration config, String key) throws DeployerConfigurationException { try { return config.configurationsAt(key); } catch (Exception e) { throw new DeployerConfigurationException("Failed to retrieve sub-configurations at '" + key + "'", e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "HierarchicalConfiguration", ">", "getConfigurationsAt", "(", "HierarchicalConfiguration", "config", ",", "String", "key", ")", "throws", "DeployerConfigurationException", "{", "try", "...
Returns the sub-configuration tree whose root is the specified key. @param config the configuration @param key the key of the configuration tree @return the sub-configuration tree, or null if not found @throws DeployerConfigurationException if an error occurs
[ "Returns", "the", "sub", "-", "configuration", "tree", "whose", "root", "is", "the", "specified", "key", "." ]
train
https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/ConfigUtils.java#L270-L279
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/interestrate/products/components/ExposureEstimator.java
ExposureEstimator.getValue
@Override public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException { final RandomVariable one = model.getRandomVariableForConstant(1.0); final RandomVariable zero = model.getRandomVariableForConstant(0.0); RandomVariable values = underlying.getValue(evaluationTime, model); if(values.getFiltrationTime() > evaluationTime) { RandomVariable filterNaN = values.isNaN().sub(1.0).mult(-1.0); RandomVariable valuesFiltered = values.mult(filterNaN); /* * Cut off two standard deviations from regression */ double valuesMean = valuesFiltered.getAverage(); double valuesStdDev = valuesFiltered.getStandardDeviation(); double valuesFloor = valuesMean*(1.0-Math.signum(valuesMean)*1E-5)-3.0*valuesStdDev; double valuesCap = valuesMean*(1.0+Math.signum(valuesMean)*1E-5)+3.0*valuesStdDev; RandomVariable filter = values.sub(valuesFloor).choose(one, zero) .mult(values.sub(valuesCap).mult(-1.0).choose(one, zero)); filter = filter.mult(filterNaN); // Filter values and regressionBasisFunctions values = values.mult(filter); RandomVariable[] regressionBasisFunctions = getRegressionBasisFunctions(evaluationTime, model); RandomVariable[] filteredRegressionBasisFunctions = new RandomVariable[regressionBasisFunctions.length]; for(int i=0; i<regressionBasisFunctions.length; i++) { filteredRegressionBasisFunctions[i] = regressionBasisFunctions[i].mult(filter); } // Remove foresight through conditional expectation MonteCarloConditionalExpectationRegression condExpEstimator = new MonteCarloConditionalExpectationRegression(filteredRegressionBasisFunctions, regressionBasisFunctions); // Calculate cond. expectation. Note that no discounting (numeraire division) is required! values = condExpEstimator.getConditionalExpectation(values); } // Return values return values; }
java
@Override public RandomVariable getValue(double evaluationTime, LIBORModelMonteCarloSimulationModel model) throws CalculationException { final RandomVariable one = model.getRandomVariableForConstant(1.0); final RandomVariable zero = model.getRandomVariableForConstant(0.0); RandomVariable values = underlying.getValue(evaluationTime, model); if(values.getFiltrationTime() > evaluationTime) { RandomVariable filterNaN = values.isNaN().sub(1.0).mult(-1.0); RandomVariable valuesFiltered = values.mult(filterNaN); /* * Cut off two standard deviations from regression */ double valuesMean = valuesFiltered.getAverage(); double valuesStdDev = valuesFiltered.getStandardDeviation(); double valuesFloor = valuesMean*(1.0-Math.signum(valuesMean)*1E-5)-3.0*valuesStdDev; double valuesCap = valuesMean*(1.0+Math.signum(valuesMean)*1E-5)+3.0*valuesStdDev; RandomVariable filter = values.sub(valuesFloor).choose(one, zero) .mult(values.sub(valuesCap).mult(-1.0).choose(one, zero)); filter = filter.mult(filterNaN); // Filter values and regressionBasisFunctions values = values.mult(filter); RandomVariable[] regressionBasisFunctions = getRegressionBasisFunctions(evaluationTime, model); RandomVariable[] filteredRegressionBasisFunctions = new RandomVariable[regressionBasisFunctions.length]; for(int i=0; i<regressionBasisFunctions.length; i++) { filteredRegressionBasisFunctions[i] = regressionBasisFunctions[i].mult(filter); } // Remove foresight through conditional expectation MonteCarloConditionalExpectationRegression condExpEstimator = new MonteCarloConditionalExpectationRegression(filteredRegressionBasisFunctions, regressionBasisFunctions); // Calculate cond. expectation. Note that no discounting (numeraire division) is required! values = condExpEstimator.getConditionalExpectation(values); } // Return values return values; }
[ "@", "Override", "public", "RandomVariable", "getValue", "(", "double", "evaluationTime", ",", "LIBORModelMonteCarloSimulationModel", "model", ")", "throws", "CalculationException", "{", "final", "RandomVariable", "one", "=", "model", ".", "getRandomVariableForConstant", ...
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered. @param evaluationTime The time on which this products value should be observed. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
[ "This", "method", "returns", "the", "value", "random", "variable", "of", "the", "product", "within", "the", "specified", "model", "evaluated", "at", "a", "given", "evalutationTime", ".", "Note", ":", "For", "a", "lattice", "this", "is", "often", "the", "valu...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/products/components/ExposureEstimator.java#L77-L117
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CfCodeGen.java
CfCodeGen.writeConnection
private void writeConnection(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/** \n"); writeWithIndent(out, indent, " * Get connection from factory\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " instance\n"); writeWithIndent(out, indent, " * @exception ResourceException Thrown if a connection can't be obtained\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " getConnection() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "getConnection"); writeWithIndent(out, indent + 1, "return (" + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + ")connectionManager.allocateConnection(mcf, null);"); writeRightCurlyBracket(out, indent); writeEol(out); }
java
private void writeConnection(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/** \n"); writeWithIndent(out, indent, " * Get connection from factory\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " instance\n"); writeWithIndent(out, indent, " * @exception ResourceException Thrown if a connection can't be obtained\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "@Override\n"); writeWithIndent(out, indent, "public " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " getConnection() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeLogging(def, out, indent + 1, "trace", "getConnection"); writeWithIndent(out, indent + 1, "return (" + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + ")connectionManager.allocateConnection(mcf, null);"); writeRightCurlyBracket(out, indent); writeEol(out); }
[ "private", "void", "writeConnection", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/** \\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "in...
Output Connection method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "Connection", "method" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CfCodeGen.java#L131-L151
networknt/json-schema-validator
src/main/java/com/networknt/schema/url/URLFactory.java
URLFactory.toURL
public static URL toURL(final String pURL) throws MalformedURLException { return new URL(null, pURL, sClasspathURLStreamHandler.supports(pURL) ? sClasspathURLStreamHandler : null); }
java
public static URL toURL(final String pURL) throws MalformedURLException { return new URL(null, pURL, sClasspathURLStreamHandler.supports(pURL) ? sClasspathURLStreamHandler : null); }
[ "public", "static", "URL", "toURL", "(", "final", "String", "pURL", ")", "throws", "MalformedURLException", "{", "return", "new", "URL", "(", "null", ",", "pURL", ",", "sClasspathURLStreamHandler", ".", "supports", "(", "pURL", ")", "?", "sClasspathURLStreamHand...
Creates an {@link URL} based on the provided string @param pURL the url @return a {@link URL} @throws MalformedURLException if the url is not a proper URL
[ "Creates", "an", "{" ]
train
https://github.com/networknt/json-schema-validator/blob/d2a3a8d2085e72eb5c25c2fd8c8c9e641a62376d/src/main/java/com/networknt/schema/url/URLFactory.java#L41-L43
dvasilen/Hive-XML-SerDe
src/main/java/com/ibm/spss/hive/serde2/xml/processor/XmlNode.java
XmlNode.addAttribute
public void addAttribute(final String _name, final String _value) { this.attributes.put(_name, new XmlNode() { { this.name = _name; this.value = _value; this.valid = true; this.type = XmlNode.ATTRIBUTE_NODE; } }); }
java
public void addAttribute(final String _name, final String _value) { this.attributes.put(_name, new XmlNode() { { this.name = _name; this.value = _value; this.valid = true; this.type = XmlNode.ATTRIBUTE_NODE; } }); }
[ "public", "void", "addAttribute", "(", "final", "String", "_name", ",", "final", "String", "_value", ")", "{", "this", ".", "attributes", ".", "put", "(", "_name", ",", "new", "XmlNode", "(", ")", "{", "{", "this", ".", "name", "=", "_name", ";", "th...
Adds the attribute @param _name the attribute name @param _value the attribute name
[ "Adds", "the", "attribute" ]
train
https://github.com/dvasilen/Hive-XML-SerDe/blob/2a7a184b2cfaeb63008529a9851cd72edb8025d9/src/main/java/com/ibm/spss/hive/serde2/xml/processor/XmlNode.java#L155-L164
zaproxy/zaproxy
src/org/zaproxy/zap/extension/script/ExtensionScript.java
ExtensionScript.invokeTargetedScript
public void invokeTargetedScript(ScriptWrapper script, HttpMessage msg) { validateScriptType(script, TYPE_TARGETED); Writer writer = getWriters(script); try { // Dont need to check if enabled as it can only be invoked manually TargetedScript s = this.getInterface(script, TargetedScript.class); if (s != null) { s.invokeWith(msg); } else { handleUnspecifiedScriptError(script, writer, Constant.messages.getString("script.interface.targeted.error")); } } catch (Exception e) { handleScriptException(script, writer, e); } }
java
public void invokeTargetedScript(ScriptWrapper script, HttpMessage msg) { validateScriptType(script, TYPE_TARGETED); Writer writer = getWriters(script); try { // Dont need to check if enabled as it can only be invoked manually TargetedScript s = this.getInterface(script, TargetedScript.class); if (s != null) { s.invokeWith(msg); } else { handleUnspecifiedScriptError(script, writer, Constant.messages.getString("script.interface.targeted.error")); } } catch (Exception e) { handleScriptException(script, writer, e); } }
[ "public", "void", "invokeTargetedScript", "(", "ScriptWrapper", "script", ",", "HttpMessage", "msg", ")", "{", "validateScriptType", "(", "script", ",", "TYPE_TARGETED", ")", ";", "Writer", "writer", "=", "getWriters", "(", "script", ")", ";", "try", "{", "// ...
Invokes the given {@code script}, synchronously, as a {@link TargetedScript}, handling any {@code Exception} thrown during the invocation. <p> The context class loader of caller thread is replaced with the class loader {@code AddOnLoader} to allow the script to access classes of add-ons. @param script the script to invoke. @param msg the HTTP message to process. @since 2.2.0 @see #getInterface(ScriptWrapper, Class)
[ "Invokes", "the", "given", "{", "@code", "script", "}", "synchronously", "as", "a", "{", "@link", "TargetedScript", "}", "handling", "any", "{", "@code", "Exception", "}", "thrown", "during", "the", "invocation", ".", "<p", ">", "The", "context", "class", ...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ExtensionScript.java#L1390-L1408
sirensolutions/siren-join
src/main/java/solutions/siren/join/action/terms/collector/NumericTermStream.java
NumericTermStream.get
public static NumericTermStream get(IndexReader reader, IndexFieldData indexFieldData) { if (indexFieldData instanceof IndexNumericFieldData) { IndexNumericFieldData numFieldData = (IndexNumericFieldData) indexFieldData; if (!numFieldData.getNumericType().isFloatingPoint()) { return new LongTermStream(reader, numFieldData); } else { throw new UnsupportedOperationException("Streaming floating points is unsupported"); } } else { return new HashTermStream(reader, indexFieldData); } }
java
public static NumericTermStream get(IndexReader reader, IndexFieldData indexFieldData) { if (indexFieldData instanceof IndexNumericFieldData) { IndexNumericFieldData numFieldData = (IndexNumericFieldData) indexFieldData; if (!numFieldData.getNumericType().isFloatingPoint()) { return new LongTermStream(reader, numFieldData); } else { throw new UnsupportedOperationException("Streaming floating points is unsupported"); } } else { return new HashTermStream(reader, indexFieldData); } }
[ "public", "static", "NumericTermStream", "get", "(", "IndexReader", "reader", ",", "IndexFieldData", "indexFieldData", ")", "{", "if", "(", "indexFieldData", "instanceof", "IndexNumericFieldData", ")", "{", "IndexNumericFieldData", "numFieldData", "=", "(", "IndexNumeri...
Instantiates a new reusable {@link NumericTermStream} based on the field type.
[ "Instantiates", "a", "new", "reusable", "{" ]
train
https://github.com/sirensolutions/siren-join/blob/cba1111b209ce6f72ab7750d5488a573a6c77fe5/src/main/java/solutions/siren/join/action/terms/collector/NumericTermStream.java#L38-L51
alkacon/opencms-core
src/org/opencms/ui/dataview/CmsDataViewPanel.java
CmsDataViewPanel.refreshData
public void refreshData(boolean resetPaging, String textQuery) { String fullTextQuery = textQuery != null ? textQuery : m_fullTextSearch.getValue(); LinkedHashMap<String, String> filterValues = new LinkedHashMap<String, String>(); for (Map.Entry<String, CmsDataViewFilter> entry : m_filterMap.entrySet()) { filterValues.put(entry.getKey(), entry.getValue().getValue()); } CmsDataViewQuery query = new CmsDataViewQuery(); String sortCol = (String)m_sortCol; boolean ascending = m_ascending; query.setFullTextQuery(fullTextQuery); query.setFilterValues(filterValues); query.setSortColumn(sortCol); query.setSortAscending(ascending); CmsDataViewResult result = m_dataView.getResults( query, resetPaging ? 0 : getOffset(), m_dataView.getPageSize()); m_container.removeAllItems(); for (I_CmsDataViewItem item : result.getItems()) { fillItem(item, m_container.addItem(item.getId())); } //m_tablePanel.setScrollTop(0); if (resetPaging) { int total = result.getHitCount(); m_pagingControls.reset(result.getHitCount(), m_dataView.getPageSize(), false); } }
java
public void refreshData(boolean resetPaging, String textQuery) { String fullTextQuery = textQuery != null ? textQuery : m_fullTextSearch.getValue(); LinkedHashMap<String, String> filterValues = new LinkedHashMap<String, String>(); for (Map.Entry<String, CmsDataViewFilter> entry : m_filterMap.entrySet()) { filterValues.put(entry.getKey(), entry.getValue().getValue()); } CmsDataViewQuery query = new CmsDataViewQuery(); String sortCol = (String)m_sortCol; boolean ascending = m_ascending; query.setFullTextQuery(fullTextQuery); query.setFilterValues(filterValues); query.setSortColumn(sortCol); query.setSortAscending(ascending); CmsDataViewResult result = m_dataView.getResults( query, resetPaging ? 0 : getOffset(), m_dataView.getPageSize()); m_container.removeAllItems(); for (I_CmsDataViewItem item : result.getItems()) { fillItem(item, m_container.addItem(item.getId())); } //m_tablePanel.setScrollTop(0); if (resetPaging) { int total = result.getHitCount(); m_pagingControls.reset(result.getHitCount(), m_dataView.getPageSize(), false); } }
[ "public", "void", "refreshData", "(", "boolean", "resetPaging", ",", "String", "textQuery", ")", "{", "String", "fullTextQuery", "=", "textQuery", "!=", "null", "?", "textQuery", ":", "m_fullTextSearch", ".", "getValue", "(", ")", ";", "LinkedHashMap", "<", "S...
Updates the data displayed in the table.<p> @param resetPaging true if we should go back to page 1 @param textQuery the text query to use
[ "Updates", "the", "data", "displayed", "in", "the", "table", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dataview/CmsDataViewPanel.java#L396-L425
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/DefaultAttributeMarshaller.java
DefaultAttributeMarshaller.marshallAsElement
@Deprecated public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, XMLStreamWriter writer) throws XMLStreamException { marshallAsElement(attribute, resourceModel, true, writer); }
java
@Deprecated public void marshallAsElement(AttributeDefinition attribute, ModelNode resourceModel, XMLStreamWriter writer) throws XMLStreamException { marshallAsElement(attribute, resourceModel, true, writer); }
[ "@", "Deprecated", "public", "void", "marshallAsElement", "(", "AttributeDefinition", "attribute", ",", "ModelNode", "resourceModel", ",", "XMLStreamWriter", "writer", ")", "throws", "XMLStreamException", "{", "marshallAsElement", "(", "attribute", ",", "resourceModel", ...
Use {@link #marshallAsElement(AttributeDefinition, ModelNode, boolean, XMLStreamWriter)} instead.
[ "Use", "{" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/DefaultAttributeMarshaller.java#L45-L48
casmi/casmi
src/main/java/casmi/image/Image.java
Image.getColor
public final Color getColor(int x, int y) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int idx = x + y * width; return new RGBColor((pixels[idx] >> 16 & 0x000000ff) / 255.0, (pixels[idx] >> 8 & 0x000000ff) / 255.0, (pixels[idx] & 0x000000ff) / 255.0, (pixels[idx] >> 24) / 255.0); }
java
public final Color getColor(int x, int y) { int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData(); int idx = x + y * width; return new RGBColor((pixels[idx] >> 16 & 0x000000ff) / 255.0, (pixels[idx] >> 8 & 0x000000ff) / 255.0, (pixels[idx] & 0x000000ff) / 255.0, (pixels[idx] >> 24) / 255.0); }
[ "public", "final", "Color", "getColor", "(", "int", "x", ",", "int", "y", ")", "{", "int", "[", "]", "pixels", "=", "(", "(", "DataBufferInt", ")", "img", ".", "getRaster", "(", ")", ".", "getDataBuffer", "(", ")", ")", ".", "getData", "(", ")", ...
Returns the pixel color of this Image. @param x The x-coordinate of the pixel. @param y The y-coordinate of the pixel. @return The color of the pixel.
[ "Returns", "the", "pixel", "color", "of", "this", "Image", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/image/Image.java#L251-L259
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java
CmsXmlContentPropertyHelper.saveProperties
public static void saveProperties( CmsObject cms, Element parentElement, Map<String, String> properties, Map<String, CmsXmlContentProperty> propertiesConf) { // remove old entries for (Object propElement : parentElement.elements(CmsXmlContentProperty.XmlNode.Properties.name())) { parentElement.remove((Element)propElement); } // use a sorted map to force a defined order SortedMap<String, String> props = new TreeMap<String, String>(properties); // create new entries for (Map.Entry<String, String> property : props.entrySet()) { String propName = property.getKey(); String propValue = property.getValue(); if ((propValue == null) || (propValue.length() == 0)) { continue; } // only if the property is configured in the schema we will save it Element propElement = parentElement.addElement(CmsXmlContentProperty.XmlNode.Properties.name()); // the property name propElement.addElement(CmsXmlContentProperty.XmlNode.Name.name()).addCDATA(propName); Element valueElement = propElement.addElement(CmsXmlContentProperty.XmlNode.Value.name()); boolean isVfs = false; CmsXmlContentProperty propDef = propertiesConf.get(propName); if (propDef != null) { isVfs = CmsXmlContentProperty.PropType.isVfsList(propDef.getType()); } if (!isVfs) { // string value valueElement.addElement(CmsXmlContentProperty.XmlNode.String.name()).addCDATA(propValue); } else { addFileListPropertyValue(cms, valueElement, propValue); } } }
java
public static void saveProperties( CmsObject cms, Element parentElement, Map<String, String> properties, Map<String, CmsXmlContentProperty> propertiesConf) { // remove old entries for (Object propElement : parentElement.elements(CmsXmlContentProperty.XmlNode.Properties.name())) { parentElement.remove((Element)propElement); } // use a sorted map to force a defined order SortedMap<String, String> props = new TreeMap<String, String>(properties); // create new entries for (Map.Entry<String, String> property : props.entrySet()) { String propName = property.getKey(); String propValue = property.getValue(); if ((propValue == null) || (propValue.length() == 0)) { continue; } // only if the property is configured in the schema we will save it Element propElement = parentElement.addElement(CmsXmlContentProperty.XmlNode.Properties.name()); // the property name propElement.addElement(CmsXmlContentProperty.XmlNode.Name.name()).addCDATA(propName); Element valueElement = propElement.addElement(CmsXmlContentProperty.XmlNode.Value.name()); boolean isVfs = false; CmsXmlContentProperty propDef = propertiesConf.get(propName); if (propDef != null) { isVfs = CmsXmlContentProperty.PropType.isVfsList(propDef.getType()); } if (!isVfs) { // string value valueElement.addElement(CmsXmlContentProperty.XmlNode.String.name()).addCDATA(propValue); } else { addFileListPropertyValue(cms, valueElement, propValue); } } }
[ "public", "static", "void", "saveProperties", "(", "CmsObject", "cms", ",", "Element", "parentElement", ",", "Map", "<", "String", ",", "String", ">", "properties", ",", "Map", "<", "String", ",", "CmsXmlContentProperty", ">", "propertiesConf", ")", "{", "// r...
Saves the given properties to the given xml element.<p> @param cms the current CMS context @param parentElement the parent xml element @param properties the properties to save, if there is a list of resources, every entry can be a site path or a UUID @param propertiesConf the configuration of the properties
[ "Saves", "the", "given", "properties", "to", "the", "given", "xml", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java#L724-L763
forge/core
facets/api/src/main/java/org/jboss/forge/addon/facets/constraints/FacetInspector.java
FacetInspector.getOptionalFacets
public static <FACETTYPE extends Facet<?>> Set<Class<FACETTYPE>> getOptionalFacets(final Class<?> inspectedType) { return getRelatedFacets(inspectedType, FacetConstraintType.OPTIONAL); }
java
public static <FACETTYPE extends Facet<?>> Set<Class<FACETTYPE>> getOptionalFacets(final Class<?> inspectedType) { return getRelatedFacets(inspectedType, FacetConstraintType.OPTIONAL); }
[ "public", "static", "<", "FACETTYPE", "extends", "Facet", "<", "?", ">", ">", "Set", "<", "Class", "<", "FACETTYPE", ">", ">", "getOptionalFacets", "(", "final", "Class", "<", "?", ">", "inspectedType", ")", "{", "return", "getRelatedFacets", "(", "inspect...
Inspect the given {@link Class} for any {@link FacetConstraintType#OPTIONAL} dependency {@link Facet} types.
[ "Inspect", "the", "given", "{" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/facets/api/src/main/java/org/jboss/forge/addon/facets/constraints/FacetInspector.java#L63-L66
visallo/vertexium
security/src/main/java/org/vertexium/security/ByteSequence.java
ByteSequence.compareBytes
public static int compareBytes(ByteSequence bs1, ByteSequence bs2) { int minLen = Math.min(bs1.length(), bs2.length()); for (int i = 0; i < minLen; i++) { int a = (bs1.byteAt(i) & 0xff); int b = (bs2.byteAt(i) & 0xff); if (a != b) { return a - b; } } return bs1.length() - bs2.length(); }
java
public static int compareBytes(ByteSequence bs1, ByteSequence bs2) { int minLen = Math.min(bs1.length(), bs2.length()); for (int i = 0; i < minLen; i++) { int a = (bs1.byteAt(i) & 0xff); int b = (bs2.byteAt(i) & 0xff); if (a != b) { return a - b; } } return bs1.length() - bs2.length(); }
[ "public", "static", "int", "compareBytes", "(", "ByteSequence", "bs1", ",", "ByteSequence", "bs2", ")", "{", "int", "minLen", "=", "Math", ".", "min", "(", "bs1", ".", "length", "(", ")", ",", "bs2", ".", "length", "(", ")", ")", ";", "for", "(", "...
Compares the two given byte sequences, byte by byte, returning a negative, zero, or positive result if the first sequence is less than, equal to, or greater than the second. The comparison is performed starting with the first byte of each sequence, and proceeds until a pair of bytes differs, or one sequence runs out of byte (is shorter). A shorter sequence is considered less than a longer one. @param bs1 first byte sequence to compare @param bs2 second byte sequence to compare @return comparison result
[ "Compares", "the", "two", "given", "byte", "sequences", "byte", "by", "byte", "returning", "a", "negative", "zero", "or", "positive", "result", "if", "the", "first", "sequence", "is", "less", "than", "equal", "to", "or", "greater", "than", "the", "second", ...
train
https://github.com/visallo/vertexium/blob/bb132b5425ac168957667164e1409b78adbea769/security/src/main/java/org/vertexium/security/ByteSequence.java#L90-L104
pushbit/sprockets
src/main/java/net/sf/sprockets/sql/Statements.java
Statements.setLongs
public static PreparedStatement setLongs(int index, PreparedStatement stmt, long... params) throws SQLException { return set(index, stmt, null, params, null); }
java
public static PreparedStatement setLongs(int index, PreparedStatement stmt, long... params) throws SQLException { return set(index, stmt, null, params, null); }
[ "public", "static", "PreparedStatement", "setLongs", "(", "int", "index", ",", "PreparedStatement", "stmt", ",", "long", "...", "params", ")", "throws", "SQLException", "{", "return", "set", "(", "index", ",", "stmt", ",", "null", ",", "params", ",", "null",...
Set the statement parameters, starting at the index, in the order of the params. @since 3.0.0
[ "Set", "the", "statement", "parameters", "starting", "at", "the", "index", "in", "the", "order", "of", "the", "params", "." ]
train
https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L80-L83
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java
Strs.before
public static Betner before(String target, String separator) { return betn(target).before(separator); }
java
public static Betner before(String target, String separator) { return betn(target).before(separator); }
[ "public", "static", "Betner", "before", "(", "String", "target", ",", "String", "separator", ")", "{", "return", "betn", "(", "target", ")", ".", "before", "(", "separator", ")", ";", "}" ]
Returns a {@code String} between matcher that matches any character in the beginning and given right @param target @param separator @return
[ "Returns", "a", "{", "@code", "String", "}", "between", "matcher", "that", "matches", "any", "character", "in", "the", "beginning", "and", "given", "right" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L477-L479
VoltDB/voltdb
src/frontend/org/voltdb/expressions/ComparisonExpression.java
ComparisonExpression.rangeFilterFromPrefixLike
static private ComparisonExpression rangeFilterFromPrefixLike(AbstractExpression leftExpr, ExpressionType rangeComparator, String comparand) { ConstantValueExpression cve = new ConstantValueExpression(); cve.setValueType(VoltType.STRING); cve.setValue(comparand); cve.setValueSize(comparand.length()); ComparisonExpression rangeFilter = new ComparisonExpression(rangeComparator, leftExpr, cve); return rangeFilter; }
java
static private ComparisonExpression rangeFilterFromPrefixLike(AbstractExpression leftExpr, ExpressionType rangeComparator, String comparand) { ConstantValueExpression cve = new ConstantValueExpression(); cve.setValueType(VoltType.STRING); cve.setValue(comparand); cve.setValueSize(comparand.length()); ComparisonExpression rangeFilter = new ComparisonExpression(rangeComparator, leftExpr, cve); return rangeFilter; }
[ "static", "private", "ComparisonExpression", "rangeFilterFromPrefixLike", "(", "AbstractExpression", "leftExpr", ",", "ExpressionType", "rangeComparator", ",", "String", "comparand", ")", "{", "ConstantValueExpression", "cve", "=", "new", "ConstantValueExpression", "(", ")"...
Construct the upper or lower bound expression that is implied by a prefix LIKE operator, given its required elements. @param leftExpr - the LIKE operator's (and the result's) lhs expression @param rangeComparator - a GTE or LT operator to indicate lower or upper bound, respectively, @param comparand - a string operand value derived from the LIKE operator's rhs pattern A helper for getGteFilterFromPrefixLike/getLtFilterFromPrefixLike
[ "Construct", "the", "upper", "or", "lower", "bound", "expression", "that", "is", "implied", "by", "a", "prefix", "LIKE", "operator", "given", "its", "required", "elements", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/ComparisonExpression.java#L144-L151
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java
StringUtils.bytesToHex
public static String bytesToHex(byte[] bytes, int size) { size=Math.min(bytes.length, size); char[] hexChars = new char[size * 2]; for ( int j = 0; j < size; j++ ) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars); }
java
public static String bytesToHex(byte[] bytes, int size) { size=Math.min(bytes.length, size); char[] hexChars = new char[size * 2]; for ( int j = 0; j < size; j++ ) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars); }
[ "public", "static", "String", "bytesToHex", "(", "byte", "[", "]", "bytes", ",", "int", "size", ")", "{", "size", "=", "Math", ".", "min", "(", "bytes", ".", "length", ",", "size", ")", ";", "char", "[", "]", "hexChars", "=", "new", "char", "[", ...
Bytes to hex. @param bytes the bytes @param size the size @return the string
[ "Bytes", "to", "hex", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java#L102-L111
aws/aws-sdk-java
aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchv2/model/ListDomainNamesResult.java
ListDomainNamesResult.withDomainNames
public ListDomainNamesResult withDomainNames(java.util.Map<String, String> domainNames) { setDomainNames(domainNames); return this; }
java
public ListDomainNamesResult withDomainNames(java.util.Map<String, String> domainNames) { setDomainNames(domainNames); return this; }
[ "public", "ListDomainNamesResult", "withDomainNames", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "domainNames", ")", "{", "setDomainNames", "(", "domainNames", ")", ";", "return", "this", ";", "}" ]
<p> The names of the search domains owned by an account. </p> @param domainNames The names of the search domains owned by an account. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "names", "of", "the", "search", "domains", "owned", "by", "an", "account", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchv2/model/ListDomainNamesResult.java#L71-L74
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java
Dialogs.showOKDialog
public static VisDialog showOKDialog (Stage stage, String title, String text) { final VisDialog dialog = new VisDialog(title); dialog.closeOnEscape(); dialog.text(text); dialog.button(ButtonType.OK.getText()).padBottom(3); dialog.pack(); dialog.centerWindow(); dialog.addListener(new InputListener() { @Override public boolean keyDown (InputEvent event, int keycode) { if (keycode == Keys.ENTER) { dialog.fadeOut(); return true; } return false; } }); stage.addActor(dialog.fadeIn()); return dialog; }
java
public static VisDialog showOKDialog (Stage stage, String title, String text) { final VisDialog dialog = new VisDialog(title); dialog.closeOnEscape(); dialog.text(text); dialog.button(ButtonType.OK.getText()).padBottom(3); dialog.pack(); dialog.centerWindow(); dialog.addListener(new InputListener() { @Override public boolean keyDown (InputEvent event, int keycode) { if (keycode == Keys.ENTER) { dialog.fadeOut(); return true; } return false; } }); stage.addActor(dialog.fadeIn()); return dialog; }
[ "public", "static", "VisDialog", "showOKDialog", "(", "Stage", "stage", ",", "String", "title", ",", "String", "text", ")", "{", "final", "VisDialog", "dialog", "=", "new", "VisDialog", "(", "title", ")", ";", "dialog", ".", "closeOnEscape", "(", ")", ";",...
Dialog with given text and single OK button. @param title dialog title
[ "Dialog", "with", "given", "text", "and", "single", "OK", "button", "." ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java#L53-L72
netty/netty
buffer/src/main/java/io/netty/buffer/Unpooled.java
Unpooled.wrappedBuffer
public static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuf... buffers) { switch (buffers.length) { case 0: break; case 1: ByteBuf buffer = buffers[0]; if (buffer.isReadable()) { return wrappedBuffer(buffer.order(BIG_ENDIAN)); } else { buffer.release(); } break; default: for (int i = 0; i < buffers.length; i++) { ByteBuf buf = buffers[i]; if (buf.isReadable()) { return new CompositeByteBuf(ALLOC, false, maxNumComponents, buffers, i); } buf.release(); } break; } return EMPTY_BUFFER; }
java
public static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuf... buffers) { switch (buffers.length) { case 0: break; case 1: ByteBuf buffer = buffers[0]; if (buffer.isReadable()) { return wrappedBuffer(buffer.order(BIG_ENDIAN)); } else { buffer.release(); } break; default: for (int i = 0; i < buffers.length; i++) { ByteBuf buf = buffers[i]; if (buf.isReadable()) { return new CompositeByteBuf(ALLOC, false, maxNumComponents, buffers, i); } buf.release(); } break; } return EMPTY_BUFFER; }
[ "public", "static", "ByteBuf", "wrappedBuffer", "(", "int", "maxNumComponents", ",", "ByteBuf", "...", "buffers", ")", "{", "switch", "(", "buffers", ".", "length", ")", "{", "case", "0", ":", "break", ";", "case", "1", ":", "ByteBuf", "buffer", "=", "bu...
Creates a new big-endian composite buffer which wraps the readable bytes of the specified buffers without copying them. A modification on the content of the specified buffers will be visible to the returned buffer. @param maxNumComponents Advisement as to how many independent buffers are allowed to exist before consolidation occurs. @param buffers The buffers to wrap. Reference count ownership of all variables is transferred to this method. @return The readable portion of the {@code buffers}. The caller is responsible for releasing this buffer.
[ "Creates", "a", "new", "big", "-", "endian", "composite", "buffer", "which", "wraps", "the", "readable", "bytes", "of", "the", "specified", "buffers", "without", "copying", "them", ".", "A", "modification", "on", "the", "content", "of", "the", "specified", "...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L306-L329
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java
ContentNegotiationFilter.adjustQualityFromImage
private static void adjustQualityFromImage(Map<String, Float> pFormatQuality, BufferedImage pImage) { // NOTE: The values are all made-up. May need tuning. // If pImage.getColorModel() instanceof IndexColorModel // JPEG qs*=0.6 // If NOT binary or 2 color index // WBMP qs*=0.5 // Else // GIF qs*=0.02 // PNG qs*=0.9 // JPEG is smaller/faster if (pImage.getColorModel() instanceof IndexColorModel) { adjustQuality(pFormatQuality, FORMAT_JPEG, 0.6f); if (pImage.getType() != BufferedImage.TYPE_BYTE_BINARY || ((IndexColorModel) pImage.getColorModel()).getMapSize() != 2) { adjustQuality(pFormatQuality, FORMAT_WBMP, 0.5f); } } else { adjustQuality(pFormatQuality, FORMAT_GIF, 0.01f); adjustQuality(pFormatQuality, FORMAT_PNG, 0.99f); // JPEG is smaller/faster } // If pImage.getColorModel().hasTransparentPixels() // JPEG qs*=0.05 // WBMP qs*=0.05 // If NOT transparency == BITMASK // GIF qs*=0.8 if (ImageUtil.hasTransparentPixels(pImage, true)) { adjustQuality(pFormatQuality, FORMAT_JPEG, 0.009f); adjustQuality(pFormatQuality, FORMAT_WBMP, 0.009f); if (pImage.getColorModel().getTransparency() != Transparency.BITMASK) { adjustQuality(pFormatQuality, FORMAT_GIF, 0.8f); } } }
java
private static void adjustQualityFromImage(Map<String, Float> pFormatQuality, BufferedImage pImage) { // NOTE: The values are all made-up. May need tuning. // If pImage.getColorModel() instanceof IndexColorModel // JPEG qs*=0.6 // If NOT binary or 2 color index // WBMP qs*=0.5 // Else // GIF qs*=0.02 // PNG qs*=0.9 // JPEG is smaller/faster if (pImage.getColorModel() instanceof IndexColorModel) { adjustQuality(pFormatQuality, FORMAT_JPEG, 0.6f); if (pImage.getType() != BufferedImage.TYPE_BYTE_BINARY || ((IndexColorModel) pImage.getColorModel()).getMapSize() != 2) { adjustQuality(pFormatQuality, FORMAT_WBMP, 0.5f); } } else { adjustQuality(pFormatQuality, FORMAT_GIF, 0.01f); adjustQuality(pFormatQuality, FORMAT_PNG, 0.99f); // JPEG is smaller/faster } // If pImage.getColorModel().hasTransparentPixels() // JPEG qs*=0.05 // WBMP qs*=0.05 // If NOT transparency == BITMASK // GIF qs*=0.8 if (ImageUtil.hasTransparentPixels(pImage, true)) { adjustQuality(pFormatQuality, FORMAT_JPEG, 0.009f); adjustQuality(pFormatQuality, FORMAT_WBMP, 0.009f); if (pImage.getColorModel().getTransparency() != Transparency.BITMASK) { adjustQuality(pFormatQuality, FORMAT_GIF, 0.8f); } } }
[ "private", "static", "void", "adjustQualityFromImage", "(", "Map", "<", "String", ",", "Float", ">", "pFormatQuality", ",", "BufferedImage", "pImage", ")", "{", "// NOTE: The values are all made-up. May need tuning.\r", "// If pImage.getColorModel() instanceof IndexColorModel\r",...
Adjusts source quality settings from image properties. @param pFormatQuality the format to quality mapping @param pImage the image
[ "Adjusts", "source", "quality", "settings", "from", "image", "properties", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java#L375-L410
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java
JDBC4DatabaseMetaData.getAttributes
@Override public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "ResultSet", "getAttributes", "(", "String", "catalog", ",", "String", "schemaPattern", ",", "String", "typeNamePattern", ",", "String", "attributeNamePattern", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "...
Retrieves a description of the given attribute of the given type for a user-defined type (UDT) that is available in the given schema and catalog.
[ "Retrieves", "a", "description", "of", "the", "given", "attribute", "of", "the", "given", "type", "for", "a", "user", "-", "defined", "type", "(", "UDT", ")", "that", "is", "available", "in", "the", "given", "schema", "and", "catalog", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L139-L144
zandero/http
src/main/java/com/zandero/http/HttpUtils.java
HttpUtils.executeAsync
public static void executeAsync(Executor executor, HttpRequestBase request, FutureCallback<HttpResponse> callback) { try { executor.execute(new AsyncHttpCall(request, callback)); } catch (Exception e) { log.error("Failed to execute asynchronously: " + request.getMethod() + " " + request.getURI().toString()); } }
java
public static void executeAsync(Executor executor, HttpRequestBase request, FutureCallback<HttpResponse> callback) { try { executor.execute(new AsyncHttpCall(request, callback)); } catch (Exception e) { log.error("Failed to execute asynchronously: " + request.getMethod() + " " + request.getURI().toString()); } }
[ "public", "static", "void", "executeAsync", "(", "Executor", "executor", ",", "HttpRequestBase", "request", ",", "FutureCallback", "<", "HttpResponse", ">", "callback", ")", "{", "try", "{", "executor", ".", "execute", "(", "new", "AsyncHttpCall", "(", "request"...
Step 2. execute request asynchronously @param executor thread executor to be used @param request to be executed @param callback to be invoked when request is completed or failes
[ "Step", "2", ".", "execute", "request", "asynchronously" ]
train
https://github.com/zandero/http/blob/909eb879f1193adf24545360c3b76bd813865f65/src/main/java/com/zandero/http/HttpUtils.java#L304-L312
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.runAfter
public static TimerTask runAfter(Timer timer, int delay, final Closure closure) { TimerTask timerTask = new TimerTask() { public void run() { closure.call(); } }; timer.schedule(timerTask, delay); return timerTask; }
java
public static TimerTask runAfter(Timer timer, int delay, final Closure closure) { TimerTask timerTask = new TimerTask() { public void run() { closure.call(); } }; timer.schedule(timerTask, delay); return timerTask; }
[ "public", "static", "TimerTask", "runAfter", "(", "Timer", "timer", ",", "int", "delay", ",", "final", "Closure", "closure", ")", "{", "TimerTask", "timerTask", "=", "new", "TimerTask", "(", ")", "{", "public", "void", "run", "(", ")", "{", "closure", "....
Allows a simple syntax for using timers. This timer will execute the given closure after the given delay. @param timer a timer object @param delay the delay in milliseconds before running the closure code @param closure the closure to invoke @return The timer task which has been scheduled. @since 1.5.0
[ "Allows", "a", "simple", "syntax", "for", "using", "timers", ".", "This", "timer", "will", "execute", "the", "given", "closure", "after", "the", "given", "delay", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L16651-L16659
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsConfigurationReader.java
CmsConfigurationReader.parseDetailPage
protected void parseDetailPage(I_CmsXmlContentLocation node) throws CmsException { I_CmsXmlContentValueLocation pageLoc = node.getSubValue(N_PAGE); String typeName = getString(node.getSubValue(N_TYPE)); try { String page = pageLoc.asString(m_cms); CmsResource detailPageRes = m_cms.readResource(page); CmsUUID id = detailPageRes.getStructureId(); String iconClasses; if (typeName.startsWith(CmsDetailPageInfo.FUNCTION_PREFIX)) { iconClasses = CmsIconUtil.getIconClasses(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION, null, false); } else { iconClasses = CmsIconUtil.getIconClasses(typeName, null, false); } CmsDetailPageInfo detailPage = new CmsDetailPageInfo(id, page, typeName, iconClasses); m_detailPageConfigs.add(detailPage); } catch (CmsVfsResourceNotFoundException e) { CmsUUID structureId = pageLoc.asId(m_cms); CmsResource detailPageRes = m_cms.readResource(structureId); CmsDetailPageInfo detailPage = new CmsDetailPageInfo( structureId, m_cms.getSitePath(detailPageRes), typeName, CmsIconUtil.getIconClasses(typeName, null, false)); m_detailPageConfigs.add(detailPage); } }
java
protected void parseDetailPage(I_CmsXmlContentLocation node) throws CmsException { I_CmsXmlContentValueLocation pageLoc = node.getSubValue(N_PAGE); String typeName = getString(node.getSubValue(N_TYPE)); try { String page = pageLoc.asString(m_cms); CmsResource detailPageRes = m_cms.readResource(page); CmsUUID id = detailPageRes.getStructureId(); String iconClasses; if (typeName.startsWith(CmsDetailPageInfo.FUNCTION_PREFIX)) { iconClasses = CmsIconUtil.getIconClasses(CmsXmlDynamicFunctionHandler.TYPE_FUNCTION, null, false); } else { iconClasses = CmsIconUtil.getIconClasses(typeName, null, false); } CmsDetailPageInfo detailPage = new CmsDetailPageInfo(id, page, typeName, iconClasses); m_detailPageConfigs.add(detailPage); } catch (CmsVfsResourceNotFoundException e) { CmsUUID structureId = pageLoc.asId(m_cms); CmsResource detailPageRes = m_cms.readResource(structureId); CmsDetailPageInfo detailPage = new CmsDetailPageInfo( structureId, m_cms.getSitePath(detailPageRes), typeName, CmsIconUtil.getIconClasses(typeName, null, false)); m_detailPageConfigs.add(detailPage); } }
[ "protected", "void", "parseDetailPage", "(", "I_CmsXmlContentLocation", "node", ")", "throws", "CmsException", "{", "I_CmsXmlContentValueLocation", "pageLoc", "=", "node", ".", "getSubValue", "(", "N_PAGE", ")", ";", "String", "typeName", "=", "getString", "(", "nod...
Parses the detail pages from an XML content node.<p> @param node the XML content node @throws CmsException if something goes wrong
[ "Parses", "the", "detail", "pages", "from", "an", "XML", "content", "node", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsConfigurationReader.java#L817-L844
apache/incubator-gobblin
gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java
AzkabanClient.executeFlow
public AzkabanExecuteFlowStatus executeFlow(String projectName, String flowName, Map<String, String> flowParameters) throws AzkabanClientException { return executeFlowWithOptions(projectName, flowName, null, flowParameters); }
java
public AzkabanExecuteFlowStatus executeFlow(String projectName, String flowName, Map<String, String> flowParameters) throws AzkabanClientException { return executeFlowWithOptions(projectName, flowName, null, flowParameters); }
[ "public", "AzkabanExecuteFlowStatus", "executeFlow", "(", "String", "projectName", ",", "String", "flowName", ",", "Map", "<", "String", ",", "String", ">", "flowParameters", ")", "throws", "AzkabanClientException", "{", "return", "executeFlowWithOptions", "(", "proje...
Execute a flow with flow parameters. The project and flow should be created first. @param projectName project name @param flowName flow name @param flowParameters flow parameters @return The status object which contains success status and execution id.
[ "Execute", "a", "flow", "with", "flow", "parameters", ".", "The", "project", "and", "flow", "should", "be", "created", "first", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-azkaban/src/main/java/org/apache/gobblin/service/modules/orchestration/AzkabanClient.java#L366-L370
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/RSAUtils.java
RSAUtils.signMessage
public static byte[] signMessage(RSAPrivateKey key, byte[] message) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException { return signMessage(key, message, DEFAULT_SIGNATURE_ALGORITHM); }
java
public static byte[] signMessage(RSAPrivateKey key, byte[] message) throws InvalidKeyException, NoSuchAlgorithmException, SignatureException { return signMessage(key, message, DEFAULT_SIGNATURE_ALGORITHM); }
[ "public", "static", "byte", "[", "]", "signMessage", "(", "RSAPrivateKey", "key", ",", "byte", "[", "]", "message", ")", "throws", "InvalidKeyException", ",", "NoSuchAlgorithmException", ",", "SignatureException", "{", "return", "signMessage", "(", "key", ",", "...
Sign a message with RSA private key, using {@link #DEFAULT_SIGNATURE_ALGORITHM}. @param key @param message @return the signature @throws InvalidKeyException @throws NoSuchAlgorithmException @throws SignatureException
[ "Sign", "a", "message", "with", "RSA", "private", "key", "using", "{", "@link", "#DEFAULT_SIGNATURE_ALGORITHM", "}", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/RSAUtils.java#L183-L186
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/MasterCatalogUrl.java
MasterCatalogUrl.getMasterCatalogUrl
public static MozuUrl getMasterCatalogUrl(Integer masterCatalogId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/mastercatalogs/{masterCatalogId}?responseFields={responseFields}"); formatter.formatUrl("masterCatalogId", masterCatalogId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getMasterCatalogUrl(Integer masterCatalogId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/mastercatalogs/{masterCatalogId}?responseFields={responseFields}"); formatter.formatUrl("masterCatalogId", masterCatalogId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getMasterCatalogUrl", "(", "Integer", "masterCatalogId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/mastercatalogs/{masterCatalogId}?responseFields={respon...
Get Resource Url for GetMasterCatalog @param masterCatalogId Unique identifier for the master catalog. The master catalog contains all products accessible per catalogs and the site/tenant. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetMasterCatalog" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/MasterCatalogUrl.java#L34-L40
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/BoundsOnRatiosInSampledSets.java
BoundsOnRatiosInSampledSets.getLowerBoundForBoverA
public static double getLowerBoundForBoverA(final long a, final long b, final double f) { checkInputs(a, b, f); if (a == 0) { return 0.0; } if (f == 1.0) { return (double) b / a; } return approximateLowerBoundOnP(a, b, NUM_STD_DEVS * hackyAdjuster(f)); }
java
public static double getLowerBoundForBoverA(final long a, final long b, final double f) { checkInputs(a, b, f); if (a == 0) { return 0.0; } if (f == 1.0) { return (double) b / a; } return approximateLowerBoundOnP(a, b, NUM_STD_DEVS * hackyAdjuster(f)); }
[ "public", "static", "double", "getLowerBoundForBoverA", "(", "final", "long", "a", ",", "final", "long", "b", ",", "final", "double", "f", ")", "{", "checkInputs", "(", "a", ",", "b", ",", "f", ")", ";", "if", "(", "a", "==", "0", ")", "{", "return...
Return the approximate lower bound based on a 95% confidence interval @param a See class javadoc @param b See class javadoc @param f the inclusion probability used to produce the set with size <i>a</i> and should generally be less than 0.5. Above this value, the results not be reliable. When <i>f</i> = 1.0 this returns the estimate. @return the approximate upper bound
[ "Return", "the", "approximate", "lower", "bound", "based", "on", "a", "95%", "confidence", "interval" ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/BoundsOnRatiosInSampledSets.java#L38-L43
aalmiray/Json-lib
src/main/java/net/sf/json/JSONObject.java
JSONObject.element
public JSONObject element( String key, double value ) { verifyIsNull(); Double d = new Double( value ); JSONUtils.testValidity( d ); return element( key, d ); }
java
public JSONObject element( String key, double value ) { verifyIsNull(); Double d = new Double( value ); JSONUtils.testValidity( d ); return element( key, d ); }
[ "public", "JSONObject", "element", "(", "String", "key", ",", "double", "value", ")", "{", "verifyIsNull", "(", ")", ";", "Double", "d", "=", "new", "Double", "(", "value", ")", ";", "JSONUtils", ".", "testValidity", "(", "d", ")", ";", "return", "elem...
Put a key/double pair in the JSONObject. @param key A key string. @param value A double which is the value. @return this. @throws JSONException If the key is null or if the number is invalid.
[ "Put", "a", "key", "/", "double", "pair", "in", "the", "JSONObject", "." ]
train
https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L1612-L1617