repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
JOML-CI/JOML
src/org/joml/Matrix3f.java
Matrix3f.obliqueZ
public Matrix3f obliqueZ(float a, float b) { """ Apply an oblique projection transformation to this matrix with the given values for <code>a</code> and <code>b</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the oblique transformation matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the oblique transformation will be applied first! <p> The oblique transformation is defined as: <pre> x' = x + a*z y' = y + a*z z' = z </pre> or in matrix form: <pre> 1 0 a 0 1 b 0 0 1 </pre> @param a the value for the z factor that applies to x @param b the value for the z factor that applies to y @return this """ this.m20 = m00 * a + m10 * b + m20; this.m21 = m01 * a + m11 * b + m21; this.m22 = m02 * a + m12 * b + m22; return this; }
java
public Matrix3f obliqueZ(float a, float b) { this.m20 = m00 * a + m10 * b + m20; this.m21 = m01 * a + m11 * b + m21; this.m22 = m02 * a + m12 * b + m22; return this; }
[ "public", "Matrix3f", "obliqueZ", "(", "float", "a", ",", "float", "b", ")", "{", "this", ".", "m20", "=", "m00", "*", "a", "+", "m10", "*", "b", "+", "m20", ";", "this", ".", "m21", "=", "m01", "*", "a", "+", "m11", "*", "b", "+", "m21", ";", "this", ".", "m22", "=", "m02", "*", "a", "+", "m12", "*", "b", "+", "m22", ";", "return", "this", ";", "}" ]
Apply an oblique projection transformation to this matrix with the given values for <code>a</code> and <code>b</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the oblique transformation matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the oblique transformation will be applied first! <p> The oblique transformation is defined as: <pre> x' = x + a*z y' = y + a*z z' = z </pre> or in matrix form: <pre> 1 0 a 0 1 b 0 0 1 </pre> @param a the value for the z factor that applies to x @param b the value for the z factor that applies to y @return this
[ "Apply", "an", "oblique", "projection", "transformation", "to", "this", "matrix", "with", "the", "given", "values", "for", "<code", ">", "a<", "/", "code", ">", "and", "<code", ">", "b<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "O<", "/", "code", ">", "the", "oblique", "transformation", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "O<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "O", "*", "v<", "/", "code", ">", "the", "oblique", "transformation", "will", "be", "applied", "first!", "<p", ">", "The", "oblique", "transformation", "is", "defined", "as", ":", "<pre", ">", "x", "=", "x", "+", "a", "*", "z", "y", "=", "y", "+", "a", "*", "z", "z", "=", "z", "<", "/", "pre", ">", "or", "in", "matrix", "form", ":", "<pre", ">", "1", "0", "a", "0", "1", "b", "0", "0", "1", "<", "/", "pre", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L4143-L4148
js-lib-com/commons
src/main/java/js/util/Strings.java
Strings.getMethodAccessor
public static String getMethodAccessor(String prefix, String memberName) throws IllegalArgumentException { """ Get Java accessor for a given member name. Returns the given <code>memberName</code> prefixed by <code>prefix</code>. If <code>memberName</code> is dashed case, that is, contains dash character convert it to camel case. For example getter for <em>email-addresses</em> is <em>getEmailAddresses</em> and for <em>picture</em> is <em>getPicture</em>. <p> Accessor <code>prefix</code> is inserted before method name and for flexibility it can be anything. Anyway, ususal values are <code>get</code>, <code>set</code> and <code>is</code>. It is caller responsibility to supply the right prefix. @param prefix accessor prefix, @param memberName member name. @return member accessor name. @throws IllegalArgumentException if any given parameter is null or empty. """ Params.notNullOrEmpty(prefix, "Prefix"); Params.notNullOrEmpty(memberName, "Member name"); StringBuilder builder = new StringBuilder(); builder.append(prefix); String[] parts = memberName.split("-+"); for(int i = 0; i < parts.length; i++) { if(parts.length > 0) { builder.append(Character.toUpperCase(parts[i].charAt(0))); builder.append(parts[i].substring(1)); } } return builder.toString(); }
java
public static String getMethodAccessor(String prefix, String memberName) throws IllegalArgumentException { Params.notNullOrEmpty(prefix, "Prefix"); Params.notNullOrEmpty(memberName, "Member name"); StringBuilder builder = new StringBuilder(); builder.append(prefix); String[] parts = memberName.split("-+"); for(int i = 0; i < parts.length; i++) { if(parts.length > 0) { builder.append(Character.toUpperCase(parts[i].charAt(0))); builder.append(parts[i].substring(1)); } } return builder.toString(); }
[ "public", "static", "String", "getMethodAccessor", "(", "String", "prefix", ",", "String", "memberName", ")", "throws", "IllegalArgumentException", "{", "Params", ".", "notNullOrEmpty", "(", "prefix", ",", "\"Prefix\"", ")", ";", "Params", ".", "notNullOrEmpty", "(", "memberName", ",", "\"Member name\"", ")", ";", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "prefix", ")", ";", "String", "[", "]", "parts", "=", "memberName", ".", "split", "(", "\"-+\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parts", ".", "length", ";", "i", "++", ")", "{", "if", "(", "parts", ".", "length", ">", "0", ")", "{", "builder", ".", "append", "(", "Character", ".", "toUpperCase", "(", "parts", "[", "i", "]", ".", "charAt", "(", "0", ")", ")", ")", ";", "builder", ".", "append", "(", "parts", "[", "i", "]", ".", "substring", "(", "1", ")", ")", ";", "}", "}", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Get Java accessor for a given member name. Returns the given <code>memberName</code> prefixed by <code>prefix</code>. If <code>memberName</code> is dashed case, that is, contains dash character convert it to camel case. For example getter for <em>email-addresses</em> is <em>getEmailAddresses</em> and for <em>picture</em> is <em>getPicture</em>. <p> Accessor <code>prefix</code> is inserted before method name and for flexibility it can be anything. Anyway, ususal values are <code>get</code>, <code>set</code> and <code>is</code>. It is caller responsibility to supply the right prefix. @param prefix accessor prefix, @param memberName member name. @return member accessor name. @throws IllegalArgumentException if any given parameter is null or empty.
[ "Get", "Java", "accessor", "for", "a", "given", "member", "name", ".", "Returns", "the", "given", "<code", ">", "memberName<", "/", "code", ">", "prefixed", "by", "<code", ">", "prefix<", "/", "code", ">", ".", "If", "<code", ">", "memberName<", "/", "code", ">", "is", "dashed", "case", "that", "is", "contains", "dash", "character", "convert", "it", "to", "camel", "case", ".", "For", "example", "getter", "for", "<em", ">", "email", "-", "addresses<", "/", "em", ">", "is", "<em", ">", "getEmailAddresses<", "/", "em", ">", "and", "for", "<em", ">", "picture<", "/", "em", ">", "is", "<em", ">", "getPicture<", "/", "em", ">", ".", "<p", ">", "Accessor", "<code", ">", "prefix<", "/", "code", ">", "is", "inserted", "before", "method", "name", "and", "for", "flexibility", "it", "can", "be", "anything", ".", "Anyway", "ususal", "values", "are", "<code", ">", "get<", "/", "code", ">", "<code", ">", "set<", "/", "code", ">", "and", "<code", ">", "is<", "/", "code", ">", ".", "It", "is", "caller", "responsibility", "to", "supply", "the", "right", "prefix", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Strings.java#L353-L369
Javacord/Javacord
javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java
MessageSetImpl.getMessagesBefore
public static CompletableFuture<MessageSet> getMessagesBefore(TextChannel channel, int limit, long before) { """ Gets up to a given amount of messages in the given channel before a given message in any channel. @param channel The channel of the messages. @param limit The limit of messages to get. @param before Get messages before the message with this id. @return The messages. @see #getMessagesBeforeAsStream(TextChannel, long) """ return getMessages(channel, limit, before, -1); }
java
public static CompletableFuture<MessageSet> getMessagesBefore(TextChannel channel, int limit, long before) { return getMessages(channel, limit, before, -1); }
[ "public", "static", "CompletableFuture", "<", "MessageSet", ">", "getMessagesBefore", "(", "TextChannel", "channel", ",", "int", "limit", ",", "long", "before", ")", "{", "return", "getMessages", "(", "channel", ",", "limit", ",", "before", ",", "-", "1", ")", ";", "}" ]
Gets up to a given amount of messages in the given channel before a given message in any channel. @param channel The channel of the messages. @param limit The limit of messages to get. @param before Get messages before the message with this id. @return The messages. @see #getMessagesBeforeAsStream(TextChannel, long)
[ "Gets", "up", "to", "a", "given", "amount", "of", "messages", "in", "the", "given", "channel", "before", "a", "given", "message", "in", "any", "channel", "." ]
train
https://github.com/Javacord/Javacord/blob/915aad084dc5e863284267529d0dccd625fc6886/javacord-core/src/main/java/org/javacord/core/entity/message/MessageSetImpl.java#L316-L318
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java
X509CertSelector.setIssuer
public void setIssuer(byte[] issuerDN) throws IOException { """ Sets the issuer criterion. The specified distinguished name must match the issuer distinguished name in the {@code X509Certificate}. If {@code null} is specified, the issuer criterion is disabled and any issuer distinguished name will do. <p> If {@code issuerDN} is not {@code null}, it should contain a single DER encoded distinguished name, as defined in X.501. The ASN.1 notation for this structure is as follows. <pre>{@code Name ::= CHOICE { RDNSequence } RDNSequence ::= SEQUENCE OF RelativeDistinguishedName RelativeDistinguishedName ::= SET SIZE (1 .. MAX) OF AttributeTypeAndValue AttributeTypeAndValue ::= SEQUENCE { type AttributeType, value AttributeValue } AttributeType ::= OBJECT IDENTIFIER AttributeValue ::= ANY DEFINED BY AttributeType .... DirectoryString ::= CHOICE { teletexString TeletexString (SIZE (1..MAX)), printableString PrintableString (SIZE (1..MAX)), universalString UniversalString (SIZE (1..MAX)), utf8String UTF8String (SIZE (1.. MAX)), bmpString BMPString (SIZE (1..MAX)) } }</pre> <p> Note that the byte array specified here is cloned to protect against subsequent modifications. @param issuerDN a byte array containing the distinguished name in ASN.1 DER encoded form (or {@code null}) @throws IOException if an encoding error occurs (incorrect form for DN) """ try { issuer = (issuerDN == null ? null : new X500Principal(issuerDN)); } catch (IllegalArgumentException e) { throw new IOException("Invalid name", e); } }
java
public void setIssuer(byte[] issuerDN) throws IOException { try { issuer = (issuerDN == null ? null : new X500Principal(issuerDN)); } catch (IllegalArgumentException e) { throw new IOException("Invalid name", e); } }
[ "public", "void", "setIssuer", "(", "byte", "[", "]", "issuerDN", ")", "throws", "IOException", "{", "try", "{", "issuer", "=", "(", "issuerDN", "==", "null", "?", "null", ":", "new", "X500Principal", "(", "issuerDN", ")", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "IOException", "(", "\"Invalid name\"", ",", "e", ")", ";", "}", "}" ]
Sets the issuer criterion. The specified distinguished name must match the issuer distinguished name in the {@code X509Certificate}. If {@code null} is specified, the issuer criterion is disabled and any issuer distinguished name will do. <p> If {@code issuerDN} is not {@code null}, it should contain a single DER encoded distinguished name, as defined in X.501. The ASN.1 notation for this structure is as follows. <pre>{@code Name ::= CHOICE { RDNSequence } RDNSequence ::= SEQUENCE OF RelativeDistinguishedName RelativeDistinguishedName ::= SET SIZE (1 .. MAX) OF AttributeTypeAndValue AttributeTypeAndValue ::= SEQUENCE { type AttributeType, value AttributeValue } AttributeType ::= OBJECT IDENTIFIER AttributeValue ::= ANY DEFINED BY AttributeType .... DirectoryString ::= CHOICE { teletexString TeletexString (SIZE (1..MAX)), printableString PrintableString (SIZE (1..MAX)), universalString UniversalString (SIZE (1..MAX)), utf8String UTF8String (SIZE (1.. MAX)), bmpString BMPString (SIZE (1..MAX)) } }</pre> <p> Note that the byte array specified here is cloned to protect against subsequent modifications. @param issuerDN a byte array containing the distinguished name in ASN.1 DER encoded form (or {@code null}) @throws IOException if an encoding error occurs (incorrect form for DN)
[ "Sets", "the", "issuer", "criterion", ".", "The", "specified", "distinguished", "name", "must", "match", "the", "issuer", "distinguished", "name", "in", "the", "{", "@code", "X509Certificate", "}", ".", "If", "{", "@code", "null", "}", "is", "specified", "the", "issuer", "criterion", "is", "disabled", "and", "any", "issuer", "distinguished", "name", "will", "do", ".", "<p", ">", "If", "{", "@code", "issuerDN", "}", "is", "not", "{", "@code", "null", "}", "it", "should", "contain", "a", "single", "DER", "encoded", "distinguished", "name", "as", "defined", "in", "X", ".", "501", ".", "The", "ASN", ".", "1", "notation", "for", "this", "structure", "is", "as", "follows", ".", "<pre", ">", "{", "@code", "Name", "::", "=", "CHOICE", "{", "RDNSequence", "}" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java#L277-L283
cqframework/clinical_quality_language
Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java
ElmBaseVisitor.visitIntervalTypeSpecifier
public T visitIntervalTypeSpecifier(IntervalTypeSpecifier elm, C context) { """ Visit a IntervalTypeSpecifier. This method will be called for every node in the tree that is a IntervalTypeSpecifier. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result """ visitElement(elm.getPointType(), context); return null; }
java
public T visitIntervalTypeSpecifier(IntervalTypeSpecifier elm, C context) { visitElement(elm.getPointType(), context); return null; }
[ "public", "T", "visitIntervalTypeSpecifier", "(", "IntervalTypeSpecifier", "elm", ",", "C", "context", ")", "{", "visitElement", "(", "elm", ".", "getPointType", "(", ")", ",", "context", ")", ";", "return", "null", ";", "}" ]
Visit a IntervalTypeSpecifier. This method will be called for every node in the tree that is a IntervalTypeSpecifier. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result
[ "Visit", "a", "IntervalTypeSpecifier", ".", "This", "method", "will", "be", "called", "for", "every", "node", "in", "the", "tree", "that", "is", "a", "IntervalTypeSpecifier", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L71-L74
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/parser/RtfParser.java
RtfParser.importRtfDocument
public void importRtfDocument(InputStream readerIn, RtfDocument rtfDoc) throws IOException { """ Imports a complete RTF document. @param readerIn The Reader to read the RTF document from. @param rtfDoc The RtfDocument to add the imported document to. @throws IOException On I/O errors. @since 2.1.3 """ if(readerIn == null || rtfDoc == null) return; this.init(TYPE_IMPORT_FULL, rtfDoc, readerIn, this.document, null); this.setCurrentDestination(RtfDestinationMgr.DESTINATION_NULL); this.groupLevel = 0; try { this.tokenise(); } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
java
public void importRtfDocument(InputStream readerIn, RtfDocument rtfDoc) throws IOException { if(readerIn == null || rtfDoc == null) return; this.init(TYPE_IMPORT_FULL, rtfDoc, readerIn, this.document, null); this.setCurrentDestination(RtfDestinationMgr.DESTINATION_NULL); this.groupLevel = 0; try { this.tokenise(); } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }
[ "public", "void", "importRtfDocument", "(", "InputStream", "readerIn", ",", "RtfDocument", "rtfDoc", ")", "throws", "IOException", "{", "if", "(", "readerIn", "==", "null", "||", "rtfDoc", "==", "null", ")", "return", ";", "this", ".", "init", "(", "TYPE_IMPORT_FULL", ",", "rtfDoc", ",", "readerIn", ",", "this", ".", "document", ",", "null", ")", ";", "this", ".", "setCurrentDestination", "(", "RtfDestinationMgr", ".", "DESTINATION_NULL", ")", ";", "this", ".", "groupLevel", "=", "0", ";", "try", "{", "this", ".", "tokenise", "(", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "// TODO Auto-generated catch block\r", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// TODO Auto-generated catch block\r", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Imports a complete RTF document. @param readerIn The Reader to read the RTF document from. @param rtfDoc The RtfDocument to add the imported document to. @throws IOException On I/O errors. @since 2.1.3
[ "Imports", "a", "complete", "RTF", "document", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/parser/RtfParser.java#L482-L497
recommenders/rival
rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/MultipleEvaluationMetricRunner.java
MultipleEvaluationMetricRunner.getAllPredictionFiles
public static void getAllPredictionFiles(final Set<String> predictionFiles, final File path, final String predictionPrefix) { """ Gets all prediction files. @param predictionFiles The prediction files. @param path The path where the splits are. @param predictionPrefix The prefix of the prediction files. """ if (path == null) { return; } File[] files = path.listFiles(); if (files == null) { return; } for (File file : files) { if (file.isDirectory()) { getAllPredictionFiles(predictionFiles, file, predictionPrefix); } else if (file.getName().startsWith(predictionPrefix)) { predictionFiles.add(file.getAbsolutePath().replaceAll(predictionPrefix, "")); } } }
java
public static void getAllPredictionFiles(final Set<String> predictionFiles, final File path, final String predictionPrefix) { if (path == null) { return; } File[] files = path.listFiles(); if (files == null) { return; } for (File file : files) { if (file.isDirectory()) { getAllPredictionFiles(predictionFiles, file, predictionPrefix); } else if (file.getName().startsWith(predictionPrefix)) { predictionFiles.add(file.getAbsolutePath().replaceAll(predictionPrefix, "")); } } }
[ "public", "static", "void", "getAllPredictionFiles", "(", "final", "Set", "<", "String", ">", "predictionFiles", ",", "final", "File", "path", ",", "final", "String", "predictionPrefix", ")", "{", "if", "(", "path", "==", "null", ")", "{", "return", ";", "}", "File", "[", "]", "files", "=", "path", ".", "listFiles", "(", ")", ";", "if", "(", "files", "==", "null", ")", "{", "return", ";", "}", "for", "(", "File", "file", ":", "files", ")", "{", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "getAllPredictionFiles", "(", "predictionFiles", ",", "file", ",", "predictionPrefix", ")", ";", "}", "else", "if", "(", "file", ".", "getName", "(", ")", ".", "startsWith", "(", "predictionPrefix", ")", ")", "{", "predictionFiles", ".", "add", "(", "file", ".", "getAbsolutePath", "(", ")", ".", "replaceAll", "(", "predictionPrefix", ",", "\"\"", ")", ")", ";", "}", "}", "}" ]
Gets all prediction files. @param predictionFiles The prediction files. @param path The path where the splits are. @param predictionPrefix The prefix of the prediction files.
[ "Gets", "all", "prediction", "files", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/metric/MultipleEvaluationMetricRunner.java#L231-L246
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/BlockVector.java
BlockVector.insertNullElementsAt
public final void insertNullElementsAt(int index, int count) { """ Inserts count null values at index, moving up all the components at index and greater. index cannot be greater than the size of the Vector. @exception ArrayIndexOutOfBoundsException if the index was invalid. """ if (tc.isEntryEnabled()) SibTr.entry( tc, "insertNullElementsAt", new Object[] { new Integer(index), new Integer(count)}); for (int i = index; i < index + count; i++) add(i, null); if (tc.isEntryEnabled()) SibTr.exit(tc, "insertNullElementsAt"); }
java
public final void insertNullElementsAt(int index, int count) { if (tc.isEntryEnabled()) SibTr.entry( tc, "insertNullElementsAt", new Object[] { new Integer(index), new Integer(count)}); for (int i = index; i < index + count; i++) add(i, null); if (tc.isEntryEnabled()) SibTr.exit(tc, "insertNullElementsAt"); }
[ "public", "final", "void", "insertNullElementsAt", "(", "int", "index", ",", "int", "count", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"insertNullElementsAt\"", ",", "new", "Object", "[", "]", "{", "new", "Integer", "(", "index", ")", ",", "new", "Integer", "(", "count", ")", "}", ")", ";", "for", "(", "int", "i", "=", "index", ";", "i", "<", "index", "+", "count", ";", "i", "++", ")", "add", "(", "i", ",", "null", ")", ";", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"insertNullElementsAt\"", ")", ";", "}" ]
Inserts count null values at index, moving up all the components at index and greater. index cannot be greater than the size of the Vector. @exception ArrayIndexOutOfBoundsException if the index was invalid.
[ "Inserts", "count", "null", "values", "at", "index", "moving", "up", "all", "the", "components", "at", "index", "and", "greater", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/BlockVector.java#L64-L77
kenyee/android-ddp-client
src/com/keysolutions/ddpclient/android/MeteorAuthCommands.java
MeteorAuthCommands.registerUser
public boolean registerUser(String username, String email, String password) { """ Register's user into Meteor's accounts-password system @param username user's username (this or email has to be specified) @param email user's email (this or username has to be specified) @param password password @return true if create user called """ if (((username == null) && (email == null)) || (password == null)) { return false; } Object[] methodArgs = new Object[1]; Map<String,Object> options = new HashMap<>(); methodArgs[0] = options; if (username != null) { options.put("username", username); } if (email != null) { options.put("email", email); } options.put("password", password); getDDP().call("createUser", methodArgs, new DDPListener() { @Override public void onResult(Map<String, Object> jsonFields) { handleLoginResult(jsonFields); } }); return true; }
java
public boolean registerUser(String username, String email, String password) { if (((username == null) && (email == null)) || (password == null)) { return false; } Object[] methodArgs = new Object[1]; Map<String,Object> options = new HashMap<>(); methodArgs[0] = options; if (username != null) { options.put("username", username); } if (email != null) { options.put("email", email); } options.put("password", password); getDDP().call("createUser", methodArgs, new DDPListener() { @Override public void onResult(Map<String, Object> jsonFields) { handleLoginResult(jsonFields); } }); return true; }
[ "public", "boolean", "registerUser", "(", "String", "username", ",", "String", "email", ",", "String", "password", ")", "{", "if", "(", "(", "(", "username", "==", "null", ")", "&&", "(", "email", "==", "null", ")", ")", "||", "(", "password", "==", "null", ")", ")", "{", "return", "false", ";", "}", "Object", "[", "]", "methodArgs", "=", "new", "Object", "[", "1", "]", ";", "Map", "<", "String", ",", "Object", ">", "options", "=", "new", "HashMap", "<>", "(", ")", ";", "methodArgs", "[", "0", "]", "=", "options", ";", "if", "(", "username", "!=", "null", ")", "{", "options", ".", "put", "(", "\"username\"", ",", "username", ")", ";", "}", "if", "(", "email", "!=", "null", ")", "{", "options", ".", "put", "(", "\"email\"", ",", "email", ")", ";", "}", "options", ".", "put", "(", "\"password\"", ",", "password", ")", ";", "getDDP", "(", ")", ".", "call", "(", "\"createUser\"", ",", "methodArgs", ",", "new", "DDPListener", "(", ")", "{", "@", "Override", "public", "void", "onResult", "(", "Map", "<", "String", ",", "Object", ">", "jsonFields", ")", "{", "handleLoginResult", "(", "jsonFields", ")", ";", "}", "}", ")", ";", "return", "true", ";", "}" ]
Register's user into Meteor's accounts-password system @param username user's username (this or email has to be specified) @param email user's email (this or username has to be specified) @param password password @return true if create user called
[ "Register", "s", "user", "into", "Meteor", "s", "accounts", "-", "password", "system" ]
train
https://github.com/kenyee/android-ddp-client/blob/6ab416e415570a03f96c383497144dd742de3f08/src/com/keysolutions/ddpclient/android/MeteorAuthCommands.java#L80-L102
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java
WarUtils.updateProperties
public static Properties updateProperties(ZipFile inZip, ZipEntry cadmiumPropertiesEntry, String repoUri, String branch, String configRepoUri, String configBranch) throws IOException { """ <p>Loads a properties file from a zip file and updates 2 properties in that properties file.</p> <p>The properties file in the zip is not written back to the zip file with the updates.</p> @param inZip The zip file to load the properties file from. @param cadmiumPropertiesEntry The entry of a properties file in the zip to load. @param repoUri The value to set the "com.meltmedia.cadmium.git.uri" property with. @param branch The value to set the "com.meltmedia.cadmium.branch" property with. @param configRepoUri The value to set the "com.meltmedia.cadmium.config.git.uri" property with. @param configBranch The value to set the "com.meltmedia.cadmium.config.branch" property with. @return The updated properties object that was loaded from the zip file. @throws IOException """ Properties cadmiumProps = new Properties(); cadmiumProps.load(inZip.getInputStream(cadmiumPropertiesEntry)); if (org.apache.commons.lang3.StringUtils.isNotBlank(repoUri)) { cadmiumProps.setProperty("com.meltmedia.cadmium.git.uri", repoUri); } if (branch != null) { cadmiumProps.setProperty("com.meltmedia.cadmium.branch", branch); } if (org.apache.commons.lang3.StringUtils.isNotBlank(configRepoUri) && !org.apache.commons.lang3.StringUtils.equals(configRepoUri, cadmiumProps.getProperty("com.meltmedia.cadmium.git.uri"))) { cadmiumProps.setProperty("com.meltmedia.cadmium.config.git.uri", configRepoUri); } else if(org.apache.commons.lang3.StringUtils.equals(configRepoUri, cadmiumProps.getProperty("com.meltmedia.cadmium.git.uri"))) { cadmiumProps.remove("com.meltmedia.cadmium.config.git.uri"); } if (configBranch != null) { cadmiumProps.setProperty("com.meltmedia.cadmium.config.branch", configBranch); } return cadmiumProps; }
java
public static Properties updateProperties(ZipFile inZip, ZipEntry cadmiumPropertiesEntry, String repoUri, String branch, String configRepoUri, String configBranch) throws IOException { Properties cadmiumProps = new Properties(); cadmiumProps.load(inZip.getInputStream(cadmiumPropertiesEntry)); if (org.apache.commons.lang3.StringUtils.isNotBlank(repoUri)) { cadmiumProps.setProperty("com.meltmedia.cadmium.git.uri", repoUri); } if (branch != null) { cadmiumProps.setProperty("com.meltmedia.cadmium.branch", branch); } if (org.apache.commons.lang3.StringUtils.isNotBlank(configRepoUri) && !org.apache.commons.lang3.StringUtils.equals(configRepoUri, cadmiumProps.getProperty("com.meltmedia.cadmium.git.uri"))) { cadmiumProps.setProperty("com.meltmedia.cadmium.config.git.uri", configRepoUri); } else if(org.apache.commons.lang3.StringUtils.equals(configRepoUri, cadmiumProps.getProperty("com.meltmedia.cadmium.git.uri"))) { cadmiumProps.remove("com.meltmedia.cadmium.config.git.uri"); } if (configBranch != null) { cadmiumProps.setProperty("com.meltmedia.cadmium.config.branch", configBranch); } return cadmiumProps; }
[ "public", "static", "Properties", "updateProperties", "(", "ZipFile", "inZip", ",", "ZipEntry", "cadmiumPropertiesEntry", ",", "String", "repoUri", ",", "String", "branch", ",", "String", "configRepoUri", ",", "String", "configBranch", ")", "throws", "IOException", "{", "Properties", "cadmiumProps", "=", "new", "Properties", "(", ")", ";", "cadmiumProps", ".", "load", "(", "inZip", ".", "getInputStream", "(", "cadmiumPropertiesEntry", ")", ")", ";", "if", "(", "org", ".", "apache", ".", "commons", ".", "lang3", ".", "StringUtils", ".", "isNotBlank", "(", "repoUri", ")", ")", "{", "cadmiumProps", ".", "setProperty", "(", "\"com.meltmedia.cadmium.git.uri\"", ",", "repoUri", ")", ";", "}", "if", "(", "branch", "!=", "null", ")", "{", "cadmiumProps", ".", "setProperty", "(", "\"com.meltmedia.cadmium.branch\"", ",", "branch", ")", ";", "}", "if", "(", "org", ".", "apache", ".", "commons", ".", "lang3", ".", "StringUtils", ".", "isNotBlank", "(", "configRepoUri", ")", "&&", "!", "org", ".", "apache", ".", "commons", ".", "lang3", ".", "StringUtils", ".", "equals", "(", "configRepoUri", ",", "cadmiumProps", ".", "getProperty", "(", "\"com.meltmedia.cadmium.git.uri\"", ")", ")", ")", "{", "cadmiumProps", ".", "setProperty", "(", "\"com.meltmedia.cadmium.config.git.uri\"", ",", "configRepoUri", ")", ";", "}", "else", "if", "(", "org", ".", "apache", ".", "commons", ".", "lang3", ".", "StringUtils", ".", "equals", "(", "configRepoUri", ",", "cadmiumProps", ".", "getProperty", "(", "\"com.meltmedia.cadmium.git.uri\"", ")", ")", ")", "{", "cadmiumProps", ".", "remove", "(", "\"com.meltmedia.cadmium.config.git.uri\"", ")", ";", "}", "if", "(", "configBranch", "!=", "null", ")", "{", "cadmiumProps", ".", "setProperty", "(", "\"com.meltmedia.cadmium.config.branch\"", ",", "configBranch", ")", ";", "}", "return", "cadmiumProps", ";", "}" ]
<p>Loads a properties file from a zip file and updates 2 properties in that properties file.</p> <p>The properties file in the zip is not written back to the zip file with the updates.</p> @param inZip The zip file to load the properties file from. @param cadmiumPropertiesEntry The entry of a properties file in the zip to load. @param repoUri The value to set the "com.meltmedia.cadmium.git.uri" property with. @param branch The value to set the "com.meltmedia.cadmium.branch" property with. @param configRepoUri The value to set the "com.meltmedia.cadmium.config.git.uri" property with. @param configBranch The value to set the "com.meltmedia.cadmium.config.branch" property with. @return The updated properties object that was loaded from the zip file. @throws IOException
[ "<p", ">", "Loads", "a", "properties", "file", "from", "a", "zip", "file", "and", "updates", "2", "properties", "in", "that", "properties", "file", ".", "<", "/", "p", ">", "<p", ">", "The", "properties", "file", "in", "the", "zip", "is", "not", "written", "back", "to", "the", "zip", "file", "with", "the", "updates", ".", "<", "/", "p", ">" ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L474-L497
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java
UtilReflection.checkInterfaces
private static void checkInterfaces(Class<?> base, Deque<Class<?>> currents, Deque<Class<?>> nexts) { """ Store all declared valid interfaces into next. @param base The minimum base interface. @param currents The current interfaces found. @param nexts The next interface to check. """ currents.stream() .map(Class::getInterfaces) .forEach(types -> Arrays.asList(types) .stream() .filter(type -> base.isAssignableFrom(type) && !type.equals(base)) .forEach(nexts::add)); }
java
private static void checkInterfaces(Class<?> base, Deque<Class<?>> currents, Deque<Class<?>> nexts) { currents.stream() .map(Class::getInterfaces) .forEach(types -> Arrays.asList(types) .stream() .filter(type -> base.isAssignableFrom(type) && !type.equals(base)) .forEach(nexts::add)); }
[ "private", "static", "void", "checkInterfaces", "(", "Class", "<", "?", ">", "base", ",", "Deque", "<", "Class", "<", "?", ">", ">", "currents", ",", "Deque", "<", "Class", "<", "?", ">", ">", "nexts", ")", "{", "currents", ".", "stream", "(", ")", ".", "map", "(", "Class", "::", "getInterfaces", ")", ".", "forEach", "(", "types", "->", "Arrays", ".", "asList", "(", "types", ")", ".", "stream", "(", ")", ".", "filter", "(", "type", "->", "base", ".", "isAssignableFrom", "(", "type", ")", "&&", "!", "type", ".", "equals", "(", "base", ")", ")", ".", "forEach", "(", "nexts", "::", "add", ")", ")", ";", "}" ]
Store all declared valid interfaces into next. @param base The minimum base interface. @param currents The current interfaces found. @param nexts The next interface to check.
[ "Store", "all", "declared", "valid", "interfaces", "into", "next", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilReflection.java#L396-L404
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java
LabAccountsInner.getByResourceGroup
public LabAccountInner getByResourceGroup(String resourceGroupName, String labAccountName) { """ Get lab account. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the LabAccountInner object if successful. """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, labAccountName).toBlocking().single().body(); }
java
public LabAccountInner getByResourceGroup(String resourceGroupName, String labAccountName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, labAccountName).toBlocking().single().body(); }
[ "public", "LabAccountInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Get lab account. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the LabAccountInner object if successful.
[ "Get", "lab", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabAccountsInner.java#L605-L607
drinkjava2/jBeanBox
jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/ASMifier.java
ASMifier.main
public static void main(final String[] args) throws Exception { """ Prints the ASM source code to generate the given class to the standard output. <p> Usage: ASMifier [-debug] &lt;binary class name or class file name&gt; @param args the command line arguments. @throws Exception if the class cannot be found, or if an IO exception occurs. """ int i = 0; int flags = ClassReader.SKIP_DEBUG; boolean ok = true; if (args.length < 1 || args.length > 2) { ok = false; } if (ok && "-debug".equals(args[0])) { i = 1; flags = 0; if (args.length != 2) { ok = false; } } if (!ok) { System.err .println("Prints the ASM code to generate the given class."); System.err.println("Usage: ASMifier [-debug] " + "<fully qualified class name or class file name>"); return; } ClassReader cr; if (args[i].endsWith(".class") || args[i].indexOf('\\') > -1 || args[i].indexOf('/') > -1) { cr = new ClassReader(new FileInputStream(args[i])); } else { cr = new ClassReader(args[i]); } cr.accept(new TraceClassVisitor(null, new ASMifier(), new PrintWriter( System.out)), flags); }
java
public static void main(final String[] args) throws Exception { int i = 0; int flags = ClassReader.SKIP_DEBUG; boolean ok = true; if (args.length < 1 || args.length > 2) { ok = false; } if (ok && "-debug".equals(args[0])) { i = 1; flags = 0; if (args.length != 2) { ok = false; } } if (!ok) { System.err .println("Prints the ASM code to generate the given class."); System.err.println("Usage: ASMifier [-debug] " + "<fully qualified class name or class file name>"); return; } ClassReader cr; if (args[i].endsWith(".class") || args[i].indexOf('\\') > -1 || args[i].indexOf('/') > -1) { cr = new ClassReader(new FileInputStream(args[i])); } else { cr = new ClassReader(args[i]); } cr.accept(new TraceClassVisitor(null, new ASMifier(), new PrintWriter( System.out)), flags); }
[ "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "throws", "Exception", "{", "int", "i", "=", "0", ";", "int", "flags", "=", "ClassReader", ".", "SKIP_DEBUG", ";", "boolean", "ok", "=", "true", ";", "if", "(", "args", ".", "length", "<", "1", "||", "args", ".", "length", ">", "2", ")", "{", "ok", "=", "false", ";", "}", "if", "(", "ok", "&&", "\"-debug\"", ".", "equals", "(", "args", "[", "0", "]", ")", ")", "{", "i", "=", "1", ";", "flags", "=", "0", ";", "if", "(", "args", ".", "length", "!=", "2", ")", "{", "ok", "=", "false", ";", "}", "}", "if", "(", "!", "ok", ")", "{", "System", ".", "err", ".", "println", "(", "\"Prints the ASM code to generate the given class.\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"Usage: ASMifier [-debug] \"", "+", "\"<fully qualified class name or class file name>\"", ")", ";", "return", ";", "}", "ClassReader", "cr", ";", "if", "(", "args", "[", "i", "]", ".", "endsWith", "(", "\".class\"", ")", "||", "args", "[", "i", "]", ".", "indexOf", "(", "'", "'", ")", ">", "-", "1", "||", "args", "[", "i", "]", ".", "indexOf", "(", "'", "'", ")", ">", "-", "1", ")", "{", "cr", "=", "new", "ClassReader", "(", "new", "FileInputStream", "(", "args", "[", "i", "]", ")", ")", ";", "}", "else", "{", "cr", "=", "new", "ClassReader", "(", "args", "[", "i", "]", ")", ";", "}", "cr", ".", "accept", "(", "new", "TraceClassVisitor", "(", "null", ",", "new", "ASMifier", "(", ")", ",", "new", "PrintWriter", "(", "System", ".", "out", ")", ")", ",", "flags", ")", ";", "}" ]
Prints the ASM source code to generate the given class to the standard output. <p> Usage: ASMifier [-debug] &lt;binary class name or class file name&gt; @param args the command line arguments. @throws Exception if the class cannot be found, or if an IO exception occurs.
[ "Prints", "the", "ASM", "source", "code", "to", "generate", "the", "given", "class", "to", "the", "standard", "output", ".", "<p", ">", "Usage", ":", "ASMifier", "[", "-", "debug", "]", "&lt", ";", "binary", "class", "name", "or", "class", "file", "name&gt", ";" ]
train
https://github.com/drinkjava2/jBeanBox/blob/01c216599ffa2e5f2d9c01df2adaad0f45567c04/jbeanbox/src/main/java/com/github/drinkjava2/asm5_0_3/util/ASMifier.java#L128-L159
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java
FSImage.loadFSImage
protected void loadFSImage(ImageInputStream iis, File imageFile) throws IOException { """ Load the image namespace from the given image file, verifying it against the MD5 sum stored in its associated .md5 file. """ MD5Hash expectedMD5 = MD5FileUtils.readStoredMd5ForFile(imageFile); if (expectedMD5 == null) { throw new IOException("No MD5 file found corresponding to image file " + imageFile); } iis.setImageDigest(expectedMD5); loadFSImage(iis); }
java
protected void loadFSImage(ImageInputStream iis, File imageFile) throws IOException { MD5Hash expectedMD5 = MD5FileUtils.readStoredMd5ForFile(imageFile); if (expectedMD5 == null) { throw new IOException("No MD5 file found corresponding to image file " + imageFile); } iis.setImageDigest(expectedMD5); loadFSImage(iis); }
[ "protected", "void", "loadFSImage", "(", "ImageInputStream", "iis", ",", "File", "imageFile", ")", "throws", "IOException", "{", "MD5Hash", "expectedMD5", "=", "MD5FileUtils", ".", "readStoredMd5ForFile", "(", "imageFile", ")", ";", "if", "(", "expectedMD5", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"No MD5 file found corresponding to image file \"", "+", "imageFile", ")", ";", "}", "iis", ".", "setImageDigest", "(", "expectedMD5", ")", ";", "loadFSImage", "(", "iis", ")", ";", "}" ]
Load the image namespace from the given image file, verifying it against the MD5 sum stored in its associated .md5 file.
[ "Load", "the", "image", "namespace", "from", "the", "given", "image", "file", "verifying", "it", "against", "the", "MD5", "sum", "stored", "in", "its", "associated", ".", "md5", "file", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L825-L833
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/util/SignalUtil.java
SignalUtil.logResuming
static void logResuming(String callerClass, String callerMethod, Object waitObj, long start) { """ Logs a warning level message indicating that a thread which has previously been reported as stuck is now resuming. @param callerClass the class name of the caller @param callerMethod the method name of the caller @param waitObj the object that is being waited on @param start the time that the wait began """ long elapsed = (System.currentTimeMillis() - start)/1000; log.logp(Level.WARNING, callerClass, callerMethod, Messages.SignalUtil_2, new Object[]{Thread.currentThread().getId(), elapsed, waitObj}); }
java
static void logResuming(String callerClass, String callerMethod, Object waitObj, long start) { long elapsed = (System.currentTimeMillis() - start)/1000; log.logp(Level.WARNING, callerClass, callerMethod, Messages.SignalUtil_2, new Object[]{Thread.currentThread().getId(), elapsed, waitObj}); }
[ "static", "void", "logResuming", "(", "String", "callerClass", ",", "String", "callerMethod", ",", "Object", "waitObj", ",", "long", "start", ")", "{", "long", "elapsed", "=", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ")", "/", "1000", ";", "log", ".", "logp", "(", "Level", ".", "WARNING", ",", "callerClass", ",", "callerMethod", ",", "Messages", ".", "SignalUtil_2", ",", "new", "Object", "[", "]", "{", "Thread", ".", "currentThread", "(", ")", ".", "getId", "(", ")", ",", "elapsed", ",", "waitObj", "}", ")", ";", "}" ]
Logs a warning level message indicating that a thread which has previously been reported as stuck is now resuming. @param callerClass the class name of the caller @param callerMethod the method name of the caller @param waitObj the object that is being waited on @param start the time that the wait began
[ "Logs", "a", "warning", "level", "message", "indicating", "that", "a", "thread", "which", "has", "previously", "been", "reported", "as", "stuck", "is", "now", "resuming", "." ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/util/SignalUtil.java#L162-L166
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathVariableResolverQName.java
MapBasedXPathVariableResolverQName.addUniqueVariable
@Nonnull public EChange addUniqueVariable (@Nonnull final QName aName, @Nonnull final Object aValue) { """ Add a new variable. @param aName The qualified name of the variable @param aValue The value to be used. @return {@link EChange} """ ValueEnforcer.notNull (aName, "Name"); ValueEnforcer.notNull (aValue, "Value"); if (m_aMap.containsKey (aName)) return EChange.UNCHANGED; m_aMap.put (aName, aValue); return EChange.CHANGED; }
java
@Nonnull public EChange addUniqueVariable (@Nonnull final QName aName, @Nonnull final Object aValue) { ValueEnforcer.notNull (aName, "Name"); ValueEnforcer.notNull (aValue, "Value"); if (m_aMap.containsKey (aName)) return EChange.UNCHANGED; m_aMap.put (aName, aValue); return EChange.CHANGED; }
[ "@", "Nonnull", "public", "EChange", "addUniqueVariable", "(", "@", "Nonnull", "final", "QName", "aName", ",", "@", "Nonnull", "final", "Object", "aValue", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aName", ",", "\"Name\"", ")", ";", "ValueEnforcer", ".", "notNull", "(", "aValue", ",", "\"Value\"", ")", ";", "if", "(", "m_aMap", ".", "containsKey", "(", "aName", ")", ")", "return", "EChange", ".", "UNCHANGED", ";", "m_aMap", ".", "put", "(", "aName", ",", "aValue", ")", ";", "return", "EChange", ".", "CHANGED", ";", "}" ]
Add a new variable. @param aName The qualified name of the variable @param aValue The value to be used. @return {@link EChange}
[ "Add", "a", "new", "variable", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/MapBasedXPathVariableResolverQName.java#L93-L103
jbundle/jbundle
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/ServletTask.java
ServletTask.doProcess
public void doProcess(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter outExt) throws ServletException, IOException { """ Process an HTML get or post. @exception ServletException From inherited class. @exception IOException From inherited class. """ ScreenModel screen = this.doProcessInput(servlet, req, res); this.doProcessOutput(servlet, req, res, outExt, screen); }
java
public void doProcess(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter outExt) throws ServletException, IOException { ScreenModel screen = this.doProcessInput(servlet, req, res); this.doProcessOutput(servlet, req, res, outExt, screen); }
[ "public", "void", "doProcess", "(", "BasicServlet", "servlet", ",", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ",", "PrintWriter", "outExt", ")", "throws", "ServletException", ",", "IOException", "{", "ScreenModel", "screen", "=", "this", ".", "doProcessInput", "(", "servlet", ",", "req", ",", "res", ")", ";", "this", ".", "doProcessOutput", "(", "servlet", ",", "req", ",", "res", ",", "outExt", ",", "screen", ")", ";", "}" ]
Process an HTML get or post. @exception ServletException From inherited class. @exception IOException From inherited class.
[ "Process", "an", "HTML", "get", "or", "post", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/ServletTask.java#L99-L104
OpenLiberty/open-liberty
dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/FATHelper.java
FATHelper.reloadApplications
public static void reloadApplications(LibertyServer server, final Set<String> appIdsToReload) throws Exception { """ Reload select applications. @throws Exception If there was an error reloading the applications for some unforeseen reason. """ ServerConfiguration config = server.getServerConfiguration().clone(); /* * Get the apps to remove. */ ConfigElementList<Application> toRemove = new ConfigElementList<Application>(config.getApplications().stream().filter(app -> appIdsToReload.contains(app.getId())).collect(Collectors.toList())); /* * Remove the applications. */ config.getApplications().removeAll(toRemove); updateConfigDynamically(server, config, true); /* * Reload applications. */ config.getApplications().addAll(toRemove); updateConfigDynamically(server, config, true); }
java
public static void reloadApplications(LibertyServer server, final Set<String> appIdsToReload) throws Exception { ServerConfiguration config = server.getServerConfiguration().clone(); /* * Get the apps to remove. */ ConfigElementList<Application> toRemove = new ConfigElementList<Application>(config.getApplications().stream().filter(app -> appIdsToReload.contains(app.getId())).collect(Collectors.toList())); /* * Remove the applications. */ config.getApplications().removeAll(toRemove); updateConfigDynamically(server, config, true); /* * Reload applications. */ config.getApplications().addAll(toRemove); updateConfigDynamically(server, config, true); }
[ "public", "static", "void", "reloadApplications", "(", "LibertyServer", "server", ",", "final", "Set", "<", "String", ">", "appIdsToReload", ")", "throws", "Exception", "{", "ServerConfiguration", "config", "=", "server", ".", "getServerConfiguration", "(", ")", ".", "clone", "(", ")", ";", "/*\n * Get the apps to remove.\n */", "ConfigElementList", "<", "Application", ">", "toRemove", "=", "new", "ConfigElementList", "<", "Application", ">", "(", "config", ".", "getApplications", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "app", "->", "appIdsToReload", ".", "contains", "(", "app", ".", "getId", "(", ")", ")", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ")", ";", "/*\n * Remove the applications.\n */", "config", ".", "getApplications", "(", ")", ".", "removeAll", "(", "toRemove", ")", ";", "updateConfigDynamically", "(", "server", ",", "config", ",", "true", ")", ";", "/*\n * Reload applications.\n */", "config", ".", "getApplications", "(", ")", ".", "addAll", "(", "toRemove", ")", ";", "updateConfigDynamically", "(", "server", ",", "config", ",", "true", ")", ";", "}" ]
Reload select applications. @throws Exception If there was an error reloading the applications for some unforeseen reason.
[ "Reload", "select", "applications", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/FATHelper.java#L31-L50
SonarSource/sonarqube
server/sonar-server-common/src/main/java/org/sonar/server/qualitygate/ConditionEvaluator.java
ConditionEvaluator.evaluateCondition
private static Optional<EvaluatedCondition> evaluateCondition(Condition condition, ValueType type, Comparable value) { """ Evaluates the error condition. Returns empty if threshold or measure value is not defined. """ Comparable threshold = getThreshold(condition, type); if (reachThreshold(value, threshold, condition)) { return of(new EvaluatedCondition(condition, EvaluationStatus.ERROR, value.toString())); } return Optional.empty(); }
java
private static Optional<EvaluatedCondition> evaluateCondition(Condition condition, ValueType type, Comparable value) { Comparable threshold = getThreshold(condition, type); if (reachThreshold(value, threshold, condition)) { return of(new EvaluatedCondition(condition, EvaluationStatus.ERROR, value.toString())); } return Optional.empty(); }
[ "private", "static", "Optional", "<", "EvaluatedCondition", ">", "evaluateCondition", "(", "Condition", "condition", ",", "ValueType", "type", ",", "Comparable", "value", ")", "{", "Comparable", "threshold", "=", "getThreshold", "(", "condition", ",", "type", ")", ";", "if", "(", "reachThreshold", "(", "value", ",", "threshold", ",", "condition", ")", ")", "{", "return", "of", "(", "new", "EvaluatedCondition", "(", "condition", ",", "EvaluationStatus", ".", "ERROR", ",", "value", ".", "toString", "(", ")", ")", ")", ";", "}", "return", "Optional", ".", "empty", "(", ")", ";", "}" ]
Evaluates the error condition. Returns empty if threshold or measure value is not defined.
[ "Evaluates", "the", "error", "condition", ".", "Returns", "empty", "if", "threshold", "or", "measure", "value", "is", "not", "defined", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/qualitygate/ConditionEvaluator.java#L69-L76
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/LongStream.java
LongStream.scan
@NotNull public LongStream scan(final long identity, @NotNull final LongBinaryOperator accumulator) { """ Returns a {@code LongStream} produced by iterative application of a accumulation function to an initial element {@code identity} and next element of the current stream. Produces a {@code LongStream} consisting of {@code identity}, {@code acc(identity, value1)}, {@code acc(acc(identity, value1), value2)}, etc. <p>This is an intermediate operation. <p>Example: <pre> identity: 0 accumulator: (a, b) -&gt; a + b stream: [1, 2, 3, 4, 5] result: [0, 1, 3, 6, 10, 15] </pre> @param identity the initial value @param accumulator the accumulation function @return the new stream @throws NullPointerException if {@code accumulator} is null @since 1.1.6 """ Objects.requireNonNull(accumulator); return new LongStream(params, new LongScanIdentity(iterator, identity, accumulator)); }
java
@NotNull public LongStream scan(final long identity, @NotNull final LongBinaryOperator accumulator) { Objects.requireNonNull(accumulator); return new LongStream(params, new LongScanIdentity(iterator, identity, accumulator)); }
[ "@", "NotNull", "public", "LongStream", "scan", "(", "final", "long", "identity", ",", "@", "NotNull", "final", "LongBinaryOperator", "accumulator", ")", "{", "Objects", ".", "requireNonNull", "(", "accumulator", ")", ";", "return", "new", "LongStream", "(", "params", ",", "new", "LongScanIdentity", "(", "iterator", ",", "identity", ",", "accumulator", ")", ")", ";", "}" ]
Returns a {@code LongStream} produced by iterative application of a accumulation function to an initial element {@code identity} and next element of the current stream. Produces a {@code LongStream} consisting of {@code identity}, {@code acc(identity, value1)}, {@code acc(acc(identity, value1), value2)}, etc. <p>This is an intermediate operation. <p>Example: <pre> identity: 0 accumulator: (a, b) -&gt; a + b stream: [1, 2, 3, 4, 5] result: [0, 1, 3, 6, 10, 15] </pre> @param identity the initial value @param accumulator the accumulation function @return the new stream @throws NullPointerException if {@code accumulator} is null @since 1.1.6
[ "Returns", "a", "{", "@code", "LongStream", "}", "produced", "by", "iterative", "application", "of", "a", "accumulation", "function", "to", "an", "initial", "element", "{", "@code", "identity", "}", "and", "next", "element", "of", "the", "current", "stream", ".", "Produces", "a", "{", "@code", "LongStream", "}", "consisting", "of", "{", "@code", "identity", "}", "{", "@code", "acc", "(", "identity", "value1", ")", "}", "{", "@code", "acc", "(", "acc", "(", "identity", "value1", ")", "value2", ")", "}", "etc", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/LongStream.java#L710-L715
UrielCh/ovh-java-sdk
ovh-java-sdk-metrics/src/main/java/net/minidev/ovh/api/ApiOvhMetrics.java
ApiOvhMetrics.serviceName_quota_PUT
public String serviceName_quota_PUT(String serviceName, Long quota) throws IOException { """ Set overquota REST: PUT /metrics/{serviceName}/quota @param serviceName [required] Name of your service @param quota [required] New value for overquota API beta """ String qPath = "/metrics/{serviceName}/quota"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "quota", quota); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, String.class); }
java
public String serviceName_quota_PUT(String serviceName, Long quota) throws IOException { String qPath = "/metrics/{serviceName}/quota"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "quota", quota); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, String.class); }
[ "public", "String", "serviceName_quota_PUT", "(", "String", "serviceName", ",", "Long", "quota", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/metrics/{serviceName}/quota\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"quota\"", ",", "quota", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "String", ".", "class", ")", ";", "}" ]
Set overquota REST: PUT /metrics/{serviceName}/quota @param serviceName [required] Name of your service @param quota [required] New value for overquota API beta
[ "Set", "overquota" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-metrics/src/main/java/net/minidev/ovh/api/ApiOvhMetrics.java#L284-L291
westnordost/osmapi
src/main/java/de/westnordost/osmapi/user/UserPreferencesDao.java
UserPreferencesDao.get
public String get(String key) { """ @param key the preference to query @return the value of the given preference or null if the preference does not exist @throws OsmAuthorizationException if the application is not authenticated to read the user's preferences. (Permission.READ_PREFERENCES_AND_USER_DETAILS) """ String urlKey = urlEncode(key); ApiResponseReader<String> reader = new ApiResponseReader<String>() { public String parse(InputStream in) throws Exception { InputStreamReader isr = new InputStreamReader(in, OsmConnection.CHARSET); BufferedReader reader = new BufferedReader(isr, BUFFER_SIZE_PREFS); return reader.readLine(); } }; try { return osm.makeAuthenticatedRequest(USERPREFS + urlKey, "GET", reader); } catch(OsmNotFoundException e) { return null; } }
java
public String get(String key) { String urlKey = urlEncode(key); ApiResponseReader<String> reader = new ApiResponseReader<String>() { public String parse(InputStream in) throws Exception { InputStreamReader isr = new InputStreamReader(in, OsmConnection.CHARSET); BufferedReader reader = new BufferedReader(isr, BUFFER_SIZE_PREFS); return reader.readLine(); } }; try { return osm.makeAuthenticatedRequest(USERPREFS + urlKey, "GET", reader); } catch(OsmNotFoundException e) { return null; } }
[ "public", "String", "get", "(", "String", "key", ")", "{", "String", "urlKey", "=", "urlEncode", "(", "key", ")", ";", "ApiResponseReader", "<", "String", ">", "reader", "=", "new", "ApiResponseReader", "<", "String", ">", "(", ")", "{", "public", "String", "parse", "(", "InputStream", "in", ")", "throws", "Exception", "{", "InputStreamReader", "isr", "=", "new", "InputStreamReader", "(", "in", ",", "OsmConnection", ".", "CHARSET", ")", ";", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "isr", ",", "BUFFER_SIZE_PREFS", ")", ";", "return", "reader", ".", "readLine", "(", ")", ";", "}", "}", ";", "try", "{", "return", "osm", ".", "makeAuthenticatedRequest", "(", "USERPREFS", "+", "urlKey", ",", "\"GET\"", ",", "reader", ")", ";", "}", "catch", "(", "OsmNotFoundException", "e", ")", "{", "return", "null", ";", "}", "}" ]
@param key the preference to query @return the value of the given preference or null if the preference does not exist @throws OsmAuthorizationException if the application is not authenticated to read the user's preferences. (Permission.READ_PREFERENCES_AND_USER_DETAILS)
[ "@param", "key", "the", "preference", "to", "query", "@return", "the", "value", "of", "the", "given", "preference", "or", "null", "if", "the", "preference", "does", "not", "exist" ]
train
https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/user/UserPreferencesDao.java#L50-L70
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConnection.java
SibRaConnection.createBrowserSession
@Override public BrowserSession createBrowserSession( final SIDestinationAddress destinationAddress, final DestinationType destType, final SelectionCriteria criteria, final String alternateUser) throws SIConnectionDroppedException, SIConnectionUnavailableException, SIConnectionLostException, SILimitExceededException, SINotAuthorizedException, SITemporaryDestinationNotFoundException, SIResourceException, SIErrorException, SIIncorrectCallException, SINotPossibleInCurrentConfigurationException { """ Creates a browser session. Checks that the connection is valid and then delegates. Wraps the <code>BrowserSession</code> returned from the delegate in a <code>SibRaBrowserSession</code>. @param destinationAddress the address of the destination @param destType the destination type @param criteria the selection criteria @param alternateUser the name of the user under whose authority operations of the BrowserSession should be performed (may be null) @return the browser session @throws SINotPossibleInCurrentConfigurationException if the delegation fails @throws SIIncorrectCallException if the delegation fails @throws SIErrorException if the delegation fails @throws SIResourceException if the delegation fails @throws SITemporaryDestinationNotFoundException if the delegation fails @throws SINotAuthorizedException if the delegation fails @throws SILimitExceededException if the delegation fails @throws SIConnectionLostException if the delegation fails @throws SIConnectionUnavailableException if the connection is not valid @throws SIConnectionDroppedException if the delegation fails """ checkValid(); final BrowserSession session = _delegateConnection .createBrowserSession(destinationAddress, destType, criteria, alternateUser); return new SibRaBrowserSession(this, session); }
java
@Override public BrowserSession createBrowserSession( final SIDestinationAddress destinationAddress, final DestinationType destType, final SelectionCriteria criteria, final String alternateUser) throws SIConnectionDroppedException, SIConnectionUnavailableException, SIConnectionLostException, SILimitExceededException, SINotAuthorizedException, SITemporaryDestinationNotFoundException, SIResourceException, SIErrorException, SIIncorrectCallException, SINotPossibleInCurrentConfigurationException { checkValid(); final BrowserSession session = _delegateConnection .createBrowserSession(destinationAddress, destType, criteria, alternateUser); return new SibRaBrowserSession(this, session); }
[ "@", "Override", "public", "BrowserSession", "createBrowserSession", "(", "final", "SIDestinationAddress", "destinationAddress", ",", "final", "DestinationType", "destType", ",", "final", "SelectionCriteria", "criteria", ",", "final", "String", "alternateUser", ")", "throws", "SIConnectionDroppedException", ",", "SIConnectionUnavailableException", ",", "SIConnectionLostException", ",", "SILimitExceededException", ",", "SINotAuthorizedException", ",", "SITemporaryDestinationNotFoundException", ",", "SIResourceException", ",", "SIErrorException", ",", "SIIncorrectCallException", ",", "SINotPossibleInCurrentConfigurationException", "{", "checkValid", "(", ")", ";", "final", "BrowserSession", "session", "=", "_delegateConnection", ".", "createBrowserSession", "(", "destinationAddress", ",", "destType", ",", "criteria", ",", "alternateUser", ")", ";", "return", "new", "SibRaBrowserSession", "(", "this", ",", "session", ")", ";", "}" ]
Creates a browser session. Checks that the connection is valid and then delegates. Wraps the <code>BrowserSession</code> returned from the delegate in a <code>SibRaBrowserSession</code>. @param destinationAddress the address of the destination @param destType the destination type @param criteria the selection criteria @param alternateUser the name of the user under whose authority operations of the BrowserSession should be performed (may be null) @return the browser session @throws SINotPossibleInCurrentConfigurationException if the delegation fails @throws SIIncorrectCallException if the delegation fails @throws SIErrorException if the delegation fails @throws SIResourceException if the delegation fails @throws SITemporaryDestinationNotFoundException if the delegation fails @throws SINotAuthorizedException if the delegation fails @throws SILimitExceededException if the delegation fails @throws SIConnectionLostException if the delegation fails @throws SIConnectionUnavailableException if the connection is not valid @throws SIConnectionDroppedException if the delegation fails
[ "Creates", "a", "browser", "session", ".", "Checks", "that", "the", "connection", "is", "valid", "and", "then", "delegates", ".", "Wraps", "the", "<code", ">", "BrowserSession<", "/", "code", ">", "returned", "from", "the", "delegate", "in", "a", "<code", ">", "SibRaBrowserSession<", "/", "code", ">", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.common/src/com/ibm/ws/sib/ra/impl/SibRaConnection.java#L1530-L1549
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/SyncRemoteTable.java
SyncRemoteTable.doRemoteAction
public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException { """ Do a remote action. @param strCommand Command to perform remotely. @param properties Properties for this command (optional). @return boolean success. """ synchronized(m_objSync) { return m_tableRemote.doRemoteAction(strCommand, properties); } }
java
public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException { synchronized(m_objSync) { return m_tableRemote.doRemoteAction(strCommand, properties); } }
[ "public", "Object", "doRemoteAction", "(", "String", "strCommand", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "DBException", ",", "RemoteException", "{", "synchronized", "(", "m_objSync", ")", "{", "return", "m_tableRemote", ".", "doRemoteAction", "(", "strCommand", ",", "properties", ")", ";", "}", "}" ]
Do a remote action. @param strCommand Command to perform remotely. @param properties Properties for this command (optional). @return boolean success.
[ "Do", "a", "remote", "action", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/SyncRemoteTable.java#L251-L257
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.getWriter
public static BufferedWriter getWriter(String path, Charset charset, boolean isAppend) throws IORuntimeException { """ 获得一个带缓存的写入对象 @param path 输出路径,绝对路径 @param charset 字符集 @param isAppend 是否追加 @return BufferedReader对象 @throws IORuntimeException IO异常 """ return getWriter(touch(path), charset, isAppend); }
java
public static BufferedWriter getWriter(String path, Charset charset, boolean isAppend) throws IORuntimeException { return getWriter(touch(path), charset, isAppend); }
[ "public", "static", "BufferedWriter", "getWriter", "(", "String", "path", ",", "Charset", "charset", ",", "boolean", "isAppend", ")", "throws", "IORuntimeException", "{", "return", "getWriter", "(", "touch", "(", "path", ")", ",", "charset", ",", "isAppend", ")", ";", "}" ]
获得一个带缓存的写入对象 @param path 输出路径,绝对路径 @param charset 字符集 @param isAppend 是否追加 @return BufferedReader对象 @throws IORuntimeException IO异常
[ "获得一个带缓存的写入对象" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2598-L2600
line/armeria
core/src/main/java/com/linecorp/armeria/common/AbstractRequestContextBuilder.java
AbstractRequestContextBuilder.requestStartTime
public final B requestStartTime(long requestStartTimeNanos, long requestStartTimeMicros) { """ Sets the request start time of the request. @param requestStartTimeNanos the {@link System#nanoTime()} value when the request started. @param requestStartTimeMicros the number of microseconds since the epoch when the request started. """ this.requestStartTimeNanos = requestStartTimeNanos; this.requestStartTimeMicros = requestStartTimeMicros; requestStartTimeSet = true; return self(); }
java
public final B requestStartTime(long requestStartTimeNanos, long requestStartTimeMicros) { this.requestStartTimeNanos = requestStartTimeNanos; this.requestStartTimeMicros = requestStartTimeMicros; requestStartTimeSet = true; return self(); }
[ "public", "final", "B", "requestStartTime", "(", "long", "requestStartTimeNanos", ",", "long", "requestStartTimeMicros", ")", "{", "this", ".", "requestStartTimeNanos", "=", "requestStartTimeNanos", ";", "this", ".", "requestStartTimeMicros", "=", "requestStartTimeMicros", ";", "requestStartTimeSet", "=", "true", ";", "return", "self", "(", ")", ";", "}" ]
Sets the request start time of the request. @param requestStartTimeNanos the {@link System#nanoTime()} value when the request started. @param requestStartTimeMicros the number of microseconds since the epoch when the request started.
[ "Sets", "the", "request", "start", "time", "of", "the", "request", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/AbstractRequestContextBuilder.java#L383-L388
josueeduardo/snappy
snappy/src/main/java/io/joshworks/snappy/SnappyServer.java
SnappyServer.add
public static void add(HttpString method, String url, HttpConsumer<HttpExchange> endpoint, MediaTypes... mediaTypes) { """ Define a REST endpoint mapped to the specified HTTP method with default path "/" as url @param method The HTTP method @param url The relative URL of the endpoint. @param endpoint The endpoint handler @param mediaTypes (Optional) The accepted and returned types for this endpoint """ addResource(method, url, endpoint, mediaTypes); }
java
public static void add(HttpString method, String url, HttpConsumer<HttpExchange> endpoint, MediaTypes... mediaTypes) { addResource(method, url, endpoint, mediaTypes); }
[ "public", "static", "void", "add", "(", "HttpString", "method", ",", "String", "url", ",", "HttpConsumer", "<", "HttpExchange", ">", "endpoint", ",", "MediaTypes", "...", "mediaTypes", ")", "{", "addResource", "(", "method", ",", "url", ",", "endpoint", ",", "mediaTypes", ")", ";", "}" ]
Define a REST endpoint mapped to the specified HTTP method with default path "/" as url @param method The HTTP method @param url The relative URL of the endpoint. @param endpoint The endpoint handler @param mediaTypes (Optional) The accepted and returned types for this endpoint
[ "Define", "a", "REST", "endpoint", "mapped", "to", "the", "specified", "HTTP", "method", "with", "default", "path", "/", "as", "url" ]
train
https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/snappy/src/main/java/io/joshworks/snappy/SnappyServer.java#L486-L488
phax/ph-datetime
ph-holiday/src/main/java/com/helger/holiday/parser/RelativeToEasterSundayParser.java
RelativeToEasterSundayParser.addChrstianHoliday
protected final void addChrstianHoliday (final ChronoLocalDate aDate, final String sPropertiesKey, final IHolidayType aHolidayType, final HolidayMap holidays) { """ Adds the given day to the list of holidays. @param aDate The day @param sPropertiesKey a {@link java.lang.String} object. @param aHolidayType a {@link HolidayType} object. @param holidays a {@link java.util.Set} object. """ final LocalDate convertedDate = LocalDate.from (aDate); holidays.add (convertedDate, new ResourceBundleHoliday (aHolidayType, sPropertiesKey)); }
java
protected final void addChrstianHoliday (final ChronoLocalDate aDate, final String sPropertiesKey, final IHolidayType aHolidayType, final HolidayMap holidays) { final LocalDate convertedDate = LocalDate.from (aDate); holidays.add (convertedDate, new ResourceBundleHoliday (aHolidayType, sPropertiesKey)); }
[ "protected", "final", "void", "addChrstianHoliday", "(", "final", "ChronoLocalDate", "aDate", ",", "final", "String", "sPropertiesKey", ",", "final", "IHolidayType", "aHolidayType", ",", "final", "HolidayMap", "holidays", ")", "{", "final", "LocalDate", "convertedDate", "=", "LocalDate", ".", "from", "(", "aDate", ")", ";", "holidays", ".", "add", "(", "convertedDate", ",", "new", "ResourceBundleHoliday", "(", "aHolidayType", ",", "sPropertiesKey", ")", ")", ";", "}" ]
Adds the given day to the list of holidays. @param aDate The day @param sPropertiesKey a {@link java.lang.String} object. @param aHolidayType a {@link HolidayType} object. @param holidays a {@link java.util.Set} object.
[ "Adds", "the", "given", "day", "to", "the", "list", "of", "holidays", "." ]
train
https://github.com/phax/ph-datetime/blob/cfaff01cb76d9affb934800ff55734b5a7d8983e/ph-holiday/src/main/java/com/helger/holiday/parser/RelativeToEasterSundayParser.java#L75-L82
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java
ComponentCollision.checkOthers
private void checkOthers(Collidable objectA, Entry<Point, Set<Collidable>> current) { """ Check others element. @param objectA The collidable reference. @param current The current group to check. """ for (final Integer acceptedGroup : objectA.getAccepted()) { // Others to compare only in accepted group if (collidables.containsKey(acceptedGroup)) { checkOthers(objectA, current, acceptedGroup); } } }
java
private void checkOthers(Collidable objectA, Entry<Point, Set<Collidable>> current) { for (final Integer acceptedGroup : objectA.getAccepted()) { // Others to compare only in accepted group if (collidables.containsKey(acceptedGroup)) { checkOthers(objectA, current, acceptedGroup); } } }
[ "private", "void", "checkOthers", "(", "Collidable", "objectA", ",", "Entry", "<", "Point", ",", "Set", "<", "Collidable", ">", ">", "current", ")", "{", "for", "(", "final", "Integer", "acceptedGroup", ":", "objectA", ".", "getAccepted", "(", ")", ")", "{", "// Others to compare only in accepted group", "if", "(", "collidables", ".", "containsKey", "(", "acceptedGroup", ")", ")", "{", "checkOthers", "(", "objectA", ",", "current", ",", "acceptedGroup", ")", ";", "}", "}", "}" ]
Check others element. @param objectA The collidable reference. @param current The current group to check.
[ "Check", "others", "element", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/ComponentCollision.java#L164-L174
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java
ImageLoading.loadBitmapOptimized
public static Bitmap loadBitmapOptimized(String fileName, int limit) throws ImageLoadException { """ Loading bitmap with optimized loaded size less than specific pixels count @param fileName Image file name @param limit maximum pixels size @return loaded bitmap (always not null) @throws ImageLoadException if it is unable to load file """ return loadBitmapOptimized(new FileSource(fileName), limit); }
java
public static Bitmap loadBitmapOptimized(String fileName, int limit) throws ImageLoadException { return loadBitmapOptimized(new FileSource(fileName), limit); }
[ "public", "static", "Bitmap", "loadBitmapOptimized", "(", "String", "fileName", ",", "int", "limit", ")", "throws", "ImageLoadException", "{", "return", "loadBitmapOptimized", "(", "new", "FileSource", "(", "fileName", ")", ",", "limit", ")", ";", "}" ]
Loading bitmap with optimized loaded size less than specific pixels count @param fileName Image file name @param limit maximum pixels size @return loaded bitmap (always not null) @throws ImageLoadException if it is unable to load file
[ "Loading", "bitmap", "with", "optimized", "loaded", "size", "less", "than", "specific", "pixels", "count" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L131-L133
keyboardsurfer/Crouton
library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java
Crouton.showText
public static void showText(Activity activity, CharSequence text, Style style, int viewGroupResId) { """ Creates a {@link Crouton} with provided text and style for a given activity and displays it directly. @param activity The {@link Activity} that represents the context in which the Crouton should exist. @param text The text you want to display. @param style The style that this {@link Crouton} should be created with. @param viewGroupResId The resource id of the {@link ViewGroup} that this {@link Crouton} should be added to. """ makeText(activity, text, style, (ViewGroup) activity.findViewById(viewGroupResId)).show(); }
java
public static void showText(Activity activity, CharSequence text, Style style, int viewGroupResId) { makeText(activity, text, style, (ViewGroup) activity.findViewById(viewGroupResId)).show(); }
[ "public", "static", "void", "showText", "(", "Activity", "activity", ",", "CharSequence", "text", ",", "Style", "style", ",", "int", "viewGroupResId", ")", "{", "makeText", "(", "activity", ",", "text", ",", "style", ",", "(", "ViewGroup", ")", "activity", ".", "findViewById", "(", "viewGroupResId", ")", ")", ".", "show", "(", ")", ";", "}" ]
Creates a {@link Crouton} with provided text and style for a given activity and displays it directly. @param activity The {@link Activity} that represents the context in which the Crouton should exist. @param text The text you want to display. @param style The style that this {@link Crouton} should be created with. @param viewGroupResId The resource id of the {@link ViewGroup} that this {@link Crouton} should be added to.
[ "Creates", "a", "{", "@link", "Crouton", "}", "with", "provided", "text", "and", "style", "for", "a", "given", "activity", "and", "displays", "it", "directly", "." ]
train
https://github.com/keyboardsurfer/Crouton/blob/7806b15e4d52793e1f5aeaa4a55b1e220289e619/library/src/main/java/de/keyboardsurfer/android/widget/crouton/Crouton.java#L411-L413
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java
Drawable.loadSpriteTiled
public static SpriteTiled loadSpriteTiled(ImageBuffer surface, int tileWidth, int tileHeight) { """ Load a tiled sprite using an image reference, giving tile dimension (sharing the same surface). It may be useful in case of multiple tiled sprites. <p> {@link SpriteTiled#load()} must not be called as surface has already been loaded. </p> @param surface The surface reference (must not be <code>null</code>). @param tileWidth The tile width (must be strictly positive). @param tileHeight The tile height (must be strictly positive). @return The loaded tiled sprite. @throws LionEngineException If arguments are invalid. """ return new SpriteTiledImpl(surface, tileWidth, tileHeight); }
java
public static SpriteTiled loadSpriteTiled(ImageBuffer surface, int tileWidth, int tileHeight) { return new SpriteTiledImpl(surface, tileWidth, tileHeight); }
[ "public", "static", "SpriteTiled", "loadSpriteTiled", "(", "ImageBuffer", "surface", ",", "int", "tileWidth", ",", "int", "tileHeight", ")", "{", "return", "new", "SpriteTiledImpl", "(", "surface", ",", "tileWidth", ",", "tileHeight", ")", ";", "}" ]
Load a tiled sprite using an image reference, giving tile dimension (sharing the same surface). It may be useful in case of multiple tiled sprites. <p> {@link SpriteTiled#load()} must not be called as surface has already been loaded. </p> @param surface The surface reference (must not be <code>null</code>). @param tileWidth The tile width (must be strictly positive). @param tileHeight The tile height (must be strictly positive). @return The loaded tiled sprite. @throws LionEngineException If arguments are invalid.
[ "Load", "a", "tiled", "sprite", "using", "an", "image", "reference", "giving", "tile", "dimension", "(", "sharing", "the", "same", "surface", ")", ".", "It", "may", "be", "useful", "in", "case", "of", "multiple", "tiled", "sprites", ".", "<p", ">", "{", "@link", "SpriteTiled#load", "()", "}", "must", "not", "be", "called", "as", "surface", "has", "already", "been", "loaded", ".", "<", "/", "p", ">" ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/drawable/Drawable.java#L232-L235
davidcarboni/restolino
src/main/java/com/github/davidcarboni/restolino/routes/DefaultIndexRedirect.java
DefaultIndexRedirect.get
@Override public Object get(HttpServletRequest req, HttpServletResponse res) throws IOException { """ Extending this class and implementing {@link Home} will make use of this method. """ res.sendRedirect(path); return null; }
java
@Override public Object get(HttpServletRequest req, HttpServletResponse res) throws IOException { res.sendRedirect(path); return null; }
[ "@", "Override", "public", "Object", "get", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "res", ")", "throws", "IOException", "{", "res", ".", "sendRedirect", "(", "path", ")", ";", "return", "null", ";", "}" ]
Extending this class and implementing {@link Home} will make use of this method.
[ "Extending", "this", "class", "and", "implementing", "{" ]
train
https://github.com/davidcarboni/restolino/blob/3f84ece1bd016fbb597c624d46fcca5a2580a33d/src/main/java/com/github/davidcarboni/restolino/routes/DefaultIndexRedirect.java#L38-L43
apache/incubator-shardingsphere
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/dml/delete/DeleteParserFactory.java
DeleteParserFactory.newInstance
public static AbstractDeleteParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine) { """ Create delete parser instance. @param dbType database type @param shardingRule databases and tables sharding rule @param lexerEngine lexical analysis engine. @return delete parser instance """ switch (dbType) { case H2: case MySQL: return new MySQLDeleteParser(shardingRule, lexerEngine); case Oracle: return new OracleDeleteParser(shardingRule, lexerEngine); case SQLServer: return new SQLServerDeleteParser(shardingRule, lexerEngine); case PostgreSQL: return new PostgreSQLDeleteParser(shardingRule, lexerEngine); default: throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType)); } }
java
public static AbstractDeleteParser newInstance(final DatabaseType dbType, final ShardingRule shardingRule, final LexerEngine lexerEngine) { switch (dbType) { case H2: case MySQL: return new MySQLDeleteParser(shardingRule, lexerEngine); case Oracle: return new OracleDeleteParser(shardingRule, lexerEngine); case SQLServer: return new SQLServerDeleteParser(shardingRule, lexerEngine); case PostgreSQL: return new PostgreSQLDeleteParser(shardingRule, lexerEngine); default: throw new UnsupportedOperationException(String.format("Cannot support database [%s].", dbType)); } }
[ "public", "static", "AbstractDeleteParser", "newInstance", "(", "final", "DatabaseType", "dbType", ",", "final", "ShardingRule", "shardingRule", ",", "final", "LexerEngine", "lexerEngine", ")", "{", "switch", "(", "dbType", ")", "{", "case", "H2", ":", "case", "MySQL", ":", "return", "new", "MySQLDeleteParser", "(", "shardingRule", ",", "lexerEngine", ")", ";", "case", "Oracle", ":", "return", "new", "OracleDeleteParser", "(", "shardingRule", ",", "lexerEngine", ")", ";", "case", "SQLServer", ":", "return", "new", "SQLServerDeleteParser", "(", "shardingRule", ",", "lexerEngine", ")", ";", "case", "PostgreSQL", ":", "return", "new", "PostgreSQLDeleteParser", "(", "shardingRule", ",", "lexerEngine", ")", ";", "default", ":", "throw", "new", "UnsupportedOperationException", "(", "String", ".", "format", "(", "\"Cannot support database [%s].\"", ",", "dbType", ")", ")", ";", "}", "}" ]
Create delete parser instance. @param dbType database type @param shardingRule databases and tables sharding rule @param lexerEngine lexical analysis engine. @return delete parser instance
[ "Create", "delete", "parser", "instance", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/old/parser/sql/dml/delete/DeleteParserFactory.java#L46-L60
zaproxy/zaproxy
src/org/zaproxy/zap/extension/script/ScriptVars.java
ScriptVars.setScriptVarImpl
private static void setScriptVarImpl(String scriptName, String key, String value) { """ Internal method that sets a variable without validating the script name. @param scriptName the name of the script. @param key the key of the variable. @param value the value of the variable. """ validateKey(key); Map<String, String> scVars = scriptVars .computeIfAbsent(scriptName, k -> Collections.synchronizedMap(new HashMap<String, String>())); if (value == null) { scVars.remove(key); } else { validateValueLength(value); if (scVars.size() > MAX_SCRIPT_VARS) { throw new IllegalArgumentException("Maximum number of script variables reached: " + MAX_SCRIPT_VARS); } scVars.put(key, value); } }
java
private static void setScriptVarImpl(String scriptName, String key, String value) { validateKey(key); Map<String, String> scVars = scriptVars .computeIfAbsent(scriptName, k -> Collections.synchronizedMap(new HashMap<String, String>())); if (value == null) { scVars.remove(key); } else { validateValueLength(value); if (scVars.size() > MAX_SCRIPT_VARS) { throw new IllegalArgumentException("Maximum number of script variables reached: " + MAX_SCRIPT_VARS); } scVars.put(key, value); } }
[ "private", "static", "void", "setScriptVarImpl", "(", "String", "scriptName", ",", "String", "key", ",", "String", "value", ")", "{", "validateKey", "(", "key", ")", ";", "Map", "<", "String", ",", "String", ">", "scVars", "=", "scriptVars", ".", "computeIfAbsent", "(", "scriptName", ",", "k", "->", "Collections", ".", "synchronizedMap", "(", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ")", ")", ";", "if", "(", "value", "==", "null", ")", "{", "scVars", ".", "remove", "(", "key", ")", ";", "}", "else", "{", "validateValueLength", "(", "value", ")", ";", "if", "(", "scVars", ".", "size", "(", ")", ">", "MAX_SCRIPT_VARS", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Maximum number of script variables reached: \"", "+", "MAX_SCRIPT_VARS", ")", ";", "}", "scVars", ".", "put", "(", "key", ",", "value", ")", ";", "}", "}" ]
Internal method that sets a variable without validating the script name. @param scriptName the name of the script. @param key the key of the variable. @param value the value of the variable.
[ "Internal", "method", "that", "sets", "a", "variable", "without", "validating", "the", "script", "name", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ScriptVars.java#L212-L227
abego/treelayout
org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java
TreeLayout.secondWalk
private void secondWalk(TreeNode v, double m, int level, double levelStart) { """ In difference to the original algorithm we also pass in extra level information. @param v @param m @param level @param levelStart """ // construct the position from the prelim and the level information // The rootLocation affects the way how x and y are changed and in what // direction. double levelChangeSign = getLevelChangeSign(); boolean levelChangeOnYAxis = isLevelChangeInYAxis(); double levelSize = getSizeOfLevel(level); double x = getPrelim(v) + m; double y; AlignmentInLevel alignment = configuration.getAlignmentInLevel(); if (alignment == AlignmentInLevel.Center) { y = levelStart + levelChangeSign * (levelSize / 2); } else if (alignment == AlignmentInLevel.TowardsRoot) { y = levelStart + levelChangeSign * (getNodeThickness(v) / 2); } else { y = levelStart + levelSize - levelChangeSign * (getNodeThickness(v) / 2); } if (!levelChangeOnYAxis) { double t = x; x = y; y = t; } positions.put(v, new NormalizedPosition(x, y)); // update the bounds updateBounds(v, x, y); // recurse if (!tree.isLeaf(v)) { double nextLevelStart = levelStart + (levelSize + configuration.getGapBetweenLevels(level + 1)) * levelChangeSign; for (TreeNode w : tree.getChildren(v)) { secondWalk(w, m + getMod(v), level + 1, nextLevelStart); } } }
java
private void secondWalk(TreeNode v, double m, int level, double levelStart) { // construct the position from the prelim and the level information // The rootLocation affects the way how x and y are changed and in what // direction. double levelChangeSign = getLevelChangeSign(); boolean levelChangeOnYAxis = isLevelChangeInYAxis(); double levelSize = getSizeOfLevel(level); double x = getPrelim(v) + m; double y; AlignmentInLevel alignment = configuration.getAlignmentInLevel(); if (alignment == AlignmentInLevel.Center) { y = levelStart + levelChangeSign * (levelSize / 2); } else if (alignment == AlignmentInLevel.TowardsRoot) { y = levelStart + levelChangeSign * (getNodeThickness(v) / 2); } else { y = levelStart + levelSize - levelChangeSign * (getNodeThickness(v) / 2); } if (!levelChangeOnYAxis) { double t = x; x = y; y = t; } positions.put(v, new NormalizedPosition(x, y)); // update the bounds updateBounds(v, x, y); // recurse if (!tree.isLeaf(v)) { double nextLevelStart = levelStart + (levelSize + configuration.getGapBetweenLevels(level + 1)) * levelChangeSign; for (TreeNode w : tree.getChildren(v)) { secondWalk(w, m + getMod(v), level + 1, nextLevelStart); } } }
[ "private", "void", "secondWalk", "(", "TreeNode", "v", ",", "double", "m", ",", "int", "level", ",", "double", "levelStart", ")", "{", "// construct the position from the prelim and the level information", "// The rootLocation affects the way how x and y are changed and in what", "// direction.", "double", "levelChangeSign", "=", "getLevelChangeSign", "(", ")", ";", "boolean", "levelChangeOnYAxis", "=", "isLevelChangeInYAxis", "(", ")", ";", "double", "levelSize", "=", "getSizeOfLevel", "(", "level", ")", ";", "double", "x", "=", "getPrelim", "(", "v", ")", "+", "m", ";", "double", "y", ";", "AlignmentInLevel", "alignment", "=", "configuration", ".", "getAlignmentInLevel", "(", ")", ";", "if", "(", "alignment", "==", "AlignmentInLevel", ".", "Center", ")", "{", "y", "=", "levelStart", "+", "levelChangeSign", "*", "(", "levelSize", "/", "2", ")", ";", "}", "else", "if", "(", "alignment", "==", "AlignmentInLevel", ".", "TowardsRoot", ")", "{", "y", "=", "levelStart", "+", "levelChangeSign", "*", "(", "getNodeThickness", "(", "v", ")", "/", "2", ")", ";", "}", "else", "{", "y", "=", "levelStart", "+", "levelSize", "-", "levelChangeSign", "*", "(", "getNodeThickness", "(", "v", ")", "/", "2", ")", ";", "}", "if", "(", "!", "levelChangeOnYAxis", ")", "{", "double", "t", "=", "x", ";", "x", "=", "y", ";", "y", "=", "t", ";", "}", "positions", ".", "put", "(", "v", ",", "new", "NormalizedPosition", "(", "x", ",", "y", ")", ")", ";", "// update the bounds", "updateBounds", "(", "v", ",", "x", ",", "y", ")", ";", "// recurse", "if", "(", "!", "tree", ".", "isLeaf", "(", "v", ")", ")", "{", "double", "nextLevelStart", "=", "levelStart", "+", "(", "levelSize", "+", "configuration", ".", "getGapBetweenLevels", "(", "level", "+", "1", ")", ")", "*", "levelChangeSign", ";", "for", "(", "TreeNode", "w", ":", "tree", ".", "getChildren", "(", "v", ")", ")", "{", "secondWalk", "(", "w", ",", "m", "+", "getMod", "(", "v", ")", ",", "level", "+", "1", ",", "nextLevelStart", ")", ";", "}", "}", "}" ]
In difference to the original algorithm we also pass in extra level information. @param v @param m @param level @param levelStart
[ "In", "difference", "to", "the", "original", "algorithm", "we", "also", "pass", "in", "extra", "level", "information", "." ]
train
https://github.com/abego/treelayout/blob/aa73af5803c6ec30db0b4ad192c7cba55d0862d2/org.abego.treelayout/src/main/java/org/abego/treelayout/TreeLayout.java#L642-L684
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.checkManagerOfProjectRole
public void checkManagerOfProjectRole(CmsDbContext dbc, CmsProject project) throws CmsRoleViolationException { """ Checks if the current user has management access to the given project.<p> @param dbc the current database context @param project the project to check @throws CmsRoleViolationException if the user does not have the required role permissions """ boolean hasRole = false; try { if (hasRole(dbc, dbc.currentUser(), CmsRole.ROOT_ADMIN)) { return; } hasRole = m_driverManager.getAllManageableProjects( dbc, m_driverManager.readOrganizationalUnit(dbc, project.getOuFqn()), false).contains(project); } catch (CmsException e) { // should never happen if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } if (!hasRole) { throw new CmsRoleViolationException( org.opencms.security.Messages.get().container( org.opencms.security.Messages.ERR_NOT_MANAGER_OF_PROJECT_2, dbc.currentUser().getName(), dbc.currentProject().getName())); } }
java
public void checkManagerOfProjectRole(CmsDbContext dbc, CmsProject project) throws CmsRoleViolationException { boolean hasRole = false; try { if (hasRole(dbc, dbc.currentUser(), CmsRole.ROOT_ADMIN)) { return; } hasRole = m_driverManager.getAllManageableProjects( dbc, m_driverManager.readOrganizationalUnit(dbc, project.getOuFqn()), false).contains(project); } catch (CmsException e) { // should never happen if (LOG.isErrorEnabled()) { LOG.error(e.getLocalizedMessage(), e); } } if (!hasRole) { throw new CmsRoleViolationException( org.opencms.security.Messages.get().container( org.opencms.security.Messages.ERR_NOT_MANAGER_OF_PROJECT_2, dbc.currentUser().getName(), dbc.currentProject().getName())); } }
[ "public", "void", "checkManagerOfProjectRole", "(", "CmsDbContext", "dbc", ",", "CmsProject", "project", ")", "throws", "CmsRoleViolationException", "{", "boolean", "hasRole", "=", "false", ";", "try", "{", "if", "(", "hasRole", "(", "dbc", ",", "dbc", ".", "currentUser", "(", ")", ",", "CmsRole", ".", "ROOT_ADMIN", ")", ")", "{", "return", ";", "}", "hasRole", "=", "m_driverManager", ".", "getAllManageableProjects", "(", "dbc", ",", "m_driverManager", ".", "readOrganizationalUnit", "(", "dbc", ",", "project", ".", "getOuFqn", "(", ")", ")", ",", "false", ")", ".", "contains", "(", "project", ")", ";", "}", "catch", "(", "CmsException", "e", ")", "{", "// should never happen", "if", "(", "LOG", ".", "isErrorEnabled", "(", ")", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "}", "if", "(", "!", "hasRole", ")", "{", "throw", "new", "CmsRoleViolationException", "(", "org", ".", "opencms", ".", "security", ".", "Messages", ".", "get", "(", ")", ".", "container", "(", "org", ".", "opencms", ".", "security", ".", "Messages", ".", "ERR_NOT_MANAGER_OF_PROJECT_2", ",", "dbc", ".", "currentUser", "(", ")", ".", "getName", "(", ")", ",", "dbc", ".", "currentProject", "(", ")", ".", "getName", "(", ")", ")", ")", ";", "}", "}" ]
Checks if the current user has management access to the given project.<p> @param dbc the current database context @param project the project to check @throws CmsRoleViolationException if the user does not have the required role permissions
[ "Checks", "if", "the", "current", "user", "has", "management", "access", "to", "the", "given", "project", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L382-L406
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/LimitCharsetValidator.java
LimitCharsetValidator.isValid
@Override public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) { """ {@inheritDoc} check if given string is a valid mail. @see javax.validation.ConstraintValidator#isValid(java.lang.Object, javax.validation.ConstraintValidatorContext) """ if (StringUtils.isEmpty(pvalue)) { return true; } return charsetEncoder.canEncode(pvalue); }
java
@Override public final boolean isValid(final String pvalue, final ConstraintValidatorContext pcontext) { if (StringUtils.isEmpty(pvalue)) { return true; } return charsetEncoder.canEncode(pvalue); }
[ "@", "Override", "public", "final", "boolean", "isValid", "(", "final", "String", "pvalue", ",", "final", "ConstraintValidatorContext", "pcontext", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "pvalue", ")", ")", "{", "return", "true", ";", "}", "return", "charsetEncoder", ".", "canEncode", "(", "pvalue", ")", ";", "}" ]
{@inheritDoc} check if given string is a valid mail. @see javax.validation.ConstraintValidator#isValid(java.lang.Object, javax.validation.ConstraintValidatorContext)
[ "{", "@inheritDoc", "}", "check", "if", "given", "string", "is", "a", "valid", "mail", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/LimitCharsetValidator.java#L57-L63
atomix/catalyst
serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java
Serializer.writeObject
public <T> OutputStream writeObject(T object, OutputStream outputStream) { """ Writes an object to the given output stream. <p> The given object must have a {@link Serializer#register(Class) registered} serializer or implement {@link java.io.Serializable}. If a serializable type ID was provided during registration, the type ID will be written to the given {@link Buffer} in lieu of the class name. Types with no associated type ID will be written to the buffer with a full class name for reference during serialization. <p> Types that implement {@link CatalystSerializable} will be serialized via {@link CatalystSerializable#writeObject(BufferOutput, Serializer)} unless a {@link TypeSerializer} was explicitly registered for the type. <p> Types that implement {@link java.io.Serializable} will be serialized using Java's {@link java.io.ObjectOutputStream}. Types that implement {@link java.io.Externalizable} will be serialized via that interface's methods unless a custom {@link TypeSerializer} has been registered for the type. {@link java.io.Externalizable} types can, however, still take advantage of faster serialization of type IDs. @param object The object to write. @param outputStream The output stream to which to write the object. @param <T> The object type. @return The serialized object. @throws SerializationException If no serializer is registered for the object. @see Serializer#writeObject(Object) """ writeObject(object, new OutputStreamBufferOutput(outputStream)); return outputStream; }
java
public <T> OutputStream writeObject(T object, OutputStream outputStream) { writeObject(object, new OutputStreamBufferOutput(outputStream)); return outputStream; }
[ "public", "<", "T", ">", "OutputStream", "writeObject", "(", "T", "object", ",", "OutputStream", "outputStream", ")", "{", "writeObject", "(", "object", ",", "new", "OutputStreamBufferOutput", "(", "outputStream", ")", ")", ";", "return", "outputStream", ";", "}" ]
Writes an object to the given output stream. <p> The given object must have a {@link Serializer#register(Class) registered} serializer or implement {@link java.io.Serializable}. If a serializable type ID was provided during registration, the type ID will be written to the given {@link Buffer} in lieu of the class name. Types with no associated type ID will be written to the buffer with a full class name for reference during serialization. <p> Types that implement {@link CatalystSerializable} will be serialized via {@link CatalystSerializable#writeObject(BufferOutput, Serializer)} unless a {@link TypeSerializer} was explicitly registered for the type. <p> Types that implement {@link java.io.Serializable} will be serialized using Java's {@link java.io.ObjectOutputStream}. Types that implement {@link java.io.Externalizable} will be serialized via that interface's methods unless a custom {@link TypeSerializer} has been registered for the type. {@link java.io.Externalizable} types can, however, still take advantage of faster serialization of type IDs. @param object The object to write. @param outputStream The output stream to which to write the object. @param <T> The object type. @return The serialized object. @throws SerializationException If no serializer is registered for the object. @see Serializer#writeObject(Object)
[ "Writes", "an", "object", "to", "the", "given", "output", "stream", ".", "<p", ">", "The", "given", "object", "must", "have", "a", "{", "@link", "Serializer#register", "(", "Class", ")", "registered", "}", "serializer", "or", "implement", "{", "@link", "java", ".", "io", ".", "Serializable", "}", ".", "If", "a", "serializable", "type", "ID", "was", "provided", "during", "registration", "the", "type", "ID", "will", "be", "written", "to", "the", "given", "{", "@link", "Buffer", "}", "in", "lieu", "of", "the", "class", "name", ".", "Types", "with", "no", "associated", "type", "ID", "will", "be", "written", "to", "the", "buffer", "with", "a", "full", "class", "name", "for", "reference", "during", "serialization", ".", "<p", ">", "Types", "that", "implement", "{", "@link", "CatalystSerializable", "}", "will", "be", "serialized", "via", "{", "@link", "CatalystSerializable#writeObject", "(", "BufferOutput", "Serializer", ")", "}", "unless", "a", "{", "@link", "TypeSerializer", "}", "was", "explicitly", "registered", "for", "the", "type", ".", "<p", ">", "Types", "that", "implement", "{", "@link", "java", ".", "io", ".", "Serializable", "}", "will", "be", "serialized", "using", "Java", "s", "{", "@link", "java", ".", "io", ".", "ObjectOutputStream", "}", ".", "Types", "that", "implement", "{", "@link", "java", ".", "io", ".", "Externalizable", "}", "will", "be", "serialized", "via", "that", "interface", "s", "methods", "unless", "a", "custom", "{", "@link", "TypeSerializer", "}", "has", "been", "registered", "for", "the", "type", ".", "{", "@link", "java", ".", "io", ".", "Externalizable", "}", "types", "can", "however", "still", "take", "advantage", "of", "faster", "serialization", "of", "type", "IDs", "." ]
train
https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java#L777-L780
undertow-io/undertow
core/src/main/java/io/undertow/protocols/http2/Hpack.java
Hpack.encodeInteger
static void encodeInteger(ByteBuffer source, int value, int n) { """ Encodes an integer in the HPACK prefix format. <p> This method assumes that the buffer has already had the first 8-n bits filled. As such it will modify the last byte that is already present in the buffer, and potentially add more if required @param source The buffer that contains the integer @param value The integer to encode @param n The encoding prefix length """ int twoNminus1 = PREFIX_TABLE[n]; int pos = source.position() - 1; if (value < twoNminus1) { source.put(pos, (byte) (source.get(pos) | value)); } else { source.put(pos, (byte) (source.get(pos) | twoNminus1)); value = value - twoNminus1; while (value >= 128) { source.put((byte) (value % 128 + 128)); value = value / 128; } source.put((byte) value); } }
java
static void encodeInteger(ByteBuffer source, int value, int n) { int twoNminus1 = PREFIX_TABLE[n]; int pos = source.position() - 1; if (value < twoNminus1) { source.put(pos, (byte) (source.get(pos) | value)); } else { source.put(pos, (byte) (source.get(pos) | twoNminus1)); value = value - twoNminus1; while (value >= 128) { source.put((byte) (value % 128 + 128)); value = value / 128; } source.put((byte) value); } }
[ "static", "void", "encodeInteger", "(", "ByteBuffer", "source", ",", "int", "value", ",", "int", "n", ")", "{", "int", "twoNminus1", "=", "PREFIX_TABLE", "[", "n", "]", ";", "int", "pos", "=", "source", ".", "position", "(", ")", "-", "1", ";", "if", "(", "value", "<", "twoNminus1", ")", "{", "source", ".", "put", "(", "pos", ",", "(", "byte", ")", "(", "source", ".", "get", "(", "pos", ")", "|", "value", ")", ")", ";", "}", "else", "{", "source", ".", "put", "(", "pos", ",", "(", "byte", ")", "(", "source", ".", "get", "(", "pos", ")", "|", "twoNminus1", ")", ")", ";", "value", "=", "value", "-", "twoNminus1", ";", "while", "(", "value", ">=", "128", ")", "{", "source", ".", "put", "(", "(", "byte", ")", "(", "value", "%", "128", "+", "128", ")", ")", ";", "value", "=", "value", "/", "128", ";", "}", "source", ".", "put", "(", "(", "byte", ")", "value", ")", ";", "}", "}" ]
Encodes an integer in the HPACK prefix format. <p> This method assumes that the buffer has already had the first 8-n bits filled. As such it will modify the last byte that is already present in the buffer, and potentially add more if required @param source The buffer that contains the integer @param value The integer to encode @param n The encoding prefix length
[ "Encodes", "an", "integer", "in", "the", "HPACK", "prefix", "format", ".", "<p", ">", "This", "method", "assumes", "that", "the", "buffer", "has", "already", "had", "the", "first", "8", "-", "n", "bits", "filled", ".", "As", "such", "it", "will", "modify", "the", "last", "byte", "that", "is", "already", "present", "in", "the", "buffer", "and", "potentially", "add", "more", "if", "required" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/protocols/http2/Hpack.java#L200-L214
wildfly/wildfly-maven-plugin
plugin/src/main/java/org/wildfly/plugin/repository/ArtifactNameBuilder.java
ArtifactNameBuilder.forRuntime
public static ArtifactNameBuilder forRuntime(final String artifact) { """ Creates an artifact builder based on the artifact. <p> If the {@link #setGroupId(String) groupId}, {@link #setArtifactId(String) artifactId}, {@link #setPackaging(String) packaging} or {@link #setVersion(String) version} is {@code null} defaults will be used. </p> @param artifact the artifact string in the {@code groupId:artifactId:version[:packaging][:classifier]} format or {@code null} @return a new builder """ return new ArtifactNameBuilder(artifact) { @Override public ArtifactName build() { final ArtifactName delegate = super.build(); String groupId = delegate.getGroupId(); if (groupId == null) { groupId = WILDFLY_GROUP_ID; } String artifactId = delegate.getArtifactId(); if (artifactId == null) { artifactId = WILDFLY_ARTIFACT_ID; } String packaging = delegate.getPackaging(); if (packaging == null) { packaging = WILDFLY_PACKAGING; } String version = delegate.getVersion(); if (version == null) { version = Runtimes.getLatestFinal(groupId, artifactId); } return new ArtifactNameImpl(groupId, artifactId, delegate.getClassifier(), packaging, version); } }; }
java
public static ArtifactNameBuilder forRuntime(final String artifact) { return new ArtifactNameBuilder(artifact) { @Override public ArtifactName build() { final ArtifactName delegate = super.build(); String groupId = delegate.getGroupId(); if (groupId == null) { groupId = WILDFLY_GROUP_ID; } String artifactId = delegate.getArtifactId(); if (artifactId == null) { artifactId = WILDFLY_ARTIFACT_ID; } String packaging = delegate.getPackaging(); if (packaging == null) { packaging = WILDFLY_PACKAGING; } String version = delegate.getVersion(); if (version == null) { version = Runtimes.getLatestFinal(groupId, artifactId); } return new ArtifactNameImpl(groupId, artifactId, delegate.getClassifier(), packaging, version); } }; }
[ "public", "static", "ArtifactNameBuilder", "forRuntime", "(", "final", "String", "artifact", ")", "{", "return", "new", "ArtifactNameBuilder", "(", "artifact", ")", "{", "@", "Override", "public", "ArtifactName", "build", "(", ")", "{", "final", "ArtifactName", "delegate", "=", "super", ".", "build", "(", ")", ";", "String", "groupId", "=", "delegate", ".", "getGroupId", "(", ")", ";", "if", "(", "groupId", "==", "null", ")", "{", "groupId", "=", "WILDFLY_GROUP_ID", ";", "}", "String", "artifactId", "=", "delegate", ".", "getArtifactId", "(", ")", ";", "if", "(", "artifactId", "==", "null", ")", "{", "artifactId", "=", "WILDFLY_ARTIFACT_ID", ";", "}", "String", "packaging", "=", "delegate", ".", "getPackaging", "(", ")", ";", "if", "(", "packaging", "==", "null", ")", "{", "packaging", "=", "WILDFLY_PACKAGING", ";", "}", "String", "version", "=", "delegate", ".", "getVersion", "(", ")", ";", "if", "(", "version", "==", "null", ")", "{", "version", "=", "Runtimes", ".", "getLatestFinal", "(", "groupId", ",", "artifactId", ")", ";", "}", "return", "new", "ArtifactNameImpl", "(", "groupId", ",", "artifactId", ",", "delegate", ".", "getClassifier", "(", ")", ",", "packaging", ",", "version", ")", ";", "}", "}", ";", "}" ]
Creates an artifact builder based on the artifact. <p> If the {@link #setGroupId(String) groupId}, {@link #setArtifactId(String) artifactId}, {@link #setPackaging(String) packaging} or {@link #setVersion(String) version} is {@code null} defaults will be used. </p> @param artifact the artifact string in the {@code groupId:artifactId:version[:packaging][:classifier]} format or {@code null} @return a new builder
[ "Creates", "an", "artifact", "builder", "based", "on", "the", "artifact", ".", "<p", ">", "If", "the", "{", "@link", "#setGroupId", "(", "String", ")", "groupId", "}", "{", "@link", "#setArtifactId", "(", "String", ")", "artifactId", "}", "{", "@link", "#setPackaging", "(", "String", ")", "packaging", "}", "or", "{", "@link", "#setVersion", "(", "String", ")", "version", "}", "is", "{", "@code", "null", "}", "defaults", "will", "be", "used", ".", "<", "/", "p", ">" ]
train
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/plugin/src/main/java/org/wildfly/plugin/repository/ArtifactNameBuilder.java#L81-L105
jmeter-maven-plugin/jmeter-maven-plugin
src/main/java/com/lazerycode/jmeter/configuration/ArtifactHelpers.java
ArtifactHelpers.convertExclusionPatternIntoExclusion
static Exclusion convertExclusionPatternIntoExclusion(String exceptionPattern) throws MojoExecutionException { """ Convert an exclusion pattern into an Exclusion object @param exceptionPattern coords pattern in the format <groupId>:<artifactId>[:<extension>][:<classifier>] @return Exclusion object @throws MojoExecutionException if coords pattern is invalid """ Matcher matcher = COORDINATE_PATTERN.matcher(exceptionPattern); if (!matcher.matches()) { throw new MojoExecutionException(String.format("Bad artifact coordinates %s, expected format is <groupId>:<artifactId>[:<extension>][:<classifier>]", exceptionPattern)); } return new Exclusion(matcher.group(1), matcher.group(2), matcher.group(4), matcher.group(6)); }
java
static Exclusion convertExclusionPatternIntoExclusion(String exceptionPattern) throws MojoExecutionException { Matcher matcher = COORDINATE_PATTERN.matcher(exceptionPattern); if (!matcher.matches()) { throw new MojoExecutionException(String.format("Bad artifact coordinates %s, expected format is <groupId>:<artifactId>[:<extension>][:<classifier>]", exceptionPattern)); } return new Exclusion(matcher.group(1), matcher.group(2), matcher.group(4), matcher.group(6)); }
[ "static", "Exclusion", "convertExclusionPatternIntoExclusion", "(", "String", "exceptionPattern", ")", "throws", "MojoExecutionException", "{", "Matcher", "matcher", "=", "COORDINATE_PATTERN", ".", "matcher", "(", "exceptionPattern", ")", ";", "if", "(", "!", "matcher", ".", "matches", "(", ")", ")", "{", "throw", "new", "MojoExecutionException", "(", "String", ".", "format", "(", "\"Bad artifact coordinates %s, expected format is <groupId>:<artifactId>[:<extension>][:<classifier>]\"", ",", "exceptionPattern", ")", ")", ";", "}", "return", "new", "Exclusion", "(", "matcher", ".", "group", "(", "1", ")", ",", "matcher", ".", "group", "(", "2", ")", ",", "matcher", ".", "group", "(", "4", ")", ",", "matcher", ".", "group", "(", "6", ")", ")", ";", "}" ]
Convert an exclusion pattern into an Exclusion object @param exceptionPattern coords pattern in the format <groupId>:<artifactId>[:<extension>][:<classifier>] @return Exclusion object @throws MojoExecutionException if coords pattern is invalid
[ "Convert", "an", "exclusion", "pattern", "into", "an", "Exclusion", "object" ]
train
https://github.com/jmeter-maven-plugin/jmeter-maven-plugin/blob/63dc8b49cc6b9542deb681e25a2ada6025ddbf6b/src/main/java/com/lazerycode/jmeter/configuration/ArtifactHelpers.java#L84-L91
ravendb/ravendb-jvm-client
src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java
AbstractDocumentQuery._search
@Override public void _search(String fieldName, String searchTerms) { """ Perform a search for documents which fields that match the searchTerms. If there is more than a single term, each of them will be checked independently. @param fieldName Field name @param searchTerms Search terms """ _search(fieldName, searchTerms, SearchOperator.OR); }
java
@Override public void _search(String fieldName, String searchTerms) { _search(fieldName, searchTerms, SearchOperator.OR); }
[ "@", "Override", "public", "void", "_search", "(", "String", "fieldName", ",", "String", "searchTerms", ")", "{", "_search", "(", "fieldName", ",", "searchTerms", ",", "SearchOperator", ".", "OR", ")", ";", "}" ]
Perform a search for documents which fields that match the searchTerms. If there is more than a single term, each of them will be checked independently. @param fieldName Field name @param searchTerms Search terms
[ "Perform", "a", "search", "for", "documents", "which", "fields", "that", "match", "the", "searchTerms", ".", "If", "there", "is", "more", "than", "a", "single", "term", "each", "of", "them", "will", "be", "checked", "independently", "." ]
train
https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L1022-L1025
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java
SdkUtils.copyStream
public static void copyStream(final InputStream inputStream, final OutputStream outputStream) throws IOException, InterruptedException { """ Utility method to write given inputStream to given outputStream. @param inputStream the inputStream to copy from. @param outputStream the outputStream to write to. @throws IOException thrown if there was a problem reading from inputStream or writing to outputStream. @throws InterruptedException thrown if the thread is interrupted which indicates cancelling. """ copyStream(inputStream, outputStream, null); }
java
public static void copyStream(final InputStream inputStream, final OutputStream outputStream) throws IOException, InterruptedException { copyStream(inputStream, outputStream, null); }
[ "public", "static", "void", "copyStream", "(", "final", "InputStream", "inputStream", ",", "final", "OutputStream", "outputStream", ")", "throws", "IOException", ",", "InterruptedException", "{", "copyStream", "(", "inputStream", ",", "outputStream", ",", "null", ")", ";", "}" ]
Utility method to write given inputStream to given outputStream. @param inputStream the inputStream to copy from. @param outputStream the outputStream to write to. @throws IOException thrown if there was a problem reading from inputStream or writing to outputStream. @throws InterruptedException thrown if the thread is interrupted which indicates cancelling.
[ "Utility", "method", "to", "write", "given", "inputStream", "to", "given", "outputStream", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java#L74-L77
gallandarakhneorg/afc
maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java
AbstractArakhneMojo.dirCopy
public final void dirCopy(File in, File out, boolean skipHiddenFiles) throws IOException { """ Copy a directory. @param in input directory. @param out output directory. @param skipHiddenFiles indicates if the hidden files should be ignored. @throws IOException on error. @since 3.3 """ assert in != null; assert out != null; getLog().debug(in.toString() + "->" + out.toString()); //$NON-NLS-1$ getLog().debug("Ignore hidden files: " + skipHiddenFiles); //$NON-NLS-1$ out.mkdirs(); final LinkedList<File> candidates = new LinkedList<>(); candidates.add(in); File[] children; while (!candidates.isEmpty()) { final File f = candidates.removeFirst(); getLog().debug("Scanning: " + f); //$NON-NLS-1$ if (f.isDirectory()) { children = f.listFiles(); if (children != null && children.length > 0) { // Non empty directory for (final File c : children) { if (!skipHiddenFiles || !c.isHidden()) { getLog().debug("Discovering: " + c); //$NON-NLS-1$ candidates.add(c); } } } } else { // not a directory final File targetFile = toOutput(in, f, out); targetFile.getParentFile().mkdirs(); fileCopy(f, targetFile); } } }
java
public final void dirCopy(File in, File out, boolean skipHiddenFiles) throws IOException { assert in != null; assert out != null; getLog().debug(in.toString() + "->" + out.toString()); //$NON-NLS-1$ getLog().debug("Ignore hidden files: " + skipHiddenFiles); //$NON-NLS-1$ out.mkdirs(); final LinkedList<File> candidates = new LinkedList<>(); candidates.add(in); File[] children; while (!candidates.isEmpty()) { final File f = candidates.removeFirst(); getLog().debug("Scanning: " + f); //$NON-NLS-1$ if (f.isDirectory()) { children = f.listFiles(); if (children != null && children.length > 0) { // Non empty directory for (final File c : children) { if (!skipHiddenFiles || !c.isHidden()) { getLog().debug("Discovering: " + c); //$NON-NLS-1$ candidates.add(c); } } } } else { // not a directory final File targetFile = toOutput(in, f, out); targetFile.getParentFile().mkdirs(); fileCopy(f, targetFile); } } }
[ "public", "final", "void", "dirCopy", "(", "File", "in", ",", "File", "out", ",", "boolean", "skipHiddenFiles", ")", "throws", "IOException", "{", "assert", "in", "!=", "null", ";", "assert", "out", "!=", "null", ";", "getLog", "(", ")", ".", "debug", "(", "in", ".", "toString", "(", ")", "+", "\"->\"", "+", "out", ".", "toString", "(", ")", ")", ";", "//$NON-NLS-1$", "getLog", "(", ")", ".", "debug", "(", "\"Ignore hidden files: \"", "+", "skipHiddenFiles", ")", ";", "//$NON-NLS-1$", "out", ".", "mkdirs", "(", ")", ";", "final", "LinkedList", "<", "File", ">", "candidates", "=", "new", "LinkedList", "<>", "(", ")", ";", "candidates", ".", "add", "(", "in", ")", ";", "File", "[", "]", "children", ";", "while", "(", "!", "candidates", ".", "isEmpty", "(", ")", ")", "{", "final", "File", "f", "=", "candidates", ".", "removeFirst", "(", ")", ";", "getLog", "(", ")", ".", "debug", "(", "\"Scanning: \"", "+", "f", ")", ";", "//$NON-NLS-1$", "if", "(", "f", ".", "isDirectory", "(", ")", ")", "{", "children", "=", "f", ".", "listFiles", "(", ")", ";", "if", "(", "children", "!=", "null", "&&", "children", ".", "length", ">", "0", ")", "{", "// Non empty directory", "for", "(", "final", "File", "c", ":", "children", ")", "{", "if", "(", "!", "skipHiddenFiles", "||", "!", "c", ".", "isHidden", "(", ")", ")", "{", "getLog", "(", ")", ".", "debug", "(", "\"Discovering: \"", "+", "c", ")", ";", "//$NON-NLS-1$", "candidates", ".", "add", "(", "c", ")", ";", "}", "}", "}", "}", "else", "{", "// not a directory", "final", "File", "targetFile", "=", "toOutput", "(", "in", ",", "f", ",", "out", ")", ";", "targetFile", ".", "getParentFile", "(", ")", ".", "mkdirs", "(", ")", ";", "fileCopy", "(", "f", ",", "targetFile", ")", ";", "}", "}", "}" ]
Copy a directory. @param in input directory. @param out output directory. @param skipHiddenFiles indicates if the hidden files should be ignored. @throws IOException on error. @since 3.3
[ "Copy", "a", "directory", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L240-L270
knowm/XChange
xchange-exx/src/main/java/org/knowm/xchange/exx/EXXAdapters.java
EXXAdapters.adaptOrderBook
public static OrderBook adaptOrderBook(EXXOrderbook exxOrderbook, CurrencyPair currencyPair) { """ Adapts a to a OrderBook Object @param currencyPair (e.g. BTC/USD) @param timeScale polled order books provide a timestamp in seconds, stream in ms @return The XChange OrderBook """ List<LimitOrder> asks = new ArrayList<LimitOrder>(); List<LimitOrder> bids = new ArrayList<LimitOrder>(); for (BigDecimal[] exxAsk : exxOrderbook.getAsks()) { asks.add(new LimitOrder(OrderType.ASK, exxAsk[1], currencyPair, null, null, exxAsk[0])); } for (BigDecimal[] exxBid : exxOrderbook.getBids()) { bids.add(new LimitOrder(OrderType.BID, exxBid[1], currencyPair, null, null, exxBid[0])); } return new OrderBook(new Date(), asks, bids); }
java
public static OrderBook adaptOrderBook(EXXOrderbook exxOrderbook, CurrencyPair currencyPair) { List<LimitOrder> asks = new ArrayList<LimitOrder>(); List<LimitOrder> bids = new ArrayList<LimitOrder>(); for (BigDecimal[] exxAsk : exxOrderbook.getAsks()) { asks.add(new LimitOrder(OrderType.ASK, exxAsk[1], currencyPair, null, null, exxAsk[0])); } for (BigDecimal[] exxBid : exxOrderbook.getBids()) { bids.add(new LimitOrder(OrderType.BID, exxBid[1], currencyPair, null, null, exxBid[0])); } return new OrderBook(new Date(), asks, bids); }
[ "public", "static", "OrderBook", "adaptOrderBook", "(", "EXXOrderbook", "exxOrderbook", ",", "CurrencyPair", "currencyPair", ")", "{", "List", "<", "LimitOrder", ">", "asks", "=", "new", "ArrayList", "<", "LimitOrder", ">", "(", ")", ";", "List", "<", "LimitOrder", ">", "bids", "=", "new", "ArrayList", "<", "LimitOrder", ">", "(", ")", ";", "for", "(", "BigDecimal", "[", "]", "exxAsk", ":", "exxOrderbook", ".", "getAsks", "(", ")", ")", "{", "asks", ".", "add", "(", "new", "LimitOrder", "(", "OrderType", ".", "ASK", ",", "exxAsk", "[", "1", "]", ",", "currencyPair", ",", "null", ",", "null", ",", "exxAsk", "[", "0", "]", ")", ")", ";", "}", "for", "(", "BigDecimal", "[", "]", "exxBid", ":", "exxOrderbook", ".", "getBids", "(", ")", ")", "{", "bids", ".", "add", "(", "new", "LimitOrder", "(", "OrderType", ".", "BID", ",", "exxBid", "[", "1", "]", ",", "currencyPair", ",", "null", ",", "null", ",", "exxBid", "[", "0", "]", ")", ")", ";", "}", "return", "new", "OrderBook", "(", "new", "Date", "(", ")", ",", "asks", ",", "bids", ")", ";", "}" ]
Adapts a to a OrderBook Object @param currencyPair (e.g. BTC/USD) @param timeScale polled order books provide a timestamp in seconds, stream in ms @return The XChange OrderBook
[ "Adapts", "a", "to", "a", "OrderBook", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-exx/src/main/java/org/knowm/xchange/exx/EXXAdapters.java#L113-L126
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsNullableType
public <T> T getAsNullableType(Class<T> type, String key) { """ Converts map element into a value defined by specied typecode. If conversion is not possible it returns null. @param type the Class type that defined the type of the result @param key a key of element to get. @return element value defined by the typecode or null if conversion is not supported. @see TypeConverter#toNullableType(Class, Object) """ Object value = getAsObject(key); return TypeConverter.toNullableType(type, value); }
java
public <T> T getAsNullableType(Class<T> type, String key) { Object value = getAsObject(key); return TypeConverter.toNullableType(type, value); }
[ "public", "<", "T", ">", "T", "getAsNullableType", "(", "Class", "<", "T", ">", "type", ",", "String", "key", ")", "{", "Object", "value", "=", "getAsObject", "(", "key", ")", ";", "return", "TypeConverter", ".", "toNullableType", "(", "type", ",", "value", ")", ";", "}" ]
Converts map element into a value defined by specied typecode. If conversion is not possible it returns null. @param type the Class type that defined the type of the result @param key a key of element to get. @return element value defined by the typecode or null if conversion is not supported. @see TypeConverter#toNullableType(Class, Object)
[ "Converts", "map", "element", "into", "a", "value", "defined", "by", "specied", "typecode", ".", "If", "conversion", "is", "not", "possible", "it", "returns", "null", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L463-L466
iipc/openwayback-access-control
access-control/src/main/java/org/archive/accesscontrol/robotstxt/RobotClient.java
RobotClient.isRobotPermitted
public boolean isRobotPermitted(String url, String userAgent) throws IOException, RobotsUnavailableException { """ Returns true if a robot with the given user-agent is allowed to access the given url. @param url @param userAgent @return @throws IOException @throws RobotsUnavailableException """ RobotRules rules = getRulesForUrl(url, userAgent); return !rules.blocksPathForUA(new LaxURI(url, false).getPath(), userAgent); }
java
public boolean isRobotPermitted(String url, String userAgent) throws IOException, RobotsUnavailableException { RobotRules rules = getRulesForUrl(url, userAgent); return !rules.blocksPathForUA(new LaxURI(url, false).getPath(), userAgent); }
[ "public", "boolean", "isRobotPermitted", "(", "String", "url", ",", "String", "userAgent", ")", "throws", "IOException", ",", "RobotsUnavailableException", "{", "RobotRules", "rules", "=", "getRulesForUrl", "(", "url", ",", "userAgent", ")", ";", "return", "!", "rules", ".", "blocksPathForUA", "(", "new", "LaxURI", "(", "url", ",", "false", ")", ".", "getPath", "(", ")", ",", "userAgent", ")", ";", "}" ]
Returns true if a robot with the given user-agent is allowed to access the given url. @param url @param userAgent @return @throws IOException @throws RobotsUnavailableException
[ "Returns", "true", "if", "a", "robot", "with", "the", "given", "user", "-", "agent", "is", "allowed", "to", "access", "the", "given", "url", "." ]
train
https://github.com/iipc/openwayback-access-control/blob/4a0f70f200fd8d7b6e313624b7628656d834bf31/access-control/src/main/java/org/archive/accesscontrol/robotstxt/RobotClient.java#L27-L32
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java
JdbcEndpointAdapterController.openConnection
@Override public void openConnection(Map<String, String> properties) throws JdbcServerException { """ Opens the connection with the given properties @param properties The properties to open the connection with @throws JdbcServerException In case that the maximum connections have been reached """ if (!endpointConfiguration.isAutoConnect()) { List<OpenConnection.Property> propertyList = convertToPropertyList(properties); handleMessageAndCheckResponse(JdbcMessage.openConnection(propertyList)); } if (connections.get() == endpointConfiguration.getServerConfiguration().getMaxConnections()) { throw new JdbcServerException(String.format("Maximum number of connections (%s) reached", endpointConfiguration.getServerConfiguration().getMaxConnections())); } connections.incrementAndGet(); }
java
@Override public void openConnection(Map<String, String> properties) throws JdbcServerException { if (!endpointConfiguration.isAutoConnect()) { List<OpenConnection.Property> propertyList = convertToPropertyList(properties); handleMessageAndCheckResponse(JdbcMessage.openConnection(propertyList)); } if (connections.get() == endpointConfiguration.getServerConfiguration().getMaxConnections()) { throw new JdbcServerException(String.format("Maximum number of connections (%s) reached", endpointConfiguration.getServerConfiguration().getMaxConnections())); } connections.incrementAndGet(); }
[ "@", "Override", "public", "void", "openConnection", "(", "Map", "<", "String", ",", "String", ">", "properties", ")", "throws", "JdbcServerException", "{", "if", "(", "!", "endpointConfiguration", ".", "isAutoConnect", "(", ")", ")", "{", "List", "<", "OpenConnection", ".", "Property", ">", "propertyList", "=", "convertToPropertyList", "(", "properties", ")", ";", "handleMessageAndCheckResponse", "(", "JdbcMessage", ".", "openConnection", "(", "propertyList", ")", ")", ";", "}", "if", "(", "connections", ".", "get", "(", ")", "==", "endpointConfiguration", ".", "getServerConfiguration", "(", ")", ".", "getMaxConnections", "(", ")", ")", "{", "throw", "new", "JdbcServerException", "(", "String", ".", "format", "(", "\"Maximum number of connections (%s) reached\"", ",", "endpointConfiguration", ".", "getServerConfiguration", "(", ")", ".", "getMaxConnections", "(", ")", ")", ")", ";", "}", "connections", ".", "incrementAndGet", "(", ")", ";", "}" ]
Opens the connection with the given properties @param properties The properties to open the connection with @throws JdbcServerException In case that the maximum connections have been reached
[ "Opens", "the", "connection", "with", "the", "given", "properties" ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/server/JdbcEndpointAdapterController.java#L134-L147
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/rights/UserManager.java
UserManager.getUser
public User getUser(String name, String password) { """ Returns the User object with the specified name and password from this object's set. """ if (name == null) { name = ""; } if (password == null) { password = ""; } User user = get(name); user.checkPassword(password); return user; }
java
public User getUser(String name, String password) { if (name == null) { name = ""; } if (password == null) { password = ""; } User user = get(name); user.checkPassword(password); return user; }
[ "public", "User", "getUser", "(", "String", "name", ",", "String", "password", ")", "{", "if", "(", "name", "==", "null", ")", "{", "name", "=", "\"\"", ";", "}", "if", "(", "password", "==", "null", ")", "{", "password", "=", "\"\"", ";", "}", "User", "user", "=", "get", "(", "name", ")", ";", "user", ".", "checkPassword", "(", "password", ")", ";", "return", "user", ";", "}" ]
Returns the User object with the specified name and password from this object's set.
[ "Returns", "the", "User", "object", "with", "the", "specified", "name", "and", "password", "from", "this", "object", "s", "set", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/rights/UserManager.java#L159-L174
javagl/CommonUI
src/main/java/de/javagl/common/ui/table/CustomizedTableHeader.java
CustomizedTableHeader.setDefaultRenderer
@Override public void setDefaultRenderer(TableCellRenderer defaultRenderer) { """ {@inheritDoc} <br> <br> <b>Note:</b> This method is overridden in the CustomizedTableHeader. It will internally combine the given renderer with the one that reserves the space for the custom components. This means that calling {@link #getDefaultRenderer()} will return a different renderer than the one that was passed to this call. """ if (spaceRenderer != null) { CompoundTableCellRenderer renderer = new CompoundTableCellRenderer(spaceRenderer, defaultRenderer); super.setDefaultRenderer(renderer); } else { super.setDefaultRenderer(defaultRenderer); } }
java
@Override public void setDefaultRenderer(TableCellRenderer defaultRenderer) { if (spaceRenderer != null) { CompoundTableCellRenderer renderer = new CompoundTableCellRenderer(spaceRenderer, defaultRenderer); super.setDefaultRenderer(renderer); } else { super.setDefaultRenderer(defaultRenderer); } }
[ "@", "Override", "public", "void", "setDefaultRenderer", "(", "TableCellRenderer", "defaultRenderer", ")", "{", "if", "(", "spaceRenderer", "!=", "null", ")", "{", "CompoundTableCellRenderer", "renderer", "=", "new", "CompoundTableCellRenderer", "(", "spaceRenderer", ",", "defaultRenderer", ")", ";", "super", ".", "setDefaultRenderer", "(", "renderer", ")", ";", "}", "else", "{", "super", ".", "setDefaultRenderer", "(", "defaultRenderer", ")", ";", "}", "}" ]
{@inheritDoc} <br> <br> <b>Note:</b> This method is overridden in the CustomizedTableHeader. It will internally combine the given renderer with the one that reserves the space for the custom components. This means that calling {@link #getDefaultRenderer()} will return a different renderer than the one that was passed to this call.
[ "{" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/table/CustomizedTableHeader.java#L222-L235
helun/Ektorp
org.ektorp/src/main/java/org/ektorp/support/DesignDocument.java
DesignDocument.mergeWith
public boolean mergeWith(DesignDocument dd, boolean updateOnDiff) { """ Merge this design document with the specified document, the result being stored in this design document. @param dd the design document to merge with @param updateOnDiff true to overwrite existing views/functions in this document with the views/functions in the specified document; false will only add new views/functions. @return true if there was any modification to this document, false otherwise. """ boolean changed = mergeViews(dd.views(), updateOnDiff); changed = mergeFunctions(lists(), dd.lists(), updateOnDiff) || changed; changed = mergeFunctions(shows(), dd.shows(), updateOnDiff) || changed; changed = mergeFunctions(filters(), dd.filters(), updateOnDiff) || changed; changed = mergeFunctions(updates(), dd.updates(), updateOnDiff) || changed; return changed; }
java
public boolean mergeWith(DesignDocument dd, boolean updateOnDiff) { boolean changed = mergeViews(dd.views(), updateOnDiff); changed = mergeFunctions(lists(), dd.lists(), updateOnDiff) || changed; changed = mergeFunctions(shows(), dd.shows(), updateOnDiff) || changed; changed = mergeFunctions(filters(), dd.filters(), updateOnDiff) || changed; changed = mergeFunctions(updates(), dd.updates(), updateOnDiff) || changed; return changed; }
[ "public", "boolean", "mergeWith", "(", "DesignDocument", "dd", ",", "boolean", "updateOnDiff", ")", "{", "boolean", "changed", "=", "mergeViews", "(", "dd", ".", "views", "(", ")", ",", "updateOnDiff", ")", ";", "changed", "=", "mergeFunctions", "(", "lists", "(", ")", ",", "dd", ".", "lists", "(", ")", ",", "updateOnDiff", ")", "||", "changed", ";", "changed", "=", "mergeFunctions", "(", "shows", "(", ")", ",", "dd", ".", "shows", "(", ")", ",", "updateOnDiff", ")", "||", "changed", ";", "changed", "=", "mergeFunctions", "(", "filters", "(", ")", ",", "dd", ".", "filters", "(", ")", ",", "updateOnDiff", ")", "||", "changed", ";", "changed", "=", "mergeFunctions", "(", "updates", "(", ")", ",", "dd", ".", "updates", "(", ")", ",", "updateOnDiff", ")", "||", "changed", ";", "return", "changed", ";", "}" ]
Merge this design document with the specified document, the result being stored in this design document. @param dd the design document to merge with @param updateOnDiff true to overwrite existing views/functions in this document with the views/functions in the specified document; false will only add new views/functions. @return true if there was any modification to this document, false otherwise.
[ "Merge", "this", "design", "document", "with", "the", "specified", "document", "the", "result", "being", "stored", "in", "this", "design", "document", "." ]
train
https://github.com/helun/Ektorp/blob/b822c0d656aefb90a5e0cb5ec2de3daa969e3eaa/org.ektorp/src/main/java/org/ektorp/support/DesignDocument.java#L199-L206
jenkinsci/jenkins
core/src/main/java/hudson/Util.java
Util.createFileSet
@Nonnull public static FileSet createFileSet(@Nonnull File baseDir, @Nonnull String includes, @CheckForNull String excludes) { """ Creates Ant {@link FileSet} with the base dir and include pattern. <p> The difference with this and using {@link FileSet#setIncludes(String)} is that this method doesn't treat whitespace as a pattern separator, which makes it impossible to use space in the file path. @param includes String like "foo/bar/*.xml" Multiple patterns can be separated by ',', and whitespace can surround ',' (so that you can write "abc, def" and "abc,def" to mean the same thing. @param excludes Exclusion pattern. Follows the same format as the 'includes' parameter. Can be null. @since 1.172 """ FileSet fs = new FileSet(); fs.setDir(baseDir); fs.setProject(new Project()); StringTokenizer tokens; tokens = new StringTokenizer(includes,","); while(tokens.hasMoreTokens()) { String token = tokens.nextToken().trim(); fs.createInclude().setName(token); } if(excludes!=null) { tokens = new StringTokenizer(excludes,","); while(tokens.hasMoreTokens()) { String token = tokens.nextToken().trim(); fs.createExclude().setName(token); } } return fs; }
java
@Nonnull public static FileSet createFileSet(@Nonnull File baseDir, @Nonnull String includes, @CheckForNull String excludes) { FileSet fs = new FileSet(); fs.setDir(baseDir); fs.setProject(new Project()); StringTokenizer tokens; tokens = new StringTokenizer(includes,","); while(tokens.hasMoreTokens()) { String token = tokens.nextToken().trim(); fs.createInclude().setName(token); } if(excludes!=null) { tokens = new StringTokenizer(excludes,","); while(tokens.hasMoreTokens()) { String token = tokens.nextToken().trim(); fs.createExclude().setName(token); } } return fs; }
[ "@", "Nonnull", "public", "static", "FileSet", "createFileSet", "(", "@", "Nonnull", "File", "baseDir", ",", "@", "Nonnull", "String", "includes", ",", "@", "CheckForNull", "String", "excludes", ")", "{", "FileSet", "fs", "=", "new", "FileSet", "(", ")", ";", "fs", ".", "setDir", "(", "baseDir", ")", ";", "fs", ".", "setProject", "(", "new", "Project", "(", ")", ")", ";", "StringTokenizer", "tokens", ";", "tokens", "=", "new", "StringTokenizer", "(", "includes", ",", "\",\"", ")", ";", "while", "(", "tokens", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "token", "=", "tokens", ".", "nextToken", "(", ")", ".", "trim", "(", ")", ";", "fs", ".", "createInclude", "(", ")", ".", "setName", "(", "token", ")", ";", "}", "if", "(", "excludes", "!=", "null", ")", "{", "tokens", "=", "new", "StringTokenizer", "(", "excludes", ",", "\",\"", ")", ";", "while", "(", "tokens", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "token", "=", "tokens", ".", "nextToken", "(", ")", ".", "trim", "(", ")", ";", "fs", ".", "createExclude", "(", ")", ".", "setName", "(", "token", ")", ";", "}", "}", "return", "fs", ";", "}" ]
Creates Ant {@link FileSet} with the base dir and include pattern. <p> The difference with this and using {@link FileSet#setIncludes(String)} is that this method doesn't treat whitespace as a pattern separator, which makes it impossible to use space in the file path. @param includes String like "foo/bar/*.xml" Multiple patterns can be separated by ',', and whitespace can surround ',' (so that you can write "abc, def" and "abc,def" to mean the same thing. @param excludes Exclusion pattern. Follows the same format as the 'includes' parameter. Can be null. @since 1.172
[ "Creates", "Ant", "{", "@link", "FileSet", "}", "with", "the", "base", "dir", "and", "include", "pattern", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Util.java#L1143-L1164
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/stat/ImageLocalNormalization.java
ImageLocalNormalization.zeroMeanStdOne
public void zeroMeanStdOne( int radius , T input , double maxPixelValue , double delta , T output ) { """ /* <p>Normalizes the input image such that local statics are a zero mean and with standard deviation of 1. The image border is handled by truncating the kernel and renormalizing it so that it's sum is still one.</p> <p>output[x,y] = (input[x,y]-mean[x,y])/(stdev[x,y] + delta)</p> @param input Input image @param maxPixelValue maximum value of a pixel element in the input image. -1 = compute max value. Typically this is 255 or 1. @param delta A small value used to avoid divide by zero errors. Typical 1e-4f for 32 bit and 1e-8 for 64bit @param output Storage for output """ // check preconditions and initialize data structures initialize(input, output); // avoid overflow issues by ensuring that the max pixel value is 1 T adjusted = ensureMaxValueOfOne(input, maxPixelValue); // take advantage of 2D gaussian kernels being separable if( border == null ) { WorkArrays work = GeneralizedImageOps.createWorkArray(input.getImageType()); GBlurImageOps.mean(adjusted, localMean, radius, output, work); GPixelMath.pow2(adjusted, pow2); GBlurImageOps.mean(pow2, localPow2, radius, output, work); } else { throw new IllegalArgumentException("Only renormalize border supported here so far. This can be changed..."); } // Compute the final output if( imageType == GrayF32.class ) computeOutput((GrayF32)input, (float)delta, (GrayF32)output, (GrayF32)adjusted); else computeOutput((GrayF64)input, delta, (GrayF64)output, (GrayF64)adjusted); }
java
public void zeroMeanStdOne( int radius , T input , double maxPixelValue , double delta , T output ) { // check preconditions and initialize data structures initialize(input, output); // avoid overflow issues by ensuring that the max pixel value is 1 T adjusted = ensureMaxValueOfOne(input, maxPixelValue); // take advantage of 2D gaussian kernels being separable if( border == null ) { WorkArrays work = GeneralizedImageOps.createWorkArray(input.getImageType()); GBlurImageOps.mean(adjusted, localMean, radius, output, work); GPixelMath.pow2(adjusted, pow2); GBlurImageOps.mean(pow2, localPow2, radius, output, work); } else { throw new IllegalArgumentException("Only renormalize border supported here so far. This can be changed..."); } // Compute the final output if( imageType == GrayF32.class ) computeOutput((GrayF32)input, (float)delta, (GrayF32)output, (GrayF32)adjusted); else computeOutput((GrayF64)input, delta, (GrayF64)output, (GrayF64)adjusted); }
[ "public", "void", "zeroMeanStdOne", "(", "int", "radius", ",", "T", "input", ",", "double", "maxPixelValue", ",", "double", "delta", ",", "T", "output", ")", "{", "// check preconditions and initialize data structures", "initialize", "(", "input", ",", "output", ")", ";", "// avoid overflow issues by ensuring that the max pixel value is 1", "T", "adjusted", "=", "ensureMaxValueOfOne", "(", "input", ",", "maxPixelValue", ")", ";", "// take advantage of 2D gaussian kernels being separable", "if", "(", "border", "==", "null", ")", "{", "WorkArrays", "work", "=", "GeneralizedImageOps", ".", "createWorkArray", "(", "input", ".", "getImageType", "(", ")", ")", ";", "GBlurImageOps", ".", "mean", "(", "adjusted", ",", "localMean", ",", "radius", ",", "output", ",", "work", ")", ";", "GPixelMath", ".", "pow2", "(", "adjusted", ",", "pow2", ")", ";", "GBlurImageOps", ".", "mean", "(", "pow2", ",", "localPow2", ",", "radius", ",", "output", ",", "work", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Only renormalize border supported here so far. This can be changed...\"", ")", ";", "}", "// Compute the final output", "if", "(", "imageType", "==", "GrayF32", ".", "class", ")", "computeOutput", "(", "(", "GrayF32", ")", "input", ",", "(", "float", ")", "delta", ",", "(", "GrayF32", ")", "output", ",", "(", "GrayF32", ")", "adjusted", ")", ";", "else", "computeOutput", "(", "(", "GrayF64", ")", "input", ",", "delta", ",", "(", "GrayF64", ")", "output", ",", "(", "GrayF64", ")", "adjusted", ")", ";", "}" ]
/* <p>Normalizes the input image such that local statics are a zero mean and with standard deviation of 1. The image border is handled by truncating the kernel and renormalizing it so that it's sum is still one.</p> <p>output[x,y] = (input[x,y]-mean[x,y])/(stdev[x,y] + delta)</p> @param input Input image @param maxPixelValue maximum value of a pixel element in the input image. -1 = compute max value. Typically this is 255 or 1. @param delta A small value used to avoid divide by zero errors. Typical 1e-4f for 32 bit and 1e-8 for 64bit @param output Storage for output
[ "/", "*", "<p", ">", "Normalizes", "the", "input", "image", "such", "that", "local", "statics", "are", "a", "zero", "mean", "and", "with", "standard", "deviation", "of", "1", ".", "The", "image", "border", "is", "handled", "by", "truncating", "the", "kernel", "and", "renormalizing", "it", "so", "that", "it", "s", "sum", "is", "still", "one", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/stat/ImageLocalNormalization.java#L132-L154
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANCountryData.java
IBANCountryData.parseToElementValues
@Nonnull @ReturnsMutableCopy public ICommonsList <IBANElementValue> parseToElementValues (@Nonnull final String sIBAN) { """ Parse a given IBAN number string and convert it to elements according to this country's definition of IBAN numbers. @param sIBAN The IBAN number string to parse. May not be <code>null</code>. @return The list of parsed elements. """ ValueEnforcer.notNull (sIBAN, "IBANString"); final String sRealIBAN = IBANManager.unifyIBAN (sIBAN); if (sRealIBAN.length () != m_nExpectedLength) throw new IllegalArgumentException ("Passed IBAN has an invalid length. Expected " + m_nExpectedLength + " but found " + sRealIBAN.length ()); final ICommonsList <IBANElementValue> ret = new CommonsArrayList <> (m_aElements.size ()); int nIndex = 0; for (final IBANElement aElement : m_aElements) { final String sIBANPart = sRealIBAN.substring (nIndex, nIndex + aElement.getLength ()); ret.add (new IBANElementValue (aElement, sIBANPart)); nIndex += aElement.getLength (); } return ret; }
java
@Nonnull @ReturnsMutableCopy public ICommonsList <IBANElementValue> parseToElementValues (@Nonnull final String sIBAN) { ValueEnforcer.notNull (sIBAN, "IBANString"); final String sRealIBAN = IBANManager.unifyIBAN (sIBAN); if (sRealIBAN.length () != m_nExpectedLength) throw new IllegalArgumentException ("Passed IBAN has an invalid length. Expected " + m_nExpectedLength + " but found " + sRealIBAN.length ()); final ICommonsList <IBANElementValue> ret = new CommonsArrayList <> (m_aElements.size ()); int nIndex = 0; for (final IBANElement aElement : m_aElements) { final String sIBANPart = sRealIBAN.substring (nIndex, nIndex + aElement.getLength ()); ret.add (new IBANElementValue (aElement, sIBANPart)); nIndex += aElement.getLength (); } return ret; }
[ "@", "Nonnull", "@", "ReturnsMutableCopy", "public", "ICommonsList", "<", "IBANElementValue", ">", "parseToElementValues", "(", "@", "Nonnull", "final", "String", "sIBAN", ")", "{", "ValueEnforcer", ".", "notNull", "(", "sIBAN", ",", "\"IBANString\"", ")", ";", "final", "String", "sRealIBAN", "=", "IBANManager", ".", "unifyIBAN", "(", "sIBAN", ")", ";", "if", "(", "sRealIBAN", ".", "length", "(", ")", "!=", "m_nExpectedLength", ")", "throw", "new", "IllegalArgumentException", "(", "\"Passed IBAN has an invalid length. Expected \"", "+", "m_nExpectedLength", "+", "\" but found \"", "+", "sRealIBAN", ".", "length", "(", ")", ")", ";", "final", "ICommonsList", "<", "IBANElementValue", ">", "ret", "=", "new", "CommonsArrayList", "<>", "(", "m_aElements", ".", "size", "(", ")", ")", ";", "int", "nIndex", "=", "0", ";", "for", "(", "final", "IBANElement", "aElement", ":", "m_aElements", ")", "{", "final", "String", "sIBANPart", "=", "sRealIBAN", ".", "substring", "(", "nIndex", ",", "nIndex", "+", "aElement", ".", "getLength", "(", ")", ")", ";", "ret", ".", "add", "(", "new", "IBANElementValue", "(", "aElement", ",", "sIBANPart", ")", ")", ";", "nIndex", "+=", "aElement", ".", "getLength", "(", ")", ";", "}", "return", "ret", ";", "}" ]
Parse a given IBAN number string and convert it to elements according to this country's definition of IBAN numbers. @param sIBAN The IBAN number string to parse. May not be <code>null</code>. @return The list of parsed elements.
[ "Parse", "a", "given", "IBAN", "number", "string", "and", "convert", "it", "to", "elements", "according", "to", "this", "country", "s", "definition", "of", "IBAN", "numbers", "." ]
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/swift/IBANCountryData.java#L167-L189
RKumsher/utils
src/main/java/com/github/rkumsher/date/RandomDateUtils.java
RandomDateUtils.randomLocalTime
public static LocalTime randomLocalTime(LocalTime startInclusive, LocalTime endExclusive) { """ Returns a random {@link LocalTime} within the specified range. @param startInclusive the earliest {@link LocalTime} that can be returned @param endExclusive the upper bound (not included) @return the random {@link LocalTime} @throws IllegalArgumentException if startInclusive or endExclusive are null or if endExclusive is earlier than startInclusive """ checkArgument(startInclusive != null, "Start must be non-null"); checkArgument(endExclusive != null, "End must be non-null"); long nanoOfDay = random(NANO_OF_DAY, startInclusive.toNanoOfDay(), endExclusive.toNanoOfDay()); return LocalTime.ofNanoOfDay(nanoOfDay); }
java
public static LocalTime randomLocalTime(LocalTime startInclusive, LocalTime endExclusive) { checkArgument(startInclusive != null, "Start must be non-null"); checkArgument(endExclusive != null, "End must be non-null"); long nanoOfDay = random(NANO_OF_DAY, startInclusive.toNanoOfDay(), endExclusive.toNanoOfDay()); return LocalTime.ofNanoOfDay(nanoOfDay); }
[ "public", "static", "LocalTime", "randomLocalTime", "(", "LocalTime", "startInclusive", ",", "LocalTime", "endExclusive", ")", "{", "checkArgument", "(", "startInclusive", "!=", "null", ",", "\"Start must be non-null\"", ")", ";", "checkArgument", "(", "endExclusive", "!=", "null", ",", "\"End must be non-null\"", ")", ";", "long", "nanoOfDay", "=", "random", "(", "NANO_OF_DAY", ",", "startInclusive", ".", "toNanoOfDay", "(", ")", ",", "endExclusive", ".", "toNanoOfDay", "(", ")", ")", ";", "return", "LocalTime", ".", "ofNanoOfDay", "(", "nanoOfDay", ")", ";", "}" ]
Returns a random {@link LocalTime} within the specified range. @param startInclusive the earliest {@link LocalTime} that can be returned @param endExclusive the upper bound (not included) @return the random {@link LocalTime} @throws IllegalArgumentException if startInclusive or endExclusive are null or if endExclusive is earlier than startInclusive
[ "Returns", "a", "random", "{", "@link", "LocalTime", "}", "within", "the", "specified", "range", "." ]
train
https://github.com/RKumsher/utils/blob/fcdb190569cd0288249bf4b46fd418f8c01d1caf/src/main/java/com/github/rkumsher/date/RandomDateUtils.java#L534-L539
lucee/Lucee
core/src/main/java/lucee/commons/io/res/type/compress/Compress.java
Compress.getInstance
public static Compress getInstance(Resource zipFile, int format, boolean caseSensitive) throws IOException { """ return zip instance matching the zipfile, singelton instance only 1 zip for one file @param zipFile @param format @param caseSensitive @return @throws IOException """ ConfigImpl config = (ConfigImpl) ThreadLocalPageContext.getConfig(); return config.getCompressInstance(zipFile, format, caseSensitive); }
java
public static Compress getInstance(Resource zipFile, int format, boolean caseSensitive) throws IOException { ConfigImpl config = (ConfigImpl) ThreadLocalPageContext.getConfig(); return config.getCompressInstance(zipFile, format, caseSensitive); }
[ "public", "static", "Compress", "getInstance", "(", "Resource", "zipFile", ",", "int", "format", ",", "boolean", "caseSensitive", ")", "throws", "IOException", "{", "ConfigImpl", "config", "=", "(", "ConfigImpl", ")", "ThreadLocalPageContext", ".", "getConfig", "(", ")", ";", "return", "config", ".", "getCompressInstance", "(", "zipFile", ",", "format", ",", "caseSensitive", ")", ";", "}" ]
return zip instance matching the zipfile, singelton instance only 1 zip for one file @param zipFile @param format @param caseSensitive @return @throws IOException
[ "return", "zip", "instance", "matching", "the", "zipfile", "singelton", "instance", "only", "1", "zip", "for", "one", "file" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/compress/Compress.java#L90-L93
GoogleCloudPlatform/appengine-mapreduce
java/src/main/java/com/google/appengine/tools/mapreduce/impl/sort/SortWorker.java
SortWorker.emitCurrentOrLeftover
private void emitCurrentOrLeftover(ByteBuffer key, List<ByteBuffer> values) { """ Writes out the provided key and value list. If the leftover item (which was not included in the sort) is lower lexicographically then it is emitted first. If the values are emitted the list will be cleared. If the leftover value is emitted the leftover value is cleared. @param key The key being asked to be emitted. (Will not be modified) @param values the values associated with the key that should be emitted. """ if (leftover != null) { int leftOverCompare = LexicographicalComparator.compareBuffers(leftover.getKey(), key); if (leftOverCompare <= 0) { emit(leftover.getKey(), leftover.getValue()); leftover = null; } } if (!values.isEmpty()) { emit(key, values); values.clear(); } }
java
private void emitCurrentOrLeftover(ByteBuffer key, List<ByteBuffer> values) { if (leftover != null) { int leftOverCompare = LexicographicalComparator.compareBuffers(leftover.getKey(), key); if (leftOverCompare <= 0) { emit(leftover.getKey(), leftover.getValue()); leftover = null; } } if (!values.isEmpty()) { emit(key, values); values.clear(); } }
[ "private", "void", "emitCurrentOrLeftover", "(", "ByteBuffer", "key", ",", "List", "<", "ByteBuffer", ">", "values", ")", "{", "if", "(", "leftover", "!=", "null", ")", "{", "int", "leftOverCompare", "=", "LexicographicalComparator", ".", "compareBuffers", "(", "leftover", ".", "getKey", "(", ")", ",", "key", ")", ";", "if", "(", "leftOverCompare", "<=", "0", ")", "{", "emit", "(", "leftover", ".", "getKey", "(", ")", ",", "leftover", ".", "getValue", "(", ")", ")", ";", "leftover", "=", "null", ";", "}", "}", "if", "(", "!", "values", ".", "isEmpty", "(", ")", ")", "{", "emit", "(", "key", ",", "values", ")", ";", "values", ".", "clear", "(", ")", ";", "}", "}" ]
Writes out the provided key and value list. If the leftover item (which was not included in the sort) is lower lexicographically then it is emitted first. If the values are emitted the list will be cleared. If the leftover value is emitted the leftover value is cleared. @param key The key being asked to be emitted. (Will not be modified) @param values the values associated with the key that should be emitted.
[ "Writes", "out", "the", "provided", "key", "and", "value", "list", ".", "If", "the", "leftover", "item", "(", "which", "was", "not", "included", "in", "the", "sort", ")", "is", "lower", "lexicographically", "then", "it", "is", "emitted", "first", "." ]
train
https://github.com/GoogleCloudPlatform/appengine-mapreduce/blob/2045eb3605b6ecb40c83d11dd5442a89fe5c5dd6/java/src/main/java/com/google/appengine/tools/mapreduce/impl/sort/SortWorker.java#L195-L207
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/hydrogeomorphology/hillshade/OmsHillshade.java
OmsHillshade.calchillshade
private void calchillshade( WritableRaster pitWR, WritableRaster hillshadeWR, WritableRaster gradientWR, double dx ) { """ Evaluate the hillshade. @param pitWR the raster of elevation. @param hillshadeWR the WR where store the result. @param gradientWR the raster of the gradient value of the dem. @param dx the resolution of the dem. . """ pAzimuth = Math.toRadians(pAzimuth); pElev = Math.toRadians(pElev); double[] sunVector = calcSunVector(); double[] normalSunVector = calcNormalSunVector(sunVector); double[] inverseSunVector = calcInverseSunVector(sunVector); int rows = pitWR.getHeight(); int cols = pitWR.getWidth(); WritableRaster sOmbraWR = calculateFactor(rows, cols, sunVector, inverseSunVector, normalSunVector, pitWR, dx); pm.beginTask(msg.message("hillshade.calculating"), rows * cols); for( int j = 1; j < rows - 1; j++ ) { for( int i = 1; i < cols - 1; i++ ) { double[] ng = gradientWR.getPixel(i, j, new double[3]); double cosinc = scalarProduct(sunVector, ng); if (cosinc < 0) { sOmbraWR.setSample(i, j, 0, 0); } hillshadeWR.setSample(i, j, 0, (int) (212.5 * (cosinc * sOmbraWR.getSample(i, j, 0) + pMinDiffuse))); pm.worked(1); } } pm.done(); }
java
private void calchillshade( WritableRaster pitWR, WritableRaster hillshadeWR, WritableRaster gradientWR, double dx ) { pAzimuth = Math.toRadians(pAzimuth); pElev = Math.toRadians(pElev); double[] sunVector = calcSunVector(); double[] normalSunVector = calcNormalSunVector(sunVector); double[] inverseSunVector = calcInverseSunVector(sunVector); int rows = pitWR.getHeight(); int cols = pitWR.getWidth(); WritableRaster sOmbraWR = calculateFactor(rows, cols, sunVector, inverseSunVector, normalSunVector, pitWR, dx); pm.beginTask(msg.message("hillshade.calculating"), rows * cols); for( int j = 1; j < rows - 1; j++ ) { for( int i = 1; i < cols - 1; i++ ) { double[] ng = gradientWR.getPixel(i, j, new double[3]); double cosinc = scalarProduct(sunVector, ng); if (cosinc < 0) { sOmbraWR.setSample(i, j, 0, 0); } hillshadeWR.setSample(i, j, 0, (int) (212.5 * (cosinc * sOmbraWR.getSample(i, j, 0) + pMinDiffuse))); pm.worked(1); } } pm.done(); }
[ "private", "void", "calchillshade", "(", "WritableRaster", "pitWR", ",", "WritableRaster", "hillshadeWR", ",", "WritableRaster", "gradientWR", ",", "double", "dx", ")", "{", "pAzimuth", "=", "Math", ".", "toRadians", "(", "pAzimuth", ")", ";", "pElev", "=", "Math", ".", "toRadians", "(", "pElev", ")", ";", "double", "[", "]", "sunVector", "=", "calcSunVector", "(", ")", ";", "double", "[", "]", "normalSunVector", "=", "calcNormalSunVector", "(", "sunVector", ")", ";", "double", "[", "]", "inverseSunVector", "=", "calcInverseSunVector", "(", "sunVector", ")", ";", "int", "rows", "=", "pitWR", ".", "getHeight", "(", ")", ";", "int", "cols", "=", "pitWR", ".", "getWidth", "(", ")", ";", "WritableRaster", "sOmbraWR", "=", "calculateFactor", "(", "rows", ",", "cols", ",", "sunVector", ",", "inverseSunVector", ",", "normalSunVector", ",", "pitWR", ",", "dx", ")", ";", "pm", ".", "beginTask", "(", "msg", ".", "message", "(", "\"hillshade.calculating\"", ")", ",", "rows", "*", "cols", ")", ";", "for", "(", "int", "j", "=", "1", ";", "j", "<", "rows", "-", "1", ";", "j", "++", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<", "cols", "-", "1", ";", "i", "++", ")", "{", "double", "[", "]", "ng", "=", "gradientWR", ".", "getPixel", "(", "i", ",", "j", ",", "new", "double", "[", "3", "]", ")", ";", "double", "cosinc", "=", "scalarProduct", "(", "sunVector", ",", "ng", ")", ";", "if", "(", "cosinc", "<", "0", ")", "{", "sOmbraWR", ".", "setSample", "(", "i", ",", "j", ",", "0", ",", "0", ")", ";", "}", "hillshadeWR", ".", "setSample", "(", "i", ",", "j", ",", "0", ",", "(", "int", ")", "(", "212.5", "*", "(", "cosinc", "*", "sOmbraWR", ".", "getSample", "(", "i", ",", "j", ",", "0", ")", "+", "pMinDiffuse", ")", ")", ")", ";", "pm", ".", "worked", "(", "1", ")", ";", "}", "}", "pm", ".", "done", "(", ")", ";", "}" ]
Evaluate the hillshade. @param pitWR the raster of elevation. @param hillshadeWR the WR where store the result. @param gradientWR the raster of the gradient value of the dem. @param dx the resolution of the dem. .
[ "Evaluate", "the", "hillshade", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/hydrogeomorphology/hillshade/OmsHillshade.java#L169-L194
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/route/RouteClient.java
RouteClient.createRoute
public CreateRouteResponse createRoute(CreateRouteRequest request) throws BceClientException { """ Create a route with the specified options. You must fill the field of clientToken,which is especially for keeping idempotent. <p/> @param request The request containing all options for creating subnet. @return List of subnetId newly created @throws BceClientException """ checkNotNull(request, "request should not be null."); if (Strings.isNullOrEmpty(request.getClientToken())) { request.setClientToken(this.generateClientToken()); } checkStringNotEmpty(request.getRouteTableId(), "routeTableId should not be empty"); checkStringNotEmpty(request.getSourceAddress(), "source address should not be empty"); checkStringNotEmpty(request.getDestinationAddress(), "destination address should not be empty"); checkStringNotEmpty(request.getNexthopType(), "nexthop type should not be empty"); checkStringNotEmpty(request.getDescription(), "description should not be empty"); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, ROUTE_PREFIX, ROUTE_RULE); internalRequest.addParameter("clientToken", request.getClientToken()); fillPayload(internalRequest,request); return invokeHttpClient(internalRequest, CreateRouteResponse.class); }
java
public CreateRouteResponse createRoute(CreateRouteRequest request) throws BceClientException { checkNotNull(request, "request should not be null."); if (Strings.isNullOrEmpty(request.getClientToken())) { request.setClientToken(this.generateClientToken()); } checkStringNotEmpty(request.getRouteTableId(), "routeTableId should not be empty"); checkStringNotEmpty(request.getSourceAddress(), "source address should not be empty"); checkStringNotEmpty(request.getDestinationAddress(), "destination address should not be empty"); checkStringNotEmpty(request.getNexthopType(), "nexthop type should not be empty"); checkStringNotEmpty(request.getDescription(), "description should not be empty"); InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, ROUTE_PREFIX, ROUTE_RULE); internalRequest.addParameter("clientToken", request.getClientToken()); fillPayload(internalRequest,request); return invokeHttpClient(internalRequest, CreateRouteResponse.class); }
[ "public", "CreateRouteResponse", "createRoute", "(", "CreateRouteRequest", "request", ")", "throws", "BceClientException", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "request", ".", "getClientToken", "(", ")", ")", ")", "{", "request", ".", "setClientToken", "(", "this", ".", "generateClientToken", "(", ")", ")", ";", "}", "checkStringNotEmpty", "(", "request", ".", "getRouteTableId", "(", ")", ",", "\"routeTableId should not be empty\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getSourceAddress", "(", ")", ",", "\"source address should not be empty\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDestinationAddress", "(", ")", ",", "\"destination address should not be empty\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getNexthopType", "(", ")", ",", "\"nexthop type should not be empty\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getDescription", "(", ")", ",", "\"description should not be empty\"", ")", ";", "InternalRequest", "internalRequest", "=", "this", ".", "createRequest", "(", "request", ",", "HttpMethodName", ".", "POST", ",", "ROUTE_PREFIX", ",", "ROUTE_RULE", ")", ";", "internalRequest", ".", "addParameter", "(", "\"clientToken\"", ",", "request", ".", "getClientToken", "(", ")", ")", ";", "fillPayload", "(", "internalRequest", ",", "request", ")", ";", "return", "invokeHttpClient", "(", "internalRequest", ",", "CreateRouteResponse", ".", "class", ")", ";", "}" ]
Create a route with the specified options. You must fill the field of clientToken,which is especially for keeping idempotent. <p/> @param request The request containing all options for creating subnet. @return List of subnetId newly created @throws BceClientException
[ "Create", "a", "route", "with", "the", "specified", "options", ".", "You", "must", "fill", "the", "field", "of", "clientToken", "which", "is", "especially", "for", "keeping", "idempotent", ".", "<p", "/", ">" ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/route/RouteClient.java#L153-L168
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java
SeaGlassStyle.getBackgroundPainter
public SeaGlassPainter getBackgroundPainter(SynthContext ctx) { """ Gets the appropriate background Painter, if there is one, for the state specified in the given SynthContext. This method does appropriate fallback searching, as described in #get. @param ctx The SynthContext. Must not be null. @return The background painter associated for the given state, or null if none could be found. """ Values v = getValues(ctx); int xstate = getExtendedState(ctx, v); SeaGlassPainter p = null; // check the cache tmpKey.init("backgroundPainter$$instance", xstate); p = (SeaGlassPainter) v.cache.get(tmpKey); if (p != null) return p; // not in cache, so lookup and store in cache RuntimeState s = null; int[] lastIndex = new int[] { -1 }; while ((s = getNextState(v.states, lastIndex, xstate)) != null) { if (s.backgroundPainter != null) { p = s.backgroundPainter; break; } } if (p == null) p = (SeaGlassPainter) get(ctx, "backgroundPainter"); if (p != null) { v.cache.put(new CacheKey("backgroundPainter$$instance", xstate), p); } return p; }
java
public SeaGlassPainter getBackgroundPainter(SynthContext ctx) { Values v = getValues(ctx); int xstate = getExtendedState(ctx, v); SeaGlassPainter p = null; // check the cache tmpKey.init("backgroundPainter$$instance", xstate); p = (SeaGlassPainter) v.cache.get(tmpKey); if (p != null) return p; // not in cache, so lookup and store in cache RuntimeState s = null; int[] lastIndex = new int[] { -1 }; while ((s = getNextState(v.states, lastIndex, xstate)) != null) { if (s.backgroundPainter != null) { p = s.backgroundPainter; break; } } if (p == null) p = (SeaGlassPainter) get(ctx, "backgroundPainter"); if (p != null) { v.cache.put(new CacheKey("backgroundPainter$$instance", xstate), p); } return p; }
[ "public", "SeaGlassPainter", "getBackgroundPainter", "(", "SynthContext", "ctx", ")", "{", "Values", "v", "=", "getValues", "(", "ctx", ")", ";", "int", "xstate", "=", "getExtendedState", "(", "ctx", ",", "v", ")", ";", "SeaGlassPainter", "p", "=", "null", ";", "// check the cache", "tmpKey", ".", "init", "(", "\"backgroundPainter$$instance\"", ",", "xstate", ")", ";", "p", "=", "(", "SeaGlassPainter", ")", "v", ".", "cache", ".", "get", "(", "tmpKey", ")", ";", "if", "(", "p", "!=", "null", ")", "return", "p", ";", "// not in cache, so lookup and store in cache", "RuntimeState", "s", "=", "null", ";", "int", "[", "]", "lastIndex", "=", "new", "int", "[", "]", "{", "-", "1", "}", ";", "while", "(", "(", "s", "=", "getNextState", "(", "v", ".", "states", ",", "lastIndex", ",", "xstate", ")", ")", "!=", "null", ")", "{", "if", "(", "s", ".", "backgroundPainter", "!=", "null", ")", "{", "p", "=", "s", ".", "backgroundPainter", ";", "break", ";", "}", "}", "if", "(", "p", "==", "null", ")", "p", "=", "(", "SeaGlassPainter", ")", "get", "(", "ctx", ",", "\"backgroundPainter\"", ")", ";", "if", "(", "p", "!=", "null", ")", "{", "v", ".", "cache", ".", "put", "(", "new", "CacheKey", "(", "\"backgroundPainter$$instance\"", ",", "xstate", ")", ",", "p", ")", ";", "}", "return", "p", ";", "}" ]
Gets the appropriate background Painter, if there is one, for the state specified in the given SynthContext. This method does appropriate fallback searching, as described in #get. @param ctx The SynthContext. Must not be null. @return The background painter associated for the given state, or null if none could be found.
[ "Gets", "the", "appropriate", "background", "Painter", "if", "there", "is", "one", "for", "the", "state", "specified", "in", "the", "given", "SynthContext", ".", "This", "method", "does", "appropriate", "fallback", "searching", "as", "described", "in", "#get", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassStyle.java#L1047-L1080
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnGatewaysInner.java
VpnGatewaysInner.createOrUpdate
public VpnGatewayInner createOrUpdate(String resourceGroupName, String gatewayName, VpnGatewayInner vpnGatewayParameters) { """ Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. @param resourceGroupName The resource group name of the VpnGateway. @param gatewayName The name of the gateway. @param vpnGatewayParameters Parameters supplied to create or Update a virtual wan vpn gateway. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VpnGatewayInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, vpnGatewayParameters).toBlocking().last().body(); }
java
public VpnGatewayInner createOrUpdate(String resourceGroupName, String gatewayName, VpnGatewayInner vpnGatewayParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, vpnGatewayParameters).toBlocking().last().body(); }
[ "public", "VpnGatewayInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "gatewayName", ",", "VpnGatewayInner", "vpnGatewayParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "gatewayName", ",", "vpnGatewayParameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. @param resourceGroupName The resource group name of the VpnGateway. @param gatewayName The name of the gateway. @param vpnGatewayParameters Parameters supplied to create or Update a virtual wan vpn gateway. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VpnGatewayInner object if successful.
[ "Creates", "a", "virtual", "wan", "vpn", "gateway", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "gateway", "." ]
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/VpnGatewaysInner.java#L211-L213
JM-Lab/utils-java8
src/main/java/kr/jm/utils/datastructure/JMMap.java
JMMap.newFilteredMap
public static <K, V> Map<K, V> newFilteredMap(Map<K, V> map, Predicate<? super Entry<K, V>> filter) { """ New filtered map map. @param <K> the type parameter @param <V> the type parameter @param map the map @param filter the filter @return the map """ return getEntryStreamWithFilter(map, filter) .collect(toMap(Entry::getKey, Entry::getValue)); }
java
public static <K, V> Map<K, V> newFilteredMap(Map<K, V> map, Predicate<? super Entry<K, V>> filter) { return getEntryStreamWithFilter(map, filter) .collect(toMap(Entry::getKey, Entry::getValue)); }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "newFilteredMap", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "Predicate", "<", "?", "super", "Entry", "<", "K", ",", "V", ">", ">", "filter", ")", "{", "return", "getEntryStreamWithFilter", "(", "map", ",", "filter", ")", ".", "collect", "(", "toMap", "(", "Entry", "::", "getKey", ",", "Entry", "::", "getValue", ")", ")", ";", "}" ]
New filtered map map. @param <K> the type parameter @param <V> the type parameter @param map the map @param filter the filter @return the map
[ "New", "filtered", "map", "map", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/datastructure/JMMap.java#L385-L389
cdk/cdk
tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java
MolecularFormulaManipulator.containsElement
public static boolean containsElement(IMolecularFormula formula, IElement element) { """ True, if the MolecularFormula contains the given element as IIsotope object. @param formula IMolecularFormula molecularFormula @param element The element this MolecularFormula is searched for @return True, if the MolecularFormula contains the given element object """ for (IIsotope isotope : formula.isotopes()) { if (element.getSymbol().equals(isotope.getSymbol())) return true; } return false; }
java
public static boolean containsElement(IMolecularFormula formula, IElement element) { for (IIsotope isotope : formula.isotopes()) { if (element.getSymbol().equals(isotope.getSymbol())) return true; } return false; }
[ "public", "static", "boolean", "containsElement", "(", "IMolecularFormula", "formula", ",", "IElement", "element", ")", "{", "for", "(", "IIsotope", "isotope", ":", "formula", ".", "isotopes", "(", ")", ")", "{", "if", "(", "element", ".", "getSymbol", "(", ")", ".", "equals", "(", "isotope", ".", "getSymbol", "(", ")", ")", ")", "return", "true", ";", "}", "return", "false", ";", "}" ]
True, if the MolecularFormula contains the given element as IIsotope object. @param formula IMolecularFormula molecularFormula @param element The element this MolecularFormula is searched for @return True, if the MolecularFormula contains the given element object
[ "True", "if", "the", "MolecularFormula", "contains", "the", "given", "element", "as", "IIsotope", "object", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaManipulator.java#L206-L213
VoltDB/voltdb
src/frontend/org/voltdb/planner/ActivePlanRepository.java
ActivePlanRepository.loadOrAddRefPlanFragment
public static long loadOrAddRefPlanFragment(byte[] planHash, byte[] plan, String stmtText) { """ Get the site-local fragment id for a given plan identified by 20-byte sha-1 hash If the plan isn't known to this SPC, load it up. Otherwise addref it. """ Sha1Wrapper key = new Sha1Wrapper(planHash); synchronized (FragInfo.class) { FragInfo frag = m_plansByHash.get(key); if (frag == null) { frag = new FragInfo(key, plan, m_nextFragId++, stmtText); m_plansByHash.put(frag.hash, frag); m_plansById.put(frag.fragId, frag); if (m_plansById.size() > ExecutionEngine.EE_PLAN_CACHE_SIZE) { evictLRUfragment(); } } // Bit of a hack to work around an issue where a statement-less adhoc // fragment could be identical to a statement-needing regular procedure. // This doesn't really address the broader issue that fragment hashes // are not 1-1 with SQL statements. if (frag.stmtText == null) { frag.stmtText = stmtText; } // The fragment MAY be in the LRU map. // An incremented refCount is a lazy way to keep it safe from eviction // without having to update the map. // This optimizes for popular fragments in a small or stable cache that may be reused // many times before the eviction process needs to take any notice. frag.refCount++; return frag.fragId; } }
java
public static long loadOrAddRefPlanFragment(byte[] planHash, byte[] plan, String stmtText) { Sha1Wrapper key = new Sha1Wrapper(planHash); synchronized (FragInfo.class) { FragInfo frag = m_plansByHash.get(key); if (frag == null) { frag = new FragInfo(key, plan, m_nextFragId++, stmtText); m_plansByHash.put(frag.hash, frag); m_plansById.put(frag.fragId, frag); if (m_plansById.size() > ExecutionEngine.EE_PLAN_CACHE_SIZE) { evictLRUfragment(); } } // Bit of a hack to work around an issue where a statement-less adhoc // fragment could be identical to a statement-needing regular procedure. // This doesn't really address the broader issue that fragment hashes // are not 1-1 with SQL statements. if (frag.stmtText == null) { frag.stmtText = stmtText; } // The fragment MAY be in the LRU map. // An incremented refCount is a lazy way to keep it safe from eviction // without having to update the map. // This optimizes for popular fragments in a small or stable cache that may be reused // many times before the eviction process needs to take any notice. frag.refCount++; return frag.fragId; } }
[ "public", "static", "long", "loadOrAddRefPlanFragment", "(", "byte", "[", "]", "planHash", ",", "byte", "[", "]", "plan", ",", "String", "stmtText", ")", "{", "Sha1Wrapper", "key", "=", "new", "Sha1Wrapper", "(", "planHash", ")", ";", "synchronized", "(", "FragInfo", ".", "class", ")", "{", "FragInfo", "frag", "=", "m_plansByHash", ".", "get", "(", "key", ")", ";", "if", "(", "frag", "==", "null", ")", "{", "frag", "=", "new", "FragInfo", "(", "key", ",", "plan", ",", "m_nextFragId", "++", ",", "stmtText", ")", ";", "m_plansByHash", ".", "put", "(", "frag", ".", "hash", ",", "frag", ")", ";", "m_plansById", ".", "put", "(", "frag", ".", "fragId", ",", "frag", ")", ";", "if", "(", "m_plansById", ".", "size", "(", ")", ">", "ExecutionEngine", ".", "EE_PLAN_CACHE_SIZE", ")", "{", "evictLRUfragment", "(", ")", ";", "}", "}", "// Bit of a hack to work around an issue where a statement-less adhoc", "// fragment could be identical to a statement-needing regular procedure.", "// This doesn't really address the broader issue that fragment hashes", "// are not 1-1 with SQL statements.", "if", "(", "frag", ".", "stmtText", "==", "null", ")", "{", "frag", ".", "stmtText", "=", "stmtText", ";", "}", "// The fragment MAY be in the LRU map.", "// An incremented refCount is a lazy way to keep it safe from eviction", "// without having to update the map.", "// This optimizes for popular fragments in a small or stable cache that may be reused", "// many times before the eviction process needs to take any notice.", "frag", ".", "refCount", "++", ";", "return", "frag", ".", "fragId", ";", "}", "}" ]
Get the site-local fragment id for a given plan identified by 20-byte sha-1 hash If the plan isn't known to this SPC, load it up. Otherwise addref it.
[ "Get", "the", "site", "-", "local", "fragment", "id", "for", "a", "given", "plan", "identified", "by", "20", "-", "byte", "sha", "-", "1", "hash", "If", "the", "plan", "isn", "t", "known", "to", "this", "SPC", "load", "it", "up", ".", "Otherwise", "addref", "it", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/ActivePlanRepository.java#L100-L129
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/TimingHandler.java
TimingHandler.stopStartTimer
public long stopStartTimer(long _expiryTime, Entry<K,V> e) { """ Convert expiry value to the entry field value, essentially maps 0 to {@link Entry#EXPIRED} since 0 is a virgin entry. Restart the timer if needed. @param _expiryTime calculated expiry time @return sanitized nextRefreshTime for storage in the entry. """ if ((_expiryTime > 0 && _expiryTime < Long.MAX_VALUE) || _expiryTime < 0) { throw new IllegalArgumentException("invalid expiry time, cache is not initialized with expiry: " + Util.formatMillis(_expiryTime)); } return _expiryTime == 0 ? Entry.EXPIRED : _expiryTime; }
java
public long stopStartTimer(long _expiryTime, Entry<K,V> e) { if ((_expiryTime > 0 && _expiryTime < Long.MAX_VALUE) || _expiryTime < 0) { throw new IllegalArgumentException("invalid expiry time, cache is not initialized with expiry: " + Util.formatMillis(_expiryTime)); } return _expiryTime == 0 ? Entry.EXPIRED : _expiryTime; }
[ "public", "long", "stopStartTimer", "(", "long", "_expiryTime", ",", "Entry", "<", "K", ",", "V", ">", "e", ")", "{", "if", "(", "(", "_expiryTime", ">", "0", "&&", "_expiryTime", "<", "Long", ".", "MAX_VALUE", ")", "||", "_expiryTime", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"invalid expiry time, cache is not initialized with expiry: \"", "+", "Util", ".", "formatMillis", "(", "_expiryTime", ")", ")", ";", "}", "return", "_expiryTime", "==", "0", "?", "Entry", ".", "EXPIRED", ":", "_expiryTime", ";", "}" ]
Convert expiry value to the entry field value, essentially maps 0 to {@link Entry#EXPIRED} since 0 is a virgin entry. Restart the timer if needed. @param _expiryTime calculated expiry time @return sanitized nextRefreshTime for storage in the entry.
[ "Convert", "expiry", "value", "to", "the", "entry", "field", "value", "essentially", "maps", "0", "to", "{", "@link", "Entry#EXPIRED", "}", "since", "0", "is", "a", "virgin", "entry", ".", "Restart", "the", "timer", "if", "needed", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/TimingHandler.java#L157-L162
i-net-software/jlessc
src/com/inet/lib/less/UrlUtils.java
UrlUtils.appendEncode
private static void appendEncode( CssFormatter formatter, byte[] bytes ) { """ Append the bytes URL encoded. @param formatter current formatter @param bytes the bytes """ for( byte b : bytes ) { if ((b >= 'a' && b <= 'z' ) || (b >= 'A' && b <= 'Z' ) || (b >= '0' && b <= '9' )) { formatter.append( (char )b ); } else { switch( b ) { case '-': case '_': case '*': case '.': formatter.append( (char )b ); break; default: formatter.append( '%' ); formatter.append( Character.toUpperCase( Character.forDigit((b >> 4) & 0xF, 16) ) ); formatter.append( Character.toUpperCase( Character.forDigit(b & 0xF, 16) ) ); } } } }
java
private static void appendEncode( CssFormatter formatter, byte[] bytes ) { for( byte b : bytes ) { if ((b >= 'a' && b <= 'z' ) || (b >= 'A' && b <= 'Z' ) || (b >= '0' && b <= '9' )) { formatter.append( (char )b ); } else { switch( b ) { case '-': case '_': case '*': case '.': formatter.append( (char )b ); break; default: formatter.append( '%' ); formatter.append( Character.toUpperCase( Character.forDigit((b >> 4) & 0xF, 16) ) ); formatter.append( Character.toUpperCase( Character.forDigit(b & 0xF, 16) ) ); } } } }
[ "private", "static", "void", "appendEncode", "(", "CssFormatter", "formatter", ",", "byte", "[", "]", "bytes", ")", "{", "for", "(", "byte", "b", ":", "bytes", ")", "{", "if", "(", "(", "b", ">=", "'", "'", "&&", "b", "<=", "'", "'", ")", "||", "(", "b", ">=", "'", "'", "&&", "b", "<=", "'", "'", ")", "||", "(", "b", ">=", "'", "'", "&&", "b", "<=", "'", "'", ")", ")", "{", "formatter", ".", "append", "(", "(", "char", ")", "b", ")", ";", "}", "else", "{", "switch", "(", "b", ")", "{", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "formatter", ".", "append", "(", "(", "char", ")", "b", ")", ";", "break", ";", "default", ":", "formatter", ".", "append", "(", "'", "'", ")", ";", "formatter", ".", "append", "(", "Character", ".", "toUpperCase", "(", "Character", ".", "forDigit", "(", "(", "b", ">>", "4", ")", "&", "0xF", ",", "16", ")", ")", ")", ";", "formatter", ".", "append", "(", "Character", ".", "toUpperCase", "(", "Character", ".", "forDigit", "(", "b", "&", "0xF", ",", "16", ")", ")", ")", ";", "}", "}", "}", "}" ]
Append the bytes URL encoded. @param formatter current formatter @param bytes the bytes
[ "Append", "the", "bytes", "URL", "encoded", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/UrlUtils.java#L254-L273
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/PaymentUrl.java
PaymentUrl.performPaymentActionUrl
public static MozuUrl performPaymentActionUrl(String orderId, String paymentId, String responseFields) { """ Get Resource Url for PerformPaymentAction @param orderId Unique identifier of the order. @param paymentId Unique identifier of the payment for which to perform the action. @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 """ UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/payments/{paymentId}/actions?responseFields={responseFields}"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("paymentId", paymentId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl performPaymentActionUrl(String orderId, String paymentId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/payments/{paymentId}/actions?responseFields={responseFields}"); formatter.formatUrl("orderId", orderId); formatter.formatUrl("paymentId", paymentId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "performPaymentActionUrl", "(", "String", "orderId", ",", "String", "paymentId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/orders/{orderId}/payments/{paymentId}/actions?responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"orderId\"", ",", "orderId", ")", ";", "formatter", ".", "formatUrl", "(", "\"paymentId\"", ",", "paymentId", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for PerformPaymentAction @param orderId Unique identifier of the order. @param paymentId Unique identifier of the payment for which to perform the action. @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", "PerformPaymentAction" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/orders/PaymentUrl.java#L67-L74
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/Java2DNativeImageLoader.java
Java2DNativeImageLoader.asBufferedImage
public BufferedImage asBufferedImage(INDArray array, int dataType) { """ Converts an INDArray to a BufferedImage. Only intended for images with rank 3. @param array to convert @param dataType from JavaCV (DEPTH_FLOAT, DEPTH_UBYTE, etc), or -1 to use same type as the INDArray @return data copied to a Frame """ return converter2.convert(asFrame(array, dataType)); }
java
public BufferedImage asBufferedImage(INDArray array, int dataType) { return converter2.convert(asFrame(array, dataType)); }
[ "public", "BufferedImage", "asBufferedImage", "(", "INDArray", "array", ",", "int", "dataType", ")", "{", "return", "converter2", ".", "convert", "(", "asFrame", "(", "array", ",", "dataType", ")", ")", ";", "}" ]
Converts an INDArray to a BufferedImage. Only intended for images with rank 3. @param array to convert @param dataType from JavaCV (DEPTH_FLOAT, DEPTH_UBYTE, etc), or -1 to use same type as the INDArray @return data copied to a Frame
[ "Converts", "an", "INDArray", "to", "a", "BufferedImage", ".", "Only", "intended", "for", "images", "with", "rank", "3", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/Java2DNativeImageLoader.java#L117-L119
sebastiangraf/perfidix
src/main/java/org/perfidix/ouput/CSVOutput.java
CSVOutput.setUpNewPrintStream
private PrintStream setUpNewPrintStream(final boolean visitorStream, final String... names) { """ Setting up a new {@link PrintStream}. @param visitorStream is the stream for the visitor? Because of line breaks after the results. @param names the elements of the filename @return a {@link PrintStream} instance @throws FileNotFoundException if something goes wrong with the file """ PrintStream out = System.out; if (folder == null) { if (visitorStream) { out.println(); } } else { final File toWriteTo = new File(folder, buildFileName(names)); try { if (usedFiles.containsKey(toWriteTo)) { out = usedFiles.get(toWriteTo); } else { toWriteTo.delete(); out = new PrintStream(new FileOutputStream(toWriteTo, !visitorStream)); usedFiles.put(toWriteTo, out); firstResult = true; } } catch (final FileNotFoundException e) { throw new IllegalStateException(e); } } return out; }
java
private PrintStream setUpNewPrintStream(final boolean visitorStream, final String... names) { PrintStream out = System.out; if (folder == null) { if (visitorStream) { out.println(); } } else { final File toWriteTo = new File(folder, buildFileName(names)); try { if (usedFiles.containsKey(toWriteTo)) { out = usedFiles.get(toWriteTo); } else { toWriteTo.delete(); out = new PrintStream(new FileOutputStream(toWriteTo, !visitorStream)); usedFiles.put(toWriteTo, out); firstResult = true; } } catch (final FileNotFoundException e) { throw new IllegalStateException(e); } } return out; }
[ "private", "PrintStream", "setUpNewPrintStream", "(", "final", "boolean", "visitorStream", ",", "final", "String", "...", "names", ")", "{", "PrintStream", "out", "=", "System", ".", "out", ";", "if", "(", "folder", "==", "null", ")", "{", "if", "(", "visitorStream", ")", "{", "out", ".", "println", "(", ")", ";", "}", "}", "else", "{", "final", "File", "toWriteTo", "=", "new", "File", "(", "folder", ",", "buildFileName", "(", "names", ")", ")", ";", "try", "{", "if", "(", "usedFiles", ".", "containsKey", "(", "toWriteTo", ")", ")", "{", "out", "=", "usedFiles", ".", "get", "(", "toWriteTo", ")", ";", "}", "else", "{", "toWriteTo", ".", "delete", "(", ")", ";", "out", "=", "new", "PrintStream", "(", "new", "FileOutputStream", "(", "toWriteTo", ",", "!", "visitorStream", ")", ")", ";", "usedFiles", ".", "put", "(", "toWriteTo", ",", "out", ")", ";", "firstResult", "=", "true", ";", "}", "}", "catch", "(", "final", "FileNotFoundException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "e", ")", ";", "}", "}", "return", "out", ";", "}" ]
Setting up a new {@link PrintStream}. @param visitorStream is the stream for the visitor? Because of line breaks after the results. @param names the elements of the filename @return a {@link PrintStream} instance @throws FileNotFoundException if something goes wrong with the file
[ "Setting", "up", "a", "new", "{", "@link", "PrintStream", "}", "." ]
train
https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/ouput/CSVOutput.java#L188-L214
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java
CsvFileExtensions.getCvsAsListMap
public static List<Map<String, String>> getCvsAsListMap(final File input) throws IOException { """ Gets the given cvs file as list of maps. Every map has as key the header from the column and the corresponding value for this line. @param input the input @return the cvs as list map @throws IOException Signals that an I/O exception has occurred. """ return getCvsAsListMap(input, "ISO-8859-1"); }
java
public static List<Map<String, String>> getCvsAsListMap(final File input) throws IOException { return getCvsAsListMap(input, "ISO-8859-1"); }
[ "public", "static", "List", "<", "Map", "<", "String", ",", "String", ">", ">", "getCvsAsListMap", "(", "final", "File", "input", ")", "throws", "IOException", "{", "return", "getCvsAsListMap", "(", "input", ",", "\"ISO-8859-1\"", ")", ";", "}" ]
Gets the given cvs file as list of maps. Every map has as key the header from the column and the corresponding value for this line. @param input the input @return the cvs as list map @throws IOException Signals that an I/O exception has occurred.
[ "Gets", "the", "given", "cvs", "file", "as", "list", "of", "maps", ".", "Every", "map", "has", "as", "key", "the", "header", "from", "the", "column", "and", "the", "corresponding", "value", "for", "this", "line", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/csv/CsvFileExtensions.java#L161-L164
dbracewell/mango
src/main/java/com/davidbracewell/reflection/Reflect.java
Reflect.onClass
public static Reflect onClass(String clazz) throws Exception { """ Creates an instance of Reflect associated with a class @param clazz The class for reflection as string @return The Reflect object @throws Exception the exception """ return new Reflect(null, ReflectionUtils.getClassForName(clazz)); }
java
public static Reflect onClass(String clazz) throws Exception { return new Reflect(null, ReflectionUtils.getClassForName(clazz)); }
[ "public", "static", "Reflect", "onClass", "(", "String", "clazz", ")", "throws", "Exception", "{", "return", "new", "Reflect", "(", "null", ",", "ReflectionUtils", ".", "getClassForName", "(", "clazz", ")", ")", ";", "}" ]
Creates an instance of Reflect associated with a class @param clazz The class for reflection as string @return The Reflect object @throws Exception the exception
[ "Creates", "an", "instance", "of", "Reflect", "associated", "with", "a", "class" ]
train
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/reflection/Reflect.java#L90-L92
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.removeExecutableFeature
public void removeExecutableFeature(EObject element, IModificationContext context) throws BadLocationException { """ Remove the exectuable feature. @param element the executable feature to remove. @param context the context of the change. @throws BadLocationException if there is a problem with the location of the element. """ final ICompositeNode node; final SarlAction action = EcoreUtil2.getContainerOfType(element, SarlAction.class); if (action == null) { final XtendMember feature = EcoreUtil2.getContainerOfType(element, XtendMember.class); node = NodeModelUtils.findActualNodeFor(feature); } else { node = NodeModelUtils.findActualNodeFor(action); } if (node != null) { remove(context.getXtextDocument(), node); } }
java
public void removeExecutableFeature(EObject element, IModificationContext context) throws BadLocationException { final ICompositeNode node; final SarlAction action = EcoreUtil2.getContainerOfType(element, SarlAction.class); if (action == null) { final XtendMember feature = EcoreUtil2.getContainerOfType(element, XtendMember.class); node = NodeModelUtils.findActualNodeFor(feature); } else { node = NodeModelUtils.findActualNodeFor(action); } if (node != null) { remove(context.getXtextDocument(), node); } }
[ "public", "void", "removeExecutableFeature", "(", "EObject", "element", ",", "IModificationContext", "context", ")", "throws", "BadLocationException", "{", "final", "ICompositeNode", "node", ";", "final", "SarlAction", "action", "=", "EcoreUtil2", ".", "getContainerOfType", "(", "element", ",", "SarlAction", ".", "class", ")", ";", "if", "(", "action", "==", "null", ")", "{", "final", "XtendMember", "feature", "=", "EcoreUtil2", ".", "getContainerOfType", "(", "element", ",", "XtendMember", ".", "class", ")", ";", "node", "=", "NodeModelUtils", ".", "findActualNodeFor", "(", "feature", ")", ";", "}", "else", "{", "node", "=", "NodeModelUtils", ".", "findActualNodeFor", "(", "action", ")", ";", "}", "if", "(", "node", "!=", "null", ")", "{", "remove", "(", "context", ".", "getXtextDocument", "(", ")", ",", "node", ")", ";", "}", "}" ]
Remove the exectuable feature. @param element the executable feature to remove. @param context the context of the change. @throws BadLocationException if there is a problem with the location of the element.
[ "Remove", "the", "exectuable", "feature", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L587-L599
alkacon/opencms-core
src/org/opencms/gwt/CmsIconUtil.java
CmsIconUtil.getFileTypeIconClass
private static String getFileTypeIconClass(String resourceTypeName, String fileName, boolean small) { """ Returns the CSS class for the given filename.<p> @param resourceTypeName the resource type name @param fileName the filename @param small if true, get the CSS class for the small icon, else for the biggest one available @return the CSS class """ if ((fileName != null) && fileName.contains(".")) { int last = fileName.lastIndexOf("."); if (fileName.length() > (last + 1)) { String suffix = fileName.substring(fileName.lastIndexOf(".") + 1); return getResourceSubTypeIconClass(resourceTypeName, suffix, small); } } return ""; }
java
private static String getFileTypeIconClass(String resourceTypeName, String fileName, boolean small) { if ((fileName != null) && fileName.contains(".")) { int last = fileName.lastIndexOf("."); if (fileName.length() > (last + 1)) { String suffix = fileName.substring(fileName.lastIndexOf(".") + 1); return getResourceSubTypeIconClass(resourceTypeName, suffix, small); } } return ""; }
[ "private", "static", "String", "getFileTypeIconClass", "(", "String", "resourceTypeName", ",", "String", "fileName", ",", "boolean", "small", ")", "{", "if", "(", "(", "fileName", "!=", "null", ")", "&&", "fileName", ".", "contains", "(", "\".\"", ")", ")", "{", "int", "last", "=", "fileName", ".", "lastIndexOf", "(", "\".\"", ")", ";", "if", "(", "fileName", ".", "length", "(", ")", ">", "(", "last", "+", "1", ")", ")", "{", "String", "suffix", "=", "fileName", ".", "substring", "(", "fileName", ".", "lastIndexOf", "(", "\".\"", ")", "+", "1", ")", ";", "return", "getResourceSubTypeIconClass", "(", "resourceTypeName", ",", "suffix", ",", "small", ")", ";", "}", "}", "return", "\"\"", ";", "}" ]
Returns the CSS class for the given filename.<p> @param resourceTypeName the resource type name @param fileName the filename @param small if true, get the CSS class for the small icon, else for the biggest one available @return the CSS class
[ "Returns", "the", "CSS", "class", "for", "the", "given", "filename", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/CmsIconUtil.java#L470-L481
google/closure-compiler
src/com/google/debugging/sourcemap/SourceMapGeneratorV3.java
SourceMapGeneratorV3.appendTo
@Override public void appendTo(Appendable out, @Nullable String name) throws IOException { """ Writes out the source map in the following format (line numbers are for reference only and are not part of the format): <pre> 1. { 2. version: 3, 3. file: "out.js", 4. lineCount: 2, 5. sourceRoot: "", 6. sources: ["foo.js", "bar.js"], 7. sourcesContent: ["var foo", "var bar"], 8. names: ["src", "maps", "are", "fun"], 9. mappings: "a;;abcde,abcd,a;" 10. x_org_extension: value 11. } </pre> <ol> <li>Line 1 : The entire file is a single JSON object <li>Line 2 : File version (always the first entry in the object) <li>Line 3 : [Optional] The name of the file that this source map is associated with. <li>Line 4 : [Optional] The number of lines represented in the source map. <li>Line 5 : [Optional] An optional source root, useful for relocating source files on a server or removing repeated prefix values in the "sources" entry. <li>Line 6 : A list of sources used by the "mappings" entry relative to the sourceRoot. <li>Line 7 : An optional list of the full content of the source files. <li>Line 8 : A list of symbol names used by the "mapping" entry. This list may be incomplete. Line 9 : The mappings field. <li>Line 10: Any custom field (extension). </ol> """ int maxLine = prepMappings() + 1; // Add the header fields. out.append("{\n"); appendFirstField(out, "version", "3"); if (name != null) { appendField(out, "file", escapeString(name)); } appendField(out, "lineCount", String.valueOf(maxLine)); //optional source root if (this.sourceRootPath != null && !this.sourceRootPath.isEmpty()) { appendField(out, "sourceRoot", escapeString(this.sourceRootPath)); } // Add the mappings themselves. appendFieldStart(out, "mappings"); // out.append("["); (new LineMapper(out, maxLine)).appendLineMappings(); // out.append("]"); appendFieldEnd(out); // Files names appendFieldStart(out, "sources"); out.append("["); addSourceNameMap(out); out.append("]"); appendFieldEnd(out); // Sources contents addSourcesContentMap(out); // Identifier names appendFieldStart(out, "names"); out.append("["); addSymbolNameMap(out); out.append("]"); appendFieldEnd(out); // Extensions, only if there is any for (String key : this.extensions.keySet()) { Object objValue = this.extensions.get(key); String value; if (objValue instanceof String) { value = escapeString((String) objValue); // escapes native String } else { value = objValue.toString(); } appendField(out, key, value); } out.append("\n}\n"); }
java
@Override public void appendTo(Appendable out, @Nullable String name) throws IOException { int maxLine = prepMappings() + 1; // Add the header fields. out.append("{\n"); appendFirstField(out, "version", "3"); if (name != null) { appendField(out, "file", escapeString(name)); } appendField(out, "lineCount", String.valueOf(maxLine)); //optional source root if (this.sourceRootPath != null && !this.sourceRootPath.isEmpty()) { appendField(out, "sourceRoot", escapeString(this.sourceRootPath)); } // Add the mappings themselves. appendFieldStart(out, "mappings"); // out.append("["); (new LineMapper(out, maxLine)).appendLineMappings(); // out.append("]"); appendFieldEnd(out); // Files names appendFieldStart(out, "sources"); out.append("["); addSourceNameMap(out); out.append("]"); appendFieldEnd(out); // Sources contents addSourcesContentMap(out); // Identifier names appendFieldStart(out, "names"); out.append("["); addSymbolNameMap(out); out.append("]"); appendFieldEnd(out); // Extensions, only if there is any for (String key : this.extensions.keySet()) { Object objValue = this.extensions.get(key); String value; if (objValue instanceof String) { value = escapeString((String) objValue); // escapes native String } else { value = objValue.toString(); } appendField(out, key, value); } out.append("\n}\n"); }
[ "@", "Override", "public", "void", "appendTo", "(", "Appendable", "out", ",", "@", "Nullable", "String", "name", ")", "throws", "IOException", "{", "int", "maxLine", "=", "prepMappings", "(", ")", "+", "1", ";", "// Add the header fields.", "out", ".", "append", "(", "\"{\\n\"", ")", ";", "appendFirstField", "(", "out", ",", "\"version\"", ",", "\"3\"", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "appendField", "(", "out", ",", "\"file\"", ",", "escapeString", "(", "name", ")", ")", ";", "}", "appendField", "(", "out", ",", "\"lineCount\"", ",", "String", ".", "valueOf", "(", "maxLine", ")", ")", ";", "//optional source root", "if", "(", "this", ".", "sourceRootPath", "!=", "null", "&&", "!", "this", ".", "sourceRootPath", ".", "isEmpty", "(", ")", ")", "{", "appendField", "(", "out", ",", "\"sourceRoot\"", ",", "escapeString", "(", "this", ".", "sourceRootPath", ")", ")", ";", "}", "// Add the mappings themselves.", "appendFieldStart", "(", "out", ",", "\"mappings\"", ")", ";", "// out.append(\"[\");", "(", "new", "LineMapper", "(", "out", ",", "maxLine", ")", ")", ".", "appendLineMappings", "(", ")", ";", "// out.append(\"]\");", "appendFieldEnd", "(", "out", ")", ";", "// Files names", "appendFieldStart", "(", "out", ",", "\"sources\"", ")", ";", "out", ".", "append", "(", "\"[\"", ")", ";", "addSourceNameMap", "(", "out", ")", ";", "out", ".", "append", "(", "\"]\"", ")", ";", "appendFieldEnd", "(", "out", ")", ";", "// Sources contents", "addSourcesContentMap", "(", "out", ")", ";", "// Identifier names", "appendFieldStart", "(", "out", ",", "\"names\"", ")", ";", "out", ".", "append", "(", "\"[\"", ")", ";", "addSymbolNameMap", "(", "out", ")", ";", "out", ".", "append", "(", "\"]\"", ")", ";", "appendFieldEnd", "(", "out", ")", ";", "// Extensions, only if there is any", "for", "(", "String", "key", ":", "this", ".", "extensions", ".", "keySet", "(", ")", ")", "{", "Object", "objValue", "=", "this", ".", "extensions", ".", "get", "(", "key", ")", ";", "String", "value", ";", "if", "(", "objValue", "instanceof", "String", ")", "{", "value", "=", "escapeString", "(", "(", "String", ")", "objValue", ")", ";", "// escapes native String", "}", "else", "{", "value", "=", "objValue", ".", "toString", "(", ")", ";", "}", "appendField", "(", "out", ",", "key", ",", "value", ")", ";", "}", "out", ".", "append", "(", "\"\\n}\\n\"", ")", ";", "}" ]
Writes out the source map in the following format (line numbers are for reference only and are not part of the format): <pre> 1. { 2. version: 3, 3. file: "out.js", 4. lineCount: 2, 5. sourceRoot: "", 6. sources: ["foo.js", "bar.js"], 7. sourcesContent: ["var foo", "var bar"], 8. names: ["src", "maps", "are", "fun"], 9. mappings: "a;;abcde,abcd,a;" 10. x_org_extension: value 11. } </pre> <ol> <li>Line 1 : The entire file is a single JSON object <li>Line 2 : File version (always the first entry in the object) <li>Line 3 : [Optional] The name of the file that this source map is associated with. <li>Line 4 : [Optional] The number of lines represented in the source map. <li>Line 5 : [Optional] An optional source root, useful for relocating source files on a server or removing repeated prefix values in the "sources" entry. <li>Line 6 : A list of sources used by the "mappings" entry relative to the sourceRoot. <li>Line 7 : An optional list of the full content of the source files. <li>Line 8 : A list of symbol names used by the "mapping" entry. This list may be incomplete. Line 9 : The mappings field. <li>Line 10: Any custom field (extension). </ol>
[ "Writes", "out", "the", "source", "map", "in", "the", "following", "format", "(", "line", "numbers", "are", "for", "reference", "only", "and", "are", "not", "part", "of", "the", "format", ")", ":" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/debugging/sourcemap/SourceMapGeneratorV3.java#L369-L424
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/Record.java
Record.setHandle
public Record setHandle(Object bookmark, int iHandleType) throws DBException { """ Reposition to this record Using this bookmark. <br>NOTE: This is a table method, it is included here in Record for convience!!! @param bookmark The handle to use to position the record. @param iHandleType The type of handle bookmark is. @exception DBException FILE_NOT_OPEN. @return <code>valid record</code> - record found; <code>null</code> - record not found """ return (Record)this.getTable().setHandle(bookmark, iHandleType); }
java
public Record setHandle(Object bookmark, int iHandleType) throws DBException { return (Record)this.getTable().setHandle(bookmark, iHandleType); }
[ "public", "Record", "setHandle", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "throws", "DBException", "{", "return", "(", "Record", ")", "this", ".", "getTable", "(", ")", ".", "setHandle", "(", "bookmark", ",", "iHandleType", ")", ";", "}" ]
Reposition to this record Using this bookmark. <br>NOTE: This is a table method, it is included here in Record for convience!!! @param bookmark The handle to use to position the record. @param iHandleType The type of handle bookmark is. @exception DBException FILE_NOT_OPEN. @return <code>valid record</code> - record found; <code>null</code> - record not found
[ "Reposition", "to", "this", "record", "Using", "this", "bookmark", ".", "<br", ">", "NOTE", ":", "This", "is", "a", "table", "method", "it", "is", "included", "here", "in", "Record", "for", "convience!!!" ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L2604-L2607
vipshop/vjtools
vjkit/src/main/java/com/vip/vjtools/vjkit/text/WildcardMatcher.java
WildcardMatcher.matchPathOne
public static int matchPathOne(String platformDependentPath, String... patterns) { """ Matches path to at least one pattern. Returns index of matched pattern or <code>-1</code> otherwise. @see #matchPath(String, String, char) """ for (int i = 0; i < patterns.length; i++) { if (matchPath(platformDependentPath, patterns[i])) { return i; } } return -1; }
java
public static int matchPathOne(String platformDependentPath, String... patterns) { for (int i = 0; i < patterns.length; i++) { if (matchPath(platformDependentPath, patterns[i])) { return i; } } return -1; }
[ "public", "static", "int", "matchPathOne", "(", "String", "platformDependentPath", ",", "String", "...", "patterns", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "patterns", ".", "length", ";", "i", "++", ")", "{", "if", "(", "matchPath", "(", "platformDependentPath", ",", "patterns", "[", "i", "]", ")", ")", "{", "return", "i", ";", "}", "}", "return", "-", "1", ";", "}" ]
Matches path to at least one pattern. Returns index of matched pattern or <code>-1</code> otherwise. @see #matchPath(String, String, char)
[ "Matches", "path", "to", "at", "least", "one", "pattern", ".", "Returns", "index", "of", "matched", "pattern", "or", "<code", ">", "-", "1<", "/", "code", ">", "otherwise", "." ]
train
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/text/WildcardMatcher.java#L162-L169
beangle/beangle3
ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java
BeanDefinitionParser.parseQualifierElement
public void parseQualifierElement(Element ele, AbstractBeanDefinition bd) { """ Parse a qualifier element. @param ele a {@link org.w3c.dom.Element} object. @param bd a {@link org.springframework.beans.factory.support.AbstractBeanDefinition} object. """ String typeName = ele.getAttribute(TYPE_ATTRIBUTE); if (!StringUtils.hasLength(typeName)) { error("Tag 'qualifier' must have a 'type' attribute", ele); return; } this.parseState.push(new QualifierEntry(typeName)); try { AutowireCandidateQualifier qualifier = new AutowireCandidateQualifier(typeName); qualifier.setSource(extractSource(ele)); String value = ele.getAttribute(VALUE_ATTRIBUTE); if (StringUtils.hasLength(value)) { qualifier.setAttribute(AutowireCandidateQualifier.VALUE_KEY, value); } NodeList nl = ele.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node instanceof Element && nodeNameEquals(node, QUALIFIER_ATTRIBUTE_ELEMENT)) { Element attributeEle = (Element) node; String attributeName = attributeEle.getAttribute(KEY_ATTRIBUTE); String attributeValue = attributeEle.getAttribute(VALUE_ATTRIBUTE); if (StringUtils.hasLength(attributeName) && StringUtils.hasLength(attributeValue)) { BeanMetadataAttribute attribute = new BeanMetadataAttribute(attributeName, attributeValue); attribute.setSource(extractSource(attributeEle)); qualifier.addMetadataAttribute(attribute); } else { error("Qualifier 'attribute' tag must have a 'name' and 'value'", attributeEle); return; } } } bd.addQualifier(qualifier); } finally { this.parseState.pop(); } }
java
public void parseQualifierElement(Element ele, AbstractBeanDefinition bd) { String typeName = ele.getAttribute(TYPE_ATTRIBUTE); if (!StringUtils.hasLength(typeName)) { error("Tag 'qualifier' must have a 'type' attribute", ele); return; } this.parseState.push(new QualifierEntry(typeName)); try { AutowireCandidateQualifier qualifier = new AutowireCandidateQualifier(typeName); qualifier.setSource(extractSource(ele)); String value = ele.getAttribute(VALUE_ATTRIBUTE); if (StringUtils.hasLength(value)) { qualifier.setAttribute(AutowireCandidateQualifier.VALUE_KEY, value); } NodeList nl = ele.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node instanceof Element && nodeNameEquals(node, QUALIFIER_ATTRIBUTE_ELEMENT)) { Element attributeEle = (Element) node; String attributeName = attributeEle.getAttribute(KEY_ATTRIBUTE); String attributeValue = attributeEle.getAttribute(VALUE_ATTRIBUTE); if (StringUtils.hasLength(attributeName) && StringUtils.hasLength(attributeValue)) { BeanMetadataAttribute attribute = new BeanMetadataAttribute(attributeName, attributeValue); attribute.setSource(extractSource(attributeEle)); qualifier.addMetadataAttribute(attribute); } else { error("Qualifier 'attribute' tag must have a 'name' and 'value'", attributeEle); return; } } } bd.addQualifier(qualifier); } finally { this.parseState.pop(); } }
[ "public", "void", "parseQualifierElement", "(", "Element", "ele", ",", "AbstractBeanDefinition", "bd", ")", "{", "String", "typeName", "=", "ele", ".", "getAttribute", "(", "TYPE_ATTRIBUTE", ")", ";", "if", "(", "!", "StringUtils", ".", "hasLength", "(", "typeName", ")", ")", "{", "error", "(", "\"Tag 'qualifier' must have a 'type' attribute\"", ",", "ele", ")", ";", "return", ";", "}", "this", ".", "parseState", ".", "push", "(", "new", "QualifierEntry", "(", "typeName", ")", ")", ";", "try", "{", "AutowireCandidateQualifier", "qualifier", "=", "new", "AutowireCandidateQualifier", "(", "typeName", ")", ";", "qualifier", ".", "setSource", "(", "extractSource", "(", "ele", ")", ")", ";", "String", "value", "=", "ele", ".", "getAttribute", "(", "VALUE_ATTRIBUTE", ")", ";", "if", "(", "StringUtils", ".", "hasLength", "(", "value", ")", ")", "{", "qualifier", ".", "setAttribute", "(", "AutowireCandidateQualifier", ".", "VALUE_KEY", ",", "value", ")", ";", "}", "NodeList", "nl", "=", "ele", ".", "getChildNodes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nl", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "Node", "node", "=", "nl", ".", "item", "(", "i", ")", ";", "if", "(", "node", "instanceof", "Element", "&&", "nodeNameEquals", "(", "node", ",", "QUALIFIER_ATTRIBUTE_ELEMENT", ")", ")", "{", "Element", "attributeEle", "=", "(", "Element", ")", "node", ";", "String", "attributeName", "=", "attributeEle", ".", "getAttribute", "(", "KEY_ATTRIBUTE", ")", ";", "String", "attributeValue", "=", "attributeEle", ".", "getAttribute", "(", "VALUE_ATTRIBUTE", ")", ";", "if", "(", "StringUtils", ".", "hasLength", "(", "attributeName", ")", "&&", "StringUtils", ".", "hasLength", "(", "attributeValue", ")", ")", "{", "BeanMetadataAttribute", "attribute", "=", "new", "BeanMetadataAttribute", "(", "attributeName", ",", "attributeValue", ")", ";", "attribute", ".", "setSource", "(", "extractSource", "(", "attributeEle", ")", ")", ";", "qualifier", ".", "addMetadataAttribute", "(", "attribute", ")", ";", "}", "else", "{", "error", "(", "\"Qualifier 'attribute' tag must have a 'name' and 'value'\"", ",", "attributeEle", ")", ";", "return", ";", "}", "}", "}", "bd", ".", "addQualifier", "(", "qualifier", ")", ";", "}", "finally", "{", "this", ".", "parseState", ".", "pop", "(", ")", ";", "}", "}" ]
Parse a qualifier element. @param ele a {@link org.w3c.dom.Element} object. @param bd a {@link org.springframework.beans.factory.support.AbstractBeanDefinition} object.
[ "Parse", "a", "qualifier", "element", "." ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/ioc/spring/src/main/java/org/beangle/inject/spring/config/BeanDefinitionParser.java#L548-L583
cdk/cdk
storage/io/src/main/java/org/openscience/cdk/io/cml/CMLResolver.java
CMLResolver.resolveEntity
public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) { """ Not implemented, but uses resolveEntity(String publicId, String systemId) instead. """ return resolveEntity(publicId, systemId); }
java
public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) { return resolveEntity(publicId, systemId); }
[ "public", "InputSource", "resolveEntity", "(", "String", "name", ",", "String", "publicId", ",", "String", "baseURI", ",", "String", "systemId", ")", "{", "return", "resolveEntity", "(", "publicId", ",", "systemId", ")", ";", "}" ]
Not implemented, but uses resolveEntity(String publicId, String systemId) instead.
[ "Not", "implemented", "but", "uses", "resolveEntity", "(", "String", "publicId", "String", "systemId", ")", "instead", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/io/src/main/java/org/openscience/cdk/io/cml/CMLResolver.java#L58-L60
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java
TimeZone.getDisplayName
public String getDisplayName(boolean daylight, int style, ULocale locale) { """ Returns a name of this time zone suitable for presentation to the user in the specified locale. If the display name is not available for the locale, then this method returns a string in the localized GMT offset format such as <code>GMT[+-]HH:mm</code>. @param daylight if true, return the daylight savings name. @param style the output style of the display name. Valid styles are <code>SHORT</code>, <code>LONG</code>, <code>SHORT_GENERIC</code>, <code>LONG_GENERIC</code>, <code>SHORT_GMT</code>, <code>LONG_GMT</code>, <code>SHORT_COMMONLY_USED</code> or <code>GENERIC_LOCATION</code>. @param locale the locale in which to supply the display name. @return the human-readable name of this time zone in the given locale or in the default locale if the given locale is not recognized. @exception IllegalArgumentException style is invalid. """ if (style < SHORT || style > GENERIC_LOCATION) { throw new IllegalArgumentException("Illegal style: " + style); } return _getDisplayName(style, daylight, locale); }
java
public String getDisplayName(boolean daylight, int style, ULocale locale) { if (style < SHORT || style > GENERIC_LOCATION) { throw new IllegalArgumentException("Illegal style: " + style); } return _getDisplayName(style, daylight, locale); }
[ "public", "String", "getDisplayName", "(", "boolean", "daylight", ",", "int", "style", ",", "ULocale", "locale", ")", "{", "if", "(", "style", "<", "SHORT", "||", "style", ">", "GENERIC_LOCATION", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Illegal style: \"", "+", "style", ")", ";", "}", "return", "_getDisplayName", "(", "style", ",", "daylight", ",", "locale", ")", ";", "}" ]
Returns a name of this time zone suitable for presentation to the user in the specified locale. If the display name is not available for the locale, then this method returns a string in the localized GMT offset format such as <code>GMT[+-]HH:mm</code>. @param daylight if true, return the daylight savings name. @param style the output style of the display name. Valid styles are <code>SHORT</code>, <code>LONG</code>, <code>SHORT_GENERIC</code>, <code>LONG_GENERIC</code>, <code>SHORT_GMT</code>, <code>LONG_GMT</code>, <code>SHORT_COMMONLY_USED</code> or <code>GENERIC_LOCATION</code>. @param locale the locale in which to supply the display name. @return the human-readable name of this time zone in the given locale or in the default locale if the given locale is not recognized. @exception IllegalArgumentException style is invalid.
[ "Returns", "a", "name", "of", "this", "time", "zone", "suitable", "for", "presentation", "to", "the", "user", "in", "the", "specified", "locale", ".", "If", "the", "display", "name", "is", "not", "available", "for", "the", "locale", "then", "this", "method", "returns", "a", "string", "in", "the", "localized", "GMT", "offset", "format", "such", "as", "<code", ">", "GMT", "[", "+", "-", "]", "HH", ":", "mm<", "/", "code", ">", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java#L460-L466
voldemort/voldemort
src/java/voldemort/server/protocol/admin/AdminServiceRequestHandler.java
AdminServiceRequestHandler.swapStore
private String swapStore(String storeName, String directory) throws VoldemortException { """ Given a read-only store name and a directory, swaps it in while returning the directory path being swapped out @param storeName The name of the read-only store @param directory The directory being swapped in @return The directory path which was swapped out @throws VoldemortException """ ReadOnlyStorageEngine store = getReadOnlyStorageEngine(metadataStore, storeRepository, storeName); if(!Utils.isReadableDir(directory)) throw new VoldemortException("Store directory '" + directory + "' is not a readable directory."); String currentDirPath = store.getCurrentDirPath(); logger.info("Swapping RO store '" + storeName + "' to version directory '" + directory + "'"); store.swapFiles(directory); logger.info("Swapping swapped RO store '" + storeName + "' to version directory '" + directory + "'"); return currentDirPath; }
java
private String swapStore(String storeName, String directory) throws VoldemortException { ReadOnlyStorageEngine store = getReadOnlyStorageEngine(metadataStore, storeRepository, storeName); if(!Utils.isReadableDir(directory)) throw new VoldemortException("Store directory '" + directory + "' is not a readable directory."); String currentDirPath = store.getCurrentDirPath(); logger.info("Swapping RO store '" + storeName + "' to version directory '" + directory + "'"); store.swapFiles(directory); logger.info("Swapping swapped RO store '" + storeName + "' to version directory '" + directory + "'"); return currentDirPath; }
[ "private", "String", "swapStore", "(", "String", "storeName", ",", "String", "directory", ")", "throws", "VoldemortException", "{", "ReadOnlyStorageEngine", "store", "=", "getReadOnlyStorageEngine", "(", "metadataStore", ",", "storeRepository", ",", "storeName", ")", ";", "if", "(", "!", "Utils", ".", "isReadableDir", "(", "directory", ")", ")", "throw", "new", "VoldemortException", "(", "\"Store directory '\"", "+", "directory", "+", "\"' is not a readable directory.\"", ")", ";", "String", "currentDirPath", "=", "store", ".", "getCurrentDirPath", "(", ")", ";", "logger", ".", "info", "(", "\"Swapping RO store '\"", "+", "storeName", "+", "\"' to version directory '\"", "+", "directory", "+", "\"'\"", ")", ";", "store", ".", "swapFiles", "(", "directory", ")", ";", "logger", ".", "info", "(", "\"Swapping swapped RO store '\"", "+", "storeName", "+", "\"' to version directory '\"", "+", "directory", "+", "\"'\"", ")", ";", "return", "currentDirPath", ";", "}" ]
Given a read-only store name and a directory, swaps it in while returning the directory path being swapped out @param storeName The name of the read-only store @param directory The directory being swapped in @return The directory path which was swapped out @throws VoldemortException
[ "Given", "a", "read", "-", "only", "store", "name", "and", "a", "directory", "swaps", "it", "in", "while", "returning", "the", "directory", "path", "being", "swapped", "out" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/server/protocol/admin/AdminServiceRequestHandler.java#L996-L1015
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/RandomMatrices_ZDRM.java
RandomMatrices_ZDRM.fillUniform
public static void fillUniform(ZMatrixD1 mat , double min , double max , Random rand ) { """ <p> Sets each element in the matrix to a value drawn from an uniform distribution from 'min' to 'max' inclusive. </p> @param min The minimum value each element can be. @param max The maximum value each element can be. @param mat The matrix who is to be randomized. Modified. @param rand Random number generator used to fill the matrix. """ double d[] = mat.getData(); int size = mat.getDataLength(); double r = max-min; for( int i = 0; i < size; i++ ) { d[i] = r*rand.nextDouble()+min; } }
java
public static void fillUniform(ZMatrixD1 mat , double min , double max , Random rand ) { double d[] = mat.getData(); int size = mat.getDataLength(); double r = max-min; for( int i = 0; i < size; i++ ) { d[i] = r*rand.nextDouble()+min; } }
[ "public", "static", "void", "fillUniform", "(", "ZMatrixD1", "mat", ",", "double", "min", ",", "double", "max", ",", "Random", "rand", ")", "{", "double", "d", "[", "]", "=", "mat", ".", "getData", "(", ")", ";", "int", "size", "=", "mat", ".", "getDataLength", "(", ")", ";", "double", "r", "=", "max", "-", "min", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "d", "[", "i", "]", "=", "r", "*", "rand", ".", "nextDouble", "(", ")", "+", "min", ";", "}", "}" ]
<p> Sets each element in the matrix to a value drawn from an uniform distribution from 'min' to 'max' inclusive. </p> @param min The minimum value each element can be. @param max The maximum value each element can be. @param mat The matrix who is to be randomized. Modified. @param rand Random number generator used to fill the matrix.
[ "<p", ">", "Sets", "each", "element", "in", "the", "matrix", "to", "a", "value", "drawn", "from", "an", "uniform", "distribution", "from", "min", "to", "max", "inclusive", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/RandomMatrices_ZDRM.java#L91-L101
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanCache.java
InfinispanCache.cacheEntryInserted
private void cacheEntryInserted(String key, T value) { """ Dispatch data insertion event. @param key the entry key. @param value the entry value. """ InfinispanCacheEntryEvent<T> event = new InfinispanCacheEntryEvent<>(new InfinispanCacheEntry<T>(this, key, value)); T previousValue = this.preEventData.get(key); if (previousValue != null) { if (previousValue != value) { disposeCacheValue(previousValue); } sendEntryModifiedEvent(event); } else { sendEntryAddedEvent(event); } }
java
private void cacheEntryInserted(String key, T value) { InfinispanCacheEntryEvent<T> event = new InfinispanCacheEntryEvent<>(new InfinispanCacheEntry<T>(this, key, value)); T previousValue = this.preEventData.get(key); if (previousValue != null) { if (previousValue != value) { disposeCacheValue(previousValue); } sendEntryModifiedEvent(event); } else { sendEntryAddedEvent(event); } }
[ "private", "void", "cacheEntryInserted", "(", "String", "key", ",", "T", "value", ")", "{", "InfinispanCacheEntryEvent", "<", "T", ">", "event", "=", "new", "InfinispanCacheEntryEvent", "<>", "(", "new", "InfinispanCacheEntry", "<", "T", ">", "(", "this", ",", "key", ",", "value", ")", ")", ";", "T", "previousValue", "=", "this", ".", "preEventData", ".", "get", "(", "key", ")", ";", "if", "(", "previousValue", "!=", "null", ")", "{", "if", "(", "previousValue", "!=", "value", ")", "{", "disposeCacheValue", "(", "previousValue", ")", ";", "}", "sendEntryModifiedEvent", "(", "event", ")", ";", "}", "else", "{", "sendEntryAddedEvent", "(", "event", ")", ";", "}", "}" ]
Dispatch data insertion event. @param key the entry key. @param value the entry value.
[ "Dispatch", "data", "insertion", "event", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanCache.java#L200-L216
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java
BaseXmlImporter.isParent
private boolean isParent(ItemData data, ItemData parent) { """ Check if item <b>parent</b> is parent item of item <b>data</b>. @param data - Possible child ItemData. @param parent - Possible parent ItemData. @return True if parent of both ItemData the same. """ String id1 = data.getParentIdentifier(); String id2 = parent.getIdentifier(); if (id1 == id2) // NOSONAR return true; if (id1 == null && id2 != null) return false; return id1 != null && id1.equals(id2); }
java
private boolean isParent(ItemData data, ItemData parent) { String id1 = data.getParentIdentifier(); String id2 = parent.getIdentifier(); if (id1 == id2) // NOSONAR return true; if (id1 == null && id2 != null) return false; return id1 != null && id1.equals(id2); }
[ "private", "boolean", "isParent", "(", "ItemData", "data", ",", "ItemData", "parent", ")", "{", "String", "id1", "=", "data", ".", "getParentIdentifier", "(", ")", ";", "String", "id2", "=", "parent", ".", "getIdentifier", "(", ")", ";", "if", "(", "id1", "==", "id2", ")", "// NOSONAR ", "return", "true", ";", "if", "(", "id1", "==", "null", "&&", "id2", "!=", "null", ")", "return", "false", ";", "return", "id1", "!=", "null", "&&", "id1", ".", "equals", "(", "id2", ")", ";", "}" ]
Check if item <b>parent</b> is parent item of item <b>data</b>. @param data - Possible child ItemData. @param parent - Possible parent ItemData. @return True if parent of both ItemData the same.
[ "Check", "if", "item", "<b", ">", "parent<", "/", "b", ">", "is", "parent", "item", "of", "item", "<b", ">", "data<", "/", "b", ">", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/xml/importing/BaseXmlImporter.java#L667-L676
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.notNull
@Throws(IllegalNullArgumentException.class) public static <T> T notNull(@Nonnull final T reference, @Nullable final String name) { """ Ensures that an object reference passed as a parameter to the calling method is not {@code null}. @param reference an object reference @param name name of object reference (in source code) @return the non-null reference that was validated @throws IllegalNullArgumentException if the given argument {@code reference} is {@code null} """ if (reference == null) { throw new IllegalNullArgumentException(name); } return reference; }
java
@Throws(IllegalNullArgumentException.class) public static <T> T notNull(@Nonnull final T reference, @Nullable final String name) { if (reference == null) { throw new IllegalNullArgumentException(name); } return reference; }
[ "@", "Throws", "(", "IllegalNullArgumentException", ".", "class", ")", "public", "static", "<", "T", ">", "T", "notNull", "(", "@", "Nonnull", "final", "T", "reference", ",", "@", "Nullable", "final", "String", "name", ")", "{", "if", "(", "reference", "==", "null", ")", "{", "throw", "new", "IllegalNullArgumentException", "(", "name", ")", ";", "}", "return", "reference", ";", "}" ]
Ensures that an object reference passed as a parameter to the calling method is not {@code null}. @param reference an object reference @param name name of object reference (in source code) @return the non-null reference that was validated @throws IllegalNullArgumentException if the given argument {@code reference} is {@code null}
[ "Ensures", "that", "an", "object", "reference", "passed", "as", "a", "parameter", "to", "the", "calling", "method", "is", "not", "{", "@code", "null", "}", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L2979-L2985
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/MessageBuilder.java
MessageBuilder.replaceLast
public MessageBuilder replaceLast(String target, String replacement) { """ Replaces the last substring that matches the target string with the specified replacement string. @param target the sequence of char values to be replaced @param replacement the replacement sequence of char values @return The MessageBuilder instance. Useful for chaining. """ int index = builder.lastIndexOf(target); if (index != -1) { builder.replace(index, index + target.length(), replacement); } return this; }
java
public MessageBuilder replaceLast(String target, String replacement) { int index = builder.lastIndexOf(target); if (index != -1) { builder.replace(index, index + target.length(), replacement); } return this; }
[ "public", "MessageBuilder", "replaceLast", "(", "String", "target", ",", "String", "replacement", ")", "{", "int", "index", "=", "builder", ".", "lastIndexOf", "(", "target", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "builder", ".", "replace", "(", "index", ",", "index", "+", "target", ".", "length", "(", ")", ",", "replacement", ")", ";", "}", "return", "this", ";", "}" ]
Replaces the last substring that matches the target string with the specified replacement string. @param target the sequence of char values to be replaced @param replacement the replacement sequence of char values @return The MessageBuilder instance. Useful for chaining.
[ "Replaces", "the", "last", "substring", "that", "matches", "the", "target", "string", "with", "the", "specified", "replacement", "string", "." ]
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/MessageBuilder.java#L430-L438
percolate/caffeine
caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java
ViewUtils.showView
public static void showView(Activity context, int id) { """ Sets visibility of the given view to <code>View.VISIBLE</code>. @param context The current Context or Activity that this method is called from. @param id R.id.xxxx value for the view to show. """ if (context != null) { View view = context.findViewById(id); if (view != null) { view.setVisibility(View.VISIBLE); } else { Log.e("Caffeine", "View does not exist. Could not show it."); } } }
java
public static void showView(Activity context, int id) { if (context != null) { View view = context.findViewById(id); if (view != null) { view.setVisibility(View.VISIBLE); } else { Log.e("Caffeine", "View does not exist. Could not show it."); } } }
[ "public", "static", "void", "showView", "(", "Activity", "context", ",", "int", "id", ")", "{", "if", "(", "context", "!=", "null", ")", "{", "View", "view", "=", "context", ".", "findViewById", "(", "id", ")", ";", "if", "(", "view", "!=", "null", ")", "{", "view", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "}", "else", "{", "Log", ".", "e", "(", "\"Caffeine\"", ",", "\"View does not exist. Could not show it.\"", ")", ";", "}", "}", "}" ]
Sets visibility of the given view to <code>View.VISIBLE</code>. @param context The current Context or Activity that this method is called from. @param id R.id.xxxx value for the view to show.
[ "Sets", "visibility", "of", "the", "given", "view", "to", "<code", ">", "View", ".", "VISIBLE<", "/", "code", ">", "." ]
train
https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L266-L275
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/util/BeanMap.java
BeanMap.convertType
@SuppressWarnings( { """ Converts the given value to the given type. First, reflection is is used to find a public constructor declared by the given class that takes one argument, which must be the precise type of the given value. If such a constructor is found, a new object is created by passing the given value to that constructor, and the newly constructed object is returned.<P> <p> If no such constructor exists, and the given type is a primitive type, then the given value is converted to a string using its {@link Object#toString() toString()} method, and that string is parsed into the correct primitive type using, for instance, {@link Integer#valueOf(String)} to convert the string into an {@code int}.<P> <p> If no special constructor exists and the given type is not a primitive type, this method returns the original value. @param newType the type to convert the value to @param value the value to convert @return the converted value @throws NumberFormatException if newType is a primitive type, and the string representation of the given value cannot be converted to that type @throws InstantiationException if the constructor found with reflection raises it @throws InvocationTargetException if the constructor found with reflection raises it @throws IllegalAccessException never """ "rawtypes", "unchecked" }) protected Object convertType(Class<?> newType, Object value) throws InstantiationException, IllegalAccessException, InvocationTargetException { // try call constructor Class<?>[] types = {value.getClass()}; try { Constructor<?> constructor = newType.getConstructor(types); Object[] arguments = {value}; return constructor.newInstance(arguments); } catch (NoSuchMethodException e) { // try using the transformers Function function = getTypeFunction(newType); if (function != null) { return function.apply(value); } return value; } }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) protected Object convertType(Class<?> newType, Object value) throws InstantiationException, IllegalAccessException, InvocationTargetException { // try call constructor Class<?>[] types = {value.getClass()}; try { Constructor<?> constructor = newType.getConstructor(types); Object[] arguments = {value}; return constructor.newInstance(arguments); } catch (NoSuchMethodException e) { // try using the transformers Function function = getTypeFunction(newType); if (function != null) { return function.apply(value); } return value; } }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "protected", "Object", "convertType", "(", "Class", "<", "?", ">", "newType", ",", "Object", "value", ")", "throws", "InstantiationException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "// try call constructor", "Class", "<", "?", ">", "[", "]", "types", "=", "{", "value", ".", "getClass", "(", ")", "}", ";", "try", "{", "Constructor", "<", "?", ">", "constructor", "=", "newType", ".", "getConstructor", "(", "types", ")", ";", "Object", "[", "]", "arguments", "=", "{", "value", "}", ";", "return", "constructor", ".", "newInstance", "(", "arguments", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "// try using the transformers", "Function", "function", "=", "getTypeFunction", "(", "newType", ")", ";", "if", "(", "function", "!=", "null", ")", "{", "return", "function", ".", "apply", "(", "value", ")", ";", "}", "return", "value", ";", "}", "}" ]
Converts the given value to the given type. First, reflection is is used to find a public constructor declared by the given class that takes one argument, which must be the precise type of the given value. If such a constructor is found, a new object is created by passing the given value to that constructor, and the newly constructed object is returned.<P> <p> If no such constructor exists, and the given type is a primitive type, then the given value is converted to a string using its {@link Object#toString() toString()} method, and that string is parsed into the correct primitive type using, for instance, {@link Integer#valueOf(String)} to convert the string into an {@code int}.<P> <p> If no special constructor exists and the given type is not a primitive type, this method returns the original value. @param newType the type to convert the value to @param value the value to convert @return the converted value @throws NumberFormatException if newType is a primitive type, and the string representation of the given value cannot be converted to that type @throws InstantiationException if the constructor found with reflection raises it @throws InvocationTargetException if the constructor found with reflection raises it @throws IllegalAccessException never
[ "Converts", "the", "given", "value", "to", "the", "given", "type", ".", "First", "reflection", "is", "is", "used", "to", "find", "a", "public", "constructor", "declared", "by", "the", "given", "class", "that", "takes", "one", "argument", "which", "must", "be", "the", "precise", "type", "of", "the", "given", "value", ".", "If", "such", "a", "constructor", "is", "found", "a", "new", "object", "is", "created", "by", "passing", "the", "given", "value", "to", "that", "constructor", "and", "the", "newly", "constructed", "object", "is", "returned", ".", "<P", ">", "<p", ">", "If", "no", "such", "constructor", "exists", "and", "the", "given", "type", "is", "a", "primitive", "type", "then", "the", "given", "value", "is", "converted", "to", "a", "string", "using", "its", "{", "@link", "Object#toString", "()", "toString", "()", "}", "method", "and", "that", "string", "is", "parsed", "into", "the", "correct", "primitive", "type", "using", "for", "instance", "{", "@link", "Integer#valueOf", "(", "String", ")", "}", "to", "convert", "the", "string", "into", "an", "{", "@code", "int", "}", ".", "<P", ">", "<p", ">", "If", "no", "special", "constructor", "exists", "and", "the", "given", "type", "is", "not", "a", "primitive", "type", "this", "method", "returns", "the", "original", "value", "." ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/util/BeanMap.java#L700-L716
EdwardRaff/JSAT
JSAT/src/jsat/io/LIBSVMLoader.java
LIBSVMLoader.getWriter
public static DataWriter getWriter(OutputStream out, int dim, DataWriter.DataSetType type) throws IOException { """ Returns a DataWriter object which can be used to stream a set of arbitrary datapoints into the given output stream. This works in a thread safe manner.<br> Categorical information dose not need to be specified since LIBSVM files can't store categorical features. @param out the location to store all the data @param dim information on how many numeric features exist @param type what type of data set (simple, classification, regression) to be written @return the DataWriter that the actual points can be streamed through @throws IOException """ DataWriter dw = new DataWriter(out, new CategoricalData[0], dim, type) { @Override protected void writeHeader(CategoricalData[] catInfo, int dim, DataWriter.DataSetType type, OutputStream out) { //nothing to do, LIBSVM format has no header } @Override protected void pointToBytes(double weight, DataPoint dp, double label, ByteArrayOutputStream byteOut) { PrintWriter writer = new PrintWriter(byteOut); //write out label if(this.type == DataSetType.REGRESSION) writer.write(label + " "); else if(this.type == DataSetType.CLASSIFICATION) writer.write((int)label + " "); else if(this.type == DataSetType.SIMPLE) writer.write("0 "); Vec vals = dp.getNumericalValues(); for(IndexValue iv : vals) { double val = iv.getValue(); if(Math.rint(val) == val)//cast to long before writting to save space writer.write((iv.getIndex()+1) + ":" + (long)val + " ");//+1 b/c 1 based indexing else writer.write((iv.getIndex()+1) + ":" + val + " ");//+1 b/c 1 based indexing } writer.write("\n"); writer.flush(); } }; return dw; }
java
public static DataWriter getWriter(OutputStream out, int dim, DataWriter.DataSetType type) throws IOException { DataWriter dw = new DataWriter(out, new CategoricalData[0], dim, type) { @Override protected void writeHeader(CategoricalData[] catInfo, int dim, DataWriter.DataSetType type, OutputStream out) { //nothing to do, LIBSVM format has no header } @Override protected void pointToBytes(double weight, DataPoint dp, double label, ByteArrayOutputStream byteOut) { PrintWriter writer = new PrintWriter(byteOut); //write out label if(this.type == DataSetType.REGRESSION) writer.write(label + " "); else if(this.type == DataSetType.CLASSIFICATION) writer.write((int)label + " "); else if(this.type == DataSetType.SIMPLE) writer.write("0 "); Vec vals = dp.getNumericalValues(); for(IndexValue iv : vals) { double val = iv.getValue(); if(Math.rint(val) == val)//cast to long before writting to save space writer.write((iv.getIndex()+1) + ":" + (long)val + " ");//+1 b/c 1 based indexing else writer.write((iv.getIndex()+1) + ":" + val + " ");//+1 b/c 1 based indexing } writer.write("\n"); writer.flush(); } }; return dw; }
[ "public", "static", "DataWriter", "getWriter", "(", "OutputStream", "out", ",", "int", "dim", ",", "DataWriter", ".", "DataSetType", "type", ")", "throws", "IOException", "{", "DataWriter", "dw", "=", "new", "DataWriter", "(", "out", ",", "new", "CategoricalData", "[", "0", "]", ",", "dim", ",", "type", ")", "{", "@", "Override", "protected", "void", "writeHeader", "(", "CategoricalData", "[", "]", "catInfo", ",", "int", "dim", ",", "DataWriter", ".", "DataSetType", "type", ",", "OutputStream", "out", ")", "{", "//nothing to do, LIBSVM format has no header", "}", "@", "Override", "protected", "void", "pointToBytes", "(", "double", "weight", ",", "DataPoint", "dp", ",", "double", "label", ",", "ByteArrayOutputStream", "byteOut", ")", "{", "PrintWriter", "writer", "=", "new", "PrintWriter", "(", "byteOut", ")", ";", "//write out label", "if", "(", "this", ".", "type", "==", "DataSetType", ".", "REGRESSION", ")", "writer", ".", "write", "(", "label", "+", "\" \"", ")", ";", "else", "if", "(", "this", ".", "type", "==", "DataSetType", ".", "CLASSIFICATION", ")", "writer", ".", "write", "(", "(", "int", ")", "label", "+", "\" \"", ")", ";", "else", "if", "(", "this", ".", "type", "==", "DataSetType", ".", "SIMPLE", ")", "writer", ".", "write", "(", "\"0 \"", ")", ";", "Vec", "vals", "=", "dp", ".", "getNumericalValues", "(", ")", ";", "for", "(", "IndexValue", "iv", ":", "vals", ")", "{", "double", "val", "=", "iv", ".", "getValue", "(", ")", ";", "if", "(", "Math", ".", "rint", "(", "val", ")", "==", "val", ")", "//cast to long before writting to save space", "writer", ".", "write", "(", "(", "iv", ".", "getIndex", "(", ")", "+", "1", ")", "+", "\":\"", "+", "(", "long", ")", "val", "+", "\" \"", ")", ";", "//+1 b/c 1 based indexing", "else", "writer", ".", "write", "(", "(", "iv", ".", "getIndex", "(", ")", "+", "1", ")", "+", "\":\"", "+", "val", "+", "\" \"", ")", ";", "//+1 b/c 1 based indexing", "}", "writer", ".", "write", "(", "\"\\n\"", ")", ";", "writer", ".", "flush", "(", ")", ";", "}", "}", ";", "return", "dw", ";", "}" ]
Returns a DataWriter object which can be used to stream a set of arbitrary datapoints into the given output stream. This works in a thread safe manner.<br> Categorical information dose not need to be specified since LIBSVM files can't store categorical features. @param out the location to store all the data @param dim information on how many numeric features exist @param type what type of data set (simple, classification, regression) to be written @return the DataWriter that the actual points can be streamed through @throws IOException
[ "Returns", "a", "DataWriter", "object", "which", "can", "be", "used", "to", "stream", "a", "set", "of", "arbitrary", "datapoints", "into", "the", "given", "output", "stream", ".", "This", "works", "in", "a", "thread", "safe", "manner", ".", "<br", ">", "Categorical", "information", "dose", "not", "need", "to", "be", "specified", "since", "LIBSVM", "files", "can", "t", "store", "categorical", "features", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/LIBSVMLoader.java#L576-L614
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.setFile
public void setFile(Element el, String key, Resource value) { """ sets a file value to a XML Element @param el Element to set value on it @param key key to set @param value value to set """ if (value != null && value.toString().length() > 0) el.setAttribute(key, value.getAbsolutePath()); }
java
public void setFile(Element el, String key, Resource value) { if (value != null && value.toString().length() > 0) el.setAttribute(key, value.getAbsolutePath()); }
[ "public", "void", "setFile", "(", "Element", "el", ",", "String", "key", ",", "Resource", "value", ")", "{", "if", "(", "value", "!=", "null", "&&", "value", ".", "toString", "(", ")", ".", "length", "(", ")", ">", "0", ")", "el", ".", "setAttribute", "(", "key", ",", "value", ".", "getAbsolutePath", "(", ")", ")", ";", "}" ]
sets a file value to a XML Element @param el Element to set value on it @param key key to set @param value value to set
[ "sets", "a", "file", "value", "to", "a", "XML", "Element" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L379-L381
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/VirtualFile.java
VirtualFile.writeView
ByteBuffer writeView(int position, int needs) throws IOException { """ Returns view of content. @return ByteBuffer position set to given position limit is position+needs. """ int waterMark = position+needs; if (waterMark > content.capacity()) { if (refSet.containsKey(content)) { throw new IOException("cannot grow file because of writable mapping for content. (non carbage collected mapping?)"); } int blockSize = fileStore.getBlockSize(); int newCapacity = Math.max(((waterMark / blockSize) + 1) * blockSize, 2*content.capacity()); ByteBuffer newBB = ByteBuffer.allocateDirect(newCapacity); newBB.put(content); newBB.flip(); content = newBB; } ByteBuffer bb = content.duplicate(); refSet.add(content, bb); bb.limit(waterMark).position(position); return bb; }
java
ByteBuffer writeView(int position, int needs) throws IOException { int waterMark = position+needs; if (waterMark > content.capacity()) { if (refSet.containsKey(content)) { throw new IOException("cannot grow file because of writable mapping for content. (non carbage collected mapping?)"); } int blockSize = fileStore.getBlockSize(); int newCapacity = Math.max(((waterMark / blockSize) + 1) * blockSize, 2*content.capacity()); ByteBuffer newBB = ByteBuffer.allocateDirect(newCapacity); newBB.put(content); newBB.flip(); content = newBB; } ByteBuffer bb = content.duplicate(); refSet.add(content, bb); bb.limit(waterMark).position(position); return bb; }
[ "ByteBuffer", "writeView", "(", "int", "position", ",", "int", "needs", ")", "throws", "IOException", "{", "int", "waterMark", "=", "position", "+", "needs", ";", "if", "(", "waterMark", ">", "content", ".", "capacity", "(", ")", ")", "{", "if", "(", "refSet", ".", "containsKey", "(", "content", ")", ")", "{", "throw", "new", "IOException", "(", "\"cannot grow file because of writable mapping for content. (non carbage collected mapping?)\"", ")", ";", "}", "int", "blockSize", "=", "fileStore", ".", "getBlockSize", "(", ")", ";", "int", "newCapacity", "=", "Math", ".", "max", "(", "(", "(", "waterMark", "/", "blockSize", ")", "+", "1", ")", "*", "blockSize", ",", "2", "*", "content", ".", "capacity", "(", ")", ")", ";", "ByteBuffer", "newBB", "=", "ByteBuffer", ".", "allocateDirect", "(", "newCapacity", ")", ";", "newBB", ".", "put", "(", "content", ")", ";", "newBB", ".", "flip", "(", ")", ";", "content", "=", "newBB", ";", "}", "ByteBuffer", "bb", "=", "content", ".", "duplicate", "(", ")", ";", "refSet", ".", "add", "(", "content", ",", "bb", ")", ";", "bb", ".", "limit", "(", "waterMark", ")", ".", "position", "(", "position", ")", ";", "return", "bb", ";", "}" ]
Returns view of content. @return ByteBuffer position set to given position limit is position+needs.
[ "Returns", "view", "of", "content", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/VirtualFile.java#L336-L356
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OClusterLocal.java
OClusterLocal.updateDataSegmentPosition
public void updateDataSegmentPosition(long iPosition, final int iDataSegmentId, final long iDataSegmentPosition) throws IOException { """ Update position in data segment (usually on defrag) @throws IOException """ iPosition = iPosition * RECORD_SIZE; acquireExclusiveLock(); try { final long[] pos = fileSegment.getRelativePosition(iPosition); final OFile f = fileSegment.files[(int) pos[0]]; long p = pos[1]; f.writeShort(p, (short) iDataSegmentId); f.writeLong(p += OBinaryProtocol.SIZE_SHORT, iDataSegmentPosition); } finally { releaseExclusiveLock(); } }
java
public void updateDataSegmentPosition(long iPosition, final int iDataSegmentId, final long iDataSegmentPosition) throws IOException { iPosition = iPosition * RECORD_SIZE; acquireExclusiveLock(); try { final long[] pos = fileSegment.getRelativePosition(iPosition); final OFile f = fileSegment.files[(int) pos[0]]; long p = pos[1]; f.writeShort(p, (short) iDataSegmentId); f.writeLong(p += OBinaryProtocol.SIZE_SHORT, iDataSegmentPosition); } finally { releaseExclusiveLock(); } }
[ "public", "void", "updateDataSegmentPosition", "(", "long", "iPosition", ",", "final", "int", "iDataSegmentId", ",", "final", "long", "iDataSegmentPosition", ")", "throws", "IOException", "{", "iPosition", "=", "iPosition", "*", "RECORD_SIZE", ";", "acquireExclusiveLock", "(", ")", ";", "try", "{", "final", "long", "[", "]", "pos", "=", "fileSegment", ".", "getRelativePosition", "(", "iPosition", ")", ";", "final", "OFile", "f", "=", "fileSegment", ".", "files", "[", "(", "int", ")", "pos", "[", "0", "]", "]", ";", "long", "p", "=", "pos", "[", "1", "]", ";", "f", ".", "writeShort", "(", "p", ",", "(", "short", ")", "iDataSegmentId", ")", ";", "f", ".", "writeLong", "(", "p", "+=", "OBinaryProtocol", ".", "SIZE_SHORT", ",", "iDataSegmentPosition", ")", ";", "}", "finally", "{", "releaseExclusiveLock", "(", ")", ";", "}", "}" ]
Update position in data segment (usually on defrag) @throws IOException
[ "Update", "position", "in", "data", "segment", "(", "usually", "on", "defrag", ")" ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OClusterLocal.java#L227-L245
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/DashboardResources.java
DashboardResources.updateDashboard
@PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("/ { """ Updates a dashboard having the given ID. @param req The HTTP request. @param dashboardId The dashboard ID to update. @param dashboardDto The updated date. @return The updated dashboard DTO. @throws WebApplicationException If an error occurs. """dashboardId}") @Description("Updates a dashboard having the given ID.") public DashboardDto updateDashboard(@Context HttpServletRequest req, @PathParam("dashboardId") BigInteger dashboardId, DashboardDto dashboardDto) { if (dashboardId == null || dashboardId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Dashboard Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (dashboardDto == null) { throw new WebApplicationException("Null object cannot be updated.", Status.BAD_REQUEST); } PrincipalUser owner = validateAndGetOwner(req, dashboardDto.getOwnerName()); Dashboard oldDashboard = dService.findDashboardByPrimaryKey(dashboardId); if (oldDashboard == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } validateResourceAuthorization(req, oldDashboard.getOwner(), owner); copyProperties(oldDashboard, dashboardDto); oldDashboard.setModifiedBy(getRemoteUser(req)); return DashboardDto.transformToDto(dService.updateDashboard(oldDashboard)); }
java
@PUT @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @Path("/{dashboardId}") @Description("Updates a dashboard having the given ID.") public DashboardDto updateDashboard(@Context HttpServletRequest req, @PathParam("dashboardId") BigInteger dashboardId, DashboardDto dashboardDto) { if (dashboardId == null || dashboardId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Dashboard Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } if (dashboardDto == null) { throw new WebApplicationException("Null object cannot be updated.", Status.BAD_REQUEST); } PrincipalUser owner = validateAndGetOwner(req, dashboardDto.getOwnerName()); Dashboard oldDashboard = dService.findDashboardByPrimaryKey(dashboardId); if (oldDashboard == null) { throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } validateResourceAuthorization(req, oldDashboard.getOwner(), owner); copyProperties(oldDashboard, dashboardDto); oldDashboard.setModifiedBy(getRemoteUser(req)); return DashboardDto.transformToDto(dService.updateDashboard(oldDashboard)); }
[ "@", "PUT", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Path", "(", "\"/{dashboardId}\"", ")", "@", "Description", "(", "\"Updates a dashboard having the given ID.\"", ")", "public", "DashboardDto", "updateDashboard", "(", "@", "Context", "HttpServletRequest", "req", ",", "@", "PathParam", "(", "\"dashboardId\"", ")", "BigInteger", "dashboardId", ",", "DashboardDto", "dashboardDto", ")", "{", "if", "(", "dashboardId", "==", "null", "||", "dashboardId", ".", "compareTo", "(", "BigInteger", ".", "ZERO", ")", "<", "1", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Dashboard Id cannot be null and must be a positive non-zero number.\"", ",", "Status", ".", "BAD_REQUEST", ")", ";", "}", "if", "(", "dashboardDto", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "\"Null object cannot be updated.\"", ",", "Status", ".", "BAD_REQUEST", ")", ";", "}", "PrincipalUser", "owner", "=", "validateAndGetOwner", "(", "req", ",", "dashboardDto", ".", "getOwnerName", "(", ")", ")", ";", "Dashboard", "oldDashboard", "=", "dService", ".", "findDashboardByPrimaryKey", "(", "dashboardId", ")", ";", "if", "(", "oldDashboard", "==", "null", ")", "{", "throw", "new", "WebApplicationException", "(", "Response", ".", "Status", ".", "NOT_FOUND", ".", "getReasonPhrase", "(", ")", ",", "Response", ".", "Status", ".", "NOT_FOUND", ")", ";", "}", "validateResourceAuthorization", "(", "req", ",", "oldDashboard", ".", "getOwner", "(", ")", ",", "owner", ")", ";", "copyProperties", "(", "oldDashboard", ",", "dashboardDto", ")", ";", "oldDashboard", ".", "setModifiedBy", "(", "getRemoteUser", "(", "req", ")", ")", ";", "return", "DashboardDto", ".", "transformToDto", "(", "dService", ".", "updateDashboard", "(", "oldDashboard", ")", ")", ";", "}" ]
Updates a dashboard having the given ID. @param req The HTTP request. @param dashboardId The dashboard ID to update. @param dashboardDto The updated date. @return The updated dashboard DTO. @throws WebApplicationException If an error occurs.
[ "Updates", "a", "dashboard", "having", "the", "given", "ID", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/DashboardResources.java#L312-L336
structr/structr
structr-core/src/main/java/org/structr/core/graph/GraphObjectModificationState.java
GraphObjectModificationState.doInnerCallback
public boolean doInnerCallback(ModificationQueue modificationQueue, SecurityContext securityContext, ErrorBuffer errorBuffer) throws FrameworkException { """ Call beforeModification/Creation/Deletion methods. @param modificationQueue @param securityContext @param errorBuffer @return valid @throws FrameworkException """ // check for modification propagation along the relationships if ((status & STATE_PROPAGATING_MODIFICATION) == STATE_PROPAGATING_MODIFICATION && object instanceof AbstractNode) { Set<AbstractNode> nodes = ((AbstractNode)object).getNodesForModificationPropagation(); if (nodes != null) { for (AbstractNode node : nodes) { modificationQueue.propagatedModification(node); } } } // examine only the last 4 bits here switch (status & 0x000f) { case 15: case 14: case 13: case 12: case 11: case 10: case 9: case 8: // since all values >= 8 mean that the object was passively deleted, no action has to be taken // (no callback for passive deletion!) break; case 7: // created, modified, deleted, poor guy => no callback break; case 6: // created, modified => only creation callback will be called object.onCreation(securityContext, errorBuffer); break; case 5: // created, deleted => no callback break; case 4: // created => creation callback object.onCreation(securityContext, errorBuffer); break; case 3: // modified, deleted => deletion callback object.onDeletion(securityContext, errorBuffer, removedProperties); break; case 2: // modified => modification callback object.onModification(securityContext, errorBuffer, modificationQueue); break; case 1: // deleted => deletion callback object.onDeletion(securityContext, errorBuffer, removedProperties); break; case 0: // no action, no callback break; default: break; } // mark as finished modified = false; return !errorBuffer.hasError(); }
java
public boolean doInnerCallback(ModificationQueue modificationQueue, SecurityContext securityContext, ErrorBuffer errorBuffer) throws FrameworkException { // check for modification propagation along the relationships if ((status & STATE_PROPAGATING_MODIFICATION) == STATE_PROPAGATING_MODIFICATION && object instanceof AbstractNode) { Set<AbstractNode> nodes = ((AbstractNode)object).getNodesForModificationPropagation(); if (nodes != null) { for (AbstractNode node : nodes) { modificationQueue.propagatedModification(node); } } } // examine only the last 4 bits here switch (status & 0x000f) { case 15: case 14: case 13: case 12: case 11: case 10: case 9: case 8: // since all values >= 8 mean that the object was passively deleted, no action has to be taken // (no callback for passive deletion!) break; case 7: // created, modified, deleted, poor guy => no callback break; case 6: // created, modified => only creation callback will be called object.onCreation(securityContext, errorBuffer); break; case 5: // created, deleted => no callback break; case 4: // created => creation callback object.onCreation(securityContext, errorBuffer); break; case 3: // modified, deleted => deletion callback object.onDeletion(securityContext, errorBuffer, removedProperties); break; case 2: // modified => modification callback object.onModification(securityContext, errorBuffer, modificationQueue); break; case 1: // deleted => deletion callback object.onDeletion(securityContext, errorBuffer, removedProperties); break; case 0: // no action, no callback break; default: break; } // mark as finished modified = false; return !errorBuffer.hasError(); }
[ "public", "boolean", "doInnerCallback", "(", "ModificationQueue", "modificationQueue", ",", "SecurityContext", "securityContext", ",", "ErrorBuffer", "errorBuffer", ")", "throws", "FrameworkException", "{", "// check for modification propagation along the relationships", "if", "(", "(", "status", "&", "STATE_PROPAGATING_MODIFICATION", ")", "==", "STATE_PROPAGATING_MODIFICATION", "&&", "object", "instanceof", "AbstractNode", ")", "{", "Set", "<", "AbstractNode", ">", "nodes", "=", "(", "(", "AbstractNode", ")", "object", ")", ".", "getNodesForModificationPropagation", "(", ")", ";", "if", "(", "nodes", "!=", "null", ")", "{", "for", "(", "AbstractNode", "node", ":", "nodes", ")", "{", "modificationQueue", ".", "propagatedModification", "(", "node", ")", ";", "}", "}", "}", "// examine only the last 4 bits here", "switch", "(", "status", "&", "0x000f", ")", "{", "case", "15", ":", "case", "14", ":", "case", "13", ":", "case", "12", ":", "case", "11", ":", "case", "10", ":", "case", "9", ":", "case", "8", ":", "// since all values >= 8 mean that the object was passively deleted, no action has to be taken", "// (no callback for passive deletion!)", "break", ";", "case", "7", ":", "// created, modified, deleted, poor guy => no callback", "break", ";", "case", "6", ":", "// created, modified => only creation callback will be called", "object", ".", "onCreation", "(", "securityContext", ",", "errorBuffer", ")", ";", "break", ";", "case", "5", ":", "// created, deleted => no callback", "break", ";", "case", "4", ":", "// created => creation callback", "object", ".", "onCreation", "(", "securityContext", ",", "errorBuffer", ")", ";", "break", ";", "case", "3", ":", "// modified, deleted => deletion callback", "object", ".", "onDeletion", "(", "securityContext", ",", "errorBuffer", ",", "removedProperties", ")", ";", "break", ";", "case", "2", ":", "// modified => modification callback", "object", ".", "onModification", "(", "securityContext", ",", "errorBuffer", ",", "modificationQueue", ")", ";", "break", ";", "case", "1", ":", "// deleted => deletion callback", "object", ".", "onDeletion", "(", "securityContext", ",", "errorBuffer", ",", "removedProperties", ")", ";", "break", ";", "case", "0", ":", "// no action, no callback", "break", ";", "default", ":", "break", ";", "}", "// mark as finished", "modified", "=", "false", ";", "return", "!", "errorBuffer", ".", "hasError", "(", ")", ";", "}" ]
Call beforeModification/Creation/Deletion methods. @param modificationQueue @param securityContext @param errorBuffer @return valid @throws FrameworkException
[ "Call", "beforeModification", "/", "Creation", "/", "Deletion", "methods", "." ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/graph/GraphObjectModificationState.java#L284-L351
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/persist/HsqlProperties.java
HsqlProperties.argArrayToProps
public static HsqlProperties argArrayToProps(String[] arg, String type) { """ Creates and populates an HsqlProperties Object from the arguments array of a Main method. Properties are in the form of "-key value" pairs. Each key is prefixed with the type argument and a dot before being inserted into the properties Object. <p> "--help" is treated as a key with no value and not inserted. """ HsqlProperties props = new HsqlProperties(); for (int i = 0; i < arg.length; i++) { String p = arg[i]; if (p.equals("--help") || p.equals("-help")) { props.addError(NO_VALUE_FOR_KEY, p.substring(1)); } else if (p.startsWith("--")) { String value = i + 1 < arg.length ? arg[i + 1] : ""; props.setProperty(type + "." + p.substring(2), value); i++; } else if (p.charAt(0) == '-') { String value = i + 1 < arg.length ? arg[i + 1] : ""; props.setProperty(type + "." + p.substring(1), value); i++; } } return props; }
java
public static HsqlProperties argArrayToProps(String[] arg, String type) { HsqlProperties props = new HsqlProperties(); for (int i = 0; i < arg.length; i++) { String p = arg[i]; if (p.equals("--help") || p.equals("-help")) { props.addError(NO_VALUE_FOR_KEY, p.substring(1)); } else if (p.startsWith("--")) { String value = i + 1 < arg.length ? arg[i + 1] : ""; props.setProperty(type + "." + p.substring(2), value); i++; } else if (p.charAt(0) == '-') { String value = i + 1 < arg.length ? arg[i + 1] : ""; props.setProperty(type + "." + p.substring(1), value); i++; } } return props; }
[ "public", "static", "HsqlProperties", "argArrayToProps", "(", "String", "[", "]", "arg", ",", "String", "type", ")", "{", "HsqlProperties", "props", "=", "new", "HsqlProperties", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "arg", ".", "length", ";", "i", "++", ")", "{", "String", "p", "=", "arg", "[", "i", "]", ";", "if", "(", "p", ".", "equals", "(", "\"--help\"", ")", "||", "p", ".", "equals", "(", "\"-help\"", ")", ")", "{", "props", ".", "addError", "(", "NO_VALUE_FOR_KEY", ",", "p", ".", "substring", "(", "1", ")", ")", ";", "}", "else", "if", "(", "p", ".", "startsWith", "(", "\"--\"", ")", ")", "{", "String", "value", "=", "i", "+", "1", "<", "arg", ".", "length", "?", "arg", "[", "i", "+", "1", "]", ":", "\"\"", ";", "props", ".", "setProperty", "(", "type", "+", "\".\"", "+", "p", ".", "substring", "(", "2", ")", ",", "value", ")", ";", "i", "++", ";", "}", "else", "if", "(", "p", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "String", "value", "=", "i", "+", "1", "<", "arg", ".", "length", "?", "arg", "[", "i", "+", "1", "]", ":", "\"\"", ";", "props", ".", "setProperty", "(", "type", "+", "\".\"", "+", "p", ".", "substring", "(", "1", ")", ",", "value", ")", ";", "i", "++", ";", "}", "}", "return", "props", ";", "}" ]
Creates and populates an HsqlProperties Object from the arguments array of a Main method. Properties are in the form of "-key value" pairs. Each key is prefixed with the type argument and a dot before being inserted into the properties Object. <p> "--help" is treated as a key with no value and not inserted.
[ "Creates", "and", "populates", "an", "HsqlProperties", "Object", "from", "the", "arguments", "array", "of", "a", "Main", "method", ".", "Properties", "are", "in", "the", "form", "of", "-", "key", "value", "pairs", ".", "Each", "key", "is", "prefixed", "with", "the", "type", "argument", "and", "a", "dot", "before", "being", "inserted", "into", "the", "properties", "Object", ".", "<p", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/HsqlProperties.java#L333-L360
apache/incubator-heron
heron/healthmgr/src/java/org/apache/heron/healthmgr/sensors/BufferSizeSensor.java
BufferSizeSensor.fetch
@Override public Collection<Measurement> fetch() { """ The buffer size as provided by tracker @return buffer size measurements """ Collection<Measurement> result = new ArrayList<>(); Instant now = context.checkpoint(); List<String> boltComponents = physicalPlanProvider.getBoltNames(); Duration duration = getDuration(); for (String component : boltComponents) { String[] boltInstanceNames = packingPlanProvider.getBoltInstanceNames(component); for (String instance : boltInstanceNames) { String metric = getMetricName() + instance + MetricName.METRIC_WAIT_Q_SIZE_SUFFIX; Collection<Measurement> stmgrResult = metricsProvider.getMeasurements(now, duration, metric, COMPONENT_STMGR); if (stmgrResult.isEmpty()) { continue; } MeasurementsTable table = MeasurementsTable.of(stmgrResult).component(COMPONENT_STMGR); if (table.size() == 0) { continue; } double totalSize = table.type(metric).sum(); Measurement measurement = new Measurement(component, instance, getMetricName(), now, totalSize); result.add(measurement); } } return result; }
java
@Override public Collection<Measurement> fetch() { Collection<Measurement> result = new ArrayList<>(); Instant now = context.checkpoint(); List<String> boltComponents = physicalPlanProvider.getBoltNames(); Duration duration = getDuration(); for (String component : boltComponents) { String[] boltInstanceNames = packingPlanProvider.getBoltInstanceNames(component); for (String instance : boltInstanceNames) { String metric = getMetricName() + instance + MetricName.METRIC_WAIT_Q_SIZE_SUFFIX; Collection<Measurement> stmgrResult = metricsProvider.getMeasurements(now, duration, metric, COMPONENT_STMGR); if (stmgrResult.isEmpty()) { continue; } MeasurementsTable table = MeasurementsTable.of(stmgrResult).component(COMPONENT_STMGR); if (table.size() == 0) { continue; } double totalSize = table.type(metric).sum(); Measurement measurement = new Measurement(component, instance, getMetricName(), now, totalSize); result.add(measurement); } } return result; }
[ "@", "Override", "public", "Collection", "<", "Measurement", ">", "fetch", "(", ")", "{", "Collection", "<", "Measurement", ">", "result", "=", "new", "ArrayList", "<>", "(", ")", ";", "Instant", "now", "=", "context", ".", "checkpoint", "(", ")", ";", "List", "<", "String", ">", "boltComponents", "=", "physicalPlanProvider", ".", "getBoltNames", "(", ")", ";", "Duration", "duration", "=", "getDuration", "(", ")", ";", "for", "(", "String", "component", ":", "boltComponents", ")", "{", "String", "[", "]", "boltInstanceNames", "=", "packingPlanProvider", ".", "getBoltInstanceNames", "(", "component", ")", ";", "for", "(", "String", "instance", ":", "boltInstanceNames", ")", "{", "String", "metric", "=", "getMetricName", "(", ")", "+", "instance", "+", "MetricName", ".", "METRIC_WAIT_Q_SIZE_SUFFIX", ";", "Collection", "<", "Measurement", ">", "stmgrResult", "=", "metricsProvider", ".", "getMeasurements", "(", "now", ",", "duration", ",", "metric", ",", "COMPONENT_STMGR", ")", ";", "if", "(", "stmgrResult", ".", "isEmpty", "(", ")", ")", "{", "continue", ";", "}", "MeasurementsTable", "table", "=", "MeasurementsTable", ".", "of", "(", "stmgrResult", ")", ".", "component", "(", "COMPONENT_STMGR", ")", ";", "if", "(", "table", ".", "size", "(", ")", "==", "0", ")", "{", "continue", ";", "}", "double", "totalSize", "=", "table", ".", "type", "(", "metric", ")", ".", "sum", "(", ")", ";", "Measurement", "measurement", "=", "new", "Measurement", "(", "component", ",", "instance", ",", "getMetricName", "(", ")", ",", "now", ",", "totalSize", ")", ";", "result", ".", "add", "(", "measurement", ")", ";", "}", "}", "return", "result", ";", "}" ]
The buffer size as provided by tracker @return buffer size measurements
[ "The", "buffer", "size", "as", "provided", "by", "tracker" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/healthmgr/src/java/org/apache/heron/healthmgr/sensors/BufferSizeSensor.java#L61-L93
i-net-software/jlessc
src/com/inet/lib/less/CssFormatter.java
CssFormatter.appendHex
void appendHex( int value, int digits ) { """ Append an hex value to the output. @param value the value @param digits the digits to write. """ if( digits > 1 ) { appendHex( value >>> 4, digits-1 ); } output.append( DIGITS[ value & 0xF ] ); }
java
void appendHex( int value, int digits ) { if( digits > 1 ) { appendHex( value >>> 4, digits-1 ); } output.append( DIGITS[ value & 0xF ] ); }
[ "void", "appendHex", "(", "int", "value", ",", "int", "digits", ")", "{", "if", "(", "digits", ">", "1", ")", "{", "appendHex", "(", "value", ">>>", "4", ",", "digits", "-", "1", ")", ";", "}", "output", ".", "append", "(", "DIGITS", "[", "value", "&", "0xF", "]", ")", ";", "}" ]
Append an hex value to the output. @param value the value @param digits the digits to write.
[ "Append", "an", "hex", "value", "to", "the", "output", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/CssFormatter.java#L641-L646
google/closure-compiler
src/com/google/javascript/rhino/HamtPMap.java
HamtPMap.pivot
@SuppressWarnings("unchecked") private HamtPMap<K, V> pivot(K key, int hash) { """ Returns a new version of this map with the given key at the root, and the root element moved to some deeper node. If the key is not found, then value will be null. """ return pivot(key, hash, null, (V[]) new Object[1]); }
java
@SuppressWarnings("unchecked") private HamtPMap<K, V> pivot(K key, int hash) { return pivot(key, hash, null, (V[]) new Object[1]); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "HamtPMap", "<", "K", ",", "V", ">", "pivot", "(", "K", "key", ",", "int", "hash", ")", "{", "return", "pivot", "(", "key", ",", "hash", ",", "null", ",", "(", "V", "[", "]", ")", "new", "Object", "[", "1", "]", ")", ";", "}" ]
Returns a new version of this map with the given key at the root, and the root element moved to some deeper node. If the key is not found, then value will be null.
[ "Returns", "a", "new", "version", "of", "this", "map", "with", "the", "given", "key", "at", "the", "root", "and", "the", "root", "element", "moved", "to", "some", "deeper", "node", ".", "If", "the", "key", "is", "not", "found", "then", "value", "will", "be", "null", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/HamtPMap.java#L475-L478
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.analyzeImageByDomainWithServiceResponseAsync
public Observable<ServiceResponse<DomainModelResults>> analyzeImageByDomainWithServiceResponseAsync(String model, String url, AnalyzeImageByDomainOptionalParameter analyzeImageByDomainOptionalParameter) { """ This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API only provides a single domain-specific model: celebrities. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong. @param model The domain-specific content to recognize. @param url Publicly reachable URL of an image @param analyzeImageByDomainOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DomainModelResults object """ if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (model == null) { throw new IllegalArgumentException("Parameter model is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final String language = analyzeImageByDomainOptionalParameter != null ? analyzeImageByDomainOptionalParameter.language() : null; return analyzeImageByDomainWithServiceResponseAsync(model, url, language); }
java
public Observable<ServiceResponse<DomainModelResults>> analyzeImageByDomainWithServiceResponseAsync(String model, String url, AnalyzeImageByDomainOptionalParameter analyzeImageByDomainOptionalParameter) { if (this.client.endpoint() == null) { throw new IllegalArgumentException("Parameter this.client.endpoint() is required and cannot be null."); } if (model == null) { throw new IllegalArgumentException("Parameter model is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final String language = analyzeImageByDomainOptionalParameter != null ? analyzeImageByDomainOptionalParameter.language() : null; return analyzeImageByDomainWithServiceResponseAsync(model, url, language); }
[ "public", "Observable", "<", "ServiceResponse", "<", "DomainModelResults", ">", ">", "analyzeImageByDomainWithServiceResponseAsync", "(", "String", "model", ",", "String", "url", ",", "AnalyzeImageByDomainOptionalParameter", "analyzeImageByDomainOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "endpoint", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.endpoint() is required and cannot be null.\"", ")", ";", "}", "if", "(", "model", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter model is required and cannot be null.\"", ")", ";", "}", "if", "(", "url", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter url is required and cannot be null.\"", ")", ";", "}", "final", "String", "language", "=", "analyzeImageByDomainOptionalParameter", "!=", "null", "?", "analyzeImageByDomainOptionalParameter", ".", "language", "(", ")", ":", "null", ";", "return", "analyzeImageByDomainWithServiceResponseAsync", "(", "model", ",", "url", ",", "language", ")", ";", "}" ]
This operation recognizes content within an image by applying a domain-specific model. The list of domain-specific models that are supported by the Computer Vision API can be retrieved using the /models GET request. Currently, the API only provides a single domain-specific model: celebrities. Two input methods are supported -- (1) Uploading an image or (2) specifying an image URL. A successful response will be returned in JSON. If the request failed, the response will contain an error code and a message to help understand what went wrong. @param model The domain-specific content to recognize. @param url Publicly reachable URL of an image @param analyzeImageByDomainOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DomainModelResults object
[ "This", "operation", "recognizes", "content", "within", "an", "image", "by", "applying", "a", "domain", "-", "specific", "model", ".", "The", "list", "of", "domain", "-", "specific", "models", "that", "are", "supported", "by", "the", "Computer", "Vision", "API", "can", "be", "retrieved", "using", "the", "/", "models", "GET", "request", ".", "Currently", "the", "API", "only", "provides", "a", "single", "domain", "-", "specific", "model", ":", "celebrities", ".", "Two", "input", "methods", "are", "supported", "--", "(", "1", ")", "Uploading", "an", "image", "or", "(", "2", ")", "specifying", "an", "image", "URL", ".", "A", "successful", "response", "will", "be", "returned", "in", "JSON", ".", "If", "the", "request", "failed", "the", "response", "will", "contain", "an", "error", "code", "and", "a", "message", "to", "help", "understand", "what", "went", "wrong", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1459-L1472
census-instrumentation/opencensus-java
exporters/stats/stackdriver/src/main/java/io/opencensus/exporter/stats/stackdriver/StackdriverStatsExporter.java
StackdriverStatsExporter.createAndRegisterWithProjectId
@Deprecated public static void createAndRegisterWithProjectId(String projectId, Duration exportInterval) throws IOException { """ Creates a Stackdriver Stats exporter for an explicit project ID, with default Monitored Resource. <p>Only one Stackdriver exporter can be created. <p>This uses the default application credentials. See {@link GoogleCredentials#getApplicationDefault}. <p>This is equivalent with: <pre>{@code StackdriverStatsExporter.createWithCredentialsAndProjectId( GoogleCredentials.getApplicationDefault(), projectId); }</pre> @param projectId the cloud project id. @param exportInterval the interval between pushing stats to StackDriver. @throws IllegalStateException if a Stackdriver exporter is already created. @deprecated in favor of {@link #createAndRegister(StackdriverStatsConfiguration)}. @since 0.9 """ checkNotNull(projectId, "projectId"); checkNotNull(exportInterval, "exportInterval"); createInternal( null, projectId, exportInterval, DEFAULT_RESOURCE, null, DEFAULT_CONSTANT_LABELS); }
java
@Deprecated public static void createAndRegisterWithProjectId(String projectId, Duration exportInterval) throws IOException { checkNotNull(projectId, "projectId"); checkNotNull(exportInterval, "exportInterval"); createInternal( null, projectId, exportInterval, DEFAULT_RESOURCE, null, DEFAULT_CONSTANT_LABELS); }
[ "@", "Deprecated", "public", "static", "void", "createAndRegisterWithProjectId", "(", "String", "projectId", ",", "Duration", "exportInterval", ")", "throws", "IOException", "{", "checkNotNull", "(", "projectId", ",", "\"projectId\"", ")", ";", "checkNotNull", "(", "exportInterval", ",", "\"exportInterval\"", ")", ";", "createInternal", "(", "null", ",", "projectId", ",", "exportInterval", ",", "DEFAULT_RESOURCE", ",", "null", ",", "DEFAULT_CONSTANT_LABELS", ")", ";", "}" ]
Creates a Stackdriver Stats exporter for an explicit project ID, with default Monitored Resource. <p>Only one Stackdriver exporter can be created. <p>This uses the default application credentials. See {@link GoogleCredentials#getApplicationDefault}. <p>This is equivalent with: <pre>{@code StackdriverStatsExporter.createWithCredentialsAndProjectId( GoogleCredentials.getApplicationDefault(), projectId); }</pre> @param projectId the cloud project id. @param exportInterval the interval between pushing stats to StackDriver. @throws IllegalStateException if a Stackdriver exporter is already created. @deprecated in favor of {@link #createAndRegister(StackdriverStatsConfiguration)}. @since 0.9
[ "Creates", "a", "Stackdriver", "Stats", "exporter", "for", "an", "explicit", "project", "ID", "with", "default", "Monitored", "Resource", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/exporters/stats/stackdriver/src/main/java/io/opencensus/exporter/stats/stackdriver/StackdriverStatsExporter.java#L164-L171