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
mlhartme/jasmin
src/main/java/net/oneandone/jasmin/model/Repository.java
Repository.loadLibrary
public void loadLibrary(Resolver resolver, Node base, Node descriptor, Node properties) throws IOException { """ Core method for loading. A library is a module or an application @param base jar file for module, docroot for application """ Source source; Module module; Library library; File file; addReload(descriptor); source = Source.load(properties, base); library = (Library) Library.TYPE.loadXml(descriptor).get(); autoFiles(resolver, library, source); for (net.oneandone.jasmin.descriptor.Module descriptorModule : library.modules()) { module = new Module(descriptorModule.getName(), source); notLinked.put(module, descriptorModule.dependencies()); for (Resource resource : descriptorModule.resources()) { file = resolver.resolve(source.classpathBase, resource); addReload(file); resolver.resolve(source.classpathBase, resource); module.files().add(file); } add(module); } }
java
public void loadLibrary(Resolver resolver, Node base, Node descriptor, Node properties) throws IOException { Source source; Module module; Library library; File file; addReload(descriptor); source = Source.load(properties, base); library = (Library) Library.TYPE.loadXml(descriptor).get(); autoFiles(resolver, library, source); for (net.oneandone.jasmin.descriptor.Module descriptorModule : library.modules()) { module = new Module(descriptorModule.getName(), source); notLinked.put(module, descriptorModule.dependencies()); for (Resource resource : descriptorModule.resources()) { file = resolver.resolve(source.classpathBase, resource); addReload(file); resolver.resolve(source.classpathBase, resource); module.files().add(file); } add(module); } }
[ "public", "void", "loadLibrary", "(", "Resolver", "resolver", ",", "Node", "base", ",", "Node", "descriptor", ",", "Node", "properties", ")", "throws", "IOException", "{", "Source", "source", ";", "Module", "module", ";", "Library", "library", ";", "File", "file", ";", "addReload", "(", "descriptor", ")", ";", "source", "=", "Source", ".", "load", "(", "properties", ",", "base", ")", ";", "library", "=", "(", "Library", ")", "Library", ".", "TYPE", ".", "loadXml", "(", "descriptor", ")", ".", "get", "(", ")", ";", "autoFiles", "(", "resolver", ",", "library", ",", "source", ")", ";", "for", "(", "net", ".", "oneandone", ".", "jasmin", ".", "descriptor", ".", "Module", "descriptorModule", ":", "library", ".", "modules", "(", ")", ")", "{", "module", "=", "new", "Module", "(", "descriptorModule", ".", "getName", "(", ")", ",", "source", ")", ";", "notLinked", ".", "put", "(", "module", ",", "descriptorModule", ".", "dependencies", "(", ")", ")", ";", "for", "(", "Resource", "resource", ":", "descriptorModule", ".", "resources", "(", ")", ")", "{", "file", "=", "resolver", ".", "resolve", "(", "source", ".", "classpathBase", ",", "resource", ")", ";", "addReload", "(", "file", ")", ";", "resolver", ".", "resolve", "(", "source", ".", "classpathBase", ",", "resource", ")", ";", "module", ".", "files", "(", ")", ".", "add", "(", "file", ")", ";", "}", "add", "(", "module", ")", ";", "}", "}" ]
Core method for loading. A library is a module or an application @param base jar file for module, docroot for application
[ "Core", "method", "for", "loading", ".", "A", "library", "is", "a", "module", "or", "an", "application" ]
train
https://github.com/mlhartme/jasmin/blob/1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d/src/main/java/net/oneandone/jasmin/model/Repository.java#L279-L300
kiegroup/jbpm
jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java
QueryCriteriaUtil.createPredicateFromIntersectingCriteriaList
private <R,T> Predicate createPredicateFromIntersectingCriteriaList(CriteriaQuery<R> query, CriteriaBuilder builder, Class<T> queryType, List<QueryCriteria> intersectingCriteriaList, QueryWhere queryWhere ) { """ This method is necessary because the AND operator in SQL has precedence over the OR operator. </p> That means that intersecting criteria should always be grouped together (and processed first, basically), which is essentially what this method does. @param query The {@link CriteriaQuery} that is being built @param intersectingCriteriaList The list of intersecting (ANDed) {@link QueryCriteria} @param builder The {@link CriteriaBuilder} builder instance @param queryType The (persistent {@link Entity}) {@link Class} that we are querying on @return A {@link Predicate} created on the basis of the given {@link List} of {@link QueryCriteria} """ combineIntersectingRangeCriteria(intersectingCriteriaList); assert intersectingCriteriaList.size() > 0 : "Empty list of currently intersecting criteria!"; Predicate [] intersectingPredicates = new Predicate[intersectingCriteriaList.size()]; int i = 0; for( QueryCriteria intersectingCriteria : intersectingCriteriaList ) { Predicate predicate = createPredicateFromSingleOrGroupCriteria(query, builder, queryType, intersectingCriteria, queryWhere ); assert predicate != null : "Null predicate when evaluating individual intersecting criteria [" + intersectingCriteria.toString() + "]"; intersectingPredicates[i++] = predicate; } Predicate predicate; if( intersectingPredicates.length > 1 ) { predicate = builder.and(intersectingPredicates); } else { predicate = intersectingPredicates[0]; } return predicate; }
java
private <R,T> Predicate createPredicateFromIntersectingCriteriaList(CriteriaQuery<R> query, CriteriaBuilder builder, Class<T> queryType, List<QueryCriteria> intersectingCriteriaList, QueryWhere queryWhere ) { combineIntersectingRangeCriteria(intersectingCriteriaList); assert intersectingCriteriaList.size() > 0 : "Empty list of currently intersecting criteria!"; Predicate [] intersectingPredicates = new Predicate[intersectingCriteriaList.size()]; int i = 0; for( QueryCriteria intersectingCriteria : intersectingCriteriaList ) { Predicate predicate = createPredicateFromSingleOrGroupCriteria(query, builder, queryType, intersectingCriteria, queryWhere ); assert predicate != null : "Null predicate when evaluating individual intersecting criteria [" + intersectingCriteria.toString() + "]"; intersectingPredicates[i++] = predicate; } Predicate predicate; if( intersectingPredicates.length > 1 ) { predicate = builder.and(intersectingPredicates); } else { predicate = intersectingPredicates[0]; } return predicate; }
[ "private", "<", "R", ",", "T", ">", "Predicate", "createPredicateFromIntersectingCriteriaList", "(", "CriteriaQuery", "<", "R", ">", "query", ",", "CriteriaBuilder", "builder", ",", "Class", "<", "T", ">", "queryType", ",", "List", "<", "QueryCriteria", ">", "intersectingCriteriaList", ",", "QueryWhere", "queryWhere", ")", "{", "combineIntersectingRangeCriteria", "(", "intersectingCriteriaList", ")", ";", "assert", "intersectingCriteriaList", ".", "size", "(", ")", ">", "0", ":", "\"Empty list of currently intersecting criteria!\"", ";", "Predicate", "[", "]", "intersectingPredicates", "=", "new", "Predicate", "[", "intersectingCriteriaList", ".", "size", "(", ")", "]", ";", "int", "i", "=", "0", ";", "for", "(", "QueryCriteria", "intersectingCriteria", ":", "intersectingCriteriaList", ")", "{", "Predicate", "predicate", "=", "createPredicateFromSingleOrGroupCriteria", "(", "query", ",", "builder", ",", "queryType", ",", "intersectingCriteria", ",", "queryWhere", ")", ";", "assert", "predicate", "!=", "null", ":", "\"Null predicate when evaluating individual intersecting criteria [\"", "+", "intersectingCriteria", ".", "toString", "(", ")", "+", "\"]\"", ";", "intersectingPredicates", "[", "i", "++", "]", "=", "predicate", ";", "}", "Predicate", "predicate", ";", "if", "(", "intersectingPredicates", ".", "length", ">", "1", ")", "{", "predicate", "=", "builder", ".", "and", "(", "intersectingPredicates", ")", ";", "}", "else", "{", "predicate", "=", "intersectingPredicates", "[", "0", "]", ";", "}", "return", "predicate", ";", "}" ]
This method is necessary because the AND operator in SQL has precedence over the OR operator. </p> That means that intersecting criteria should always be grouped together (and processed first, basically), which is essentially what this method does. @param query The {@link CriteriaQuery} that is being built @param intersectingCriteriaList The list of intersecting (ANDed) {@link QueryCriteria} @param builder The {@link CriteriaBuilder} builder instance @param queryType The (persistent {@link Entity}) {@link Class} that we are querying on @return A {@link Predicate} created on the basis of the given {@link List} of {@link QueryCriteria}
[ "This", "method", "is", "necessary", "because", "the", "AND", "operator", "in", "SQL", "has", "precedence", "over", "the", "OR", "operator", ".", "<", "/", "p", ">", "That", "means", "that", "intersecting", "criteria", "should", "always", "be", "grouped", "together", "(", "and", "processed", "first", "basically", ")", "which", "is", "essentially", "what", "this", "method", "does", "." ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java#L289-L308
apereo/cas
support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSamlObjectBuilder.java
AbstractSamlObjectBuilder.signSamlResponse
public static String signSamlResponse(final String samlResponse, final PrivateKey privateKey, final PublicKey publicKey) { """ Sign SAML response. @param samlResponse the SAML response @param privateKey the private key @param publicKey the public key @return the response """ val doc = constructDocumentFromXml(samlResponse); if (doc != null) { val signedElement = signSamlElement(doc.getRootElement(), privateKey, publicKey); doc.setRootElement((org.jdom.Element) signedElement.detach()); return new XMLOutputter().outputString(doc); } throw new IllegalArgumentException("Error signing SAML Response: Null document"); }
java
public static String signSamlResponse(final String samlResponse, final PrivateKey privateKey, final PublicKey publicKey) { val doc = constructDocumentFromXml(samlResponse); if (doc != null) { val signedElement = signSamlElement(doc.getRootElement(), privateKey, publicKey); doc.setRootElement((org.jdom.Element) signedElement.detach()); return new XMLOutputter().outputString(doc); } throw new IllegalArgumentException("Error signing SAML Response: Null document"); }
[ "public", "static", "String", "signSamlResponse", "(", "final", "String", "samlResponse", ",", "final", "PrivateKey", "privateKey", ",", "final", "PublicKey", "publicKey", ")", "{", "val", "doc", "=", "constructDocumentFromXml", "(", "samlResponse", ")", ";", "if", "(", "doc", "!=", "null", ")", "{", "val", "signedElement", "=", "signSamlElement", "(", "doc", ".", "getRootElement", "(", ")", ",", "privateKey", ",", "publicKey", ")", ";", "doc", ".", "setRootElement", "(", "(", "org", ".", "jdom", ".", "Element", ")", "signedElement", ".", "detach", "(", ")", ")", ";", "return", "new", "XMLOutputter", "(", ")", ".", "outputString", "(", "doc", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"Error signing SAML Response: Null document\"", ")", ";", "}" ]
Sign SAML response. @param samlResponse the SAML response @param privateKey the private key @param publicKey the public key @return the response
[ "Sign", "SAML", "response", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSamlObjectBuilder.java#L107-L117
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java
ActiveSyncManager.applyAndJournal
public void applyAndJournal(Supplier<JournalContext> context, AddSyncPointEntry entry) { """ Apply AddSyncPoint entry and journal the entry. @param context journal context @param entry addSyncPoint entry """ try { apply(entry); context.get().append(Journal.JournalEntry.newBuilder().setAddSyncPoint(entry).build()); } catch (Throwable t) { ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry); throw t; // fatalError will usually system.exit } }
java
public void applyAndJournal(Supplier<JournalContext> context, AddSyncPointEntry entry) { try { apply(entry); context.get().append(Journal.JournalEntry.newBuilder().setAddSyncPoint(entry).build()); } catch (Throwable t) { ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry); throw t; // fatalError will usually system.exit } }
[ "public", "void", "applyAndJournal", "(", "Supplier", "<", "JournalContext", ">", "context", ",", "AddSyncPointEntry", "entry", ")", "{", "try", "{", "apply", "(", "entry", ")", ";", "context", ".", "get", "(", ")", ".", "append", "(", "Journal", ".", "JournalEntry", ".", "newBuilder", "(", ")", ".", "setAddSyncPoint", "(", "entry", ")", ".", "build", "(", ")", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "ProcessUtils", ".", "fatalError", "(", "LOG", ",", "t", ",", "\"Failed to apply %s\"", ",", "entry", ")", ";", "throw", "t", ";", "// fatalError will usually system.exit", "}", "}" ]
Apply AddSyncPoint entry and journal the entry. @param context journal context @param entry addSyncPoint entry
[ "Apply", "AddSyncPoint", "entry", "and", "journal", "the", "entry", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java#L232-L240
UrielCh/ovh-java-sdk
ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java
ApiOvhXdsl.serviceName_lines_number_dslamPort_logs_GET
public ArrayList<OvhDslamPortLog> serviceName_lines_number_dslamPort_logs_GET(String serviceName, String number, Long limit) throws IOException { """ Get the logs emitted by the DSLAM for this port REST: GET /xdsl/{serviceName}/lines/{number}/dslamPort/logs @param limit [required] [default=50] @param serviceName [required] The internal name of your XDSL offer @param number [required] The number of the line """ String qPath = "/xdsl/{serviceName}/lines/{number}/dslamPort/logs"; StringBuilder sb = path(qPath, serviceName, number); query(sb, "limit", limit); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t13); }
java
public ArrayList<OvhDslamPortLog> serviceName_lines_number_dslamPort_logs_GET(String serviceName, String number, Long limit) throws IOException { String qPath = "/xdsl/{serviceName}/lines/{number}/dslamPort/logs"; StringBuilder sb = path(qPath, serviceName, number); query(sb, "limit", limit); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t13); }
[ "public", "ArrayList", "<", "OvhDslamPortLog", ">", "serviceName_lines_number_dslamPort_logs_GET", "(", "String", "serviceName", ",", "String", "number", ",", "Long", "limit", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/xdsl/{serviceName}/lines/{number}/dslamPort/logs\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "number", ")", ";", "query", "(", "sb", ",", "\"limit\"", ",", "limit", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t13", ")", ";", "}" ]
Get the logs emitted by the DSLAM for this port REST: GET /xdsl/{serviceName}/lines/{number}/dslamPort/logs @param limit [required] [default=50] @param serviceName [required] The internal name of your XDSL offer @param number [required] The number of the line
[ "Get", "the", "logs", "emitted", "by", "the", "DSLAM", "for", "this", "port" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-xdsl/src/main/java/net/minidev/ovh/api/ApiOvhXdsl.java#L522-L528
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java
URLConnection.lookupContentHandlerClassFor
private ContentHandler lookupContentHandlerClassFor(String contentType) throws InstantiationException, IllegalAccessException, ClassNotFoundException { """ Looks for a content handler in a user-defineable set of places. By default it looks in sun.net.www.content, but users can define a vertical-bar delimited set of class prefixes to search through in addition by defining the java.content.handler.pkgs property. The class name must be of the form: <pre> {package-prefix}.{major}.{minor} e.g. YoyoDyne.experimental.text.plain </pre> """ String contentHandlerClassName = typeToPackageName(contentType); String contentHandlerPkgPrefixes =getContentHandlerPkgPrefixes(); StringTokenizer packagePrefixIter = new StringTokenizer(contentHandlerPkgPrefixes, "|"); while (packagePrefixIter.hasMoreTokens()) { String packagePrefix = packagePrefixIter.nextToken().trim(); try { String clsName = packagePrefix + "." + contentHandlerClassName; Class cls = null; try { cls = Class.forName(clsName); } catch (ClassNotFoundException e) { ClassLoader cl = ClassLoader.getSystemClassLoader(); if (cl != null) { cls = cl.loadClass(clsName); } } if (cls != null) { ContentHandler handler = (ContentHandler)cls.newInstance(); return handler; } } catch(Exception e) { } } return UnknownContentHandler.INSTANCE; }
java
private ContentHandler lookupContentHandlerClassFor(String contentType) throws InstantiationException, IllegalAccessException, ClassNotFoundException { String contentHandlerClassName = typeToPackageName(contentType); String contentHandlerPkgPrefixes =getContentHandlerPkgPrefixes(); StringTokenizer packagePrefixIter = new StringTokenizer(contentHandlerPkgPrefixes, "|"); while (packagePrefixIter.hasMoreTokens()) { String packagePrefix = packagePrefixIter.nextToken().trim(); try { String clsName = packagePrefix + "." + contentHandlerClassName; Class cls = null; try { cls = Class.forName(clsName); } catch (ClassNotFoundException e) { ClassLoader cl = ClassLoader.getSystemClassLoader(); if (cl != null) { cls = cl.loadClass(clsName); } } if (cls != null) { ContentHandler handler = (ContentHandler)cls.newInstance(); return handler; } } catch(Exception e) { } } return UnknownContentHandler.INSTANCE; }
[ "private", "ContentHandler", "lookupContentHandlerClassFor", "(", "String", "contentType", ")", "throws", "InstantiationException", ",", "IllegalAccessException", ",", "ClassNotFoundException", "{", "String", "contentHandlerClassName", "=", "typeToPackageName", "(", "contentType", ")", ";", "String", "contentHandlerPkgPrefixes", "=", "getContentHandlerPkgPrefixes", "(", ")", ";", "StringTokenizer", "packagePrefixIter", "=", "new", "StringTokenizer", "(", "contentHandlerPkgPrefixes", ",", "\"|\"", ")", ";", "while", "(", "packagePrefixIter", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "packagePrefix", "=", "packagePrefixIter", ".", "nextToken", "(", ")", ".", "trim", "(", ")", ";", "try", "{", "String", "clsName", "=", "packagePrefix", "+", "\".\"", "+", "contentHandlerClassName", ";", "Class", "cls", "=", "null", ";", "try", "{", "cls", "=", "Class", ".", "forName", "(", "clsName", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "ClassLoader", "cl", "=", "ClassLoader", ".", "getSystemClassLoader", "(", ")", ";", "if", "(", "cl", "!=", "null", ")", "{", "cls", "=", "cl", ".", "loadClass", "(", "clsName", ")", ";", "}", "}", "if", "(", "cls", "!=", "null", ")", "{", "ContentHandler", "handler", "=", "(", "ContentHandler", ")", "cls", ".", "newInstance", "(", ")", ";", "return", "handler", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "return", "UnknownContentHandler", ".", "INSTANCE", ";", "}" ]
Looks for a content handler in a user-defineable set of places. By default it looks in sun.net.www.content, but users can define a vertical-bar delimited set of class prefixes to search through in addition by defining the java.content.handler.pkgs property. The class name must be of the form: <pre> {package-prefix}.{major}.{minor} e.g. YoyoDyne.experimental.text.plain </pre>
[ "Looks", "for", "a", "content", "handler", "in", "a", "user", "-", "defineable", "set", "of", "places", ".", "By", "default", "it", "looks", "in", "sun", ".", "net", ".", "www", ".", "content", "but", "users", "can", "define", "a", "vertical", "-", "bar", "delimited", "set", "of", "class", "prefixes", "to", "search", "through", "in", "addition", "by", "defining", "the", "java", ".", "content", ".", "handler", ".", "pkgs", "property", ".", "The", "class", "name", "must", "be", "of", "the", "form", ":", "<pre", ">", "{", "package", "-", "prefix", "}", ".", "{", "major", "}", ".", "{", "minor", "}", "e", ".", "g", ".", "YoyoDyne", ".", "experimental", ".", "text", ".", "plain", "<", "/", "pre", ">" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L1299-L1332
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_spla_GET
public ArrayList<Long> serviceName_spla_GET(String serviceName, OvhSplaStatusEnum status, OvhSplaTypeEnum type) throws IOException { """ Your own SPLA licenses attached to this dedicated server REST: GET /dedicated/server/{serviceName}/spla @param status [required] Filter the value of status property (=) @param type [required] Filter the value of type property (=) @param serviceName [required] The internal name of your dedicated server """ String qPath = "/dedicated/server/{serviceName}/spla"; StringBuilder sb = path(qPath, serviceName); query(sb, "status", status); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
java
public ArrayList<Long> serviceName_spla_GET(String serviceName, OvhSplaStatusEnum status, OvhSplaTypeEnum type) throws IOException { String qPath = "/dedicated/server/{serviceName}/spla"; StringBuilder sb = path(qPath, serviceName); query(sb, "status", status); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t5); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_spla_GET", "(", "String", "serviceName", ",", "OvhSplaStatusEnum", "status", ",", "OvhSplaTypeEnum", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/spla\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "query", "(", "sb", ",", "\"status\"", ",", "status", ")", ";", "query", "(", "sb", ",", "\"type\"", ",", "type", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t5", ")", ";", "}" ]
Your own SPLA licenses attached to this dedicated server REST: GET /dedicated/server/{serviceName}/spla @param status [required] Filter the value of status property (=) @param type [required] Filter the value of type property (=) @param serviceName [required] The internal name of your dedicated server
[ "Your", "own", "SPLA", "licenses", "attached", "to", "this", "dedicated", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L706-L713
marklogic/marklogic-contentpump
mlcp/src/main/java/com/marklogic/contentpump/ImportRecordReader.java
ImportRecordReader.setKey
protected boolean setKey(String uri, int line, int col, boolean encode) { """ Apply URI replace option, encode URI if specified, apply URI prefix and suffix configuration options and set the result as DocumentURI key. @param uri Source string of document URI. @param line Line number in the source if applicable; 0 otherwise. @param col Column number in the source if applicable; 0 otherwise. @param encode Encode uri if set to true. @return true if key indicates the record is to be skipped; false otherwise. """ if (key == null) { key = new DocumentURIWithSourceInfo(uri, srcId); } // apply prefix, suffix and replace for URI if (uri != null && !uri.isEmpty()) { uri = URIUtil.applyUriReplace(uri, conf); key.setSkipReason(""); if (encode) { try { URI uriObj = new URI(null, null, null, 0, uri, null, null); uri = uriObj.toString(); } catch (URISyntaxException e) { uri = null; key.setSkipReason(e.getMessage()); } } uri = URIUtil.applyPrefixSuffix(uri, conf); } else { key.setSkipReason("empty uri value"); } key.setUri(uri); key.setSrcId(srcId); key.setSubId(subId); key.setColNumber(col); key.setLineNumber(line); if (LOG.isTraceEnabled()) { LOG.trace("Set key: " + key); } return key.isSkip(); }
java
protected boolean setKey(String uri, int line, int col, boolean encode) { if (key == null) { key = new DocumentURIWithSourceInfo(uri, srcId); } // apply prefix, suffix and replace for URI if (uri != null && !uri.isEmpty()) { uri = URIUtil.applyUriReplace(uri, conf); key.setSkipReason(""); if (encode) { try { URI uriObj = new URI(null, null, null, 0, uri, null, null); uri = uriObj.toString(); } catch (URISyntaxException e) { uri = null; key.setSkipReason(e.getMessage()); } } uri = URIUtil.applyPrefixSuffix(uri, conf); } else { key.setSkipReason("empty uri value"); } key.setUri(uri); key.setSrcId(srcId); key.setSubId(subId); key.setColNumber(col); key.setLineNumber(line); if (LOG.isTraceEnabled()) { LOG.trace("Set key: " + key); } return key.isSkip(); }
[ "protected", "boolean", "setKey", "(", "String", "uri", ",", "int", "line", ",", "int", "col", ",", "boolean", "encode", ")", "{", "if", "(", "key", "==", "null", ")", "{", "key", "=", "new", "DocumentURIWithSourceInfo", "(", "uri", ",", "srcId", ")", ";", "}", "// apply prefix, suffix and replace for URI", "if", "(", "uri", "!=", "null", "&&", "!", "uri", ".", "isEmpty", "(", ")", ")", "{", "uri", "=", "URIUtil", ".", "applyUriReplace", "(", "uri", ",", "conf", ")", ";", "key", ".", "setSkipReason", "(", "\"\"", ")", ";", "if", "(", "encode", ")", "{", "try", "{", "URI", "uriObj", "=", "new", "URI", "(", "null", ",", "null", ",", "null", ",", "0", ",", "uri", ",", "null", ",", "null", ")", ";", "uri", "=", "uriObj", ".", "toString", "(", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "uri", "=", "null", ";", "key", ".", "setSkipReason", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "uri", "=", "URIUtil", ".", "applyPrefixSuffix", "(", "uri", ",", "conf", ")", ";", "}", "else", "{", "key", ".", "setSkipReason", "(", "\"empty uri value\"", ")", ";", "}", "key", ".", "setUri", "(", "uri", ")", ";", "key", ".", "setSrcId", "(", "srcId", ")", ";", "key", ".", "setSubId", "(", "subId", ")", ";", "key", ".", "setColNumber", "(", "col", ")", ";", "key", ".", "setLineNumber", "(", "line", ")", ";", "if", "(", "LOG", ".", "isTraceEnabled", "(", ")", ")", "{", "LOG", ".", "trace", "(", "\"Set key: \"", "+", "key", ")", ";", "}", "return", "key", ".", "isSkip", "(", ")", ";", "}" ]
Apply URI replace option, encode URI if specified, apply URI prefix and suffix configuration options and set the result as DocumentURI key. @param uri Source string of document URI. @param line Line number in the source if applicable; 0 otherwise. @param col Column number in the source if applicable; 0 otherwise. @param encode Encode uri if set to true. @return true if key indicates the record is to be skipped; false otherwise.
[ "Apply", "URI", "replace", "option", "encode", "URI", "if", "specified", "apply", "URI", "prefix", "and", "suffix", "configuration", "options", "and", "set", "the", "result", "as", "DocumentURI", "key", "." ]
train
https://github.com/marklogic/marklogic-contentpump/blob/4c41e4a953301f81a4c655efb2a847603dee8afc/mlcp/src/main/java/com/marklogic/contentpump/ImportRecordReader.java#L75-L106
Bedework/bw-util
bw-util-xml/src/main/java/org/bedework/util/xml/XmlEmit.java
XmlEmit.startEmit
public void startEmit(final Writer wtr, final String dtd) throws IOException { """ Emit any headers, dtd and namespace declarations @param wtr @param dtd @throws IOException """ this.wtr = wtr; this.dtd = dtd; }
java
public void startEmit(final Writer wtr, final String dtd) throws IOException { this.wtr = wtr; this.dtd = dtd; }
[ "public", "void", "startEmit", "(", "final", "Writer", "wtr", ",", "final", "String", "dtd", ")", "throws", "IOException", "{", "this", ".", "wtr", "=", "wtr", ";", "this", ".", "dtd", "=", "dtd", ";", "}" ]
Emit any headers, dtd and namespace declarations @param wtr @param dtd @throws IOException
[ "Emit", "any", "headers", "dtd", "and", "namespace", "declarations" ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlEmit.java#L176-L179
wcm-io/wcm-io-tooling
netbeans/sightly/src/main/java/io/wcm/tooling/netbeans/sightly/completion/classLookup/MemberLookupResolver.java
MemberLookupResolver.getMethodsFromClassLoader
private Set<MemberLookupResult> getMethodsFromClassLoader(String clazzname, String variable) { """ Fallback used to load the methods from classloader @param clazzname @param variable @return set with all methods, can be empty """ final Set<MemberLookupResult> ret = new LinkedHashSet<>(); try { Class clazz = classPath.getClassLoader(true).loadClass(clazzname); for (Method method : clazz.getMethods()) { if (method.getReturnType() != Void.TYPE && GETTER_PATTERN.matcher(method.getName()).matches()) { ret.add(new MemberLookupResult(variable, method.getName(), method.getReturnType().getName())); } } for (Field field : clazz.getFields()) { ret.add(new MemberLookupResult(variable, field.getName(), field.getType().getName())); } } catch (ClassNotFoundException cnfe) { LOGGER.log(Level.FINE, "Could not resolve class " + clazzname + "defined for variable " + variable, cnfe); } return ret; }
java
private Set<MemberLookupResult> getMethodsFromClassLoader(String clazzname, String variable) { final Set<MemberLookupResult> ret = new LinkedHashSet<>(); try { Class clazz = classPath.getClassLoader(true).loadClass(clazzname); for (Method method : clazz.getMethods()) { if (method.getReturnType() != Void.TYPE && GETTER_PATTERN.matcher(method.getName()).matches()) { ret.add(new MemberLookupResult(variable, method.getName(), method.getReturnType().getName())); } } for (Field field : clazz.getFields()) { ret.add(new MemberLookupResult(variable, field.getName(), field.getType().getName())); } } catch (ClassNotFoundException cnfe) { LOGGER.log(Level.FINE, "Could not resolve class " + clazzname + "defined for variable " + variable, cnfe); } return ret; }
[ "private", "Set", "<", "MemberLookupResult", ">", "getMethodsFromClassLoader", "(", "String", "clazzname", ",", "String", "variable", ")", "{", "final", "Set", "<", "MemberLookupResult", ">", "ret", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "try", "{", "Class", "clazz", "=", "classPath", ".", "getClassLoader", "(", "true", ")", ".", "loadClass", "(", "clazzname", ")", ";", "for", "(", "Method", "method", ":", "clazz", ".", "getMethods", "(", ")", ")", "{", "if", "(", "method", ".", "getReturnType", "(", ")", "!=", "Void", ".", "TYPE", "&&", "GETTER_PATTERN", ".", "matcher", "(", "method", ".", "getName", "(", ")", ")", ".", "matches", "(", ")", ")", "{", "ret", ".", "add", "(", "new", "MemberLookupResult", "(", "variable", ",", "method", ".", "getName", "(", ")", ",", "method", ".", "getReturnType", "(", ")", ".", "getName", "(", ")", ")", ")", ";", "}", "}", "for", "(", "Field", "field", ":", "clazz", ".", "getFields", "(", ")", ")", "{", "ret", ".", "add", "(", "new", "MemberLookupResult", "(", "variable", ",", "field", ".", "getName", "(", ")", ",", "field", ".", "getType", "(", ")", ".", "getName", "(", ")", ")", ")", ";", "}", "}", "catch", "(", "ClassNotFoundException", "cnfe", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "FINE", ",", "\"Could not resolve class \"", "+", "clazzname", "+", "\"defined for variable \"", "+", "variable", ",", "cnfe", ")", ";", "}", "return", "ret", ";", "}" ]
Fallback used to load the methods from classloader @param clazzname @param variable @return set with all methods, can be empty
[ "Fallback", "used", "to", "load", "the", "methods", "from", "classloader" ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/netbeans/sightly/src/main/java/io/wcm/tooling/netbeans/sightly/completion/classLookup/MemberLookupResolver.java#L188-L205
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java
Circle.contains
public boolean contains(float x, float y) { """ Check if a point is contained by this circle @param x The x coordinate of the point to check @param y The y coorindate of the point to check @return True if the point is contained by this circle """ float xDelta = x - getCenterX(), yDelta = y - getCenterY(); return xDelta * xDelta + yDelta * yDelta < getRadius() * getRadius(); }
java
public boolean contains(float x, float y) { float xDelta = x - getCenterX(), yDelta = y - getCenterY(); return xDelta * xDelta + yDelta * yDelta < getRadius() * getRadius(); }
[ "public", "boolean", "contains", "(", "float", "x", ",", "float", "y", ")", "{", "float", "xDelta", "=", "x", "-", "getCenterX", "(", ")", ",", "yDelta", "=", "y", "-", "getCenterY", "(", ")", ";", "return", "xDelta", "*", "xDelta", "+", "yDelta", "*", "yDelta", "<", "getRadius", "(", ")", "*", "getRadius", "(", ")", ";", "}" ]
Check if a point is contained by this circle @param x The x coordinate of the point to check @param y The y coorindate of the point to check @return True if the point is contained by this circle
[ "Check", "if", "a", "point", "is", "contained", "by", "this", "circle" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Circle.java#L129-L133
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java
EnvironmentSettingsInner.claimAnyAsync
public Observable<Void> claimAnyAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName) { """ Claims a random environment for a user in an environment settings. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return claimAnyWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> claimAnyAsync(String resourceGroupName, String labAccountName, String labName, String environmentSettingName) { return claimAnyWithServiceResponseAsync(resourceGroupName, labAccountName, labName, environmentSettingName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "claimAnyAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "environmentSettingName", ")", "{", "return", "claimAnyWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ",", "labName", ",", "environmentSettingName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Claims a random environment for a user in an environment settings. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param environmentSettingName The name of the environment Setting. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Claims", "a", "random", "environment", "for", "a", "user", "in", "an", "environment", "settings", "." ]
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/EnvironmentSettingsInner.java#L1133-L1140
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MkColCommand.java
MkColCommand.addMixins
private void addMixins(Node node, List<String> mixinTypes) { """ Adds mixins to node. @param node node. @param mixinTypes mixin types. """ for (int i = 0; i < mixinTypes.size(); i++) { String curMixinType = mixinTypes.get(i); try { node.addMixin(curMixinType); } catch (Exception exc) { log.error("Can't add mixin [" + curMixinType + "]", exc); } } }
java
private void addMixins(Node node, List<String> mixinTypes) { for (int i = 0; i < mixinTypes.size(); i++) { String curMixinType = mixinTypes.get(i); try { node.addMixin(curMixinType); } catch (Exception exc) { log.error("Can't add mixin [" + curMixinType + "]", exc); } } }
[ "private", "void", "addMixins", "(", "Node", "node", ",", "List", "<", "String", ">", "mixinTypes", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mixinTypes", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "curMixinType", "=", "mixinTypes", ".", "get", "(", "i", ")", ";", "try", "{", "node", ".", "addMixin", "(", "curMixinType", ")", ";", "}", "catch", "(", "Exception", "exc", ")", "{", "log", ".", "error", "(", "\"Can't add mixin [\"", "+", "curMixinType", "+", "\"]\"", ",", "exc", ")", ";", "}", "}", "}" ]
Adds mixins to node. @param node node. @param mixinTypes mixin types.
[ "Adds", "mixins", "to", "node", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/command/MkColCommand.java#L158-L172
jdereg/java-util
src/main/java/com/cedarsoftware/util/DeepEquals.java
DeepEquals.nearlyEqual
private static boolean nearlyEqual(double a, double b, double epsilon) { """ Correctly handles floating point comparisions. <br> source: http://floating-point-gui.de/errors/comparison/ @param a first number @param b second number @param epsilon double tolerance value @return true if a and b are close enough """ final double absA = Math.abs(a); final double absB = Math.abs(b); final double diff = Math.abs(a - b); if (a == b) { // shortcut, handles infinities return true; } else if (a == 0 || b == 0 || diff < Double.MIN_NORMAL) { // a or b is zero or both are extremely close to it // relative error is less meaningful here return diff < (epsilon * Double.MIN_NORMAL); } else { // use relative error return diff / (absA + absB) < epsilon; } }
java
private static boolean nearlyEqual(double a, double b, double epsilon) { final double absA = Math.abs(a); final double absB = Math.abs(b); final double diff = Math.abs(a - b); if (a == b) { // shortcut, handles infinities return true; } else if (a == 0 || b == 0 || diff < Double.MIN_NORMAL) { // a or b is zero or both are extremely close to it // relative error is less meaningful here return diff < (epsilon * Double.MIN_NORMAL); } else { // use relative error return diff / (absA + absB) < epsilon; } }
[ "private", "static", "boolean", "nearlyEqual", "(", "double", "a", ",", "double", "b", ",", "double", "epsilon", ")", "{", "final", "double", "absA", "=", "Math", ".", "abs", "(", "a", ")", ";", "final", "double", "absB", "=", "Math", ".", "abs", "(", "b", ")", ";", "final", "double", "diff", "=", "Math", ".", "abs", "(", "a", "-", "b", ")", ";", "if", "(", "a", "==", "b", ")", "{", "// shortcut, handles infinities", "return", "true", ";", "}", "else", "if", "(", "a", "==", "0", "||", "b", "==", "0", "||", "diff", "<", "Double", ".", "MIN_NORMAL", ")", "{", "// a or b is zero or both are extremely close to it", "// relative error is less meaningful here", "return", "diff", "<", "(", "epsilon", "*", "Double", ".", "MIN_NORMAL", ")", ";", "}", "else", "{", "// use relative error", "return", "diff", "/", "(", "absA", "+", "absB", ")", "<", "epsilon", ";", "}", "}" ]
Correctly handles floating point comparisions. <br> source: http://floating-point-gui.de/errors/comparison/ @param a first number @param b second number @param epsilon double tolerance value @return true if a and b are close enough
[ "Correctly", "handles", "floating", "point", "comparisions", ".", "<br", ">", "source", ":", "http", ":", "//", "floating", "-", "point", "-", "gui", ".", "de", "/", "errors", "/", "comparison", "/" ]
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/DeepEquals.java#L652-L672
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/decompose/UtilDecompositons_ZDRM.java
UtilDecompositons_ZDRM.checkZerosLT
public static ZMatrixRMaj checkZerosLT(ZMatrixRMaj A , int numRows , int numCols) { """ Creates a zeros matrix only if A does not already exist. If it does exist it will fill the lower triangular portion with zeros. """ if( A == null ) { return new ZMatrixRMaj(numRows,numCols); } else if( numRows != A.numRows || numCols != A.numCols ) throw new IllegalArgumentException("Input is not "+numRows+" x "+numCols+" matrix"); else { for( int i = 0; i < A.numRows; i++ ) { int index = i*A.numCols*2; int end = index + Math.min(i,A.numCols)*2;; while( index < end ) { A.data[index++] = 0; } } } return A; }
java
public static ZMatrixRMaj checkZerosLT(ZMatrixRMaj A , int numRows , int numCols) { if( A == null ) { return new ZMatrixRMaj(numRows,numCols); } else if( numRows != A.numRows || numCols != A.numCols ) throw new IllegalArgumentException("Input is not "+numRows+" x "+numCols+" matrix"); else { for( int i = 0; i < A.numRows; i++ ) { int index = i*A.numCols*2; int end = index + Math.min(i,A.numCols)*2;; while( index < end ) { A.data[index++] = 0; } } } return A; }
[ "public", "static", "ZMatrixRMaj", "checkZerosLT", "(", "ZMatrixRMaj", "A", ",", "int", "numRows", ",", "int", "numCols", ")", "{", "if", "(", "A", "==", "null", ")", "{", "return", "new", "ZMatrixRMaj", "(", "numRows", ",", "numCols", ")", ";", "}", "else", "if", "(", "numRows", "!=", "A", ".", "numRows", "||", "numCols", "!=", "A", ".", "numCols", ")", "throw", "new", "IllegalArgumentException", "(", "\"Input is not \"", "+", "numRows", "+", "\" x \"", "+", "numCols", "+", "\" matrix\"", ")", ";", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "A", ".", "numRows", ";", "i", "++", ")", "{", "int", "index", "=", "i", "*", "A", ".", "numCols", "*", "2", ";", "int", "end", "=", "index", "+", "Math", ".", "min", "(", "i", ",", "A", ".", "numCols", ")", "*", "2", ";", ";", "while", "(", "index", "<", "end", ")", "{", "A", ".", "data", "[", "index", "++", "]", "=", "0", ";", "}", "}", "}", "return", "A", ";", "}" ]
Creates a zeros matrix only if A does not already exist. If it does exist it will fill the lower triangular portion with zeros.
[ "Creates", "a", "zeros", "matrix", "only", "if", "A", "does", "not", "already", "exist", ".", "If", "it", "does", "exist", "it", "will", "fill", "the", "lower", "triangular", "portion", "with", "zeros", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/decompose/UtilDecompositons_ZDRM.java#L55-L70
hawkular/hawkular-apm
api/src/main/java/org/hawkular/apm/api/model/trace/Node.java
Node.findCorrelatedNodes
protected void findCorrelatedNodes(CorrelationIdentifier cid, Set<Node> nodes) { """ This method identifies all of the nodes within a trace that are associated with the supplied correlation identifier. @param cid The correlation identifier @param nodes The set of nodes that are associated with the correlation identifier """ if (isCorrelated(cid)) { nodes.add(this); } }
java
protected void findCorrelatedNodes(CorrelationIdentifier cid, Set<Node> nodes) { if (isCorrelated(cid)) { nodes.add(this); } }
[ "protected", "void", "findCorrelatedNodes", "(", "CorrelationIdentifier", "cid", ",", "Set", "<", "Node", ">", "nodes", ")", "{", "if", "(", "isCorrelated", "(", "cid", ")", ")", "{", "nodes", ".", "add", "(", "this", ")", ";", "}", "}" ]
This method identifies all of the nodes within a trace that are associated with the supplied correlation identifier. @param cid The correlation identifier @param nodes The set of nodes that are associated with the correlation identifier
[ "This", "method", "identifies", "all", "of", "the", "nodes", "within", "a", "trace", "that", "are", "associated", "with", "the", "supplied", "correlation", "identifier", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/api/src/main/java/org/hawkular/apm/api/model/trace/Node.java#L360-L364
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java
PgCallableStatement.checkIndex
protected void checkIndex(int parameterIndex, int type1, int type2, String getName) throws SQLException { """ helperfunction for the getXXX calls to check isFunction and index == 1 Compare BOTH type fields against the return type. @param parameterIndex parameter index (1-based) @param type1 type 1 @param type2 type 2 @param getName getter name @throws SQLException if something goes wrong """ checkIndex(parameterIndex); if (type1 != this.testReturn[parameterIndex - 1] && type2 != this.testReturn[parameterIndex - 1]) { throw new PSQLException( GT.tr("Parameter of type {0} was registered, but call to get{1} (sqltype={2}) was made.", "java.sql.Types=" + testReturn[parameterIndex - 1], getName, "java.sql.Types=" + type1), PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH); } }
java
protected void checkIndex(int parameterIndex, int type1, int type2, String getName) throws SQLException { checkIndex(parameterIndex); if (type1 != this.testReturn[parameterIndex - 1] && type2 != this.testReturn[parameterIndex - 1]) { throw new PSQLException( GT.tr("Parameter of type {0} was registered, but call to get{1} (sqltype={2}) was made.", "java.sql.Types=" + testReturn[parameterIndex - 1], getName, "java.sql.Types=" + type1), PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH); } }
[ "protected", "void", "checkIndex", "(", "int", "parameterIndex", ",", "int", "type1", ",", "int", "type2", ",", "String", "getName", ")", "throws", "SQLException", "{", "checkIndex", "(", "parameterIndex", ")", ";", "if", "(", "type1", "!=", "this", ".", "testReturn", "[", "parameterIndex", "-", "1", "]", "&&", "type2", "!=", "this", ".", "testReturn", "[", "parameterIndex", "-", "1", "]", ")", "{", "throw", "new", "PSQLException", "(", "GT", ".", "tr", "(", "\"Parameter of type {0} was registered, but call to get{1} (sqltype={2}) was made.\"", ",", "\"java.sql.Types=\"", "+", "testReturn", "[", "parameterIndex", "-", "1", "]", ",", "getName", ",", "\"java.sql.Types=\"", "+", "type1", ")", ",", "PSQLState", ".", "MOST_SPECIFIC_TYPE_DOES_NOT_MATCH", ")", ";", "}", "}" ]
helperfunction for the getXXX calls to check isFunction and index == 1 Compare BOTH type fields against the return type. @param parameterIndex parameter index (1-based) @param type1 type 1 @param type2 type 2 @param getName getter name @throws SQLException if something goes wrong
[ "helperfunction", "for", "the", "getXXX", "calls", "to", "check", "isFunction", "and", "index", "==", "1", "Compare", "BOTH", "type", "fields", "against", "the", "return", "type", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java#L361-L372
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java
CommerceNotificationAttachmentPersistenceImpl.findByUuid_C
@Override public List<CommerceNotificationAttachment> findByUuid_C(String uuid, long companyId, int start, int end, OrderByComparator<CommerceNotificationAttachment> orderByComparator) { """ Returns an ordered range of all the commerce notification attachments where uuid = &#63; and companyId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceNotificationAttachmentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param uuid the uuid @param companyId the company ID @param start the lower bound of the range of commerce notification attachments @param end the upper bound of the range of commerce notification attachments (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching commerce notification attachments """ return findByUuid_C(uuid, companyId, start, end, orderByComparator, true); }
java
@Override public List<CommerceNotificationAttachment> findByUuid_C(String uuid, long companyId, int start, int end, OrderByComparator<CommerceNotificationAttachment> orderByComparator) { return findByUuid_C(uuid, companyId, start, end, orderByComparator, true); }
[ "@", "Override", "public", "List", "<", "CommerceNotificationAttachment", ">", "findByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ",", "int", "start", ",", "int", "end", ",", "OrderByComparator", "<", "CommerceNotificationAttachment", ">", "orderByComparator", ")", "{", "return", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "start", ",", "end", ",", "orderByComparator", ",", "true", ")", ";", "}" ]
Returns an ordered range of all the commerce notification attachments where uuid = &#63; and companyId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceNotificationAttachmentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param uuid the uuid @param companyId the company ID @param start the lower bound of the range of commerce notification attachments @param end the upper bound of the range of commerce notification attachments (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching commerce notification attachments
[ "Returns", "an", "ordered", "range", "of", "all", "the", "commerce", "notification", "attachments", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationAttachmentPersistenceImpl.java#L984-L989
elastic/elasticsearch-metrics-reporter-java
src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java
ElasticsearchReporter.openConnection
private HttpURLConnection openConnection(String uri, String method) { """ Open a new HttpUrlConnection, in case it fails it tries for the next host in the configured list """ for (String host : hosts) { try { URL templateUrl = new URL("http://" + host + uri); HttpURLConnection connection = ( HttpURLConnection ) templateUrl.openConnection(); connection.setRequestMethod(method); connection.setConnectTimeout(timeout); connection.setUseCaches(false); if (method.equalsIgnoreCase("POST") || method.equalsIgnoreCase("PUT")) { connection.setDoOutput(true); } connection.connect(); return connection; } catch (IOException e) { LOGGER.error("Error connecting to {}: {}", host, e); } } return null; }
java
private HttpURLConnection openConnection(String uri, String method) { for (String host : hosts) { try { URL templateUrl = new URL("http://" + host + uri); HttpURLConnection connection = ( HttpURLConnection ) templateUrl.openConnection(); connection.setRequestMethod(method); connection.setConnectTimeout(timeout); connection.setUseCaches(false); if (method.equalsIgnoreCase("POST") || method.equalsIgnoreCase("PUT")) { connection.setDoOutput(true); } connection.connect(); return connection; } catch (IOException e) { LOGGER.error("Error connecting to {}: {}", host, e); } } return null; }
[ "private", "HttpURLConnection", "openConnection", "(", "String", "uri", ",", "String", "method", ")", "{", "for", "(", "String", "host", ":", "hosts", ")", "{", "try", "{", "URL", "templateUrl", "=", "new", "URL", "(", "\"http://\"", "+", "host", "+", "uri", ")", ";", "HttpURLConnection", "connection", "=", "(", "HttpURLConnection", ")", "templateUrl", ".", "openConnection", "(", ")", ";", "connection", ".", "setRequestMethod", "(", "method", ")", ";", "connection", ".", "setConnectTimeout", "(", "timeout", ")", ";", "connection", ".", "setUseCaches", "(", "false", ")", ";", "if", "(", "method", ".", "equalsIgnoreCase", "(", "\"POST\"", ")", "||", "method", ".", "equalsIgnoreCase", "(", "\"PUT\"", ")", ")", "{", "connection", ".", "setDoOutput", "(", "true", ")", ";", "}", "connection", ".", "connect", "(", ")", ";", "return", "connection", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"Error connecting to {}: {}\"", ",", "host", ",", "e", ")", ";", "}", "}", "return", "null", ";", "}" ]
Open a new HttpUrlConnection, in case it fails it tries for the next host in the configured list
[ "Open", "a", "new", "HttpUrlConnection", "in", "case", "it", "fails", "it", "tries", "for", "the", "next", "host", "in", "the", "configured", "list" ]
train
https://github.com/elastic/elasticsearch-metrics-reporter-java/blob/4018eaef6fc7721312f7440b2bf5a19699a6cb56/src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java#L436-L456
openzipkin-contrib/brave-opentracing
src/main/java/brave/opentracing/BraveSpan.java
BraveSpan.toAnnotation
static String toAnnotation(Map<String, ?> fields) { """ Converts a map to a string of form: "key1=value1 key2=value2" """ // special-case the "event" field which is similar to the semantics of a zipkin annotation Object event = fields.get("event"); if (event != null && fields.size() == 1) return event.toString(); return joinOnEqualsSpace(fields); }
java
static String toAnnotation(Map<String, ?> fields) { // special-case the "event" field which is similar to the semantics of a zipkin annotation Object event = fields.get("event"); if (event != null && fields.size() == 1) return event.toString(); return joinOnEqualsSpace(fields); }
[ "static", "String", "toAnnotation", "(", "Map", "<", "String", ",", "?", ">", "fields", ")", "{", "// special-case the \"event\" field which is similar to the semantics of a zipkin annotation", "Object", "event", "=", "fields", ".", "get", "(", "\"event\"", ")", ";", "if", "(", "event", "!=", "null", "&&", "fields", ".", "size", "(", ")", "==", "1", ")", "return", "event", ".", "toString", "(", ")", ";", "return", "joinOnEqualsSpace", "(", "fields", ")", ";", "}" ]
Converts a map to a string of form: "key1=value1 key2=value2"
[ "Converts", "a", "map", "to", "a", "string", "of", "form", ":", "key1", "=", "value1", "key2", "=", "value2" ]
train
https://github.com/openzipkin-contrib/brave-opentracing/blob/07653ac3a67beb7df71008961051ff03db2b60b7/src/main/java/brave/opentracing/BraveSpan.java#L160-L166
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelJsonFormatter.java
HpelJsonFormatter.addToJSON
static boolean addToJSON(StringBuilder sb, String name, String value, boolean jsonEscapeName, boolean jsonEscapeValue, boolean trim, boolean isFirstField) { """ /* returns true if name value pair was added to the string buffer """ // if name or value is null just return if (name == null || value == null) return false; // add comma if isFirstField == false if (!isFirstField) sb.append(","); // trim value if requested if (trim) value = value.trim(); // escape value if requested if (jsonEscapeValue) value = jsonEscape2(value); // escape name if requested if (jsonEscapeName) name = jsonEscape2(name); // append name : value to sb sb.append("\"" + name + "\":\"").append(value).append("\""); return true; }
java
static boolean addToJSON(StringBuilder sb, String name, String value, boolean jsonEscapeName, boolean jsonEscapeValue, boolean trim, boolean isFirstField) { // if name or value is null just return if (name == null || value == null) return false; // add comma if isFirstField == false if (!isFirstField) sb.append(","); // trim value if requested if (trim) value = value.trim(); // escape value if requested if (jsonEscapeValue) value = jsonEscape2(value); // escape name if requested if (jsonEscapeName) name = jsonEscape2(name); // append name : value to sb sb.append("\"" + name + "\":\"").append(value).append("\""); return true; }
[ "static", "boolean", "addToJSON", "(", "StringBuilder", "sb", ",", "String", "name", ",", "String", "value", ",", "boolean", "jsonEscapeName", ",", "boolean", "jsonEscapeValue", ",", "boolean", "trim", ",", "boolean", "isFirstField", ")", "{", "// if name or value is null just return", "if", "(", "name", "==", "null", "||", "value", "==", "null", ")", "return", "false", ";", "// add comma if isFirstField == false", "if", "(", "!", "isFirstField", ")", "sb", ".", "append", "(", "\",\"", ")", ";", "// trim value if requested", "if", "(", "trim", ")", "value", "=", "value", ".", "trim", "(", ")", ";", "// escape value if requested", "if", "(", "jsonEscapeValue", ")", "value", "=", "jsonEscape2", "(", "value", ")", ";", "// escape name if requested", "if", "(", "jsonEscapeName", ")", "name", "=", "jsonEscape2", "(", "name", ")", ";", "// append name : value to sb", "sb", ".", "append", "(", "\"\\\"\"", "+", "name", "+", "\"\\\":\\\"\"", ")", ".", "append", "(", "value", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "return", "true", ";", "}" ]
/* returns true if name value pair was added to the string buffer
[ "/", "*", "returns", "true", "if", "name", "value", "pair", "was", "added", "to", "the", "string", "buffer" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/HpelJsonFormatter.java#L123-L143
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/Criteria.java
Criteria.addOrderBy
public void addOrderBy(String fieldName, boolean sortAscending) { """ Adds a field for orderBy @param fieldName the field name to be used @param sortAscending true for ASCENDING, false for DESCENDING @deprecated use QueryByCriteria#addOrderBy """ if (fieldName != null) { _getOrderby().add(new FieldHelper(fieldName, sortAscending)); } }
java
public void addOrderBy(String fieldName, boolean sortAscending) { if (fieldName != null) { _getOrderby().add(new FieldHelper(fieldName, sortAscending)); } }
[ "public", "void", "addOrderBy", "(", "String", "fieldName", ",", "boolean", "sortAscending", ")", "{", "if", "(", "fieldName", "!=", "null", ")", "{", "_getOrderby", "(", ")", ".", "add", "(", "new", "FieldHelper", "(", "fieldName", ",", "sortAscending", ")", ")", ";", "}", "}" ]
Adds a field for orderBy @param fieldName the field name to be used @param sortAscending true for ASCENDING, false for DESCENDING @deprecated use QueryByCriteria#addOrderBy
[ "Adds", "a", "field", "for", "orderBy" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/Criteria.java#L572-L578
morimekta/utils
io-util/src/main/java/net/morimekta/util/json/JsonWriter.java
JsonWriter.keyLiteral
public JsonWriter keyLiteral(CharSequence key) { """ Write the string key without quoting or escaping. @param key The raw string key. @return The JSON Writer. """ startKey(); if (key == null) { throw new IllegalArgumentException("Expected map key, but got null."); } writer.write(key.toString()); writer.write(':'); return this; }
java
public JsonWriter keyLiteral(CharSequence key) { startKey(); if (key == null) { throw new IllegalArgumentException("Expected map key, but got null."); } writer.write(key.toString()); writer.write(':'); return this; }
[ "public", "JsonWriter", "keyLiteral", "(", "CharSequence", "key", ")", "{", "startKey", "(", ")", ";", "if", "(", "key", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Expected map key, but got null.\"", ")", ";", "}", "writer", ".", "write", "(", "key", ".", "toString", "(", ")", ")", ";", "writer", ".", "write", "(", "'", "'", ")", ";", "return", "this", ";", "}" ]
Write the string key without quoting or escaping. @param key The raw string key. @return The JSON Writer.
[ "Write", "the", "string", "key", "without", "quoting", "or", "escaping", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/json/JsonWriter.java#L297-L307
apiman/apiman
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultPluginRegistry.java
DefaultPluginRegistry.readPluginFile
protected Plugin readPluginFile(PluginCoordinates coordinates, File pluginFile) throws Exception { """ Reads the plugin into an object. This method will fail if the plugin is not valid. This could happen if the file is not a java archive, or if the plugin spec file is missing from the archive, etc. """ try { PluginClassLoader pluginClassLoader = createPluginClassLoader(pluginFile); URL specFile = pluginClassLoader.getResource(PluginUtils.PLUGIN_SPEC_PATH); if (specFile == null) { throw new Exception(Messages.i18n.format("DefaultPluginRegistry.MissingPluginSpecFile", PluginUtils.PLUGIN_SPEC_PATH)); //$NON-NLS-1$ } else { PluginSpec spec = PluginUtils.readPluginSpecFile(specFile); Plugin plugin = new Plugin(spec, coordinates, pluginClassLoader); // TODO use logger when available System.out.println("Read apiman plugin: " + spec); //$NON-NLS-1$ return plugin; } } catch (Exception e) { throw new Exception(Messages.i18n.format("DefaultPluginRegistry.InvalidPlugin", pluginFile.getAbsolutePath()), e); //$NON-NLS-1$ } }
java
protected Plugin readPluginFile(PluginCoordinates coordinates, File pluginFile) throws Exception { try { PluginClassLoader pluginClassLoader = createPluginClassLoader(pluginFile); URL specFile = pluginClassLoader.getResource(PluginUtils.PLUGIN_SPEC_PATH); if (specFile == null) { throw new Exception(Messages.i18n.format("DefaultPluginRegistry.MissingPluginSpecFile", PluginUtils.PLUGIN_SPEC_PATH)); //$NON-NLS-1$ } else { PluginSpec spec = PluginUtils.readPluginSpecFile(specFile); Plugin plugin = new Plugin(spec, coordinates, pluginClassLoader); // TODO use logger when available System.out.println("Read apiman plugin: " + spec); //$NON-NLS-1$ return plugin; } } catch (Exception e) { throw new Exception(Messages.i18n.format("DefaultPluginRegistry.InvalidPlugin", pluginFile.getAbsolutePath()), e); //$NON-NLS-1$ } }
[ "protected", "Plugin", "readPluginFile", "(", "PluginCoordinates", "coordinates", ",", "File", "pluginFile", ")", "throws", "Exception", "{", "try", "{", "PluginClassLoader", "pluginClassLoader", "=", "createPluginClassLoader", "(", "pluginFile", ")", ";", "URL", "specFile", "=", "pluginClassLoader", ".", "getResource", "(", "PluginUtils", ".", "PLUGIN_SPEC_PATH", ")", ";", "if", "(", "specFile", "==", "null", ")", "{", "throw", "new", "Exception", "(", "Messages", ".", "i18n", ".", "format", "(", "\"DefaultPluginRegistry.MissingPluginSpecFile\"", ",", "PluginUtils", ".", "PLUGIN_SPEC_PATH", ")", ")", ";", "//$NON-NLS-1$", "}", "else", "{", "PluginSpec", "spec", "=", "PluginUtils", ".", "readPluginSpecFile", "(", "specFile", ")", ";", "Plugin", "plugin", "=", "new", "Plugin", "(", "spec", ",", "coordinates", ",", "pluginClassLoader", ")", ";", "// TODO use logger when available", "System", ".", "out", ".", "println", "(", "\"Read apiman plugin: \"", "+", "spec", ")", ";", "//$NON-NLS-1$", "return", "plugin", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "Exception", "(", "Messages", ".", "i18n", ".", "format", "(", "\"DefaultPluginRegistry.InvalidPlugin\"", ",", "pluginFile", ".", "getAbsolutePath", "(", ")", ")", ",", "e", ")", ";", "//$NON-NLS-1$", "}", "}" ]
Reads the plugin into an object. This method will fail if the plugin is not valid. This could happen if the file is not a java archive, or if the plugin spec file is missing from the archive, etc.
[ "Reads", "the", "plugin", "into", "an", "object", ".", "This", "method", "will", "fail", "if", "the", "plugin", "is", "not", "valid", ".", "This", "could", "happen", "if", "the", "file", "is", "not", "a", "java", "archive", "or", "if", "the", "plugin", "spec", "file", "is", "missing", "from", "the", "archive", "etc", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/DefaultPluginRegistry.java#L298-L314
qos-ch/slf4j
jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java
SLF4JLog.error
public void error(Object message, Throwable t) { """ Converts the first input parameter to String and then delegates to the wrapped <code>org.slf4j.Logger</code> instance. @param message the message to log. Converted to {@link String} @param t the exception to log """ logger.error(String.valueOf(message), t); }
java
public void error(Object message, Throwable t) { logger.error(String.valueOf(message), t); }
[ "public", "void", "error", "(", "Object", "message", ",", "Throwable", "t", ")", "{", "logger", ".", "error", "(", "String", ".", "valueOf", "(", "message", ")", ",", "t", ")", ";", "}" ]
Converts the first input parameter to String and then delegates to the wrapped <code>org.slf4j.Logger</code> instance. @param message the message to log. Converted to {@link String} @param t the exception to log
[ "Converts", "the", "first", "input", "parameter", "to", "String", "and", "then", "delegates", "to", "the", "wrapped", "<code", ">", "org", ".", "slf4j", ".", "Logger<", "/", "code", ">", "instance", "." ]
train
https://github.com/qos-ch/slf4j/blob/905443f39fadd88a8dd2c467e44affd8cb072a4d/jcl-over-slf4j/src/main/java/org/apache/commons/logging/impl/SLF4JLog.java#L212-L214
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.data_afnicCorporationTrademarkInformation_afnicCorporationTrademarkId_GET
public OvhAfnicCorporationTrademarkContact data_afnicCorporationTrademarkInformation_afnicCorporationTrademarkId_GET(Long afnicCorporationTrademarkId) throws IOException { """ Retrieve a corporation trademark information according to Afnic REST: GET /domain/data/afnicCorporationTrademarkInformation/{afnicCorporationTrademarkId} @param afnicCorporationTrademarkId [required] Corporation Inpi Information ID """ String qPath = "/domain/data/afnicCorporationTrademarkInformation/{afnicCorporationTrademarkId}"; StringBuilder sb = path(qPath, afnicCorporationTrademarkId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAfnicCorporationTrademarkContact.class); }
java
public OvhAfnicCorporationTrademarkContact data_afnicCorporationTrademarkInformation_afnicCorporationTrademarkId_GET(Long afnicCorporationTrademarkId) throws IOException { String qPath = "/domain/data/afnicCorporationTrademarkInformation/{afnicCorporationTrademarkId}"; StringBuilder sb = path(qPath, afnicCorporationTrademarkId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhAfnicCorporationTrademarkContact.class); }
[ "public", "OvhAfnicCorporationTrademarkContact", "data_afnicCorporationTrademarkInformation_afnicCorporationTrademarkId_GET", "(", "Long", "afnicCorporationTrademarkId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/data/afnicCorporationTrademarkInformation/{afnicCorporationTrademarkId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "afnicCorporationTrademarkId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhAfnicCorporationTrademarkContact", ".", "class", ")", ";", "}" ]
Retrieve a corporation trademark information according to Afnic REST: GET /domain/data/afnicCorporationTrademarkInformation/{afnicCorporationTrademarkId} @param afnicCorporationTrademarkId [required] Corporation Inpi Information ID
[ "Retrieve", "a", "corporation", "trademark", "information", "according", "to", "Afnic" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L67-L72
dwdyer/uncommons-maths
core/src/java/main/org/uncommons/maths/Maths.java
Maths.raiseToPower
public static long raiseToPower(int value, int power) { """ Calculate the first argument raised to the power of the second. This method only supports non-negative powers. @param value The number to be raised. @param power The exponent (must be positive). @return {@code value} raised to {@code power}. """ if (power < 0) { throw new IllegalArgumentException("This method does not support negative powers."); } long result = 1; for (int i = 0; i < power; i++) { result *= value; } return result; }
java
public static long raiseToPower(int value, int power) { if (power < 0) { throw new IllegalArgumentException("This method does not support negative powers."); } long result = 1; for (int i = 0; i < power; i++) { result *= value; } return result; }
[ "public", "static", "long", "raiseToPower", "(", "int", "value", ",", "int", "power", ")", "{", "if", "(", "power", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"This method does not support negative powers.\"", ")", ";", "}", "long", "result", "=", "1", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "power", ";", "i", "++", ")", "{", "result", "*=", "value", ";", "}", "return", "result", ";", "}" ]
Calculate the first argument raised to the power of the second. This method only supports non-negative powers. @param value The number to be raised. @param power The exponent (must be positive). @return {@code value} raised to {@code power}.
[ "Calculate", "the", "first", "argument", "raised", "to", "the", "power", "of", "the", "second", ".", "This", "method", "only", "supports", "non", "-", "negative", "powers", "." ]
train
https://github.com/dwdyer/uncommons-maths/blob/b7ba13aea70625bb7f37c856783a29e17e354964/core/src/java/main/org/uncommons/maths/Maths.java#L111-L123
vanilladb/vanillacore
src/main/java/org/vanilladb/core/query/algebra/multibuffer/BufferNeeds.java
BufferNeeds.bestRoot
public static int bestRoot(long size, Transaction tx) { """ This method considers the various roots of the specified output size (in blocks), and returns the highest root that is less than the number of available buffers. @param size the size of the output file @param tx the tx to execute @return the highest number less than the number of available buffers, that is a root of the plan's output size """ int avail = tx.bufferMgr().available(); if (avail <= 1) return 1; int k = Integer.MAX_VALUE; double i = 1.0; while (k > avail) { i++; k = (int) Math.ceil(Math.pow(size, 1 / i)); } return k; }
java
public static int bestRoot(long size, Transaction tx) { int avail = tx.bufferMgr().available(); if (avail <= 1) return 1; int k = Integer.MAX_VALUE; double i = 1.0; while (k > avail) { i++; k = (int) Math.ceil(Math.pow(size, 1 / i)); } return k; }
[ "public", "static", "int", "bestRoot", "(", "long", "size", ",", "Transaction", "tx", ")", "{", "int", "avail", "=", "tx", ".", "bufferMgr", "(", ")", ".", "available", "(", ")", ";", "if", "(", "avail", "<=", "1", ")", "return", "1", ";", "int", "k", "=", "Integer", ".", "MAX_VALUE", ";", "double", "i", "=", "1.0", ";", "while", "(", "k", ">", "avail", ")", "{", "i", "++", ";", "k", "=", "(", "int", ")", "Math", ".", "ceil", "(", "Math", ".", "pow", "(", "size", ",", "1", "/", "i", ")", ")", ";", "}", "return", "k", ";", "}" ]
This method considers the various roots of the specified output size (in blocks), and returns the highest root that is less than the number of available buffers. @param size the size of the output file @param tx the tx to execute @return the highest number less than the number of available buffers, that is a root of the plan's output size
[ "This", "method", "considers", "the", "various", "roots", "of", "the", "specified", "output", "size", "(", "in", "blocks", ")", "and", "returns", "the", "highest", "root", "that", "is", "less", "than", "the", "number", "of", "available", "buffers", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/query/algebra/multibuffer/BufferNeeds.java#L38-L49
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java
Shape.hasVertex
public boolean hasVertex(float x, float y) { """ Check if a particular location is a vertex of this polygon @param x The x coordinate to check @param y The y coordinate to check @return True if the cordinates supplied are a vertex of this polygon """ if (points.length == 0) { return false; } checkPoints(); for (int i=0;i<points.length;i+=2) { if ((points[i] == x) && (points[i+1] == y)) { return true; } } return false; }
java
public boolean hasVertex(float x, float y) { if (points.length == 0) { return false; } checkPoints(); for (int i=0;i<points.length;i+=2) { if ((points[i] == x) && (points[i+1] == y)) { return true; } } return false; }
[ "public", "boolean", "hasVertex", "(", "float", "x", ",", "float", "y", ")", "{", "if", "(", "points", ".", "length", "==", "0", ")", "{", "return", "false", ";", "}", "checkPoints", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "length", ";", "i", "+=", "2", ")", "{", "if", "(", "(", "points", "[", "i", "]", "==", "x", ")", "&&", "(", "points", "[", "i", "+", "1", "]", "==", "y", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Check if a particular location is a vertex of this polygon @param x The x coordinate to check @param y The y coordinate to check @return True if the cordinates supplied are a vertex of this polygon
[ "Check", "if", "a", "particular", "location", "is", "a", "vertex", "of", "this", "polygon" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/Shape.java#L555-L569
sporniket/core
sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java
FunctorFactory.instanciateFunctorAsAClassMethodWrapper
public static Functor instanciateFunctorAsAClassMethodWrapper(Class<?> instanceClass, String methodName) throws Exception { """ Create a functor without parameter, wrapping a call to another method. @param instanceClass class containing the method. @param methodName Name of the method, it must exist. @return a Functor that call the specified method on the specified instance. @throws Exception if there is a problem to deal with. """ if (null == instanceClass) { throw new NullPointerException("instanceClass is null"); } Method _method = instanceClass.getMethod(methodName, (Class<?>[]) null); return instanciateFunctorAsAMethodWrapper(null, _method); }
java
public static Functor instanciateFunctorAsAClassMethodWrapper(Class<?> instanceClass, String methodName) throws Exception { if (null == instanceClass) { throw new NullPointerException("instanceClass is null"); } Method _method = instanceClass.getMethod(methodName, (Class<?>[]) null); return instanciateFunctorAsAMethodWrapper(null, _method); }
[ "public", "static", "Functor", "instanciateFunctorAsAClassMethodWrapper", "(", "Class", "<", "?", ">", "instanceClass", ",", "String", "methodName", ")", "throws", "Exception", "{", "if", "(", "null", "==", "instanceClass", ")", "{", "throw", "new", "NullPointerException", "(", "\"instanceClass is null\"", ")", ";", "}", "Method", "_method", "=", "instanceClass", ".", "getMethod", "(", "methodName", ",", "(", "Class", "<", "?", ">", "[", "]", ")", "null", ")", ";", "return", "instanciateFunctorAsAMethodWrapper", "(", "null", ",", "_method", ")", ";", "}" ]
Create a functor without parameter, wrapping a call to another method. @param instanceClass class containing the method. @param methodName Name of the method, it must exist. @return a Functor that call the specified method on the specified instance. @throws Exception if there is a problem to deal with.
[ "Create", "a", "functor", "without", "parameter", "wrapping", "a", "call", "to", "another", "method", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-lang/src/main/java/com/sporniket/libre/lang/functor/FunctorFactory.java#L50-L58
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java
AttributeDefinition.addResourceAttributeDescription
public ModelNode addResourceAttributeDescription(final ResourceBundle bundle, final String prefix, final ModelNode resourceDescription) { """ Creates a returns a basic model node describing the attribute, after attaching it to the given overall resource description model node. The node describing the attribute is returned to make it easy to perform further modification. @param bundle resource bundle to use for text descriptions @param prefix prefix to prepend to the attribute name key when looking up descriptions @param resourceDescription the overall resource description @return the attribute description node """ final ModelNode attr = getNoTextDescription(false); attr.get(ModelDescriptionConstants.DESCRIPTION).set(getAttributeTextDescription(bundle, prefix)); final ModelNode result = resourceDescription.get(ModelDescriptionConstants.ATTRIBUTES, getName()).set(attr); ModelNode deprecated = addDeprecatedInfo(result); if (deprecated != null) { deprecated.get(ModelDescriptionConstants.REASON).set(getAttributeDeprecatedDescription(bundle, prefix)); } addAccessConstraints(result, bundle.getLocale()); return result; }
java
public ModelNode addResourceAttributeDescription(final ResourceBundle bundle, final String prefix, final ModelNode resourceDescription) { final ModelNode attr = getNoTextDescription(false); attr.get(ModelDescriptionConstants.DESCRIPTION).set(getAttributeTextDescription(bundle, prefix)); final ModelNode result = resourceDescription.get(ModelDescriptionConstants.ATTRIBUTES, getName()).set(attr); ModelNode deprecated = addDeprecatedInfo(result); if (deprecated != null) { deprecated.get(ModelDescriptionConstants.REASON).set(getAttributeDeprecatedDescription(bundle, prefix)); } addAccessConstraints(result, bundle.getLocale()); return result; }
[ "public", "ModelNode", "addResourceAttributeDescription", "(", "final", "ResourceBundle", "bundle", ",", "final", "String", "prefix", ",", "final", "ModelNode", "resourceDescription", ")", "{", "final", "ModelNode", "attr", "=", "getNoTextDescription", "(", "false", ")", ";", "attr", ".", "get", "(", "ModelDescriptionConstants", ".", "DESCRIPTION", ")", ".", "set", "(", "getAttributeTextDescription", "(", "bundle", ",", "prefix", ")", ")", ";", "final", "ModelNode", "result", "=", "resourceDescription", ".", "get", "(", "ModelDescriptionConstants", ".", "ATTRIBUTES", ",", "getName", "(", ")", ")", ".", "set", "(", "attr", ")", ";", "ModelNode", "deprecated", "=", "addDeprecatedInfo", "(", "result", ")", ";", "if", "(", "deprecated", "!=", "null", ")", "{", "deprecated", ".", "get", "(", "ModelDescriptionConstants", ".", "REASON", ")", ".", "set", "(", "getAttributeDeprecatedDescription", "(", "bundle", ",", "prefix", ")", ")", ";", "}", "addAccessConstraints", "(", "result", ",", "bundle", ".", "getLocale", "(", ")", ")", ";", "return", "result", ";", "}" ]
Creates a returns a basic model node describing the attribute, after attaching it to the given overall resource description model node. The node describing the attribute is returned to make it easy to perform further modification. @param bundle resource bundle to use for text descriptions @param prefix prefix to prepend to the attribute name key when looking up descriptions @param resourceDescription the overall resource description @return the attribute description node
[ "Creates", "a", "returns", "a", "basic", "model", "node", "describing", "the", "attribute", "after", "attaching", "it", "to", "the", "given", "overall", "resource", "description", "model", "node", ".", "The", "node", "describing", "the", "attribute", "is", "returned", "to", "make", "it", "easy", "to", "perform", "further", "modification", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L774-L784
prestodb/presto
presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java
SemiTransactionalHiveMetastore.recursiveDeleteFiles
private static RecursiveDeleteResult recursiveDeleteFiles(HdfsEnvironment hdfsEnvironment, HdfsContext context, Path directory, List<String> filePrefixes, boolean deleteEmptyDirectories) { """ Attempt to recursively remove eligible files and/or directories in {@code directory}. <p> When {@code filePrefixes} is not present, all files (but not necessarily directories) will be ineligible. If all files shall be deleted, you can use an empty string as {@code filePrefixes}. <p> When {@code deleteEmptySubDirectory} is true, any empty directory (including directories that were originally empty, and directories that become empty after files prefixed with {@code filePrefixes} are deleted) will be eligible. <p> This method will not delete anything that's neither a directory nor a file. @param filePrefixes prefix of files that should be deleted @param deleteEmptyDirectories whether empty directories should be deleted """ FileSystem fileSystem; try { fileSystem = hdfsEnvironment.getFileSystem(context, directory); if (!fileSystem.exists(directory)) { return new RecursiveDeleteResult(true, ImmutableList.of()); } } catch (IOException e) { ImmutableList.Builder<String> notDeletedItems = ImmutableList.builder(); notDeletedItems.add(directory.toString() + "/**"); return new RecursiveDeleteResult(false, notDeletedItems.build()); } return doRecursiveDeleteFiles(fileSystem, directory, filePrefixes, deleteEmptyDirectories); }
java
private static RecursiveDeleteResult recursiveDeleteFiles(HdfsEnvironment hdfsEnvironment, HdfsContext context, Path directory, List<String> filePrefixes, boolean deleteEmptyDirectories) { FileSystem fileSystem; try { fileSystem = hdfsEnvironment.getFileSystem(context, directory); if (!fileSystem.exists(directory)) { return new RecursiveDeleteResult(true, ImmutableList.of()); } } catch (IOException e) { ImmutableList.Builder<String> notDeletedItems = ImmutableList.builder(); notDeletedItems.add(directory.toString() + "/**"); return new RecursiveDeleteResult(false, notDeletedItems.build()); } return doRecursiveDeleteFiles(fileSystem, directory, filePrefixes, deleteEmptyDirectories); }
[ "private", "static", "RecursiveDeleteResult", "recursiveDeleteFiles", "(", "HdfsEnvironment", "hdfsEnvironment", ",", "HdfsContext", "context", ",", "Path", "directory", ",", "List", "<", "String", ">", "filePrefixes", ",", "boolean", "deleteEmptyDirectories", ")", "{", "FileSystem", "fileSystem", ";", "try", "{", "fileSystem", "=", "hdfsEnvironment", ".", "getFileSystem", "(", "context", ",", "directory", ")", ";", "if", "(", "!", "fileSystem", ".", "exists", "(", "directory", ")", ")", "{", "return", "new", "RecursiveDeleteResult", "(", "true", ",", "ImmutableList", ".", "of", "(", ")", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "ImmutableList", ".", "Builder", "<", "String", ">", "notDeletedItems", "=", "ImmutableList", ".", "builder", "(", ")", ";", "notDeletedItems", ".", "add", "(", "directory", ".", "toString", "(", ")", "+", "\"/**\"", ")", ";", "return", "new", "RecursiveDeleteResult", "(", "false", ",", "notDeletedItems", ".", "build", "(", ")", ")", ";", "}", "return", "doRecursiveDeleteFiles", "(", "fileSystem", ",", "directory", ",", "filePrefixes", ",", "deleteEmptyDirectories", ")", ";", "}" ]
Attempt to recursively remove eligible files and/or directories in {@code directory}. <p> When {@code filePrefixes} is not present, all files (but not necessarily directories) will be ineligible. If all files shall be deleted, you can use an empty string as {@code filePrefixes}. <p> When {@code deleteEmptySubDirectory} is true, any empty directory (including directories that were originally empty, and directories that become empty after files prefixed with {@code filePrefixes} are deleted) will be eligible. <p> This method will not delete anything that's neither a directory nor a file. @param filePrefixes prefix of files that should be deleted @param deleteEmptyDirectories whether empty directories should be deleted
[ "Attempt", "to", "recursively", "remove", "eligible", "files", "and", "/", "or", "directories", "in", "{", "@code", "directory", "}", ".", "<p", ">", "When", "{", "@code", "filePrefixes", "}", "is", "not", "present", "all", "files", "(", "but", "not", "necessarily", "directories", ")", "will", "be", "ineligible", ".", "If", "all", "files", "shall", "be", "deleted", "you", "can", "use", "an", "empty", "string", "as", "{", "@code", "filePrefixes", "}", ".", "<p", ">", "When", "{", "@code", "deleteEmptySubDirectory", "}", "is", "true", "any", "empty", "directory", "(", "including", "directories", "that", "were", "originally", "empty", "and", "directories", "that", "become", "empty", "after", "files", "prefixed", "with", "{", "@code", "filePrefixes", "}", "are", "deleted", ")", "will", "be", "eligible", ".", "<p", ">", "This", "method", "will", "not", "delete", "anything", "that", "s", "neither", "a", "directory", "nor", "a", "file", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-hive/src/main/java/com/facebook/presto/hive/metastore/SemiTransactionalHiveMetastore.java#L1749-L1766
mjiderhamn/classloader-leak-prevention
classloader-leak-prevention/classloader-leak-prevention-servlet/src/main/java/se/jiderhamn/classloader/leak/prevention/ClassLoaderLeakPreventorListener.java
ClassLoaderLeakPreventorListener.getIntInitParameter
protected static int getIntInitParameter(ServletContext servletContext, String parameterName, int defaultValue) { """ Parse init parameter for integer value, returning default if not found or invalid """ final String parameterString = servletContext.getInitParameter(parameterName); if(parameterString != null && parameterString.trim().length() > 0) { try { return Integer.parseInt(parameterString); } catch (NumberFormatException e) { // Do nothing, return default value } } return defaultValue; }
java
protected static int getIntInitParameter(ServletContext servletContext, String parameterName, int defaultValue) { final String parameterString = servletContext.getInitParameter(parameterName); if(parameterString != null && parameterString.trim().length() > 0) { try { return Integer.parseInt(parameterString); } catch (NumberFormatException e) { // Do nothing, return default value } } return defaultValue; }
[ "protected", "static", "int", "getIntInitParameter", "(", "ServletContext", "servletContext", ",", "String", "parameterName", ",", "int", "defaultValue", ")", "{", "final", "String", "parameterString", "=", "servletContext", ".", "getInitParameter", "(", "parameterName", ")", ";", "if", "(", "parameterString", "!=", "null", "&&", "parameterString", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "parameterString", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "// Do nothing, return default value", "}", "}", "return", "defaultValue", ";", "}" ]
Parse init parameter for integer value, returning default if not found or invalid
[ "Parse", "init", "parameter", "for", "integer", "value", "returning", "default", "if", "not", "found", "or", "invalid" ]
train
https://github.com/mjiderhamn/classloader-leak-prevention/blob/eea8e3cef64f8096dbbb87552df0a1bd272bcb63/classloader-leak-prevention/classloader-leak-prevention-servlet/src/main/java/se/jiderhamn/classloader/leak/prevention/ClassLoaderLeakPreventorListener.java#L255-L266
Azure/azure-sdk-for-java
redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java
RedisInner.beginCreate
public RedisResourceInner beginCreate(String resourceGroupName, String name, RedisCreateParameters parameters) { """ Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param parameters Parameters supplied to the Create Redis operation. @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 RedisResourceInner object if successful. """ return beginCreateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body(); }
java
public RedisResourceInner beginCreate(String resourceGroupName, String name, RedisCreateParameters parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, name, parameters).toBlocking().single().body(); }
[ "public", "RedisResourceInner", "beginCreate", "(", "String", "resourceGroupName", ",", "String", "name", ",", "RedisCreateParameters", "parameters", ")", "{", "return", "beginCreateWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param parameters Parameters supplied to the Create Redis operation. @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 RedisResourceInner object if successful.
[ "Create", "or", "replace", "(", "overwrite", "/", "recreate", "with", "potential", "downtime", ")", "an", "existing", "Redis", "cache", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/redis/v2017_10_01/implementation/RedisInner.java#L412-L414
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java
JavacParser.createEnvironment
private JavacEnvironment createEnvironment(List<File> files, List<JavaFileObject> fileObjects, boolean processAnnotations) throws IOException { """ Creates a javac environment from a collection of files and/or file objects. """ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>(); StandardJavaFileManager fileManager = getFileManager(compiler, diagnostics); List<String> javacOptions = getJavacOptions(processAnnotations); if (fileObjects == null) { fileObjects = new ArrayList<>(); } for (JavaFileObject jfo : fileManager.getJavaFileObjectsFromFiles(files)) { fileObjects.add(filterJavaFileObject(jfo)); } JavacTask task = (JavacTask) compiler.getTask(null, fileManager, diagnostics, javacOptions, null, fileObjects); return new JavacEnvironment(task, fileManager, diagnostics); }
java
private JavacEnvironment createEnvironment(List<File> files, List<JavaFileObject> fileObjects, boolean processAnnotations) throws IOException { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>(); StandardJavaFileManager fileManager = getFileManager(compiler, diagnostics); List<String> javacOptions = getJavacOptions(processAnnotations); if (fileObjects == null) { fileObjects = new ArrayList<>(); } for (JavaFileObject jfo : fileManager.getJavaFileObjectsFromFiles(files)) { fileObjects.add(filterJavaFileObject(jfo)); } JavacTask task = (JavacTask) compiler.getTask(null, fileManager, diagnostics, javacOptions, null, fileObjects); return new JavacEnvironment(task, fileManager, diagnostics); }
[ "private", "JavacEnvironment", "createEnvironment", "(", "List", "<", "File", ">", "files", ",", "List", "<", "JavaFileObject", ">", "fileObjects", ",", "boolean", "processAnnotations", ")", "throws", "IOException", "{", "JavaCompiler", "compiler", "=", "ToolProvider", ".", "getSystemJavaCompiler", "(", ")", ";", "DiagnosticCollector", "<", "JavaFileObject", ">", "diagnostics", "=", "new", "DiagnosticCollector", "<>", "(", ")", ";", "StandardJavaFileManager", "fileManager", "=", "getFileManager", "(", "compiler", ",", "diagnostics", ")", ";", "List", "<", "String", ">", "javacOptions", "=", "getJavacOptions", "(", "processAnnotations", ")", ";", "if", "(", "fileObjects", "==", "null", ")", "{", "fileObjects", "=", "new", "ArrayList", "<>", "(", ")", ";", "}", "for", "(", "JavaFileObject", "jfo", ":", "fileManager", ".", "getJavaFileObjectsFromFiles", "(", "files", ")", ")", "{", "fileObjects", ".", "add", "(", "filterJavaFileObject", "(", "jfo", ")", ")", ";", "}", "JavacTask", "task", "=", "(", "JavacTask", ")", "compiler", ".", "getTask", "(", "null", ",", "fileManager", ",", "diagnostics", ",", "javacOptions", ",", "null", ",", "fileObjects", ")", ";", "return", "new", "JavacEnvironment", "(", "task", ",", "fileManager", ",", "diagnostics", ")", ";", "}" ]
Creates a javac environment from a collection of files and/or file objects.
[ "Creates", "a", "javac", "environment", "from", "a", "collection", "of", "files", "and", "/", "or", "file", "objects", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java#L252-L267
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkExport.java
SparkExport.exportCSVSequenceLocalNoShuffling
public static void exportCSVSequenceLocalNoShuffling(File baseDir, JavaRDD<List<List<Writable>>> sequences) throws Exception { """ Quick and dirty CSV export: one file per sequence, without shuffling """ exportCSVSequenceLocalNoShuffling(baseDir, sequences, "", ",", "csv"); }
java
public static void exportCSVSequenceLocalNoShuffling(File baseDir, JavaRDD<List<List<Writable>>> sequences) throws Exception { exportCSVSequenceLocalNoShuffling(baseDir, sequences, "", ",", "csv"); }
[ "public", "static", "void", "exportCSVSequenceLocalNoShuffling", "(", "File", "baseDir", ",", "JavaRDD", "<", "List", "<", "List", "<", "Writable", ">", ">", ">", "sequences", ")", "throws", "Exception", "{", "exportCSVSequenceLocalNoShuffling", "(", "baseDir", ",", "sequences", ",", "\"\"", ",", "\",\"", ",", "\"csv\"", ")", ";", "}" ]
Quick and dirty CSV export: one file per sequence, without shuffling
[ "Quick", "and", "dirty", "CSV", "export", ":", "one", "file", "per", "sequence", "without", "shuffling" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkExport.java#L185-L188
GistLabs/mechanize
src/main/java/com/gistlabs/mechanize/util/apache/URLEncodedUtils.java
URLEncodedUtils.encPath
static String encPath(final String content, final Charset charset) { """ Encode a String using the {@link #PATHSAFE} set of characters. <p> Used by URIBuilder to encode path segments. @param content the string to encode, does not convert space to '+' @param charset the charset to use @return the encoded string """ return urlencode(content, charset, PATHSAFE, false); }
java
static String encPath(final String content, final Charset charset) { return urlencode(content, charset, PATHSAFE, false); }
[ "static", "String", "encPath", "(", "final", "String", "content", ",", "final", "Charset", "charset", ")", "{", "return", "urlencode", "(", "content", ",", "charset", ",", "PATHSAFE", ",", "false", ")", ";", "}" ]
Encode a String using the {@link #PATHSAFE} set of characters. <p> Used by URIBuilder to encode path segments. @param content the string to encode, does not convert space to '+' @param charset the charset to use @return the encoded string
[ "Encode", "a", "String", "using", "the", "{", "@link", "#PATHSAFE", "}", "set", "of", "characters", ".", "<p", ">", "Used", "by", "URIBuilder", "to", "encode", "path", "segments", "." ]
train
https://github.com/GistLabs/mechanize/blob/32ddd0774439a4c08513c05d7ac7416a3899efed/src/main/java/com/gistlabs/mechanize/util/apache/URLEncodedUtils.java#L520-L522
fengwenyi/JavaLib
src/main/java/com/fengwenyi/javalib/util/RSAUtil.java
RSAUtil.privateKeyDecrypt
public static String privateKeyDecrypt(String key, String cipherText) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException { """ 私钥解密 @param key [ellipsis] @param cipherText [ellipsis] @return [ellipsis] @throws NoSuchAlgorithmException [ellipsis] @throws InvalidKeySpecException [ellipsis] @throws NoSuchPaddingException [ellipsis] @throws InvalidKeyException [ellipsis] @throws BadPaddingException [ellipsis] @throws IllegalBlockSizeException [ellipsis] """ PrivateKey privateKey = commonGetPrivatekeyByText(key); Cipher cipher = Cipher.getInstance(RSA); cipher.init(Cipher.DECRYPT_MODE, privateKey); byte[] result = cipher.doFinal(Base64.base64ToByteArray(cipherText)); return new String(result); }
java
public static String privateKeyDecrypt(String key, String cipherText) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException { PrivateKey privateKey = commonGetPrivatekeyByText(key); Cipher cipher = Cipher.getInstance(RSA); cipher.init(Cipher.DECRYPT_MODE, privateKey); byte[] result = cipher.doFinal(Base64.base64ToByteArray(cipherText)); return new String(result); }
[ "public", "static", "String", "privateKeyDecrypt", "(", "String", "key", ",", "String", "cipherText", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeySpecException", ",", "NoSuchPaddingException", ",", "InvalidKeyException", ",", "BadPaddingException", ",", "IllegalBlockSizeException", "{", "PrivateKey", "privateKey", "=", "commonGetPrivatekeyByText", "(", "key", ")", ";", "Cipher", "cipher", "=", "Cipher", ".", "getInstance", "(", "RSA", ")", ";", "cipher", ".", "init", "(", "Cipher", ".", "DECRYPT_MODE", ",", "privateKey", ")", ";", "byte", "[", "]", "result", "=", "cipher", ".", "doFinal", "(", "Base64", ".", "base64ToByteArray", "(", "cipherText", ")", ")", ";", "return", "new", "String", "(", "result", ")", ";", "}" ]
私钥解密 @param key [ellipsis] @param cipherText [ellipsis] @return [ellipsis] @throws NoSuchAlgorithmException [ellipsis] @throws InvalidKeySpecException [ellipsis] @throws NoSuchPaddingException [ellipsis] @throws InvalidKeyException [ellipsis] @throws BadPaddingException [ellipsis] @throws IllegalBlockSizeException [ellipsis]
[ "私钥解密" ]
train
https://github.com/fengwenyi/JavaLib/blob/14838b13fb11c024e41be766aa3e13ead4be1703/src/main/java/com/fengwenyi/javalib/util/RSAUtil.java#L145-L153
google/closure-templates
java/src/com/google/template/soy/jbcsrc/ProtoUtils.java
ProtoUtils.getDefaultInstanceMethod
private static MethodRef getDefaultInstanceMethod(Descriptor descriptor) { """ Returns the {@link MethodRef} for the generated defaultInstance method. """ TypeInfo message = messageRuntimeType(descriptor); return MethodRef.createStaticMethod( message, new Method("getDefaultInstance", message.type(), NO_METHOD_ARGS)) .asNonNullable(); }
java
private static MethodRef getDefaultInstanceMethod(Descriptor descriptor) { TypeInfo message = messageRuntimeType(descriptor); return MethodRef.createStaticMethod( message, new Method("getDefaultInstance", message.type(), NO_METHOD_ARGS)) .asNonNullable(); }
[ "private", "static", "MethodRef", "getDefaultInstanceMethod", "(", "Descriptor", "descriptor", ")", "{", "TypeInfo", "message", "=", "messageRuntimeType", "(", "descriptor", ")", ";", "return", "MethodRef", ".", "createStaticMethod", "(", "message", ",", "new", "Method", "(", "\"getDefaultInstance\"", ",", "message", ".", "type", "(", ")", ",", "NO_METHOD_ARGS", ")", ")", ".", "asNonNullable", "(", ")", ";", "}" ]
Returns the {@link MethodRef} for the generated defaultInstance method.
[ "Returns", "the", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/ProtoUtils.java#L1253-L1258
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/refer/DependencyResolver.java
DependencyResolver.getOneRequired
public <T> T getOneRequired(Class<T> type, String name) throws ReferenceException { """ Gets one required dependency by its name and matching to the specified type. At least one dependency must present. If the dependency was found it throws a ReferenceException @param type the Class type that defined the type of the result. @param name the dependency name to locate. @return a dependency reference @throws ReferenceException if dependency was not found. """ Object locator = find(name); if (locator == null) throw new ReferenceException(null, name); return _references.getOneRequired(type, locator); }
java
public <T> T getOneRequired(Class<T> type, String name) throws ReferenceException { Object locator = find(name); if (locator == null) throw new ReferenceException(null, name); return _references.getOneRequired(type, locator); }
[ "public", "<", "T", ">", "T", "getOneRequired", "(", "Class", "<", "T", ">", "type", ",", "String", "name", ")", "throws", "ReferenceException", "{", "Object", "locator", "=", "find", "(", "name", ")", ";", "if", "(", "locator", "==", "null", ")", "throw", "new", "ReferenceException", "(", "null", ",", "name", ")", ";", "return", "_references", ".", "getOneRequired", "(", "type", ",", "locator", ")", ";", "}" ]
Gets one required dependency by its name and matching to the specified type. At least one dependency must present. If the dependency was found it throws a ReferenceException @param type the Class type that defined the type of the result. @param name the dependency name to locate. @return a dependency reference @throws ReferenceException if dependency was not found.
[ "Gets", "one", "required", "dependency", "by", "its", "name", "and", "matching", "to", "the", "specified", "type", ".", "At", "least", "one", "dependency", "must", "present", ".", "If", "the", "dependency", "was", "found", "it", "throws", "a", "ReferenceException" ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/refer/DependencyResolver.java#L272-L278
alkacon/opencms-core
src/org/opencms/ade/publish/CmsPublishListHelper.java
CmsPublishListHelper.adjustCmsObject
public static CmsObject adjustCmsObject(CmsObject cms, boolean online) throws CmsException { """ Initializes a CmsObject based on the given one, but with adjusted project information and configured, such that release and expiration date are ignored.<p> @param cms the original CmsObject. @param online true if a CmsObject for the Online project should be returned @return the initialized CmsObject @throws CmsException if something goes wrong """ CmsObject result = OpenCms.initCmsObject(cms); if (online) { CmsProject onlineProject = cms.readProject(CmsProject.ONLINE_PROJECT_ID); result.getRequestContext().setCurrentProject(onlineProject); } result.getRequestContext().setRequestTime(CmsResource.DATE_RELEASED_EXPIRED_IGNORE); return result; }
java
public static CmsObject adjustCmsObject(CmsObject cms, boolean online) throws CmsException { CmsObject result = OpenCms.initCmsObject(cms); if (online) { CmsProject onlineProject = cms.readProject(CmsProject.ONLINE_PROJECT_ID); result.getRequestContext().setCurrentProject(onlineProject); } result.getRequestContext().setRequestTime(CmsResource.DATE_RELEASED_EXPIRED_IGNORE); return result; }
[ "public", "static", "CmsObject", "adjustCmsObject", "(", "CmsObject", "cms", ",", "boolean", "online", ")", "throws", "CmsException", "{", "CmsObject", "result", "=", "OpenCms", ".", "initCmsObject", "(", "cms", ")", ";", "if", "(", "online", ")", "{", "CmsProject", "onlineProject", "=", "cms", ".", "readProject", "(", "CmsProject", ".", "ONLINE_PROJECT_ID", ")", ";", "result", ".", "getRequestContext", "(", ")", ".", "setCurrentProject", "(", "onlineProject", ")", ";", "}", "result", ".", "getRequestContext", "(", ")", ".", "setRequestTime", "(", "CmsResource", ".", "DATE_RELEASED_EXPIRED_IGNORE", ")", ";", "return", "result", ";", "}" ]
Initializes a CmsObject based on the given one, but with adjusted project information and configured, such that release and expiration date are ignored.<p> @param cms the original CmsObject. @param online true if a CmsObject for the Online project should be returned @return the initialized CmsObject @throws CmsException if something goes wrong
[ "Initializes", "a", "CmsObject", "based", "on", "the", "given", "one", "but", "with", "adjusted", "project", "information", "and", "configured", "such", "that", "release", "and", "expiration", "date", "are", "ignored", ".", "<p", ">", "@param", "cms", "the", "original", "CmsObject", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/publish/CmsPublishListHelper.java#L56-L65
OpenLiberty/open-liberty
dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceFormatter.java
BaseTraceFormatter.formatMessage
@Override public String formatMessage(LogRecord logRecord) { """ {@inheritDoc} <br /> We override this method because in some JVMs, it is synchronized (why on earth?!?!). """ if (System.getSecurityManager() == null) { return formatMessage(logRecord, logRecord.getParameters(), true); } else { final LogRecord f_logRecord = logRecord; return AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return formatMessage(f_logRecord, f_logRecord.getParameters(), true); } }); } }
java
@Override public String formatMessage(LogRecord logRecord) { if (System.getSecurityManager() == null) { return formatMessage(logRecord, logRecord.getParameters(), true); } else { final LogRecord f_logRecord = logRecord; return AccessController.doPrivileged(new PrivilegedAction<String>() { @Override public String run() { return formatMessage(f_logRecord, f_logRecord.getParameters(), true); } }); } }
[ "@", "Override", "public", "String", "formatMessage", "(", "LogRecord", "logRecord", ")", "{", "if", "(", "System", ".", "getSecurityManager", "(", ")", "==", "null", ")", "{", "return", "formatMessage", "(", "logRecord", ",", "logRecord", ".", "getParameters", "(", ")", ",", "true", ")", ";", "}", "else", "{", "final", "LogRecord", "f_logRecord", "=", "logRecord", ";", "return", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedAction", "<", "String", ">", "(", ")", "{", "@", "Override", "public", "String", "run", "(", ")", "{", "return", "formatMessage", "(", "f_logRecord", ",", "f_logRecord", ".", "getParameters", "(", ")", ",", "true", ")", ";", "}", "}", ")", ";", "}", "}" ]
{@inheritDoc} <br /> We override this method because in some JVMs, it is synchronized (why on earth?!?!).
[ "{" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging/src/com/ibm/ws/logging/internal/impl/BaseTraceFormatter.java#L222-L236
landawn/AbacusUtil
src/com/landawn/abacus/util/SQLExecutor.java
SQLExecutor.getDBSequence
public DBSequence getDBSequence(final String tableName, final String seqName, final long startVal, final int seqBufferSize) { """ Supports global sequence by db table. @param tableName @param seqName @param startVal @param seqBufferSize the numbers to allocate/reserve from database table when cached numbers are used up. @return """ return new DBSequence(this, tableName, seqName, startVal, seqBufferSize); }
java
public DBSequence getDBSequence(final String tableName, final String seqName, final long startVal, final int seqBufferSize) { return new DBSequence(this, tableName, seqName, startVal, seqBufferSize); }
[ "public", "DBSequence", "getDBSequence", "(", "final", "String", "tableName", ",", "final", "String", "seqName", ",", "final", "long", "startVal", ",", "final", "int", "seqBufferSize", ")", "{", "return", "new", "DBSequence", "(", "this", ",", "tableName", ",", "seqName", ",", "startVal", ",", "seqBufferSize", ")", ";", "}" ]
Supports global sequence by db table. @param tableName @param seqName @param startVal @param seqBufferSize the numbers to allocate/reserve from database table when cached numbers are used up. @return
[ "Supports", "global", "sequence", "by", "db", "table", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/SQLExecutor.java#L3233-L3235
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/MustBeClosedChecker.java
MustBeClosedChecker.matchNewClass
@Override public Description matchNewClass(NewClassTree tree, VisitorState state) { """ Check that construction of constructors annotated with {@link MustBeClosed} occurs within the resource variable initializer of a try-with-resources statement. """ if (!HAS_MUST_BE_CLOSED_ANNOTATION.matches(tree, state)) { return NO_MATCH; } return matchNewClassOrMethodInvocation(tree, state); }
java
@Override public Description matchNewClass(NewClassTree tree, VisitorState state) { if (!HAS_MUST_BE_CLOSED_ANNOTATION.matches(tree, state)) { return NO_MATCH; } return matchNewClassOrMethodInvocation(tree, state); }
[ "@", "Override", "public", "Description", "matchNewClass", "(", "NewClassTree", "tree", ",", "VisitorState", "state", ")", "{", "if", "(", "!", "HAS_MUST_BE_CLOSED_ANNOTATION", ".", "matches", "(", "tree", ",", "state", ")", ")", "{", "return", "NO_MATCH", ";", "}", "return", "matchNewClassOrMethodInvocation", "(", "tree", ",", "state", ")", ";", "}" ]
Check that construction of constructors annotated with {@link MustBeClosed} occurs within the resource variable initializer of a try-with-resources statement.
[ "Check", "that", "construction", "of", "constructors", "annotated", "with", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/MustBeClosedChecker.java#L123-L129
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/AttributeService.java
AttributeService.readAttributes
@SuppressWarnings("unchecked") public <A extends BasicFileAttributes> A readAttributes(File file, Class<A> type) { """ Returns attributes of the given file as an object of the given type. @throws UnsupportedOperationException if the given attributes type is not supported """ AttributeProvider provider = providersByAttributesType.get(type); if (provider != null) { return (A) provider.readAttributes(file); } throw new UnsupportedOperationException("unsupported attributes type: " + type); }
java
@SuppressWarnings("unchecked") public <A extends BasicFileAttributes> A readAttributes(File file, Class<A> type) { AttributeProvider provider = providersByAttributesType.get(type); if (provider != null) { return (A) provider.readAttributes(file); } throw new UnsupportedOperationException("unsupported attributes type: " + type); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "A", "extends", "BasicFileAttributes", ">", "A", "readAttributes", "(", "File", "file", ",", "Class", "<", "A", ">", "type", ")", "{", "AttributeProvider", "provider", "=", "providersByAttributesType", ".", "get", "(", "type", ")", ";", "if", "(", "provider", "!=", "null", ")", "{", "return", "(", "A", ")", "provider", ".", "readAttributes", "(", "file", ")", ";", "}", "throw", "new", "UnsupportedOperationException", "(", "\"unsupported attributes type: \"", "+", "type", ")", ";", "}" ]
Returns attributes of the given file as an object of the given type. @throws UnsupportedOperationException if the given attributes type is not supported
[ "Returns", "attributes", "of", "the", "given", "file", "as", "an", "object", "of", "the", "given", "type", "." ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/AttributeService.java#L356-L364
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java
MajorCompactionTask.compactSegment
private void compactSegment(Segment segment, OffsetPredicate predicate, Segment compactSegment) { """ Compacts the given segment. @param segment The segment to compact. @param compactSegment The segment to which to write the compacted segment. """ for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { checkEntry(i, segment, predicate, compactSegment); } }
java
private void compactSegment(Segment segment, OffsetPredicate predicate, Segment compactSegment) { for (long i = segment.firstIndex(); i <= segment.lastIndex(); i++) { checkEntry(i, segment, predicate, compactSegment); } }
[ "private", "void", "compactSegment", "(", "Segment", "segment", ",", "OffsetPredicate", "predicate", ",", "Segment", "compactSegment", ")", "{", "for", "(", "long", "i", "=", "segment", ".", "firstIndex", "(", ")", ";", "i", "<=", "segment", ".", "lastIndex", "(", ")", ";", "i", "++", ")", "{", "checkEntry", "(", "i", ",", "segment", ",", "predicate", ",", "compactSegment", ")", ";", "}", "}" ]
Compacts the given segment. @param segment The segment to compact. @param compactSegment The segment to which to write the compacted segment.
[ "Compacts", "the", "given", "segment", "." ]
train
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/compaction/MajorCompactionTask.java#L187-L191
Credntia/MVBarcodeReader
mvbarcodereader/src/main/java/devliving/online/mvbarcodereader/BarcodeCaptureFragment.java
BarcodeCaptureFragment.onTouch
@Override public boolean onTouch(View v, MotionEvent event) { """ Called when a touch event is dispatched to a view. This allows listeners to get a chance to respond before the target view. @param v The view the touch event has been dispatched to. @param event The MotionEvent object containing full information about the event. @return True if the listener has consumed the event, false otherwise. """ boolean b = scaleGestureDetector.onTouchEvent(event); boolean c = gestureDetector.onTouchEvent(event); return b || c || v.onTouchEvent(event); }
java
@Override public boolean onTouch(View v, MotionEvent event) { boolean b = scaleGestureDetector.onTouchEvent(event); boolean c = gestureDetector.onTouchEvent(event); return b || c || v.onTouchEvent(event); }
[ "@", "Override", "public", "boolean", "onTouch", "(", "View", "v", ",", "MotionEvent", "event", ")", "{", "boolean", "b", "=", "scaleGestureDetector", ".", "onTouchEvent", "(", "event", ")", ";", "boolean", "c", "=", "gestureDetector", ".", "onTouchEvent", "(", "event", ")", ";", "return", "b", "||", "c", "||", "v", ".", "onTouchEvent", "(", "event", ")", ";", "}" ]
Called when a touch event is dispatched to a view. This allows listeners to get a chance to respond before the target view. @param v The view the touch event has been dispatched to. @param event The MotionEvent object containing full information about the event. @return True if the listener has consumed the event, false otherwise.
[ "Called", "when", "a", "touch", "event", "is", "dispatched", "to", "a", "view", ".", "This", "allows", "listeners", "to", "get", "a", "chance", "to", "respond", "before", "the", "target", "view", "." ]
train
https://github.com/Credntia/MVBarcodeReader/blob/2a2561f1c3b4d4e3c046a341fbf23a31eabfda8d/mvbarcodereader/src/main/java/devliving/online/mvbarcodereader/BarcodeCaptureFragment.java#L423-L430
jayantk/jklol
src/com/jayantkrish/jklol/ccg/lexinduct/vote/VotingLexiconInduction.java
VotingLexiconInduction.getLexiconEntriesFromParses
private static Set<LexiconEntry> getLexiconEntriesFromParses(Collection<CcgParse> parses) { """ Gets all of the lexicon entries used in {@code parses}. @param parses @return """ // Generate candidate lexicon entries from the correct max parses. Set<LexiconEntry> candidateEntries = Sets.newHashSet(); for (CcgParse correctMaxParse : parses) { for (LexiconEntryInfo info : correctMaxParse.getSpannedLexiconEntries()) { CcgCategory category = info.getCategory(); Object trigger = info.getLexiconTrigger(); List<String> words = (List<String>) trigger; candidateEntries.add(new LexiconEntry(words, category)); } } return candidateEntries; }
java
private static Set<LexiconEntry> getLexiconEntriesFromParses(Collection<CcgParse> parses) { // Generate candidate lexicon entries from the correct max parses. Set<LexiconEntry> candidateEntries = Sets.newHashSet(); for (CcgParse correctMaxParse : parses) { for (LexiconEntryInfo info : correctMaxParse.getSpannedLexiconEntries()) { CcgCategory category = info.getCategory(); Object trigger = info.getLexiconTrigger(); List<String> words = (List<String>) trigger; candidateEntries.add(new LexiconEntry(words, category)); } } return candidateEntries; }
[ "private", "static", "Set", "<", "LexiconEntry", ">", "getLexiconEntriesFromParses", "(", "Collection", "<", "CcgParse", ">", "parses", ")", "{", "// Generate candidate lexicon entries from the correct max parses.", "Set", "<", "LexiconEntry", ">", "candidateEntries", "=", "Sets", ".", "newHashSet", "(", ")", ";", "for", "(", "CcgParse", "correctMaxParse", ":", "parses", ")", "{", "for", "(", "LexiconEntryInfo", "info", ":", "correctMaxParse", ".", "getSpannedLexiconEntries", "(", ")", ")", "{", "CcgCategory", "category", "=", "info", ".", "getCategory", "(", ")", ";", "Object", "trigger", "=", "info", ".", "getLexiconTrigger", "(", ")", ";", "List", "<", "String", ">", "words", "=", "(", "List", "<", "String", ">", ")", "trigger", ";", "candidateEntries", ".", "add", "(", "new", "LexiconEntry", "(", "words", ",", "category", ")", ")", ";", "}", "}", "return", "candidateEntries", ";", "}" ]
Gets all of the lexicon entries used in {@code parses}. @param parses @return
[ "Gets", "all", "of", "the", "lexicon", "entries", "used", "in", "{", "@code", "parses", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/ccg/lexinduct/vote/VotingLexiconInduction.java#L217-L230
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java
RandomMatrices_DDRM.insideSpan
public static DMatrixRMaj insideSpan(DMatrixRMaj[] span , double min , double max , Random rand ) { """ Creates a random vector that is inside the specified span. @param span The span the random vector belongs in. @param rand RNG @return A random vector within the specified span. """ DMatrixRMaj A = new DMatrixRMaj(span.length,1); DMatrixRMaj B = new DMatrixRMaj(span[0].getNumElements(),1); for( int i = 0; i < span.length; i++ ) { B.set(span[i]); double val = rand.nextDouble()*(max-min)+min; CommonOps_DDRM.scale(val,B); CommonOps_DDRM.add(A,B,A); } return A; }
java
public static DMatrixRMaj insideSpan(DMatrixRMaj[] span , double min , double max , Random rand ) { DMatrixRMaj A = new DMatrixRMaj(span.length,1); DMatrixRMaj B = new DMatrixRMaj(span[0].getNumElements(),1); for( int i = 0; i < span.length; i++ ) { B.set(span[i]); double val = rand.nextDouble()*(max-min)+min; CommonOps_DDRM.scale(val,B); CommonOps_DDRM.add(A,B,A); } return A; }
[ "public", "static", "DMatrixRMaj", "insideSpan", "(", "DMatrixRMaj", "[", "]", "span", ",", "double", "min", ",", "double", "max", ",", "Random", "rand", ")", "{", "DMatrixRMaj", "A", "=", "new", "DMatrixRMaj", "(", "span", ".", "length", ",", "1", ")", ";", "DMatrixRMaj", "B", "=", "new", "DMatrixRMaj", "(", "span", "[", "0", "]", ".", "getNumElements", "(", ")", ",", "1", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "span", ".", "length", ";", "i", "++", ")", "{", "B", ".", "set", "(", "span", "[", "i", "]", ")", ";", "double", "val", "=", "rand", ".", "nextDouble", "(", ")", "*", "(", "max", "-", "min", ")", "+", "min", ";", "CommonOps_DDRM", ".", "scale", "(", "val", ",", "B", ")", ";", "CommonOps_DDRM", ".", "add", "(", "A", ",", "B", ",", "A", ")", ";", "}", "return", "A", ";", "}" ]
Creates a random vector that is inside the specified span. @param span The span the random vector belongs in. @param rand RNG @return A random vector within the specified span.
[ "Creates", "a", "random", "vector", "that", "is", "inside", "the", "specified", "span", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java#L110-L125
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java
CmsGalleryController.categoryTreeToList
private void categoryTreeToList(List<CmsCategoryBean> categoryList, List<CmsCategoryTreeEntry> entries) { """ Converts categories tree to a list of info beans.<p> @param categoryList the category list @param entries the tree entries """ if (entries == null) { return; } // skipping the root tree entry where the path property is empty for (CmsCategoryTreeEntry entry : entries) { CmsCategoryBean bean = new CmsCategoryBean(entry); categoryList.add(bean); categoryTreeToList(categoryList, entry.getChildren()); } }
java
private void categoryTreeToList(List<CmsCategoryBean> categoryList, List<CmsCategoryTreeEntry> entries) { if (entries == null) { return; } // skipping the root tree entry where the path property is empty for (CmsCategoryTreeEntry entry : entries) { CmsCategoryBean bean = new CmsCategoryBean(entry); categoryList.add(bean); categoryTreeToList(categoryList, entry.getChildren()); } }
[ "private", "void", "categoryTreeToList", "(", "List", "<", "CmsCategoryBean", ">", "categoryList", ",", "List", "<", "CmsCategoryTreeEntry", ">", "entries", ")", "{", "if", "(", "entries", "==", "null", ")", "{", "return", ";", "}", "// skipping the root tree entry where the path property is empty", "for", "(", "CmsCategoryTreeEntry", "entry", ":", "entries", ")", "{", "CmsCategoryBean", "bean", "=", "new", "CmsCategoryBean", "(", "entry", ")", ";", "categoryList", ".", "add", "(", "bean", ")", ";", "categoryTreeToList", "(", "categoryList", ",", "entry", ".", "getChildren", "(", ")", ")", ";", "}", "}" ]
Converts categories tree to a list of info beans.<p> @param categoryList the category list @param entries the tree entries
[ "Converts", "categories", "tree", "to", "a", "list", "of", "info", "beans", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryController.java#L1795-L1806
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/RequestClientOptions.java
RequestClientOptions.createUserAgentMarkerString
private String createUserAgentMarkerString(final String marker, String userAgent) { """ Appends the given client marker string to the existing one and returns it. """ return marker.contains(userAgent) ? marker : marker + " " + userAgent; }
java
private String createUserAgentMarkerString(final String marker, String userAgent) { return marker.contains(userAgent) ? marker : marker + " " + userAgent; }
[ "private", "String", "createUserAgentMarkerString", "(", "final", "String", "marker", ",", "String", "userAgent", ")", "{", "return", "marker", ".", "contains", "(", "userAgent", ")", "?", "marker", ":", "marker", "+", "\" \"", "+", "userAgent", ";", "}" ]
Appends the given client marker string to the existing one and returns it.
[ "Appends", "the", "given", "client", "marker", "string", "to", "the", "existing", "one", "and", "returns", "it", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/RequestClientOptions.java#L97-L99
jasminb/jsonapi-converter
src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java
ResourceConverter.parseRelationship
private Object parseRelationship(JsonNode relationshipDataNode, Class<?> type) throws IOException, IllegalAccessException, InstantiationException { """ Creates relationship object by consuming provided 'data' node. @param relationshipDataNode relationship data node @param type object type @return created object or <code>null</code> in case data node is not valid @throws IOException @throws IllegalAccessException @throws InstantiationException """ if (ValidationUtils.isRelationshipParsable(relationshipDataNode)) { String identifier = createIdentifier(relationshipDataNode); if (resourceCache.contains(identifier)) { return resourceCache.get(identifier); } else { // Never cache relationship objects resourceCache.lock(); try { return readObject(relationshipDataNode, type, true); } finally { resourceCache.unlock(); } } } return null; }
java
private Object parseRelationship(JsonNode relationshipDataNode, Class<?> type) throws IOException, IllegalAccessException, InstantiationException { if (ValidationUtils.isRelationshipParsable(relationshipDataNode)) { String identifier = createIdentifier(relationshipDataNode); if (resourceCache.contains(identifier)) { return resourceCache.get(identifier); } else { // Never cache relationship objects resourceCache.lock(); try { return readObject(relationshipDataNode, type, true); } finally { resourceCache.unlock(); } } } return null; }
[ "private", "Object", "parseRelationship", "(", "JsonNode", "relationshipDataNode", ",", "Class", "<", "?", ">", "type", ")", "throws", "IOException", ",", "IllegalAccessException", ",", "InstantiationException", "{", "if", "(", "ValidationUtils", ".", "isRelationshipParsable", "(", "relationshipDataNode", ")", ")", "{", "String", "identifier", "=", "createIdentifier", "(", "relationshipDataNode", ")", ";", "if", "(", "resourceCache", ".", "contains", "(", "identifier", ")", ")", "{", "return", "resourceCache", ".", "get", "(", "identifier", ")", ";", "}", "else", "{", "// Never cache relationship objects", "resourceCache", ".", "lock", "(", ")", ";", "try", "{", "return", "readObject", "(", "relationshipDataNode", ",", "type", ",", "true", ")", ";", "}", "finally", "{", "resourceCache", ".", "unlock", "(", ")", ";", "}", "}", "}", "return", "null", ";", "}" ]
Creates relationship object by consuming provided 'data' node. @param relationshipDataNode relationship data node @param type object type @return created object or <code>null</code> in case data node is not valid @throws IOException @throws IllegalAccessException @throws InstantiationException
[ "Creates", "relationship", "object", "by", "consuming", "provided", "data", "node", "." ]
train
https://github.com/jasminb/jsonapi-converter/blob/73b41c3b9274e70e62b3425071ca8afdc7bddaf6/src/main/java/com/github/jasminb/jsonapi/ResourceConverter.java#L576-L595
line/armeria
core/src/main/java/com/linecorp/armeria/server/streaming/JsonTextSequences.java
JsonTextSequences.fromObject
public static HttpResponse fromObject(HttpHeaders headers, @Nullable Object content) { """ Creates a new JSON Text Sequences of the specified {@code content}. @param headers the HTTP headers supposed to send @param content the object supposed to send as contents """ return fromObject(headers, content, HttpHeaders.EMPTY_HEADERS, defaultMapper); }
java
public static HttpResponse fromObject(HttpHeaders headers, @Nullable Object content) { return fromObject(headers, content, HttpHeaders.EMPTY_HEADERS, defaultMapper); }
[ "public", "static", "HttpResponse", "fromObject", "(", "HttpHeaders", "headers", ",", "@", "Nullable", "Object", "content", ")", "{", "return", "fromObject", "(", "headers", ",", "content", ",", "HttpHeaders", ".", "EMPTY_HEADERS", ",", "defaultMapper", ")", ";", "}" ]
Creates a new JSON Text Sequences of the specified {@code content}. @param headers the HTTP headers supposed to send @param content the object supposed to send as contents
[ "Creates", "a", "new", "JSON", "Text", "Sequences", "of", "the", "specified", "{", "@code", "content", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/JsonTextSequences.java#L228-L230
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/price/Price.java
Price.createFromNetAmount
@Nonnull public static Price createFromNetAmount (@Nonnull final ICurrencyValue aNetAmount, @Nonnull final IVATItem aVATItem) { """ Create a price from a net amount. @param aNetAmount The net amount to use. May not be <code>null</code>. @param aVATItem The VAT item to use. May not be <code>null</code>. @return The created {@link Price} """ return new Price (aNetAmount, aVATItem); }
java
@Nonnull public static Price createFromNetAmount (@Nonnull final ICurrencyValue aNetAmount, @Nonnull final IVATItem aVATItem) { return new Price (aNetAmount, aVATItem); }
[ "@", "Nonnull", "public", "static", "Price", "createFromNetAmount", "(", "@", "Nonnull", "final", "ICurrencyValue", "aNetAmount", ",", "@", "Nonnull", "final", "IVATItem", "aVATItem", ")", "{", "return", "new", "Price", "(", "aNetAmount", ",", "aVATItem", ")", ";", "}" ]
Create a price from a net amount. @param aNetAmount The net amount to use. May not be <code>null</code>. @param aVATItem The VAT item to use. May not be <code>null</code>. @return The created {@link Price}
[ "Create", "a", "price", "from", "a", "net", "amount", "." ]
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/price/Price.java#L246-L250
ManfredTremmel/gwt-bean-validators
gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/constraintvalidators/hv/ModCheckBase.java
ModCheckBase.isValid
public boolean isValid(final CharSequence value, final ConstraintValidatorContext context) { """ valid check. @param value value to check. @param context constraint validator context @return true if valid """ if (value == null) { return true; } final String valueAsString = value.toString(); String digitsAsString; char checkDigit; try { digitsAsString = this.extractVerificationString(valueAsString); checkDigit = this.extractCheckDigit(valueAsString); } catch (final IndexOutOfBoundsException e) { return false; } digitsAsString = this.stripNonDigitsIfRequired(digitsAsString); List<Integer> digits; try { digits = this.extractDigits(digitsAsString); } catch (final NumberFormatException e) { return false; } return this.isCheckDigitValid(digits, checkDigit); }
java
public boolean isValid(final CharSequence value, final ConstraintValidatorContext context) { if (value == null) { return true; } final String valueAsString = value.toString(); String digitsAsString; char checkDigit; try { digitsAsString = this.extractVerificationString(valueAsString); checkDigit = this.extractCheckDigit(valueAsString); } catch (final IndexOutOfBoundsException e) { return false; } digitsAsString = this.stripNonDigitsIfRequired(digitsAsString); List<Integer> digits; try { digits = this.extractDigits(digitsAsString); } catch (final NumberFormatException e) { return false; } return this.isCheckDigitValid(digits, checkDigit); }
[ "public", "boolean", "isValid", "(", "final", "CharSequence", "value", ",", "final", "ConstraintValidatorContext", "context", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "true", ";", "}", "final", "String", "valueAsString", "=", "value", ".", "toString", "(", ")", ";", "String", "digitsAsString", ";", "char", "checkDigit", ";", "try", "{", "digitsAsString", "=", "this", ".", "extractVerificationString", "(", "valueAsString", ")", ";", "checkDigit", "=", "this", ".", "extractCheckDigit", "(", "valueAsString", ")", ";", "}", "catch", "(", "final", "IndexOutOfBoundsException", "e", ")", "{", "return", "false", ";", "}", "digitsAsString", "=", "this", ".", "stripNonDigitsIfRequired", "(", "digitsAsString", ")", ";", "List", "<", "Integer", ">", "digits", ";", "try", "{", "digits", "=", "this", ".", "extractDigits", "(", "digitsAsString", ")", ";", "}", "catch", "(", "final", "NumberFormatException", "e", ")", "{", "return", "false", ";", "}", "return", "this", ".", "isCheckDigitValid", "(", "digits", ",", "checkDigit", ")", ";", "}" ]
valid check. @param value value to check. @param context constraint validator context @return true if valid
[ "valid", "check", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/super/de/knightsoftnet/validators/supersource/org/hibernate/validator/internal/constraintvalidators/hv/ModCheckBase.java#L63-L87
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/index/hash/HashIndex.java
HashIndex.beforeFirst
@Override public void beforeFirst(SearchRange searchRange) { """ Positions the index before the first index record having the specified search key. The method hashes the search key to determine the bucket, and then opens a {@link RecordFile} on the file corresponding to the bucket. The record file for the previous bucket (if any) is closed. @see Index#beforeFirst(SearchRange) """ close(); // support the equality query only if (!searchRange.isSingleValue()) throw new UnsupportedOperationException(); this.searchKey = searchRange.asSearchKey(); int bucket = searchKey.hashCode() % NUM_BUCKETS; String tblname = ii.indexName() + bucket; TableInfo ti = new TableInfo(tblname, schema(keyType)); // the underlying record file should not perform logging this.rf = ti.open(tx, false); // initialize the file header if needed if (rf.fileSize() == 0) RecordFile.formatFileHeader(ti.fileName(), tx); rf.beforeFirst(); }
java
@Override public void beforeFirst(SearchRange searchRange) { close(); // support the equality query only if (!searchRange.isSingleValue()) throw new UnsupportedOperationException(); this.searchKey = searchRange.asSearchKey(); int bucket = searchKey.hashCode() % NUM_BUCKETS; String tblname = ii.indexName() + bucket; TableInfo ti = new TableInfo(tblname, schema(keyType)); // the underlying record file should not perform logging this.rf = ti.open(tx, false); // initialize the file header if needed if (rf.fileSize() == 0) RecordFile.formatFileHeader(ti.fileName(), tx); rf.beforeFirst(); }
[ "@", "Override", "public", "void", "beforeFirst", "(", "SearchRange", "searchRange", ")", "{", "close", "(", ")", ";", "// support the equality query only\r", "if", "(", "!", "searchRange", ".", "isSingleValue", "(", ")", ")", "throw", "new", "UnsupportedOperationException", "(", ")", ";", "this", ".", "searchKey", "=", "searchRange", ".", "asSearchKey", "(", ")", ";", "int", "bucket", "=", "searchKey", ".", "hashCode", "(", ")", "%", "NUM_BUCKETS", ";", "String", "tblname", "=", "ii", ".", "indexName", "(", ")", "+", "bucket", ";", "TableInfo", "ti", "=", "new", "TableInfo", "(", "tblname", ",", "schema", "(", "keyType", ")", ")", ";", "// the underlying record file should not perform logging\r", "this", ".", "rf", "=", "ti", ".", "open", "(", "tx", ",", "false", ")", ";", "// initialize the file header if needed\r", "if", "(", "rf", ".", "fileSize", "(", ")", "==", "0", ")", "RecordFile", ".", "formatFileHeader", "(", "ti", ".", "fileName", "(", ")", ",", "tx", ")", ";", "rf", ".", "beforeFirst", "(", ")", ";", "}" ]
Positions the index before the first index record having the specified search key. The method hashes the search key to determine the bucket, and then opens a {@link RecordFile} on the file corresponding to the bucket. The record file for the previous bucket (if any) is closed. @see Index#beforeFirst(SearchRange)
[ "Positions", "the", "index", "before", "the", "first", "index", "record", "having", "the", "specified", "search", "key", ".", "The", "method", "hashes", "the", "search", "key", "to", "determine", "the", "bucket", "and", "then", "opens", "a", "{", "@link", "RecordFile", "}", "on", "the", "file", "corresponding", "to", "the", "bucket", ".", "The", "record", "file", "for", "the", "previous", "bucket", "(", "if", "any", ")", "is", "closed", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/index/hash/HashIndex.java#L123-L142
alkacon/opencms-core
src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java
CmsSetupXmlHelper.getValue
public static String getValue(Document document, String xPath) { """ Returns the value in the given xpath of the given xml file.<p> @param document the xml document @param xPath the xpath to read (should select a single node or attribute) @return the value in the given xpath of the given xml file, or <code>null</code> if no matching node """ Node node = document.selectSingleNode(xPath); if (node != null) { // return the value return node.getText(); } else { return null; } }
java
public static String getValue(Document document, String xPath) { Node node = document.selectSingleNode(xPath); if (node != null) { // return the value return node.getText(); } else { return null; } }
[ "public", "static", "String", "getValue", "(", "Document", "document", ",", "String", "xPath", ")", "{", "Node", "node", "=", "document", ".", "selectSingleNode", "(", "xPath", ")", ";", "if", "(", "node", "!=", "null", ")", "{", "// return the value", "return", "node", ".", "getText", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Returns the value in the given xpath of the given xml file.<p> @param document the xml document @param xPath the xpath to read (should select a single node or attribute) @return the value in the given xpath of the given xml file, or <code>null</code> if no matching node
[ "Returns", "the", "value", "in", "the", "given", "xpath", "of", "the", "given", "xml", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/xml/CmsSetupXmlHelper.java#L137-L146
apache/incubator-gobblin
gobblin-compaction/src/main/java/org/apache/gobblin/compaction/event/CompactionSlaEventHelper.java
CompactionSlaEventHelper.populateState
@Deprecated public static void populateState(Dataset dataset, Optional<Job> job, FileSystem fs) { """ {@link Deprecated} use {@link #getEventSubmitterBuilder(Dataset, Optional, FileSystem)} """ dataset.jobProps().setProp(SlaEventKeys.DATASET_URN_KEY, dataset.getUrn()); dataset.jobProps().setProp(SlaEventKeys.PARTITION_KEY, dataset.jobProps().getProp(MRCompactor.COMPACTION_JOB_DEST_PARTITION, "")); dataset.jobProps().setProp(SlaEventKeys.DEDUPE_STATUS_KEY, getOutputDedupeStatus(dataset.jobProps())); dataset.jobProps().setProp(SlaEventKeys.PREVIOUS_PUBLISH_TS_IN_MILLI_SECS_KEY, getPreviousPublishTime(dataset, fs)); dataset.jobProps().setProp(SlaEventKeys.RECORD_COUNT_KEY, getRecordCount(job)); }
java
@Deprecated public static void populateState(Dataset dataset, Optional<Job> job, FileSystem fs) { dataset.jobProps().setProp(SlaEventKeys.DATASET_URN_KEY, dataset.getUrn()); dataset.jobProps().setProp(SlaEventKeys.PARTITION_KEY, dataset.jobProps().getProp(MRCompactor.COMPACTION_JOB_DEST_PARTITION, "")); dataset.jobProps().setProp(SlaEventKeys.DEDUPE_STATUS_KEY, getOutputDedupeStatus(dataset.jobProps())); dataset.jobProps().setProp(SlaEventKeys.PREVIOUS_PUBLISH_TS_IN_MILLI_SECS_KEY, getPreviousPublishTime(dataset, fs)); dataset.jobProps().setProp(SlaEventKeys.RECORD_COUNT_KEY, getRecordCount(job)); }
[ "@", "Deprecated", "public", "static", "void", "populateState", "(", "Dataset", "dataset", ",", "Optional", "<", "Job", ">", "job", ",", "FileSystem", "fs", ")", "{", "dataset", ".", "jobProps", "(", ")", ".", "setProp", "(", "SlaEventKeys", ".", "DATASET_URN_KEY", ",", "dataset", ".", "getUrn", "(", ")", ")", ";", "dataset", ".", "jobProps", "(", ")", ".", "setProp", "(", "SlaEventKeys", ".", "PARTITION_KEY", ",", "dataset", ".", "jobProps", "(", ")", ".", "getProp", "(", "MRCompactor", ".", "COMPACTION_JOB_DEST_PARTITION", ",", "\"\"", ")", ")", ";", "dataset", ".", "jobProps", "(", ")", ".", "setProp", "(", "SlaEventKeys", ".", "DEDUPE_STATUS_KEY", ",", "getOutputDedupeStatus", "(", "dataset", ".", "jobProps", "(", ")", ")", ")", ";", "dataset", ".", "jobProps", "(", ")", ".", "setProp", "(", "SlaEventKeys", ".", "PREVIOUS_PUBLISH_TS_IN_MILLI_SECS_KEY", ",", "getPreviousPublishTime", "(", "dataset", ",", "fs", ")", ")", ";", "dataset", ".", "jobProps", "(", ")", ".", "setProp", "(", "SlaEventKeys", ".", "RECORD_COUNT_KEY", ",", "getRecordCount", "(", "job", ")", ")", ";", "}" ]
{@link Deprecated} use {@link #getEventSubmitterBuilder(Dataset, Optional, FileSystem)}
[ "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/event/CompactionSlaEventHelper.java#L98-L106
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/Member.java
Member.getTotalDone
public Double getTotalDone(WorkitemFilter filter) { """ Return the total done for all workitems owned by this member optionally filtered. @param filter Criteria to filter workitems on. @return total done of selected Workitems. """ filter = (filter != null) ? filter : new WorkitemFilter(); return getSum("OwnedWorkitems", filter, "Actuals.Value"); }
java
public Double getTotalDone(WorkitemFilter filter) { filter = (filter != null) ? filter : new WorkitemFilter(); return getSum("OwnedWorkitems", filter, "Actuals.Value"); }
[ "public", "Double", "getTotalDone", "(", "WorkitemFilter", "filter", ")", "{", "filter", "=", "(", "filter", "!=", "null", ")", "?", "filter", ":", "new", "WorkitemFilter", "(", ")", ";", "return", "getSum", "(", "\"OwnedWorkitems\"", ",", "filter", ",", "\"Actuals.Value\"", ")", ";", "}" ]
Return the total done for all workitems owned by this member optionally filtered. @param filter Criteria to filter workitems on. @return total done of selected Workitems.
[ "Return", "the", "total", "done", "for", "all", "workitems", "owned", "by", "this", "member", "optionally", "filtered", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/Member.java#L322-L326
dropwizard/dropwizard
dropwizard-util/src/main/java/io/dropwizard/util/Resources.java
Resources.copy
public static void copy(URL from, OutputStream to) throws IOException { """ Copies all bytes from a URL to an output stream. @param from the URL to read from @param to the output stream @throws IOException if an I/O error occurs """ try (InputStream inputStream = from.openStream()) { ByteStreams.copy(inputStream, to); } }
java
public static void copy(URL from, OutputStream to) throws IOException { try (InputStream inputStream = from.openStream()) { ByteStreams.copy(inputStream, to); } }
[ "public", "static", "void", "copy", "(", "URL", "from", ",", "OutputStream", "to", ")", "throws", "IOException", "{", "try", "(", "InputStream", "inputStream", "=", "from", ".", "openStream", "(", ")", ")", "{", "ByteStreams", ".", "copy", "(", "inputStream", ",", "to", ")", ";", "}", "}" ]
Copies all bytes from a URL to an output stream. @param from the URL to read from @param to the output stream @throws IOException if an I/O error occurs
[ "Copies", "all", "bytes", "from", "a", "URL", "to", "an", "output", "stream", "." ]
train
https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-util/src/main/java/io/dropwizard/util/Resources.java#L71-L75
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java
ManagedInstanceEncryptionProtectorsInner.createOrUpdate
public ManagedInstanceEncryptionProtectorInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { """ Updates an existing encryption protector. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param parameters The requested encryption protector resource state. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ManagedInstanceEncryptionProtectorInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); }
java
public ManagedInstanceEncryptionProtectorInner createOrUpdate(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).toBlocking().last().body(); }
[ "public", "ManagedInstanceEncryptionProtectorInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "ManagedInstanceEncryptionProtectorInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "managedInstanceName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates an existing encryption protector. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param parameters The requested encryption protector resource state. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ManagedInstanceEncryptionProtectorInner object if successful.
[ "Updates", "an", "existing", "encryption", "protector", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java#L306-L308
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java
WorkflowClient.terminateWorkflow
public void terminateWorkflow(String workflowId, String reason) { """ Terminates the execution of the given workflow instance @param workflowId the id of the workflow to be terminated @param reason the reason to be logged and displayed """ Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank"); delete(new Object[]{"reason", reason}, "workflow/{workflowId}", workflowId); }
java
public void terminateWorkflow(String workflowId, String reason) { Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank"); delete(new Object[]{"reason", reason}, "workflow/{workflowId}", workflowId); }
[ "public", "void", "terminateWorkflow", "(", "String", "workflowId", ",", "String", "reason", ")", "{", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "workflowId", ")", ",", "\"workflow id cannot be blank\"", ")", ";", "delete", "(", "new", "Object", "[", "]", "{", "\"reason\"", ",", "reason", "}", ",", "\"workflow/{workflowId}\"", ",", "workflowId", ")", ";", "}" ]
Terminates the execution of the given workflow instance @param workflowId the id of the workflow to be terminated @param reason the reason to be logged and displayed
[ "Terminates", "the", "execution", "of", "the", "given", "workflow", "instance" ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java#L333-L336
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addInlineComment
public void addInlineComment(Element element, DocTree tag, Content htmltree) { """ Add the inline comment. @param element the Element for which the inline comment will be added @param tag the inline tag to be added @param htmltree the content tree to which the comment will be added """ CommentHelper ch = utils.getCommentHelper(element); List<? extends DocTree> description = ch.getDescription(configuration, tag); addCommentTags(element, tag, description, false, false, htmltree); }
java
public void addInlineComment(Element element, DocTree tag, Content htmltree) { CommentHelper ch = utils.getCommentHelper(element); List<? extends DocTree> description = ch.getDescription(configuration, tag); addCommentTags(element, tag, description, false, false, htmltree); }
[ "public", "void", "addInlineComment", "(", "Element", "element", ",", "DocTree", "tag", ",", "Content", "htmltree", ")", "{", "CommentHelper", "ch", "=", "utils", ".", "getCommentHelper", "(", "element", ")", ";", "List", "<", "?", "extends", "DocTree", ">", "description", "=", "ch", ".", "getDescription", "(", "configuration", ",", "tag", ")", ";", "addCommentTags", "(", "element", ",", "tag", ",", "description", ",", "false", ",", "false", ",", "htmltree", ")", ";", "}" ]
Add the inline comment. @param element the Element for which the inline comment will be added @param tag the inline tag to be added @param htmltree the content tree to which the comment will be added
[ "Add", "the", "inline", "comment", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1622-L1626
BoltsFramework/Bolts-Android
bolts-tasks/src/main/java/bolts/Task.java
Task.continueWhile
public Task<Void> continueWhile(Callable<Boolean> predicate, Continuation<Void, Task<Void>> continuation, CancellationToken ct) { """ Continues a task with the equivalent of a Task-based while loop, where the body of the loop is a task continuation. """ return continueWhile(predicate, continuation, IMMEDIATE_EXECUTOR, ct); }
java
public Task<Void> continueWhile(Callable<Boolean> predicate, Continuation<Void, Task<Void>> continuation, CancellationToken ct) { return continueWhile(predicate, continuation, IMMEDIATE_EXECUTOR, ct); }
[ "public", "Task", "<", "Void", ">", "continueWhile", "(", "Callable", "<", "Boolean", ">", "predicate", ",", "Continuation", "<", "Void", ",", "Task", "<", "Void", ">", ">", "continuation", ",", "CancellationToken", "ct", ")", "{", "return", "continueWhile", "(", "predicate", ",", "continuation", ",", "IMMEDIATE_EXECUTOR", ",", "ct", ")", ";", "}" ]
Continues a task with the equivalent of a Task-based while loop, where the body of the loop is a task continuation.
[ "Continues", "a", "task", "with", "the", "equivalent", "of", "a", "Task", "-", "based", "while", "loop", "where", "the", "body", "of", "the", "loop", "is", "a", "task", "continuation", "." ]
train
https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-tasks/src/main/java/bolts/Task.java#L585-L588
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getTPDeliveryInfo
public void getTPDeliveryInfo(String API, Callback<Delivery> callback) throws GuildWars2Exception, NullPointerException { """ For more info on delivery API go <a href="https://wiki.guildwars2.com/wiki/API:2/commerce/delivery">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param API API key @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key @throws NullPointerException if given {@link Callback} is empty @see Delivery devlivery info """ isParamValid(new ParamChecker(ParamType.API, API)); gw2API.getTPDeliveryInfo(API).enqueue(callback); }
java
public void getTPDeliveryInfo(String API, Callback<Delivery> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.API, API)); gw2API.getTPDeliveryInfo(API).enqueue(callback); }
[ "public", "void", "getTPDeliveryInfo", "(", "String", "API", ",", "Callback", "<", "Delivery", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ParamType", ".", "API", ",", "API", ")", ")", ";", "gw2API", ".", "getTPDeliveryInfo", "(", "API", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on delivery API go <a href="https://wiki.guildwars2.com/wiki/API:2/commerce/delivery">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param API API key @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key @throws NullPointerException if given {@link Callback} is empty @see Delivery devlivery info
[ "For", "more", "info", "on", "delivery", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "commerce", "/", "delivery", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the", "access", "to", "{", "@link", "Callback#onResponse", "(", "Call", "Response", ")", "}", "and", "{", "@link", "Callback#onFailure", "(", "Call", "Throwable", ")", "}", "methods", "for", "custom", "interactions" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L906-L909
VoltDB/voltdb
third_party/java/src/com/google_voltpatches/common/util/concurrent/AbstractFuture.java
AbstractFuture.executeListener
private static void executeListener(Runnable runnable, Executor executor, boolean maskExecutorExceptions) { """ Submits the given runnable to the given {@link Executor} catching and logging all {@linkplain RuntimeException runtime exceptions} thrown by the executor. """ try { executor.execute(runnable); } catch (RuntimeException e) { if (!maskExecutorExceptions) { // Caller wants to handle those exceptions throw e; } // Log it and keep going -- bad runnable and/or executor. Don't punish the other runnables if // we're given a bad one. We only catch RuntimeException because we want Errors to propagate // up. log.log( Level.SEVERE, "RuntimeException while executing runnable " + runnable + " with executor " + executor, e); } }
java
private static void executeListener(Runnable runnable, Executor executor, boolean maskExecutorExceptions) { try { executor.execute(runnable); } catch (RuntimeException e) { if (!maskExecutorExceptions) { // Caller wants to handle those exceptions throw e; } // Log it and keep going -- bad runnable and/or executor. Don't punish the other runnables if // we're given a bad one. We only catch RuntimeException because we want Errors to propagate // up. log.log( Level.SEVERE, "RuntimeException while executing runnable " + runnable + " with executor " + executor, e); } }
[ "private", "static", "void", "executeListener", "(", "Runnable", "runnable", ",", "Executor", "executor", ",", "boolean", "maskExecutorExceptions", ")", "{", "try", "{", "executor", ".", "execute", "(", "runnable", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "if", "(", "!", "maskExecutorExceptions", ")", "{", "// Caller wants to handle those exceptions", "throw", "e", ";", "}", "// Log it and keep going -- bad runnable and/or executor. Don't punish the other runnables if", "// we're given a bad one. We only catch RuntimeException because we want Errors to propagate", "// up.", "log", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"RuntimeException while executing runnable \"", "+", "runnable", "+", "\" with executor \"", "+", "executor", ",", "e", ")", ";", "}", "}" ]
Submits the given runnable to the given {@link Executor} catching and logging all {@linkplain RuntimeException runtime exceptions} thrown by the executor.
[ "Submits", "the", "given", "runnable", "to", "the", "given", "{" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/com/google_voltpatches/common/util/concurrent/AbstractFuture.java#L915-L931
dhanji/sitebricks
sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java
HtmlTemplateCompiler.lexicalDescend
private void lexicalDescend(PageCompilingContext pc, Element element, boolean shouldPopScope) { """ Complement of HtmlTemplateCompiler#lexicalClimb(). This method pops off the stack of lexical scopes when we're done processing a sitebricks widget. """ //pop form if ("form".equals(element.tagName())) pc.form = null; //pop compiler if the scope ends if (shouldPopScope) { pc.lexicalScopes.pop(); } }
java
private void lexicalDescend(PageCompilingContext pc, Element element, boolean shouldPopScope) { //pop form if ("form".equals(element.tagName())) pc.form = null; //pop compiler if the scope ends if (shouldPopScope) { pc.lexicalScopes.pop(); } }
[ "private", "void", "lexicalDescend", "(", "PageCompilingContext", "pc", ",", "Element", "element", ",", "boolean", "shouldPopScope", ")", "{", "//pop form", "if", "(", "\"form\"", ".", "equals", "(", "element", ".", "tagName", "(", ")", ")", ")", "pc", ".", "form", "=", "null", ";", "//pop compiler if the scope ends", "if", "(", "shouldPopScope", ")", "{", "pc", ".", "lexicalScopes", ".", "pop", "(", ")", ";", "}", "}" ]
Complement of HtmlTemplateCompiler#lexicalClimb(). This method pops off the stack of lexical scopes when we're done processing a sitebricks widget.
[ "Complement", "of", "HtmlTemplateCompiler#lexicalClimb", "()", ".", "This", "method", "pops", "off", "the", "stack", "of", "lexical", "scopes", "when", "we", "re", "done", "processing", "a", "sitebricks", "widget", "." ]
train
https://github.com/dhanji/sitebricks/blob/8682029a78bd48fb8566173d970800499e9e5d97/sitebricks/src/main/java/com/google/sitebricks/compiler/HtmlTemplateCompiler.java#L209-L219
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201902/publisherquerylanguageservice/GetAllLineItems.java
GetAllLineItems.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws IOException { """ Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors. @throws IOException if unable to write the response to a file. """ // Get the PublisherQueryLanguageService. PublisherQueryLanguageServiceInterface pqlService = adManagerServices.get(session, PublisherQueryLanguageServiceInterface.class); // Create statement to select all line items. StatementBuilder statementBuilder = new StatementBuilder() .select("Id, Name, Status") .from("Line_Item") .orderBy("Id ASC") .offset(0) .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for result sets. ResultSet combinedResultSet = null; ResultSet resultSet; int i = 0; do { // Get all line items. resultSet = pqlService.select(statementBuilder.toStatement()); // Combine result sets with previous ones. combinedResultSet = combinedResultSet == null ? resultSet : Pql.combineResultSets(combinedResultSet, resultSet); System.out.printf( "%d) %d line items beginning at offset %d were found.%n", i++, resultSet.getRows() == null ? 0 : resultSet.getRows().length, statementBuilder.getOffset()); statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (resultSet.getRows() != null && resultSet.getRows().length > 0); // Change to your file location. String filePath = File.createTempFile("Line-Items-", ".csv").toString(); // Write the result set to a CSV. CsvFiles.writeCsv(Pql.resultSetToStringArrayList(combinedResultSet), filePath); System.out.printf("Line items saved to: %s%n", filePath); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws IOException { // Get the PublisherQueryLanguageService. PublisherQueryLanguageServiceInterface pqlService = adManagerServices.get(session, PublisherQueryLanguageServiceInterface.class); // Create statement to select all line items. StatementBuilder statementBuilder = new StatementBuilder() .select("Id, Name, Status") .from("Line_Item") .orderBy("Id ASC") .offset(0) .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for result sets. ResultSet combinedResultSet = null; ResultSet resultSet; int i = 0; do { // Get all line items. resultSet = pqlService.select(statementBuilder.toStatement()); // Combine result sets with previous ones. combinedResultSet = combinedResultSet == null ? resultSet : Pql.combineResultSets(combinedResultSet, resultSet); System.out.printf( "%d) %d line items beginning at offset %d were found.%n", i++, resultSet.getRows() == null ? 0 : resultSet.getRows().length, statementBuilder.getOffset()); statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (resultSet.getRows() != null && resultSet.getRows().length > 0); // Change to your file location. String filePath = File.createTempFile("Line-Items-", ".csv").toString(); // Write the result set to a CSV. CsvFiles.writeCsv(Pql.resultSetToStringArrayList(combinedResultSet), filePath); System.out.printf("Line items saved to: %s%n", filePath); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "IOException", "{", "// Get the PublisherQueryLanguageService.", "PublisherQueryLanguageServiceInterface", "pqlService", "=", "adManagerServices", ".", "get", "(", "session", ",", "PublisherQueryLanguageServiceInterface", ".", "class", ")", ";", "// Create statement to select all line items.", "StatementBuilder", "statementBuilder", "=", "new", "StatementBuilder", "(", ")", ".", "select", "(", "\"Id, Name, Status\"", ")", ".", "from", "(", "\"Line_Item\"", ")", ".", "orderBy", "(", "\"Id ASC\"", ")", ".", "offset", "(", "0", ")", ".", "limit", "(", "StatementBuilder", ".", "SUGGESTED_PAGE_LIMIT", ")", ";", "// Default for result sets.", "ResultSet", "combinedResultSet", "=", "null", ";", "ResultSet", "resultSet", ";", "int", "i", "=", "0", ";", "do", "{", "// Get all line items.", "resultSet", "=", "pqlService", ".", "select", "(", "statementBuilder", ".", "toStatement", "(", ")", ")", ";", "// Combine result sets with previous ones.", "combinedResultSet", "=", "combinedResultSet", "==", "null", "?", "resultSet", ":", "Pql", ".", "combineResultSets", "(", "combinedResultSet", ",", "resultSet", ")", ";", "System", ".", "out", ".", "printf", "(", "\"%d) %d line items beginning at offset %d were found.%n\"", ",", "i", "++", ",", "resultSet", ".", "getRows", "(", ")", "==", "null", "?", "0", ":", "resultSet", ".", "getRows", "(", ")", ".", "length", ",", "statementBuilder", ".", "getOffset", "(", ")", ")", ";", "statementBuilder", ".", "increaseOffsetBy", "(", "StatementBuilder", ".", "SUGGESTED_PAGE_LIMIT", ")", ";", "}", "while", "(", "resultSet", ".", "getRows", "(", ")", "!=", "null", "&&", "resultSet", ".", "getRows", "(", ")", ".", "length", ">", "0", ")", ";", "// Change to your file location.", "String", "filePath", "=", "File", ".", "createTempFile", "(", "\"Line-Items-\"", ",", "\".csv\"", ")", ".", "toString", "(", ")", ";", "// Write the result set to a CSV.", "CsvFiles", ".", "writeCsv", "(", "Pql", ".", "resultSetToStringArrayList", "(", "combinedResultSet", ")", ",", "filePath", ")", ";", "System", ".", "out", ".", "printf", "(", "\"Line items saved to: %s%n\"", ",", "filePath", ")", ";", "}" ]
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors. @throws IOException if unable to write the response to a file.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/publisherquerylanguageservice/GetAllLineItems.java#L59-L105
apache/flink
flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/util/SetCache.java
SetCache.getUnsortedGrouping
@SuppressWarnings("unchecked") public <T> UnsortedGrouping<T> getUnsortedGrouping(int id) { """ Returns the cached {@link UnsortedGrouping} for the given ID. @param id Set ID @param <T> UnsortedGrouping type @return Cached UnsortedGrouping @throws IllegalStateException if the cached set is not an UnsortedGrouping """ return verifyType(id, unsortedGroupings.get(id), SetType.UNSORTED_GROUPING); }
java
@SuppressWarnings("unchecked") public <T> UnsortedGrouping<T> getUnsortedGrouping(int id) { return verifyType(id, unsortedGroupings.get(id), SetType.UNSORTED_GROUPING); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "UnsortedGrouping", "<", "T", ">", "getUnsortedGrouping", "(", "int", "id", ")", "{", "return", "verifyType", "(", "id", ",", "unsortedGroupings", ".", "get", "(", "id", ")", ",", "SetType", ".", "UNSORTED_GROUPING", ")", ";", "}" ]
Returns the cached {@link UnsortedGrouping} for the given ID. @param id Set ID @param <T> UnsortedGrouping type @return Cached UnsortedGrouping @throws IllegalStateException if the cached set is not an UnsortedGrouping
[ "Returns", "the", "cached", "{", "@link", "UnsortedGrouping", "}", "for", "the", "given", "ID", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-python/src/main/java/org/apache/flink/python/api/util/SetCache.java#L169-L172
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.appendGroupByClause
protected void appendGroupByClause(List groupByFields, StringBuffer buf) { """ Appends the GROUP BY clause for the Query @param groupByFields @param buf """ if (groupByFields == null || groupByFields.size() == 0) { return; } buf.append(" GROUP BY "); for (int i = 0; i < groupByFields.size(); i++) { FieldHelper cf = (FieldHelper) groupByFields.get(i); if (i > 0) { buf.append(","); } appendColName(cf.name, false, null, buf); } }
java
protected void appendGroupByClause(List groupByFields, StringBuffer buf) { if (groupByFields == null || groupByFields.size() == 0) { return; } buf.append(" GROUP BY "); for (int i = 0; i < groupByFields.size(); i++) { FieldHelper cf = (FieldHelper) groupByFields.get(i); if (i > 0) { buf.append(","); } appendColName(cf.name, false, null, buf); } }
[ "protected", "void", "appendGroupByClause", "(", "List", "groupByFields", ",", "StringBuffer", "buf", ")", "{", "if", "(", "groupByFields", "==", "null", "||", "groupByFields", ".", "size", "(", ")", "==", "0", ")", "{", "return", ";", "}", "buf", ".", "append", "(", "\" GROUP BY \"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "groupByFields", ".", "size", "(", ")", ";", "i", "++", ")", "{", "FieldHelper", "cf", "=", "(", "FieldHelper", ")", "groupByFields", ".", "get", "(", "i", ")", ";", "if", "(", "i", ">", "0", ")", "{", "buf", ".", "append", "(", "\",\"", ")", ";", "}", "appendColName", "(", "cf", ".", "name", ",", "false", ",", "null", ",", "buf", ")", ";", "}", "}" ]
Appends the GROUP BY clause for the Query @param groupByFields @param buf
[ "Appends", "the", "GROUP", "BY", "clause", "for", "the", "Query" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L1520-L1539
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/instance/SimpleSlot.java
SimpleSlot.tryAssignPayload
@Override public boolean tryAssignPayload(Payload payload) { """ Atomically sets the executed vertex, if no vertex has been assigned to this slot so far. @param payload The vertex to assign to this slot. @return True, if the vertex was assigned, false, otherwise. """ Preconditions.checkNotNull(payload); // check that we can actually run in this slot if (isCanceled()) { return false; } // atomically assign the vertex if (!PAYLOAD_UPDATER.compareAndSet(this, null, payload)) { return false; } // we need to do a double check that we were not cancelled in the meantime if (isCanceled()) { this.payload = null; return false; } return true; }
java
@Override public boolean tryAssignPayload(Payload payload) { Preconditions.checkNotNull(payload); // check that we can actually run in this slot if (isCanceled()) { return false; } // atomically assign the vertex if (!PAYLOAD_UPDATER.compareAndSet(this, null, payload)) { return false; } // we need to do a double check that we were not cancelled in the meantime if (isCanceled()) { this.payload = null; return false; } return true; }
[ "@", "Override", "public", "boolean", "tryAssignPayload", "(", "Payload", "payload", ")", "{", "Preconditions", ".", "checkNotNull", "(", "payload", ")", ";", "// check that we can actually run in this slot", "if", "(", "isCanceled", "(", ")", ")", "{", "return", "false", ";", "}", "// atomically assign the vertex", "if", "(", "!", "PAYLOAD_UPDATER", ".", "compareAndSet", "(", "this", ",", "null", ",", "payload", ")", ")", "{", "return", "false", ";", "}", "// we need to do a double check that we were not cancelled in the meantime", "if", "(", "isCanceled", "(", ")", ")", "{", "this", ".", "payload", "=", "null", ";", "return", "false", ";", "}", "return", "true", ";", "}" ]
Atomically sets the executed vertex, if no vertex has been assigned to this slot so far. @param payload The vertex to assign to this slot. @return True, if the vertex was assigned, false, otherwise.
[ "Atomically", "sets", "the", "executed", "vertex", "if", "no", "vertex", "has", "been", "assigned", "to", "this", "slot", "so", "far", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/instance/SimpleSlot.java#L171-L192
jenkinsci/jenkins
core/src/main/java/jenkins/model/Jenkins.java
Jenkins.toVersion
private static @CheckForNull VersionNumber toVersion(@CheckForNull String versionString) { """ Parses a version string into {@link VersionNumber}, or null if it's not parseable as a version number (such as when Jenkins is run with "mvn hudson-dev:run") """ if (versionString == null) { return null; } try { return new VersionNumber(versionString); } catch (NumberFormatException e) { try { // for non-released version of Jenkins, this looks like "1.345 (private-foobar), so try to approximate. int idx = versionString.indexOf(' '); if (idx > 0) { return new VersionNumber(versionString.substring(0,idx)); } } catch (NumberFormatException ignored) { // fall through } // totally unparseable return null; } catch (IllegalArgumentException e) { // totally unparseable return null; } }
java
private static @CheckForNull VersionNumber toVersion(@CheckForNull String versionString) { if (versionString == null) { return null; } try { return new VersionNumber(versionString); } catch (NumberFormatException e) { try { // for non-released version of Jenkins, this looks like "1.345 (private-foobar), so try to approximate. int idx = versionString.indexOf(' '); if (idx > 0) { return new VersionNumber(versionString.substring(0,idx)); } } catch (NumberFormatException ignored) { // fall through } // totally unparseable return null; } catch (IllegalArgumentException e) { // totally unparseable return null; } }
[ "private", "static", "@", "CheckForNull", "VersionNumber", "toVersion", "(", "@", "CheckForNull", "String", "versionString", ")", "{", "if", "(", "versionString", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "return", "new", "VersionNumber", "(", "versionString", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "try", "{", "// for non-released version of Jenkins, this looks like \"1.345 (private-foobar), so try to approximate.", "int", "idx", "=", "versionString", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "idx", ">", "0", ")", "{", "return", "new", "VersionNumber", "(", "versionString", ".", "substring", "(", "0", ",", "idx", ")", ")", ";", "}", "}", "catch", "(", "NumberFormatException", "ignored", ")", "{", "// fall through", "}", "// totally unparseable", "return", "null", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "// totally unparseable", "return", "null", ";", "}", "}" ]
Parses a version string into {@link VersionNumber}, or null if it's not parseable as a version number (such as when Jenkins is run with "mvn hudson-dev:run")
[ "Parses", "a", "version", "string", "into", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Jenkins.java#L5077-L5101
alkacon/opencms-core
src/org/opencms/ade/detailpage/CmsDetailPageResourceHandler.java
CmsDetailPageResourceHandler.isValidDetailPage
protected boolean isValidDetailPage(CmsObject cms, CmsResource page, CmsResource detailRes) { """ Checks whether the given detail page is valid for the given resource.<p> @param cms the CMS context @param page the detail page @param detailRes the detail resource @return true if the given detail page is valid """ if (OpenCms.getSystemInfo().isRestrictDetailContents()) { // in 'restrict detail contents mode', do not allow detail contents from a real site on a detail page of a different real site CmsSite pageSite = OpenCms.getSiteManager().getSiteForRootPath(page.getRootPath()); CmsSite detailSite = OpenCms.getSiteManager().getSiteForRootPath(detailRes.getRootPath()); if ((pageSite != null) && (detailSite != null) && !pageSite.getSiteRoot().equals(detailSite.getSiteRoot())) { return false; } } return OpenCms.getADEManager().isDetailPage(cms, page); }
java
protected boolean isValidDetailPage(CmsObject cms, CmsResource page, CmsResource detailRes) { if (OpenCms.getSystemInfo().isRestrictDetailContents()) { // in 'restrict detail contents mode', do not allow detail contents from a real site on a detail page of a different real site CmsSite pageSite = OpenCms.getSiteManager().getSiteForRootPath(page.getRootPath()); CmsSite detailSite = OpenCms.getSiteManager().getSiteForRootPath(detailRes.getRootPath()); if ((pageSite != null) && (detailSite != null) && !pageSite.getSiteRoot().equals(detailSite.getSiteRoot())) { return false; } } return OpenCms.getADEManager().isDetailPage(cms, page); }
[ "protected", "boolean", "isValidDetailPage", "(", "CmsObject", "cms", ",", "CmsResource", "page", ",", "CmsResource", "detailRes", ")", "{", "if", "(", "OpenCms", ".", "getSystemInfo", "(", ")", ".", "isRestrictDetailContents", "(", ")", ")", "{", "// in 'restrict detail contents mode', do not allow detail contents from a real site on a detail page of a different real site", "CmsSite", "pageSite", "=", "OpenCms", ".", "getSiteManager", "(", ")", ".", "getSiteForRootPath", "(", "page", ".", "getRootPath", "(", ")", ")", ";", "CmsSite", "detailSite", "=", "OpenCms", ".", "getSiteManager", "(", ")", ".", "getSiteForRootPath", "(", "detailRes", ".", "getRootPath", "(", ")", ")", ";", "if", "(", "(", "pageSite", "!=", "null", ")", "&&", "(", "detailSite", "!=", "null", ")", "&&", "!", "pageSite", ".", "getSiteRoot", "(", ")", ".", "equals", "(", "detailSite", ".", "getSiteRoot", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "OpenCms", ".", "getADEManager", "(", ")", ".", "isDetailPage", "(", "cms", ",", "page", ")", ";", "}" ]
Checks whether the given detail page is valid for the given resource.<p> @param cms the CMS context @param page the detail page @param detailRes the detail resource @return true if the given detail page is valid
[ "Checks", "whether", "the", "given", "detail", "page", "is", "valid", "for", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/detailpage/CmsDetailPageResourceHandler.java#L214-L227
imsweb/naaccr-xml
src/main/java/com/imsweb/naaccrxml/PatientXmlWriter.java
PatientXmlWriter.convertSyntaxException
protected NaaccrIOException convertSyntaxException(ConversionException ex) { """ We don't want to expose the conversion exceptions, so let's translate them into our own exceptions... """ String msg = ex.get("message"); if (msg == null) msg = ex.getMessage(); NaaccrIOException e = new NaaccrIOException(msg, ex); if (ex.get("line number") != null) e.setLineNumber(Integer.valueOf(ex.get("line number"))); e.setPath(ex.get("path")); return e; }
java
protected NaaccrIOException convertSyntaxException(ConversionException ex) { String msg = ex.get("message"); if (msg == null) msg = ex.getMessage(); NaaccrIOException e = new NaaccrIOException(msg, ex); if (ex.get("line number") != null) e.setLineNumber(Integer.valueOf(ex.get("line number"))); e.setPath(ex.get("path")); return e; }
[ "protected", "NaaccrIOException", "convertSyntaxException", "(", "ConversionException", "ex", ")", "{", "String", "msg", "=", "ex", ".", "get", "(", "\"message\"", ")", ";", "if", "(", "msg", "==", "null", ")", "msg", "=", "ex", ".", "getMessage", "(", ")", ";", "NaaccrIOException", "e", "=", "new", "NaaccrIOException", "(", "msg", ",", "ex", ")", ";", "if", "(", "ex", ".", "get", "(", "\"line number\"", ")", "!=", "null", ")", "e", ".", "setLineNumber", "(", "Integer", ".", "valueOf", "(", "ex", ".", "get", "(", "\"line number\"", ")", ")", ")", ";", "e", ".", "setPath", "(", "ex", ".", "get", "(", "\"path\"", ")", ")", ";", "return", "e", ";", "}" ]
We don't want to expose the conversion exceptions, so let's translate them into our own exceptions...
[ "We", "don", "t", "want", "to", "expose", "the", "conversion", "exceptions", "so", "let", "s", "translate", "them", "into", "our", "own", "exceptions", "..." ]
train
https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/PatientXmlWriter.java#L268-L277
lucee/Lucee
core/src/main/java/lucee/runtime/type/scope/ScopeSupport.java
ScopeSupport.fillDecoded
protected void fillDecoded(URLItem[] raw, String encoding, boolean scriptProteced, boolean sameAsArray) throws UnsupportedEncodingException { """ fill th data from given strut and decode it @param raw @param encoding @throws UnsupportedEncodingException """ clear(); String name, value; // Object curr; for (int i = 0; i < raw.length; i++) { name = raw[i].getName(); value = raw[i].getValue(); if (raw[i].isUrlEncoded()) { name = URLDecoder.decode(name, encoding, true); value = URLDecoder.decode(value, encoding, true); } // MUST valueStruct if (name.indexOf('.') != -1) { StringList list = ListUtil.listToStringListRemoveEmpty(name, '.'); if (list.size() > 0) { Struct parent = this; while (list.hasNextNext()) { parent = _fill(parent, list.next(), new CastableStruct(Struct.TYPE_LINKED), false, scriptProteced, sameAsArray); } _fill(parent, list.next(), value, true, scriptProteced, sameAsArray); } } // else _fill(this, name, value, true, scriptProteced, sameAsArray); } }
java
protected void fillDecoded(URLItem[] raw, String encoding, boolean scriptProteced, boolean sameAsArray) throws UnsupportedEncodingException { clear(); String name, value; // Object curr; for (int i = 0; i < raw.length; i++) { name = raw[i].getName(); value = raw[i].getValue(); if (raw[i].isUrlEncoded()) { name = URLDecoder.decode(name, encoding, true); value = URLDecoder.decode(value, encoding, true); } // MUST valueStruct if (name.indexOf('.') != -1) { StringList list = ListUtil.listToStringListRemoveEmpty(name, '.'); if (list.size() > 0) { Struct parent = this; while (list.hasNextNext()) { parent = _fill(parent, list.next(), new CastableStruct(Struct.TYPE_LINKED), false, scriptProteced, sameAsArray); } _fill(parent, list.next(), value, true, scriptProteced, sameAsArray); } } // else _fill(this, name, value, true, scriptProteced, sameAsArray); } }
[ "protected", "void", "fillDecoded", "(", "URLItem", "[", "]", "raw", ",", "String", "encoding", ",", "boolean", "scriptProteced", ",", "boolean", "sameAsArray", ")", "throws", "UnsupportedEncodingException", "{", "clear", "(", ")", ";", "String", "name", ",", "value", ";", "// Object curr;", "for", "(", "int", "i", "=", "0", ";", "i", "<", "raw", ".", "length", ";", "i", "++", ")", "{", "name", "=", "raw", "[", "i", "]", ".", "getName", "(", ")", ";", "value", "=", "raw", "[", "i", "]", ".", "getValue", "(", ")", ";", "if", "(", "raw", "[", "i", "]", ".", "isUrlEncoded", "(", ")", ")", "{", "name", "=", "URLDecoder", ".", "decode", "(", "name", ",", "encoding", ",", "true", ")", ";", "value", "=", "URLDecoder", ".", "decode", "(", "value", ",", "encoding", ",", "true", ")", ";", "}", "// MUST valueStruct", "if", "(", "name", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "{", "StringList", "list", "=", "ListUtil", ".", "listToStringListRemoveEmpty", "(", "name", ",", "'", "'", ")", ";", "if", "(", "list", ".", "size", "(", ")", ">", "0", ")", "{", "Struct", "parent", "=", "this", ";", "while", "(", "list", ".", "hasNextNext", "(", ")", ")", "{", "parent", "=", "_fill", "(", "parent", ",", "list", ".", "next", "(", ")", ",", "new", "CastableStruct", "(", "Struct", ".", "TYPE_LINKED", ")", ",", "false", ",", "scriptProteced", ",", "sameAsArray", ")", ";", "}", "_fill", "(", "parent", ",", "list", ".", "next", "(", ")", ",", "value", ",", "true", ",", "scriptProteced", ",", "sameAsArray", ")", ";", "}", "}", "// else", "_fill", "(", "this", ",", "name", ",", "value", ",", "true", ",", "scriptProteced", ",", "sameAsArray", ")", ";", "}", "}" ]
fill th data from given strut and decode it @param raw @param encoding @throws UnsupportedEncodingException
[ "fill", "th", "data", "from", "given", "strut", "and", "decode", "it" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/scope/ScopeSupport.java#L172-L198
burberius/eve-esi
src/main/java/net/troja/eve/esi/auth/OAuth.java
OAuth.getAuthorizationUri
public String getAuthorizationUri(final String redirectUri, final Set<String> scopes, final String state) { """ Get the authorization uri, where the user logs in. @param redirectUri Uri the user is redirected to, after successful authorization. This must be the same as specified at the Eve Online developer page. @param scopes Scopes of the Eve Online SSO. @param state This should be some secret to prevent XRSF, please read: http://www.thread-safe.com/2014/05/the-correct-use-of-state- parameter-in.html @return """ if (account == null) throw new IllegalArgumentException("Auth is not set"); if (account.getClientId() == null) throw new IllegalArgumentException("client_id is not set"); StringBuilder builder = new StringBuilder(); builder.append(URI_AUTHENTICATION); builder.append("?"); builder.append("response_type="); builder.append(encode("code")); builder.append("&redirect_uri="); builder.append(encode(redirectUri)); builder.append("&client_id="); builder.append(encode(account.getClientId())); builder.append("&scope="); builder.append(encode(getScopesString(scopes))); builder.append("&state="); builder.append(encode(state)); builder.append("&code_challenge"); builder.append(getCodeChallenge()); // Already url encoded builder.append("&code_challenge_method="); builder.append(encode("S256")); return builder.toString(); }
java
public String getAuthorizationUri(final String redirectUri, final Set<String> scopes, final String state) { if (account == null) throw new IllegalArgumentException("Auth is not set"); if (account.getClientId() == null) throw new IllegalArgumentException("client_id is not set"); StringBuilder builder = new StringBuilder(); builder.append(URI_AUTHENTICATION); builder.append("?"); builder.append("response_type="); builder.append(encode("code")); builder.append("&redirect_uri="); builder.append(encode(redirectUri)); builder.append("&client_id="); builder.append(encode(account.getClientId())); builder.append("&scope="); builder.append(encode(getScopesString(scopes))); builder.append("&state="); builder.append(encode(state)); builder.append("&code_challenge"); builder.append(getCodeChallenge()); // Already url encoded builder.append("&code_challenge_method="); builder.append(encode("S256")); return builder.toString(); }
[ "public", "String", "getAuthorizationUri", "(", "final", "String", "redirectUri", ",", "final", "Set", "<", "String", ">", "scopes", ",", "final", "String", "state", ")", "{", "if", "(", "account", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Auth is not set\"", ")", ";", "if", "(", "account", ".", "getClientId", "(", ")", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"client_id is not set\"", ")", ";", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "URI_AUTHENTICATION", ")", ";", "builder", ".", "append", "(", "\"?\"", ")", ";", "builder", ".", "append", "(", "\"response_type=\"", ")", ";", "builder", ".", "append", "(", "encode", "(", "\"code\"", ")", ")", ";", "builder", ".", "append", "(", "\"&redirect_uri=\"", ")", ";", "builder", ".", "append", "(", "encode", "(", "redirectUri", ")", ")", ";", "builder", ".", "append", "(", "\"&client_id=\"", ")", ";", "builder", ".", "append", "(", "encode", "(", "account", ".", "getClientId", "(", ")", ")", ")", ";", "builder", ".", "append", "(", "\"&scope=\"", ")", ";", "builder", ".", "append", "(", "encode", "(", "getScopesString", "(", "scopes", ")", ")", ")", ";", "builder", ".", "append", "(", "\"&state=\"", ")", ";", "builder", ".", "append", "(", "encode", "(", "state", ")", ")", ";", "builder", ".", "append", "(", "\"&code_challenge\"", ")", ";", "builder", ".", "append", "(", "getCodeChallenge", "(", ")", ")", ";", "// Already url encoded", "builder", ".", "append", "(", "\"&code_challenge_method=\"", ")", ";", "builder", ".", "append", "(", "encode", "(", "\"S256\"", ")", ")", ";", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
Get the authorization uri, where the user logs in. @param redirectUri Uri the user is redirected to, after successful authorization. This must be the same as specified at the Eve Online developer page. @param scopes Scopes of the Eve Online SSO. @param state This should be some secret to prevent XRSF, please read: http://www.thread-safe.com/2014/05/the-correct-use-of-state- parameter-in.html @return
[ "Get", "the", "authorization", "uri", "where", "the", "user", "logs", "in", "." ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/auth/OAuth.java#L163-L186
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/organization/MemberUpdater.java
MemberUpdater.synchronizeUserOrganizationMembership
public void synchronizeUserOrganizationMembership(DbSession dbSession, UserDto user, ALM alm, Set<String> organizationAlmIds) { """ Synchronize organization membership of a user from a list of ALM organization specific ids Please note that no commit will not be executed. """ Set<String> userOrganizationUuids = dbClient.organizationMemberDao().selectOrganizationUuidsByUser(dbSession, user.getId()); Set<String> userOrganizationUuidsWithMembersSyncEnabled = dbClient.organizationAlmBindingDao().selectByOrganizationUuids(dbSession, userOrganizationUuids).stream() .filter(OrganizationAlmBindingDto::isMembersSyncEnable) .map(OrganizationAlmBindingDto::getOrganizationUuid) .collect(toSet()); Set<String> almOrganizationUuidsWithMembersSyncEnabled = dbClient.organizationAlmBindingDao().selectByOrganizationAlmIds(dbSession, alm, organizationAlmIds).stream() .filter(OrganizationAlmBindingDto::isMembersSyncEnable) .map(OrganizationAlmBindingDto::getOrganizationUuid) .collect(toSet()); Set<String> organizationUuidsToBeAdded = difference(almOrganizationUuidsWithMembersSyncEnabled, userOrganizationUuidsWithMembersSyncEnabled); Set<String> organizationUuidsToBeRemoved = difference(userOrganizationUuidsWithMembersSyncEnabled, almOrganizationUuidsWithMembersSyncEnabled); Map<String, OrganizationDto> allOrganizationsByUuid = dbClient.organizationDao().selectByUuids(dbSession, union(organizationUuidsToBeAdded, organizationUuidsToBeRemoved)) .stream() .collect(uniqueIndex(OrganizationDto::getUuid)); allOrganizationsByUuid.entrySet().stream() .filter(entry -> organizationUuidsToBeAdded.contains(entry.getKey())) .forEach(entry -> addMemberInDb(dbSession, entry.getValue(), user)); allOrganizationsByUuid.entrySet().stream() .filter(entry -> organizationUuidsToBeRemoved.contains(entry.getKey())) .forEach(entry -> removeMemberInDb(dbSession, entry.getValue(), user)); }
java
public void synchronizeUserOrganizationMembership(DbSession dbSession, UserDto user, ALM alm, Set<String> organizationAlmIds) { Set<String> userOrganizationUuids = dbClient.organizationMemberDao().selectOrganizationUuidsByUser(dbSession, user.getId()); Set<String> userOrganizationUuidsWithMembersSyncEnabled = dbClient.organizationAlmBindingDao().selectByOrganizationUuids(dbSession, userOrganizationUuids).stream() .filter(OrganizationAlmBindingDto::isMembersSyncEnable) .map(OrganizationAlmBindingDto::getOrganizationUuid) .collect(toSet()); Set<String> almOrganizationUuidsWithMembersSyncEnabled = dbClient.organizationAlmBindingDao().selectByOrganizationAlmIds(dbSession, alm, organizationAlmIds).stream() .filter(OrganizationAlmBindingDto::isMembersSyncEnable) .map(OrganizationAlmBindingDto::getOrganizationUuid) .collect(toSet()); Set<String> organizationUuidsToBeAdded = difference(almOrganizationUuidsWithMembersSyncEnabled, userOrganizationUuidsWithMembersSyncEnabled); Set<String> organizationUuidsToBeRemoved = difference(userOrganizationUuidsWithMembersSyncEnabled, almOrganizationUuidsWithMembersSyncEnabled); Map<String, OrganizationDto> allOrganizationsByUuid = dbClient.organizationDao().selectByUuids(dbSession, union(organizationUuidsToBeAdded, organizationUuidsToBeRemoved)) .stream() .collect(uniqueIndex(OrganizationDto::getUuid)); allOrganizationsByUuid.entrySet().stream() .filter(entry -> organizationUuidsToBeAdded.contains(entry.getKey())) .forEach(entry -> addMemberInDb(dbSession, entry.getValue(), user)); allOrganizationsByUuid.entrySet().stream() .filter(entry -> organizationUuidsToBeRemoved.contains(entry.getKey())) .forEach(entry -> removeMemberInDb(dbSession, entry.getValue(), user)); }
[ "public", "void", "synchronizeUserOrganizationMembership", "(", "DbSession", "dbSession", ",", "UserDto", "user", ",", "ALM", "alm", ",", "Set", "<", "String", ">", "organizationAlmIds", ")", "{", "Set", "<", "String", ">", "userOrganizationUuids", "=", "dbClient", ".", "organizationMemberDao", "(", ")", ".", "selectOrganizationUuidsByUser", "(", "dbSession", ",", "user", ".", "getId", "(", ")", ")", ";", "Set", "<", "String", ">", "userOrganizationUuidsWithMembersSyncEnabled", "=", "dbClient", ".", "organizationAlmBindingDao", "(", ")", ".", "selectByOrganizationUuids", "(", "dbSession", ",", "userOrganizationUuids", ")", ".", "stream", "(", ")", ".", "filter", "(", "OrganizationAlmBindingDto", "::", "isMembersSyncEnable", ")", ".", "map", "(", "OrganizationAlmBindingDto", "::", "getOrganizationUuid", ")", ".", "collect", "(", "toSet", "(", ")", ")", ";", "Set", "<", "String", ">", "almOrganizationUuidsWithMembersSyncEnabled", "=", "dbClient", ".", "organizationAlmBindingDao", "(", ")", ".", "selectByOrganizationAlmIds", "(", "dbSession", ",", "alm", ",", "organizationAlmIds", ")", ".", "stream", "(", ")", ".", "filter", "(", "OrganizationAlmBindingDto", "::", "isMembersSyncEnable", ")", ".", "map", "(", "OrganizationAlmBindingDto", "::", "getOrganizationUuid", ")", ".", "collect", "(", "toSet", "(", ")", ")", ";", "Set", "<", "String", ">", "organizationUuidsToBeAdded", "=", "difference", "(", "almOrganizationUuidsWithMembersSyncEnabled", ",", "userOrganizationUuidsWithMembersSyncEnabled", ")", ";", "Set", "<", "String", ">", "organizationUuidsToBeRemoved", "=", "difference", "(", "userOrganizationUuidsWithMembersSyncEnabled", ",", "almOrganizationUuidsWithMembersSyncEnabled", ")", ";", "Map", "<", "String", ",", "OrganizationDto", ">", "allOrganizationsByUuid", "=", "dbClient", ".", "organizationDao", "(", ")", ".", "selectByUuids", "(", "dbSession", ",", "union", "(", "organizationUuidsToBeAdded", ",", "organizationUuidsToBeRemoved", ")", ")", ".", "stream", "(", ")", ".", "collect", "(", "uniqueIndex", "(", "OrganizationDto", "::", "getUuid", ")", ")", ";", "allOrganizationsByUuid", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "entry", "->", "organizationUuidsToBeAdded", ".", "contains", "(", "entry", ".", "getKey", "(", ")", ")", ")", ".", "forEach", "(", "entry", "->", "addMemberInDb", "(", "dbSession", ",", "entry", ".", "getValue", "(", ")", ",", "user", ")", ")", ";", "allOrganizationsByUuid", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "filter", "(", "entry", "->", "organizationUuidsToBeRemoved", ".", "contains", "(", "entry", ".", "getKey", "(", ")", ")", ")", ".", "forEach", "(", "entry", "->", "removeMemberInDb", "(", "dbSession", ",", "entry", ".", "getValue", "(", ")", ",", "user", ")", ")", ";", "}" ]
Synchronize organization membership of a user from a list of ALM organization specific ids Please note that no commit will not be executed.
[ "Synchronize", "organization", "membership", "of", "a", "user", "from", "a", "list", "of", "ALM", "organization", "specific", "ids", "Please", "note", "that", "no", "commit", "will", "not", "be", "executed", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/organization/MemberUpdater.java#L110-L133
lucee/Lucee
core/src/main/java/lucee/transformer/cfml/expression/AbstrCFMLExprTransformer.java
AbstrCFMLExprTransformer.functionArgument
private Argument functionArgument(Data data, boolean varKeyUpperCase) throws TemplateException { """ Liest einen gelableten Funktionsparamter ein <br /> EBNF:<br /> <code>assignOp [":" spaces assignOp];</code> @return CFXD Element @throws TemplateException """ return functionArgument(data, null, varKeyUpperCase); }
java
private Argument functionArgument(Data data, boolean varKeyUpperCase) throws TemplateException { return functionArgument(data, null, varKeyUpperCase); }
[ "private", "Argument", "functionArgument", "(", "Data", "data", ",", "boolean", "varKeyUpperCase", ")", "throws", "TemplateException", "{", "return", "functionArgument", "(", "data", ",", "null", ",", "varKeyUpperCase", ")", ";", "}" ]
Liest einen gelableten Funktionsparamter ein <br /> EBNF:<br /> <code>assignOp [":" spaces assignOp];</code> @return CFXD Element @throws TemplateException
[ "Liest", "einen", "gelableten", "Funktionsparamter", "ein", "<br", "/", ">", "EBNF", ":", "<br", "/", ">", "<code", ">", "assignOp", "[", ":", "spaces", "assignOp", "]", ";", "<", "/", "code", ">" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/expression/AbstrCFMLExprTransformer.java#L283-L285
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.recoverDeletedKeyAsync
public Observable<KeyBundle> recoverDeletedKeyAsync(String vaultBaseUrl, String keyName) { """ Recovers the deleted key to its latest version. The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the deleted key. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the KeyBundle object """ return recoverDeletedKeyWithServiceResponseAsync(vaultBaseUrl, keyName).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() { @Override public KeyBundle call(ServiceResponse<KeyBundle> response) { return response.body(); } }); }
java
public Observable<KeyBundle> recoverDeletedKeyAsync(String vaultBaseUrl, String keyName) { return recoverDeletedKeyWithServiceResponseAsync(vaultBaseUrl, keyName).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() { @Override public KeyBundle call(ServiceResponse<KeyBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "KeyBundle", ">", "recoverDeletedKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ")", "{", "return", "recoverDeletedKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "KeyBundle", ">", ",", "KeyBundle", ">", "(", ")", "{", "@", "Override", "public", "KeyBundle", "call", "(", "ServiceResponse", "<", "KeyBundle", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Recovers the deleted key to its latest version. The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the deleted key. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the KeyBundle object
[ "Recovers", "the", "deleted", "key", "to", "its", "latest", "version", ".", "The", "Recover", "Deleted", "Key", "operation", "is", "applicable", "for", "deleted", "keys", "in", "soft", "-", "delete", "enabled", "vaults", ".", "It", "recovers", "the", "deleted", "key", "back", "to", "its", "latest", "version", "under", "/", "keys", ".", "An", "attempt", "to", "recover", "an", "non", "-", "deleted", "key", "will", "return", "an", "error", ".", "Consider", "this", "the", "inverse", "of", "the", "delete", "operation", "on", "soft", "-", "delete", "enabled", "vaults", ".", "This", "operation", "requires", "the", "keys", "/", "recover", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3260-L3267
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java
FlowController.saveMessages
protected void saveMessages( HttpServletRequest request, ActionMessages messages ) { """ Save the specified messages keys into the appropriate request attribute for use by the Struts &lt;html:messages&gt; tag (if messages="true" is set), if any messages are required. Otherwise, ensure that the request attribute is not created. Formerly deprecated: This method will be removed without replacement in a future release. @param request The servlet request we are processing @param messages Messages object """ // Remove any messages attribute if none are required if ( messages == null || messages.isEmpty() ) { request.removeAttribute( Globals.MESSAGE_KEY ); return; } // Save the messages we need request.setAttribute( Globals.MESSAGE_KEY, messages ); }
java
protected void saveMessages( HttpServletRequest request, ActionMessages messages ) { // Remove any messages attribute if none are required if ( messages == null || messages.isEmpty() ) { request.removeAttribute( Globals.MESSAGE_KEY ); return; } // Save the messages we need request.setAttribute( Globals.MESSAGE_KEY, messages ); }
[ "protected", "void", "saveMessages", "(", "HttpServletRequest", "request", ",", "ActionMessages", "messages", ")", "{", "// Remove any messages attribute if none are required", "if", "(", "messages", "==", "null", "||", "messages", ".", "isEmpty", "(", ")", ")", "{", "request", ".", "removeAttribute", "(", "Globals", ".", "MESSAGE_KEY", ")", ";", "return", ";", "}", "// Save the messages we need", "request", ".", "setAttribute", "(", "Globals", ".", "MESSAGE_KEY", ",", "messages", ")", ";", "}" ]
Save the specified messages keys into the appropriate request attribute for use by the Struts &lt;html:messages&gt; tag (if messages="true" is set), if any messages are required. Otherwise, ensure that the request attribute is not created. Formerly deprecated: This method will be removed without replacement in a future release. @param request The servlet request we are processing @param messages Messages object
[ "Save", "the", "specified", "messages", "keys", "into", "the", "appropriate", "request", "attribute", "for", "use", "by", "the", "Struts", "&lt", ";", "html", ":", "messages&gt", ";", "tag", "(", "if", "messages", "=", "true", "is", "set", ")", "if", "any", "messages", "are", "required", ".", "Otherwise", "ensure", "that", "the", "request", "attribute", "is", "not", "created", ".", "Formerly", "deprecated", ":", "This", "method", "will", "be", "removed", "without", "replacement", "in", "a", "future", "release", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowController.java#L1880-L1893
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Partition.java
Partition.createListSubPartition
private static Partition createListSubPartition(SqlgGraph sqlgGraph, Partition parentPartition, String name, String in) { """ Create a list partition on an existing {@link Partition} @param sqlgGraph @param parentPartition @param name @param in @return """ Preconditions.checkArgument(!parentPartition.getAbstractLabel().getSchema().isSqlgSchema(), "createPartition may not be called for \"%s\"", Topology.SQLG_SCHEMA); Partition partition = new Partition(sqlgGraph, parentPartition, name, in, PartitionType.NONE, null); partition.createListPartitionOnDb(); TopologyManager.addSubPartition(sqlgGraph, partition); partition.committed = false; return partition; }
java
private static Partition createListSubPartition(SqlgGraph sqlgGraph, Partition parentPartition, String name, String in) { Preconditions.checkArgument(!parentPartition.getAbstractLabel().getSchema().isSqlgSchema(), "createPartition may not be called for \"%s\"", Topology.SQLG_SCHEMA); Partition partition = new Partition(sqlgGraph, parentPartition, name, in, PartitionType.NONE, null); partition.createListPartitionOnDb(); TopologyManager.addSubPartition(sqlgGraph, partition); partition.committed = false; return partition; }
[ "private", "static", "Partition", "createListSubPartition", "(", "SqlgGraph", "sqlgGraph", ",", "Partition", "parentPartition", ",", "String", "name", ",", "String", "in", ")", "{", "Preconditions", ".", "checkArgument", "(", "!", "parentPartition", ".", "getAbstractLabel", "(", ")", ".", "getSchema", "(", ")", ".", "isSqlgSchema", "(", ")", ",", "\"createPartition may not be called for \\\"%s\\\"\"", ",", "Topology", ".", "SQLG_SCHEMA", ")", ";", "Partition", "partition", "=", "new", "Partition", "(", "sqlgGraph", ",", "parentPartition", ",", "name", ",", "in", ",", "PartitionType", ".", "NONE", ",", "null", ")", ";", "partition", ".", "createListPartitionOnDb", "(", ")", ";", "TopologyManager", ".", "addSubPartition", "(", "sqlgGraph", ",", "partition", ")", ";", "partition", ".", "committed", "=", "false", ";", "return", "partition", ";", "}" ]
Create a list partition on an existing {@link Partition} @param sqlgGraph @param parentPartition @param name @param in @return
[ "Create", "a", "list", "partition", "on", "an", "existing", "{", "@link", "Partition", "}" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Partition.java#L395-L402
rometools/rome
rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedCollection.java
FileBasedCollection.getFeedDocument
public Feed getFeedDocument() throws AtomException { """ Get feed document representing collection. @throws com.rometools.rome.propono.atom.server.AtomException On error retrieving feed file. @return Atom Feed representing collection. """ InputStream in = null; synchronized (FileStore.getFileStore()) { in = FileStore.getFileStore().getFileInputStream(getFeedPath()); if (in == null) { in = createDefaultFeedDocument(contextURI + servletPath + "/" + handle + "/" + collection); } } try { final WireFeedInput input = new WireFeedInput(); final WireFeed wireFeed = input.build(new InputStreamReader(in, "UTF-8")); return (Feed) wireFeed; } catch (final Exception ex) { throw new AtomException(ex); } }
java
public Feed getFeedDocument() throws AtomException { InputStream in = null; synchronized (FileStore.getFileStore()) { in = FileStore.getFileStore().getFileInputStream(getFeedPath()); if (in == null) { in = createDefaultFeedDocument(contextURI + servletPath + "/" + handle + "/" + collection); } } try { final WireFeedInput input = new WireFeedInput(); final WireFeed wireFeed = input.build(new InputStreamReader(in, "UTF-8")); return (Feed) wireFeed; } catch (final Exception ex) { throw new AtomException(ex); } }
[ "public", "Feed", "getFeedDocument", "(", ")", "throws", "AtomException", "{", "InputStream", "in", "=", "null", ";", "synchronized", "(", "FileStore", ".", "getFileStore", "(", ")", ")", "{", "in", "=", "FileStore", ".", "getFileStore", "(", ")", ".", "getFileInputStream", "(", "getFeedPath", "(", ")", ")", ";", "if", "(", "in", "==", "null", ")", "{", "in", "=", "createDefaultFeedDocument", "(", "contextURI", "+", "servletPath", "+", "\"/\"", "+", "handle", "+", "\"/\"", "+", "collection", ")", ";", "}", "}", "try", "{", "final", "WireFeedInput", "input", "=", "new", "WireFeedInput", "(", ")", ";", "final", "WireFeed", "wireFeed", "=", "input", ".", "build", "(", "new", "InputStreamReader", "(", "in", ",", "\"UTF-8\"", ")", ")", ";", "return", "(", "Feed", ")", "wireFeed", ";", "}", "catch", "(", "final", "Exception", "ex", ")", "{", "throw", "new", "AtomException", "(", "ex", ")", ";", "}", "}" ]
Get feed document representing collection. @throws com.rometools.rome.propono.atom.server.AtomException On error retrieving feed file. @return Atom Feed representing collection.
[ "Get", "feed", "document", "representing", "collection", "." ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedCollection.java#L130-L145
threerings/narya
core/src/main/java/com/threerings/presents/dobj/DObject.java
DObject.removeFromSet
public void removeFromSet (String setName, Comparable<?> key) { """ Request to have the specified key removed from the specified DSet. """ requestEntryRemove(setName, getSet(setName), key); }
java
public void removeFromSet (String setName, Comparable<?> key) { requestEntryRemove(setName, getSet(setName), key); }
[ "public", "void", "removeFromSet", "(", "String", "setName", ",", "Comparable", "<", "?", ">", "key", ")", "{", "requestEntryRemove", "(", "setName", ",", "getSet", "(", "setName", ")", ",", "key", ")", ";", "}" ]
Request to have the specified key removed from the specified DSet.
[ "Request", "to", "have", "the", "specified", "key", "removed", "from", "the", "specified", "DSet", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L283-L286
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.setProperty
public void setProperty(String strProperty, String strValue) { """ Set this property. @param strProperty The property key. @param strValue The property value. """ if (this.getSystemRecordOwner() != null) this.getSystemRecordOwner().setProperty(strProperty, strValue); // Note: This is where the user properies are. super.setProperty(strProperty, strValue); }
java
public void setProperty(String strProperty, String strValue) { if (this.getSystemRecordOwner() != null) this.getSystemRecordOwner().setProperty(strProperty, strValue); // Note: This is where the user properies are. super.setProperty(strProperty, strValue); }
[ "public", "void", "setProperty", "(", "String", "strProperty", ",", "String", "strValue", ")", "{", "if", "(", "this", ".", "getSystemRecordOwner", "(", ")", "!=", "null", ")", "this", ".", "getSystemRecordOwner", "(", ")", ".", "setProperty", "(", "strProperty", ",", "strValue", ")", ";", "// Note: This is where the user properies are.", "super", ".", "setProperty", "(", "strProperty", ",", "strValue", ")", ";", "}" ]
Set this property. @param strProperty The property key. @param strValue The property value.
[ "Set", "this", "property", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L560-L565
apache/reef
lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/utils/ScatterEncoder.java
ScatterEncoder.encodeScatterMsgForNode
private byte[] encodeScatterMsgForNode(final TopologySimpleNode node, final Map<String, byte[]> taskIdToBytes) { """ Compute a single byte array message for a node and its children. Using {@code taskIdToBytes}, we pack all messages for a {@code TopologySimpleNode} and its children into a single byte array. @param node the target TopologySimpleNode to generate a message for @param taskIdToBytes map containing byte array of encoded data for individual Tasks @return single byte array message """ try (final ByteArrayOutputStream bstream = new ByteArrayOutputStream(); final DataOutputStream dstream = new DataOutputStream(bstream)) { // first write the node's encoded data final String taskId = node.getTaskId(); if (taskIdToBytes.containsKey(taskId)) { dstream.write(taskIdToBytes.get(node.getTaskId())); } else { // in case mapOfTaskToBytes does not contain this node's id, write an empty // message (zero elements) dstream.writeInt(0); } // and then write its children's identifiers and their encoded data for (final TopologySimpleNode child : node.getChildren()) { dstream.writeUTF(child.getTaskId()); final byte[] childData = encodeScatterMsgForNode(child, taskIdToBytes); dstream.writeInt(childData.length); dstream.write(childData); } return bstream.toByteArray(); } catch (final IOException e) { throw new RuntimeException("IOException", e); } }
java
private byte[] encodeScatterMsgForNode(final TopologySimpleNode node, final Map<String, byte[]> taskIdToBytes) { try (final ByteArrayOutputStream bstream = new ByteArrayOutputStream(); final DataOutputStream dstream = new DataOutputStream(bstream)) { // first write the node's encoded data final String taskId = node.getTaskId(); if (taskIdToBytes.containsKey(taskId)) { dstream.write(taskIdToBytes.get(node.getTaskId())); } else { // in case mapOfTaskToBytes does not contain this node's id, write an empty // message (zero elements) dstream.writeInt(0); } // and then write its children's identifiers and their encoded data for (final TopologySimpleNode child : node.getChildren()) { dstream.writeUTF(child.getTaskId()); final byte[] childData = encodeScatterMsgForNode(child, taskIdToBytes); dstream.writeInt(childData.length); dstream.write(childData); } return bstream.toByteArray(); } catch (final IOException e) { throw new RuntimeException("IOException", e); } }
[ "private", "byte", "[", "]", "encodeScatterMsgForNode", "(", "final", "TopologySimpleNode", "node", ",", "final", "Map", "<", "String", ",", "byte", "[", "]", ">", "taskIdToBytes", ")", "{", "try", "(", "final", "ByteArrayOutputStream", "bstream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "final", "DataOutputStream", "dstream", "=", "new", "DataOutputStream", "(", "bstream", ")", ")", "{", "// first write the node's encoded data", "final", "String", "taskId", "=", "node", ".", "getTaskId", "(", ")", ";", "if", "(", "taskIdToBytes", ".", "containsKey", "(", "taskId", ")", ")", "{", "dstream", ".", "write", "(", "taskIdToBytes", ".", "get", "(", "node", ".", "getTaskId", "(", ")", ")", ")", ";", "}", "else", "{", "// in case mapOfTaskToBytes does not contain this node's id, write an empty", "// message (zero elements)", "dstream", ".", "writeInt", "(", "0", ")", ";", "}", "// and then write its children's identifiers and their encoded data", "for", "(", "final", "TopologySimpleNode", "child", ":", "node", ".", "getChildren", "(", ")", ")", "{", "dstream", ".", "writeUTF", "(", "child", ".", "getTaskId", "(", ")", ")", ";", "final", "byte", "[", "]", "childData", "=", "encodeScatterMsgForNode", "(", "child", ",", "taskIdToBytes", ")", ";", "dstream", ".", "writeInt", "(", "childData", ".", "length", ")", ";", "dstream", ".", "write", "(", "childData", ")", ";", "}", "return", "bstream", ".", "toByteArray", "(", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"IOException\"", ",", "e", ")", ";", "}", "}" ]
Compute a single byte array message for a node and its children. Using {@code taskIdToBytes}, we pack all messages for a {@code TopologySimpleNode} and its children into a single byte array. @param node the target TopologySimpleNode to generate a message for @param taskIdToBytes map containing byte array of encoded data for individual Tasks @return single byte array message
[ "Compute", "a", "single", "byte", "array", "message", "for", "a", "node", "and", "its", "children", ".", "Using", "{", "@code", "taskIdToBytes", "}", "we", "pack", "all", "messages", "for", "a", "{", "@code", "TopologySimpleNode", "}", "and", "its", "children", "into", "a", "single", "byte", "array", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-io/src/main/java/org/apache/reef/io/network/group/impl/utils/ScatterEncoder.java#L71-L101
ugli/jocote
src/main/java/se/ugli/jocote/lpr/Printer.java
Printer.printFile
public void printFile(final File f, final String hostName, final String printerName, final String documentName) throws IOException { """ /* Print a file to a network host or printer fileName The path to the file to be printed hostName The host name or IP address of the print server printerName The name of the remote queue or the port on the print server documentName The name of the document as displayed in the spooler of the host """ final byte buffer[] = new byte[1000]; //Send print file if (!(f.exists() && f.isFile() && f.canRead())) throw new IOException("Error opening print file"); final ByteArrayOutputStream output = new ByteArrayOutputStream(); try (FileInputStream fs = new FileInputStream(f)) { int readCounter; do { readCounter = fs.read(buffer); if (readCounter > 0) output.write(buffer, 0, readCounter); } while (readCounter > 0); printStream(output, hostName, printerName, documentName); } }
java
public void printFile(final File f, final String hostName, final String printerName, final String documentName) throws IOException { final byte buffer[] = new byte[1000]; //Send print file if (!(f.exists() && f.isFile() && f.canRead())) throw new IOException("Error opening print file"); final ByteArrayOutputStream output = new ByteArrayOutputStream(); try (FileInputStream fs = new FileInputStream(f)) { int readCounter; do { readCounter = fs.read(buffer); if (readCounter > 0) output.write(buffer, 0, readCounter); } while (readCounter > 0); printStream(output, hostName, printerName, documentName); } }
[ "public", "void", "printFile", "(", "final", "File", "f", ",", "final", "String", "hostName", ",", "final", "String", "printerName", ",", "final", "String", "documentName", ")", "throws", "IOException", "{", "final", "byte", "buffer", "[", "]", "=", "new", "byte", "[", "1000", "]", ";", "//Send print file", "if", "(", "!", "(", "f", ".", "exists", "(", ")", "&&", "f", ".", "isFile", "(", ")", "&&", "f", ".", "canRead", "(", ")", ")", ")", "throw", "new", "IOException", "(", "\"Error opening print file\"", ")", ";", "final", "ByteArrayOutputStream", "output", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "try", "(", "FileInputStream", "fs", "=", "new", "FileInputStream", "(", "f", ")", ")", "{", "int", "readCounter", ";", "do", "{", "readCounter", "=", "fs", ".", "read", "(", "buffer", ")", ";", "if", "(", "readCounter", ">", "0", ")", "output", ".", "write", "(", "buffer", ",", "0", ",", "readCounter", ")", ";", "}", "while", "(", "readCounter", ">", "0", ")", ";", "printStream", "(", "output", ",", "hostName", ",", "printerName", ",", "documentName", ")", ";", "}", "}" ]
/* Print a file to a network host or printer fileName The path to the file to be printed hostName The host name or IP address of the print server printerName The name of the remote queue or the port on the print server documentName The name of the document as displayed in the spooler of the host
[ "/", "*", "Print", "a", "file", "to", "a", "network", "host", "or", "printer", "fileName", "The", "path", "to", "the", "file", "to", "be", "printed", "hostName", "The", "host", "name", "or", "IP", "address", "of", "the", "print", "server", "printerName", "The", "name", "of", "the", "remote", "queue", "or", "the", "port", "on", "the", "print", "server", "documentName", "The", "name", "of", "the", "document", "as", "displayed", "in", "the", "spooler", "of", "the", "host" ]
train
https://github.com/ugli/jocote/blob/28c34eb5aadbca6597bf006bb92d4fc340c71b41/src/main/java/se/ugli/jocote/lpr/Printer.java#L110-L126
microfocus-idol/java-content-parameter-api
src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java
FieldTextBuilder.binaryOperation
private FieldTextBuilder binaryOperation(final String operator, final FieldText fieldText) { """ Does the work for the OR, AND, XOR and WHEN methods. @param operator @param fieldText @return """ // This should never happen as the AND, OR, XOR and WHEN methods should already have checked this Validate.isTrue(fieldText != this); // Optimized case when fieldText is a FieldTextBuilder if(fieldText instanceof FieldTextBuilder) { return binaryOp(operator, (FieldTextBuilder)fieldText); } // Special case when we're empty if(componentCount == 0) { fieldTextString.append(fieldText.toString()); if(fieldText.size() > 1) { lastOperator = ""; } } else { // Add the NOTs, parentheses and operator addOperator(operator); // Size 1 means a single specifier, so no parentheses if(fieldText.size() == 1) { fieldTextString.append(fieldText.toString()); } else { fieldTextString.append('(').append(fieldText.toString()).append(')'); } } componentCount += fieldText.size(); not = false; return this; }
java
private FieldTextBuilder binaryOperation(final String operator, final FieldText fieldText) { // This should never happen as the AND, OR, XOR and WHEN methods should already have checked this Validate.isTrue(fieldText != this); // Optimized case when fieldText is a FieldTextBuilder if(fieldText instanceof FieldTextBuilder) { return binaryOp(operator, (FieldTextBuilder)fieldText); } // Special case when we're empty if(componentCount == 0) { fieldTextString.append(fieldText.toString()); if(fieldText.size() > 1) { lastOperator = ""; } } else { // Add the NOTs, parentheses and operator addOperator(operator); // Size 1 means a single specifier, so no parentheses if(fieldText.size() == 1) { fieldTextString.append(fieldText.toString()); } else { fieldTextString.append('(').append(fieldText.toString()).append(')'); } } componentCount += fieldText.size(); not = false; return this; }
[ "private", "FieldTextBuilder", "binaryOperation", "(", "final", "String", "operator", ",", "final", "FieldText", "fieldText", ")", "{", "// This should never happen as the AND, OR, XOR and WHEN methods should already have checked this", "Validate", ".", "isTrue", "(", "fieldText", "!=", "this", ")", ";", "// Optimized case when fieldText is a FieldTextBuilder", "if", "(", "fieldText", "instanceof", "FieldTextBuilder", ")", "{", "return", "binaryOp", "(", "operator", ",", "(", "FieldTextBuilder", ")", "fieldText", ")", ";", "}", "// Special case when we're empty", "if", "(", "componentCount", "==", "0", ")", "{", "fieldTextString", ".", "append", "(", "fieldText", ".", "toString", "(", ")", ")", ";", "if", "(", "fieldText", ".", "size", "(", ")", ">", "1", ")", "{", "lastOperator", "=", "\"\"", ";", "}", "}", "else", "{", "// Add the NOTs, parentheses and operator", "addOperator", "(", "operator", ")", ";", "// Size 1 means a single specifier, so no parentheses", "if", "(", "fieldText", ".", "size", "(", ")", "==", "1", ")", "{", "fieldTextString", ".", "append", "(", "fieldText", ".", "toString", "(", ")", ")", ";", "}", "else", "{", "fieldTextString", ".", "append", "(", "'", "'", ")", ".", "append", "(", "fieldText", ".", "toString", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "}", "}", "componentCount", "+=", "fieldText", ".", "size", "(", ")", ";", "not", "=", "false", ";", "return", "this", ";", "}" ]
Does the work for the OR, AND, XOR and WHEN methods. @param operator @param fieldText @return
[ "Does", "the", "work", "for", "the", "OR", "AND", "XOR", "and", "WHEN", "methods", "." ]
train
https://github.com/microfocus-idol/java-content-parameter-api/blob/8d33dc633f8df2a470a571ac7694e423e7004ad0/src/main/java/com/hp/autonomy/aci/content/fieldtext/FieldTextBuilder.java#L299-L331
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java
SourceLineAnnotation.fromVisitedInstruction
public static SourceLineAnnotation fromVisitedInstruction(BytecodeScanningDetector visitor, int pc) { """ Factory method for creating a source line annotation describing the source line number for the instruction being visited by given visitor. @param visitor a BetterVisitor which is visiting the method @param pc the bytecode offset of the instruction in the method @return the SourceLineAnnotation, or null if we do not have line number information for the instruction """ return fromVisitedInstructionRange(visitor.getClassContext(), visitor, pc, pc); }
java
public static SourceLineAnnotation fromVisitedInstruction(BytecodeScanningDetector visitor, int pc) { return fromVisitedInstructionRange(visitor.getClassContext(), visitor, pc, pc); }
[ "public", "static", "SourceLineAnnotation", "fromVisitedInstruction", "(", "BytecodeScanningDetector", "visitor", ",", "int", "pc", ")", "{", "return", "fromVisitedInstructionRange", "(", "visitor", ".", "getClassContext", "(", ")", ",", "visitor", ",", "pc", ",", "pc", ")", ";", "}" ]
Factory method for creating a source line annotation describing the source line number for the instruction being visited by given visitor. @param visitor a BetterVisitor which is visiting the method @param pc the bytecode offset of the instruction in the method @return the SourceLineAnnotation, or null if we do not have line number information for the instruction
[ "Factory", "method", "for", "creating", "a", "source", "line", "annotation", "describing", "the", "source", "line", "number", "for", "the", "instruction", "being", "visited", "by", "given", "visitor", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L367-L369
belaban/JGroups
src/org/jgroups/stack/Configurator.java
Configurator.createProtocol
public static Protocol createProtocol(String prot_spec, ProtocolStack stack) throws Exception { """ Creates a new protocol given the protocol specification. Initializes the properties and starts the up and down handler threads. @param prot_spec The specification of the protocol. Same convention as for specifying a protocol stack. An exception will be thrown if the class cannot be created. Example: <pre>"VERIFY_SUSPECT(timeout=1500)"</pre> Note that no colons (:) have to be specified @param stack The protocol stack @return Protocol The newly created protocol @exception Exception Will be thrown when the new protocol cannot be created """ ProtocolConfiguration config; Protocol prot; if(prot_spec == null) throw new Exception("Configurator.createProtocol(): prot_spec is null"); // parse the configuration for this protocol config=new ProtocolConfiguration(prot_spec); // create an instance of the protocol class and configure it prot=createLayer(stack, config); prot.init(); return prot; }
java
public static Protocol createProtocol(String prot_spec, ProtocolStack stack) throws Exception { ProtocolConfiguration config; Protocol prot; if(prot_spec == null) throw new Exception("Configurator.createProtocol(): prot_spec is null"); // parse the configuration for this protocol config=new ProtocolConfiguration(prot_spec); // create an instance of the protocol class and configure it prot=createLayer(stack, config); prot.init(); return prot; }
[ "public", "static", "Protocol", "createProtocol", "(", "String", "prot_spec", ",", "ProtocolStack", "stack", ")", "throws", "Exception", "{", "ProtocolConfiguration", "config", ";", "Protocol", "prot", ";", "if", "(", "prot_spec", "==", "null", ")", "throw", "new", "Exception", "(", "\"Configurator.createProtocol(): prot_spec is null\"", ")", ";", "// parse the configuration for this protocol", "config", "=", "new", "ProtocolConfiguration", "(", "prot_spec", ")", ";", "// create an instance of the protocol class and configure it", "prot", "=", "createLayer", "(", "stack", ",", "config", ")", ";", "prot", ".", "init", "(", ")", ";", "return", "prot", ";", "}" ]
Creates a new protocol given the protocol specification. Initializes the properties and starts the up and down handler threads. @param prot_spec The specification of the protocol. Same convention as for specifying a protocol stack. An exception will be thrown if the class cannot be created. Example: <pre>"VERIFY_SUSPECT(timeout=1500)"</pre> Note that no colons (:) have to be specified @param stack The protocol stack @return Protocol The newly created protocol @exception Exception Will be thrown when the new protocol cannot be created
[ "Creates", "a", "new", "protocol", "given", "the", "protocol", "specification", ".", "Initializes", "the", "properties", "and", "starts", "the", "up", "and", "down", "handler", "threads", "." ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/stack/Configurator.java#L155-L168
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/svg/Gradient.java
Gradient.genImage
public void genImage() { """ Generate the image used for texturing the gradient across shapes """ if (image == null) { ImageBuffer buffer = new ImageBuffer(128,16); for (int i=0;i<128;i++) { Color col = getColorAt(i / 128.0f); for (int j=0;j<16;j++) { buffer.setRGBA(i, j, col.getRedByte(), col.getGreenByte(), col.getBlueByte(), col.getAlphaByte()); } } image = buffer.getImage(); } }
java
public void genImage() { if (image == null) { ImageBuffer buffer = new ImageBuffer(128,16); for (int i=0;i<128;i++) { Color col = getColorAt(i / 128.0f); for (int j=0;j<16;j++) { buffer.setRGBA(i, j, col.getRedByte(), col.getGreenByte(), col.getBlueByte(), col.getAlphaByte()); } } image = buffer.getImage(); } }
[ "public", "void", "genImage", "(", ")", "{", "if", "(", "image", "==", "null", ")", "{", "ImageBuffer", "buffer", "=", "new", "ImageBuffer", "(", "128", ",", "16", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "128", ";", "i", "++", ")", "{", "Color", "col", "=", "getColorAt", "(", "i", "/", "128.0f", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "16", ";", "j", "++", ")", "{", "buffer", ".", "setRGBA", "(", "i", ",", "j", ",", "col", ".", "getRedByte", "(", ")", ",", "col", ".", "getGreenByte", "(", ")", ",", "col", ".", "getBlueByte", "(", ")", ",", "col", ".", "getAlphaByte", "(", ")", ")", ";", "}", "}", "image", "=", "buffer", ".", "getImage", "(", ")", ";", "}", "}" ]
Generate the image used for texturing the gradient across shapes
[ "Generate", "the", "image", "used", "for", "texturing", "the", "gradient", "across", "shapes" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/svg/Gradient.java#L106-L117
mygreen/super-csv-annotation
src/main/java/com/github/mygreen/supercsv/expression/CustomFunctions.java
CustomFunctions.join
@SuppressWarnings( { """ コレクションの値を結合する。 @param collection 結合対象のコレクション @param delimiter 区切り文字 @param printer コレクションの要素の値のフォーマッタ @return 結合した文字列を返す。結合の対象のコレクションがnulの場合、空文字を返す。 @throws NullPointerException {@literal printer is null.} """"rawtypes", "unchecked"}) public static String join(final Collection<?> collection, final String delimiter, final TextPrinter printer) { Objects.requireNonNull(printer); if(collection == null || collection.isEmpty()) { return ""; } String value = collection.stream() .map(v -> printer.print(v)) .collect(Collectors.joining(defaultString(delimiter))); return value; }
java
@SuppressWarnings({"rawtypes", "unchecked"}) public static String join(final Collection<?> collection, final String delimiter, final TextPrinter printer) { Objects.requireNonNull(printer); if(collection == null || collection.isEmpty()) { return ""; } String value = collection.stream() .map(v -> printer.print(v)) .collect(Collectors.joining(defaultString(delimiter))); return value; }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "String", "join", "(", "final", "Collection", "<", "?", ">", "collection", ",", "final", "String", "delimiter", ",", "final", "TextPrinter", "printer", ")", "{", "Objects", ".", "requireNonNull", "(", "printer", ")", ";", "if", "(", "collection", "==", "null", "||", "collection", ".", "isEmpty", "(", ")", ")", "{", "return", "\"\"", ";", "}", "String", "value", "=", "collection", ".", "stream", "(", ")", ".", "map", "(", "v", "->", "printer", ".", "print", "(", "v", ")", ")", ".", "collect", "(", "Collectors", ".", "joining", "(", "defaultString", "(", "delimiter", ")", ")", ")", ";", "return", "value", ";", "}" ]
コレクションの値を結合する。 @param collection 結合対象のコレクション @param delimiter 区切り文字 @param printer コレクションの要素の値のフォーマッタ @return 結合した文字列を返す。結合の対象のコレクションがnulの場合、空文字を返す。 @throws NullPointerException {@literal printer is null.}
[ "コレクションの値を結合する。" ]
train
https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/expression/CustomFunctions.java#L128-L142
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/TagsApi.java
TagsApi.updateRelease
public Release updateRelease(Object projectIdOrPath, String tagName, String releaseNotes) throws GitLabApiException { """ Updates the release notes of a given release. <pre><code>GitLab Endpoint: PUT /projects/:id/repository/tags/:tagName/release</code></pre> @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path @param tagName the name of a tag @param releaseNotes release notes with markdown support @return a Tag instance containing info on the newly created tag @throws GitLabApiException if any exception occurs """ Form formData = new GitLabApiForm().withParam("description", releaseNotes); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "tags", tagName, "release"); return (response.readEntity(Release.class)); }
java
public Release updateRelease(Object projectIdOrPath, String tagName, String releaseNotes) throws GitLabApiException { Form formData = new GitLabApiForm().withParam("description", releaseNotes); Response response = put(Response.Status.OK, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "repository", "tags", tagName, "release"); return (response.readEntity(Release.class)); }
[ "public", "Release", "updateRelease", "(", "Object", "projectIdOrPath", ",", "String", "tagName", ",", "String", "releaseNotes", ")", "throws", "GitLabApiException", "{", "Form", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"description\"", ",", "releaseNotes", ")", ";", "Response", "response", "=", "put", "(", "Response", ".", "Status", ".", "OK", ",", "formData", ".", "asMap", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"repository\"", ",", "\"tags\"", ",", "tagName", ",", "\"release\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Release", ".", "class", ")", ")", ";", "}" ]
Updates the release notes of a given release. <pre><code>GitLab Endpoint: PUT /projects/:id/repository/tags/:tagName/release</code></pre> @param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path @param tagName the name of a tag @param releaseNotes release notes with markdown support @return a Tag instance containing info on the newly created tag @throws GitLabApiException if any exception occurs
[ "Updates", "the", "release", "notes", "of", "a", "given", "release", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/TagsApi.java#L233-L238
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java
Util.detectJdiExitEvent
public static void detectJdiExitEvent(VirtualMachine vm, Consumer<String> unbiddenExitHandler) { """ Monitor the JDI event stream for {@link com.sun.jdi.event.VMDeathEvent} and {@link com.sun.jdi.event.VMDisconnectEvent}. If encountered, invokes {@code unbiddenExitHandler}. @param vm the virtual machine to check @param unbiddenExitHandler the handler, which will accept the exit information """ if (vm.canBeModified()) { new JdiEventHandler(vm, unbiddenExitHandler).start(); } }
java
public static void detectJdiExitEvent(VirtualMachine vm, Consumer<String> unbiddenExitHandler) { if (vm.canBeModified()) { new JdiEventHandler(vm, unbiddenExitHandler).start(); } }
[ "public", "static", "void", "detectJdiExitEvent", "(", "VirtualMachine", "vm", ",", "Consumer", "<", "String", ">", "unbiddenExitHandler", ")", "{", "if", "(", "vm", ".", "canBeModified", "(", ")", ")", "{", "new", "JdiEventHandler", "(", "vm", ",", "unbiddenExitHandler", ")", ".", "start", "(", ")", ";", "}", "}" ]
Monitor the JDI event stream for {@link com.sun.jdi.event.VMDeathEvent} and {@link com.sun.jdi.event.VMDisconnectEvent}. If encountered, invokes {@code unbiddenExitHandler}. @param vm the virtual machine to check @param unbiddenExitHandler the handler, which will accept the exit information
[ "Monitor", "the", "JDI", "event", "stream", "for", "{", "@link", "com", ".", "sun", ".", "jdi", ".", "event", ".", "VMDeathEvent", "}", "and", "{", "@link", "com", ".", "sun", ".", "jdi", ".", "event", ".", "VMDisconnectEvent", "}", ".", "If", "encountered", "invokes", "{", "@code", "unbiddenExitHandler", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/execution/Util.java#L213-L217
RestComm/jss7
map/map-impl/src/main/java/org/restcomm/protocols/ss7/map/MAPDialogImpl.java
MAPDialogImpl.getMessageUserDataLengthOnClose
public int getMessageUserDataLengthOnClose(boolean prearrangedEnd) throws MAPException { """ Return the MAP message length (in bytes) that will be after encoding if TC-END case This value must not exceed getMaxUserDataLength() value @param prearrangedEnd @return """ if (prearrangedEnd) // we do not send any data in prearrangedEnd dialog termination return 0; try { switch (this.tcapDialog.getState()) { case InitialReceived: ApplicationContextName acn = this.mapProviderImpl.getTCAPProvider().getDialogPrimitiveFactory() .createApplicationContextName(this.appCntx.getOID()); TCEndRequest te = this.mapProviderImpl.encodeTCEnd(this.getTcapDialog(), true, prearrangedEnd, acn, this.extContainer); return tcapDialog.getDataLength(te); case Active: te = this.mapProviderImpl.encodeTCEnd(this.getTcapDialog(), false, prearrangedEnd, null, null); return tcapDialog.getDataLength(te); } } catch (TCAPSendException e) { throw new MAPException("TCAPSendException when getMessageUserDataLengthOnSend", e); } throw new MAPException("Bad TCAP Dialog state: " + this.tcapDialog.getState()); }
java
public int getMessageUserDataLengthOnClose(boolean prearrangedEnd) throws MAPException { if (prearrangedEnd) // we do not send any data in prearrangedEnd dialog termination return 0; try { switch (this.tcapDialog.getState()) { case InitialReceived: ApplicationContextName acn = this.mapProviderImpl.getTCAPProvider().getDialogPrimitiveFactory() .createApplicationContextName(this.appCntx.getOID()); TCEndRequest te = this.mapProviderImpl.encodeTCEnd(this.getTcapDialog(), true, prearrangedEnd, acn, this.extContainer); return tcapDialog.getDataLength(te); case Active: te = this.mapProviderImpl.encodeTCEnd(this.getTcapDialog(), false, prearrangedEnd, null, null); return tcapDialog.getDataLength(te); } } catch (TCAPSendException e) { throw new MAPException("TCAPSendException when getMessageUserDataLengthOnSend", e); } throw new MAPException("Bad TCAP Dialog state: " + this.tcapDialog.getState()); }
[ "public", "int", "getMessageUserDataLengthOnClose", "(", "boolean", "prearrangedEnd", ")", "throws", "MAPException", "{", "if", "(", "prearrangedEnd", ")", "// we do not send any data in prearrangedEnd dialog termination", "return", "0", ";", "try", "{", "switch", "(", "this", ".", "tcapDialog", ".", "getState", "(", ")", ")", "{", "case", "InitialReceived", ":", "ApplicationContextName", "acn", "=", "this", ".", "mapProviderImpl", ".", "getTCAPProvider", "(", ")", ".", "getDialogPrimitiveFactory", "(", ")", ".", "createApplicationContextName", "(", "this", ".", "appCntx", ".", "getOID", "(", ")", ")", ";", "TCEndRequest", "te", "=", "this", ".", "mapProviderImpl", ".", "encodeTCEnd", "(", "this", ".", "getTcapDialog", "(", ")", ",", "true", ",", "prearrangedEnd", ",", "acn", ",", "this", ".", "extContainer", ")", ";", "return", "tcapDialog", ".", "getDataLength", "(", "te", ")", ";", "case", "Active", ":", "te", "=", "this", ".", "mapProviderImpl", ".", "encodeTCEnd", "(", "this", ".", "getTcapDialog", "(", ")", ",", "false", ",", "prearrangedEnd", ",", "null", ",", "null", ")", ";", "return", "tcapDialog", ".", "getDataLength", "(", "te", ")", ";", "}", "}", "catch", "(", "TCAPSendException", "e", ")", "{", "throw", "new", "MAPException", "(", "\"TCAPSendException when getMessageUserDataLengthOnSend\"", ",", "e", ")", ";", "}", "throw", "new", "MAPException", "(", "\"Bad TCAP Dialog state: \"", "+", "this", ".", "tcapDialog", ".", "getState", "(", ")", ")", ";", "}" ]
Return the MAP message length (in bytes) that will be after encoding if TC-END case This value must not exceed getMaxUserDataLength() value @param prearrangedEnd @return
[ "Return", "the", "MAP", "message", "length", "(", "in", "bytes", ")", "that", "will", "be", "after", "encoding", "if", "TC", "-", "END", "case", "This", "value", "must", "not", "exceed", "getMaxUserDataLength", "()", "value" ]
train
https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/map/map-impl/src/main/java/org/restcomm/protocols/ss7/map/MAPDialogImpl.java#L649-L674
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseField.java
BaseField.setupTablePopup
public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, int iDisplayFieldDesc, Rec record, int iDisplayFieldSeq, boolean bIncludeBlankOption) { """ Add a popup for the table tied to this field. @return Return the component or ScreenField that is created for this field. """ return this.setupTablePopup(itsLocation, targetScreen, this, iDisplayFieldDesc, record, DBConstants.MAIN_KEY_AREA, iDisplayFieldSeq, bIncludeBlankOption, false); }
java
public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, int iDisplayFieldDesc, Rec record, int iDisplayFieldSeq, boolean bIncludeBlankOption) { return this.setupTablePopup(itsLocation, targetScreen, this, iDisplayFieldDesc, record, DBConstants.MAIN_KEY_AREA, iDisplayFieldSeq, bIncludeBlankOption, false); }
[ "public", "ScreenComponent", "setupTablePopup", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "int", "iDisplayFieldDesc", ",", "Rec", "record", ",", "int", "iDisplayFieldSeq", ",", "boolean", "bIncludeBlankOption", ")", "{", "return", "this", ".", "setupTablePopup", "(", "itsLocation", ",", "targetScreen", ",", "this", ",", "iDisplayFieldDesc", ",", "record", ",", "DBConstants", ".", "MAIN_KEY_AREA", ",", "iDisplayFieldSeq", ",", "bIncludeBlankOption", ",", "false", ")", ";", "}" ]
Add a popup for the table tied to this field. @return Return the component or ScreenField that is created for this field.
[ "Add", "a", "popup", "for", "the", "table", "tied", "to", "this", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L1193-L1196
eclipse/xtext-extras
org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java
AbstractXbaseSemanticSequencer.sequence_XDoWhileExpression
protected void sequence_XDoWhileExpression(ISerializationContext context, XDoWhileExpression semanticObject) { """ Contexts: XExpression returns XDoWhileExpression XAssignment returns XDoWhileExpression XAssignment.XBinaryOperation_1_1_0_0_0 returns XDoWhileExpression XOrExpression returns XDoWhileExpression XOrExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XAndExpression returns XDoWhileExpression XAndExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XEqualityExpression returns XDoWhileExpression XEqualityExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XRelationalExpression returns XDoWhileExpression XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XDoWhileExpression XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XDoWhileExpression XOtherOperatorExpression returns XDoWhileExpression XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XAdditiveExpression returns XDoWhileExpression XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XMultiplicativeExpression returns XDoWhileExpression XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XUnaryOperation returns XDoWhileExpression XCastedExpression returns XDoWhileExpression XCastedExpression.XCastedExpression_1_0_0_0 returns XDoWhileExpression XPostfixOperation returns XDoWhileExpression XPostfixOperation.XPostfixOperation_1_0_0 returns XDoWhileExpression XMemberFeatureCall returns XDoWhileExpression XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XDoWhileExpression XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XDoWhileExpression XPrimaryExpression returns XDoWhileExpression XParenthesizedExpression returns XDoWhileExpression XDoWhileExpression returns XDoWhileExpression XExpressionOrVarDeclaration returns XDoWhileExpression Constraint: (body=XExpression predicate=XExpression) """ if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__BODY) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__BODY)); if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__PREDICATE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__PREDICATE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXDoWhileExpressionAccess().getBodyXExpressionParserRuleCall_2_0(), semanticObject.getBody()); feeder.accept(grammarAccess.getXDoWhileExpressionAccess().getPredicateXExpressionParserRuleCall_5_0(), semanticObject.getPredicate()); feeder.finish(); }
java
protected void sequence_XDoWhileExpression(ISerializationContext context, XDoWhileExpression semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__BODY) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__BODY)); if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__PREDICATE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XABSTRACT_WHILE_EXPRESSION__PREDICATE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXDoWhileExpressionAccess().getBodyXExpressionParserRuleCall_2_0(), semanticObject.getBody()); feeder.accept(grammarAccess.getXDoWhileExpressionAccess().getPredicateXExpressionParserRuleCall_5_0(), semanticObject.getPredicate()); feeder.finish(); }
[ "protected", "void", "sequence_XDoWhileExpression", "(", "ISerializationContext", "context", ",", "XDoWhileExpression", "semanticObject", ")", "{", "if", "(", "errorAcceptor", "!=", "null", ")", "{", "if", "(", "transientValues", ".", "isValueTransient", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XABSTRACT_WHILE_EXPRESSION__BODY", ")", "==", "ValueTransient", ".", "YES", ")", "errorAcceptor", ".", "accept", "(", "diagnosticProvider", ".", "createFeatureValueMissing", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XABSTRACT_WHILE_EXPRESSION__BODY", ")", ")", ";", "if", "(", "transientValues", ".", "isValueTransient", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XABSTRACT_WHILE_EXPRESSION__PREDICATE", ")", "==", "ValueTransient", ".", "YES", ")", "errorAcceptor", ".", "accept", "(", "diagnosticProvider", ".", "createFeatureValueMissing", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XABSTRACT_WHILE_EXPRESSION__PREDICATE", ")", ")", ";", "}", "SequenceFeeder", "feeder", "=", "createSequencerFeeder", "(", "context", ",", "semanticObject", ")", ";", "feeder", ".", "accept", "(", "grammarAccess", ".", "getXDoWhileExpressionAccess", "(", ")", ".", "getBodyXExpressionParserRuleCall_2_0", "(", ")", ",", "semanticObject", ".", "getBody", "(", ")", ")", ";", "feeder", ".", "accept", "(", "grammarAccess", ".", "getXDoWhileExpressionAccess", "(", ")", ".", "getPredicateXExpressionParserRuleCall_5_0", "(", ")", ",", "semanticObject", ".", "getPredicate", "(", ")", ")", ";", "feeder", ".", "finish", "(", ")", ";", "}" ]
Contexts: XExpression returns XDoWhileExpression XAssignment returns XDoWhileExpression XAssignment.XBinaryOperation_1_1_0_0_0 returns XDoWhileExpression XOrExpression returns XDoWhileExpression XOrExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XAndExpression returns XDoWhileExpression XAndExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XEqualityExpression returns XDoWhileExpression XEqualityExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XRelationalExpression returns XDoWhileExpression XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XDoWhileExpression XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XDoWhileExpression XOtherOperatorExpression returns XDoWhileExpression XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XAdditiveExpression returns XDoWhileExpression XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XMultiplicativeExpression returns XDoWhileExpression XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XDoWhileExpression XUnaryOperation returns XDoWhileExpression XCastedExpression returns XDoWhileExpression XCastedExpression.XCastedExpression_1_0_0_0 returns XDoWhileExpression XPostfixOperation returns XDoWhileExpression XPostfixOperation.XPostfixOperation_1_0_0 returns XDoWhileExpression XMemberFeatureCall returns XDoWhileExpression XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XDoWhileExpression XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XDoWhileExpression XPrimaryExpression returns XDoWhileExpression XParenthesizedExpression returns XDoWhileExpression XDoWhileExpression returns XDoWhileExpression XExpressionOrVarDeclaration returns XDoWhileExpression Constraint: (body=XExpression predicate=XExpression)
[ "Contexts", ":", "XExpression", "returns", "XDoWhileExpression", "XAssignment", "returns", "XDoWhileExpression", "XAssignment", ".", "XBinaryOperation_1_1_0_0_0", "returns", "XDoWhileExpression", "XOrExpression", "returns", "XDoWhileExpression", "XOrExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XDoWhileExpression", "XAndExpression", "returns", "XDoWhileExpression", "XAndExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XDoWhileExpression", "XEqualityExpression", "returns", "XDoWhileExpression", "XEqualityExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XDoWhileExpression", "XRelationalExpression", "returns", "XDoWhileExpression", "XRelationalExpression", ".", "XInstanceOfExpression_1_0_0_0_0", "returns", "XDoWhileExpression", "XRelationalExpression", ".", "XBinaryOperation_1_1_0_0_0", "returns", "XDoWhileExpression", "XOtherOperatorExpression", "returns", "XDoWhileExpression", "XOtherOperatorExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XDoWhileExpression", "XAdditiveExpression", "returns", "XDoWhileExpression", "XAdditiveExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XDoWhileExpression", "XMultiplicativeExpression", "returns", "XDoWhileExpression", "XMultiplicativeExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XDoWhileExpression", "XUnaryOperation", "returns", "XDoWhileExpression", "XCastedExpression", "returns", "XDoWhileExpression", "XCastedExpression", ".", "XCastedExpression_1_0_0_0", "returns", "XDoWhileExpression", "XPostfixOperation", "returns", "XDoWhileExpression", "XPostfixOperation", ".", "XPostfixOperation_1_0_0", "returns", "XDoWhileExpression", "XMemberFeatureCall", "returns", "XDoWhileExpression", "XMemberFeatureCall", ".", "XAssignment_1_0_0_0_0", "returns", "XDoWhileExpression", "XMemberFeatureCall", ".", "XMemberFeatureCall_1_1_0_0_0", "returns", "XDoWhileExpression", "XPrimaryExpression", "returns", "XDoWhileExpression", "XParenthesizedExpression", "returns", "XDoWhileExpression", "XDoWhileExpression", "returns", "XDoWhileExpression", "XExpressionOrVarDeclaration", "returns", "XDoWhileExpression" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java#L833-L844
timtiemens/secretshare
src/main/java/com/tiemens/secretshare/math/BigIntStringChecksum.java
BigIntStringChecksum.asBigInteger
public BigInteger asBigInteger() { """ Return the original BigInteger. (or throw an exception if something went wrong). @return BigInteger or throw exception @throws SecretShareException if the hex is invalid """ try { return new BigInteger(asHex, HEX_RADIX); } catch (NumberFormatException e) { throw new SecretShareException("Invalid input='" + asHex + "'", e); } }
java
public BigInteger asBigInteger() { try { return new BigInteger(asHex, HEX_RADIX); } catch (NumberFormatException e) { throw new SecretShareException("Invalid input='" + asHex + "'", e); } }
[ "public", "BigInteger", "asBigInteger", "(", ")", "{", "try", "{", "return", "new", "BigInteger", "(", "asHex", ",", "HEX_RADIX", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "throw", "new", "SecretShareException", "(", "\"Invalid input='\"", "+", "asHex", "+", "\"'\"", ",", "e", ")", ";", "}", "}" ]
Return the original BigInteger. (or throw an exception if something went wrong). @return BigInteger or throw exception @throws SecretShareException if the hex is invalid
[ "Return", "the", "original", "BigInteger", ".", "(", "or", "throw", "an", "exception", "if", "something", "went", "wrong", ")", "." ]
train
https://github.com/timtiemens/secretshare/blob/f5f88929af99ae0ed0df02dc802e40cdb25fceac/src/main/java/com/tiemens/secretshare/math/BigIntStringChecksum.java#L309-L319
defei/codelogger-utils
src/main/java/org/codelogger/utils/SortUtils.java
SortUtils.lessThan
public static <T extends Comparable<? super T>> boolean lessThan(final T object, final T other) { """ Returns true if object less than other; false otherwise. @param object comparable object to test. @param other comparable object to test. @return true if object less than other; false otherwise. """ return JudgeUtils.lessThan(object, other); }
java
public static <T extends Comparable<? super T>> boolean lessThan(final T object, final T other) { return JudgeUtils.lessThan(object, other); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "boolean", "lessThan", "(", "final", "T", "object", ",", "final", "T", "other", ")", "{", "return", "JudgeUtils", ".", "lessThan", "(", "object", ",", "other", ")", ";", "}" ]
Returns true if object less than other; false otherwise. @param object comparable object to test. @param other comparable object to test. @return true if object less than other; false otherwise.
[ "Returns", "true", "if", "object", "less", "than", "other", ";", "false", "otherwise", "." ]
train
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/SortUtils.java#L82-L85
alkacon/opencms-core
src/org/opencms/util/CmsStringUtil.java
CmsStringUtil.mapAsJson
public static String mapAsJson(Map<String, String> map) { """ Encodes a map with string keys and values as a JSON string with the same keys/values.<p> @param map the input map @return the JSON data containing the map entries """ JSONObject obj = new JSONObject(); for (Map.Entry<String, String> entry : map.entrySet()) { try { obj.put(entry.getKey(), entry.getValue()); } catch (JSONException e) { LOG.error(e.getLocalizedMessage(), e); } } return obj.toString(); }
java
public static String mapAsJson(Map<String, String> map) { JSONObject obj = new JSONObject(); for (Map.Entry<String, String> entry : map.entrySet()) { try { obj.put(entry.getKey(), entry.getValue()); } catch (JSONException e) { LOG.error(e.getLocalizedMessage(), e); } } return obj.toString(); }
[ "public", "static", "String", "mapAsJson", "(", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "JSONObject", "obj", "=", "new", "JSONObject", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "try", "{", "obj", ".", "put", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "LOG", ".", "error", "(", "e", ".", "getLocalizedMessage", "(", ")", ",", "e", ")", ";", "}", "}", "return", "obj", ".", "toString", "(", ")", ";", "}" ]
Encodes a map with string keys and values as a JSON string with the same keys/values.<p> @param map the input map @return the JSON data containing the map entries
[ "Encodes", "a", "map", "with", "string", "keys", "and", "values", "as", "a", "JSON", "string", "with", "the", "same", "keys", "/", "values", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L1290-L1301
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java
GenericGenerators.tryCatchBlock
public static InsnList tryCatchBlock(TryCatchBlockNode tryCatchBlockNode, Type exceptionType, InsnList tryInsnList, InsnList catchInsnList) { """ Generates instructions for a try-catch block. @param tryCatchBlockNode try catch block node to populate to with label with relevant information @param exceptionType exception type to catch ({@code null} means catch any exception) @param tryInsnList instructions to execute for try block @param catchInsnList instructions to execute for catch block @return instructions for a try catch block @throws NullPointerException if any argument other than {@code exceptionType} is {@code null} or contains {@code null} @throws IllegalArgumentException if {@code exceptionType} is not an object type (technically must inherit from {@link Throwable}, but no way to check this) """ Validate.notNull(tryInsnList); // exceptionType can be null Validate.notNull(catchInsnList); if (exceptionType != null) { Validate.isTrue(exceptionType.getSort() == Type.OBJECT); } InsnList ret = new InsnList(); LabelNode tryLabelNode = new LabelNode(); LabelNode catchLabelNode = new LabelNode(); LabelNode endLabelNode = new LabelNode(); tryCatchBlockNode.start = tryLabelNode; tryCatchBlockNode.end = catchLabelNode; tryCatchBlockNode.handler = catchLabelNode; tryCatchBlockNode.type = exceptionType == null ? null : exceptionType.getInternalName(); ret.add(tryLabelNode); ret.add(tryInsnList); ret.add(new JumpInsnNode(Opcodes.GOTO, endLabelNode)); ret.add(catchLabelNode); ret.add(catchInsnList); ret.add(endLabelNode); return ret; }
java
public static InsnList tryCatchBlock(TryCatchBlockNode tryCatchBlockNode, Type exceptionType, InsnList tryInsnList, InsnList catchInsnList) { Validate.notNull(tryInsnList); // exceptionType can be null Validate.notNull(catchInsnList); if (exceptionType != null) { Validate.isTrue(exceptionType.getSort() == Type.OBJECT); } InsnList ret = new InsnList(); LabelNode tryLabelNode = new LabelNode(); LabelNode catchLabelNode = new LabelNode(); LabelNode endLabelNode = new LabelNode(); tryCatchBlockNode.start = tryLabelNode; tryCatchBlockNode.end = catchLabelNode; tryCatchBlockNode.handler = catchLabelNode; tryCatchBlockNode.type = exceptionType == null ? null : exceptionType.getInternalName(); ret.add(tryLabelNode); ret.add(tryInsnList); ret.add(new JumpInsnNode(Opcodes.GOTO, endLabelNode)); ret.add(catchLabelNode); ret.add(catchInsnList); ret.add(endLabelNode); return ret; }
[ "public", "static", "InsnList", "tryCatchBlock", "(", "TryCatchBlockNode", "tryCatchBlockNode", ",", "Type", "exceptionType", ",", "InsnList", "tryInsnList", ",", "InsnList", "catchInsnList", ")", "{", "Validate", ".", "notNull", "(", "tryInsnList", ")", ";", "// exceptionType can be null", "Validate", ".", "notNull", "(", "catchInsnList", ")", ";", "if", "(", "exceptionType", "!=", "null", ")", "{", "Validate", ".", "isTrue", "(", "exceptionType", ".", "getSort", "(", ")", "==", "Type", ".", "OBJECT", ")", ";", "}", "InsnList", "ret", "=", "new", "InsnList", "(", ")", ";", "LabelNode", "tryLabelNode", "=", "new", "LabelNode", "(", ")", ";", "LabelNode", "catchLabelNode", "=", "new", "LabelNode", "(", ")", ";", "LabelNode", "endLabelNode", "=", "new", "LabelNode", "(", ")", ";", "tryCatchBlockNode", ".", "start", "=", "tryLabelNode", ";", "tryCatchBlockNode", ".", "end", "=", "catchLabelNode", ";", "tryCatchBlockNode", ".", "handler", "=", "catchLabelNode", ";", "tryCatchBlockNode", ".", "type", "=", "exceptionType", "==", "null", "?", "null", ":", "exceptionType", ".", "getInternalName", "(", ")", ";", "ret", ".", "add", "(", "tryLabelNode", ")", ";", "ret", ".", "add", "(", "tryInsnList", ")", ";", "ret", ".", "add", "(", "new", "JumpInsnNode", "(", "Opcodes", ".", "GOTO", ",", "endLabelNode", ")", ")", ";", "ret", ".", "add", "(", "catchLabelNode", ")", ";", "ret", ".", "add", "(", "catchInsnList", ")", ";", "ret", ".", "add", "(", "endLabelNode", ")", ";", "return", "ret", ";", "}" ]
Generates instructions for a try-catch block. @param tryCatchBlockNode try catch block node to populate to with label with relevant information @param exceptionType exception type to catch ({@code null} means catch any exception) @param tryInsnList instructions to execute for try block @param catchInsnList instructions to execute for catch block @return instructions for a try catch block @throws NullPointerException if any argument other than {@code exceptionType} is {@code null} or contains {@code null} @throws IllegalArgumentException if {@code exceptionType} is not an object type (technically must inherit from {@link Throwable}, but no way to check this)
[ "Generates", "instructions", "for", "a", "try", "-", "catch", "block", "." ]
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L983-L1010