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
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java
AbstractIndexWriter.addClassInfo
protected void addClassInfo(TypeElement te, Content contentTree) { """ Add the classkind (class, interface, exception), error of the class passed. @param te the class being documented @param contentTree the content tree to which the class info will be added """ contentTree.addContent(contents.getContent("doclet.in", utils.getTypeElementName(te, false), getPackageLink(utils.containingPackage(te), utils.getPackageName(utils.containingPackage(te))) )); }
java
protected void addClassInfo(TypeElement te, Content contentTree) { contentTree.addContent(contents.getContent("doclet.in", utils.getTypeElementName(te, false), getPackageLink(utils.containingPackage(te), utils.getPackageName(utils.containingPackage(te))) )); }
[ "protected", "void", "addClassInfo", "(", "TypeElement", "te", ",", "Content", "contentTree", ")", "{", "contentTree", ".", "addContent", "(", "contents", ".", "getContent", "(", "\"doclet.in\"", ",", "utils", ".", "getTypeElementName", "(", "te", ",", "false", ")", ",", "getPackageLink", "(", "utils", ".", "containingPackage", "(", "te", ")", ",", "utils", ".", "getPackageName", "(", "utils", ".", "containingPackage", "(", "te", ")", ")", ")", ")", ")", ";", "}" ]
Add the classkind (class, interface, exception), error of the class passed. @param te the class being documented @param contentTree the content tree to which the class info will be added
[ "Add", "the", "classkind", "(", "class", "interface", "exception", ")", "error", "of", "the", "class", "passed", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractIndexWriter.java#L294-L300
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java
MapDotApi.dotGetNullableString
public static String dotGetNullableString(final Map map, final String pathString) { """ Get string value by path. @param map subject @param pathString nodes to walk in map @return value """ return dotGetNullable(map, String.class, pathString); }
java
public static String dotGetNullableString(final Map map, final String pathString) { return dotGetNullable(map, String.class, pathString); }
[ "public", "static", "String", "dotGetNullableString", "(", "final", "Map", "map", ",", "final", "String", "pathString", ")", "{", "return", "dotGetNullable", "(", "map", ",", "String", ".", "class", ",", "pathString", ")", ";", "}" ]
Get string value by path. @param map subject @param pathString nodes to walk in map @return value
[ "Get", "string", "value", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L146-L148
walkmod/walkmod-core
src/main/java/org/walkmod/WalkModFacade.java
WalkModFacade.setReader
public void setReader(String chain, String type, String path, boolean recursive, Map<String, String> params) throws Exception { """ Sets an specific reader for an specific chain. @param chain Chain to apply the writer @param type Reader type to set @param path Reader path to set @param recursive If to set the reader to all the submodules. @param params Reader parameters @throws Exception if the walkmod configuration file can't be read. """ if ((type != null && !"".equals(type.trim())) || (path != null && !"".equals(path.trim()))) { long startTime = System.currentTimeMillis(); Exception exception = null; if (!cfg.exists()) { init(); } userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider(); cfgProvider.setReader(chain, type, path, recursive, params); } catch (Exception e) { exception = e; } finally { System.setProperty("user.dir", userDir); updateMsg(startTime, exception); } } }
java
public void setReader(String chain, String type, String path, boolean recursive, Map<String, String> params) throws Exception { if ((type != null && !"".equals(type.trim())) || (path != null && !"".equals(path.trim()))) { long startTime = System.currentTimeMillis(); Exception exception = null; if (!cfg.exists()) { init(); } userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider(); cfgProvider.setReader(chain, type, path, recursive, params); } catch (Exception e) { exception = e; } finally { System.setProperty("user.dir", userDir); updateMsg(startTime, exception); } } }
[ "public", "void", "setReader", "(", "String", "chain", ",", "String", "type", ",", "String", "path", ",", "boolean", "recursive", ",", "Map", "<", "String", ",", "String", ">", "params", ")", "throws", "Exception", "{", "if", "(", "(", "type", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "type", ".", "trim", "(", ")", ")", ")", "||", "(", "path", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "path", ".", "trim", "(", ")", ")", ")", ")", "{", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "Exception", "exception", "=", "null", ";", "if", "(", "!", "cfg", ".", "exists", "(", ")", ")", "{", "init", "(", ")", ";", "}", "userDir", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"user.dir\"", ")", ")", ".", "getAbsolutePath", "(", ")", ";", "System", ".", "setProperty", "(", "\"user.dir\"", ",", "options", ".", "getExecutionDirectory", "(", ")", ".", "getAbsolutePath", "(", ")", ")", ";", "try", "{", "ConfigurationManager", "manager", "=", "new", "ConfigurationManager", "(", "cfg", ",", "false", ")", ";", "ProjectConfigurationProvider", "cfgProvider", "=", "manager", ".", "getProjectConfigurationProvider", "(", ")", ";", "cfgProvider", ".", "setReader", "(", "chain", ",", "type", ",", "path", ",", "recursive", ",", "params", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "exception", "=", "e", ";", "}", "finally", "{", "System", ".", "setProperty", "(", "\"user.dir\"", ",", "userDir", ")", ";", "updateMsg", "(", "startTime", ",", "exception", ")", ";", "}", "}", "}" ]
Sets an specific reader for an specific chain. @param chain Chain to apply the writer @param type Reader type to set @param path Reader path to set @param recursive If to set the reader to all the submodules. @param params Reader parameters @throws Exception if the walkmod configuration file can't be read.
[ "Sets", "an", "specific", "reader", "for", "an", "specific", "chain", "." ]
train
https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L806-L829
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseIncomingBodyBufferSize
private void parseIncomingBodyBufferSize(Map<Object, Object> props) { """ Check the input configuration for the buffer size to use when reading the incoming body. @param props """ Object value = props.get(HttpConfigConstants.PROPNAME_INCOMING_BODY_BUFFSIZE); if (null != value) { try { this.incomingBodyBuffSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BUFFER_SIZE, HttpConfigConstants.MAX_BUFFER_SIZE); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Incoming body buffer size is " + getIncomingBodyBufferSize()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseIncomingBodyBufferSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid incoming body buffer size; " + value); } } } }
java
private void parseIncomingBodyBufferSize(Map<Object, Object> props) { Object value = props.get(HttpConfigConstants.PROPNAME_INCOMING_BODY_BUFFSIZE); if (null != value) { try { this.incomingBodyBuffSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BUFFER_SIZE, HttpConfigConstants.MAX_BUFFER_SIZE); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Incoming body buffer size is " + getIncomingBodyBufferSize()); } } catch (NumberFormatException nfe) { FFDCFilter.processException(nfe, getClass().getName() + ".parseIncomingBodyBufferSize", "1"); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Config: Invalid incoming body buffer size; " + value); } } } }
[ "private", "void", "parseIncomingBodyBufferSize", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_INCOMING_BODY_BUFFSIZE", ")", ";", "if", "(", "null", "!=", "value", ")", "{", "try", "{", "this", ".", "incomingBodyBuffSize", "=", "rangeLimit", "(", "convertInteger", "(", "value", ")", ",", "HttpConfigConstants", ".", "MIN_BUFFER_SIZE", ",", "HttpConfigConstants", ".", "MAX_BUFFER_SIZE", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Config: Incoming body buffer size is \"", "+", "getIncomingBodyBufferSize", "(", ")", ")", ";", "}", "}", "catch", "(", "NumberFormatException", "nfe", ")", "{", "FFDCFilter", ".", "processException", "(", "nfe", ",", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\".parseIncomingBodyBufferSize\"", ",", "\"1\"", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEventEnabled", "(", ")", ")", "{", "Tr", ".", "event", "(", "tc", ",", "\"Config: Invalid incoming body buffer size; \"", "+", "value", ")", ";", "}", "}", "}", "}" ]
Check the input configuration for the buffer size to use when reading the incoming body. @param props
[ "Check", "the", "input", "configuration", "for", "the", "buffer", "size", "to", "use", "when", "reading", "the", "incoming", "body", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L612-L627
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/PennTreeReader.java
PennTreeReader.main
public static void main(String[] args) { """ Loads treebank data from first argument and prints it. @param args Array of command-line arguments: specifies a filename """ try { TreeFactory tf = new LabeledScoredTreeFactory(); Reader r = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]), "UTF-8")); TreeReader tr = new PennTreeReader(r, tf); Tree t = tr.readTree(); while (t != null) { System.out.println(t); System.out.println(); t = tr.readTree(); } r.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
java
public static void main(String[] args) { try { TreeFactory tf = new LabeledScoredTreeFactory(); Reader r = new BufferedReader(new InputStreamReader(new FileInputStream(args[0]), "UTF-8")); TreeReader tr = new PennTreeReader(r, tf); Tree t = tr.readTree(); while (t != null) { System.out.println(t); System.out.println(); t = tr.readTree(); } r.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "try", "{", "TreeFactory", "tf", "=", "new", "LabeledScoredTreeFactory", "(", ")", ";", "Reader", "r", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "new", "FileInputStream", "(", "args", "[", "0", "]", ")", ",", "\"UTF-8\"", ")", ")", ";", "TreeReader", "tr", "=", "new", "PennTreeReader", "(", "r", ",", "tf", ")", ";", "Tree", "t", "=", "tr", ".", "readTree", "(", ")", ";", "while", "(", "t", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "t", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "t", "=", "tr", ".", "readTree", "(", ")", ";", "}", "r", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "ioe", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Loads treebank data from first argument and prints it. @param args Array of command-line arguments: specifies a filename
[ "Loads", "treebank", "data", "from", "first", "argument", "and", "prints", "it", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/PennTreeReader.java#L240-L255
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/Iterate.java
Iterate.sumOfBigDecimal
public static <T> BigDecimal sumOfBigDecimal(Iterable<T> iterable, Function<? super T, BigDecimal> function) { """ Returns the BigDecimal sum of the result of applying the function to each element of the iterable. @since 6.0 """ if (iterable instanceof List) { return ListIterate.sumOfBigDecimal((List<T>) iterable, function); } if (iterable != null) { return IterableIterate.sumOfBigDecimal(iterable, function); } throw new IllegalArgumentException("Cannot perform an sumOfBigDecimal on null"); }
java
public static <T> BigDecimal sumOfBigDecimal(Iterable<T> iterable, Function<? super T, BigDecimal> function) { if (iterable instanceof List) { return ListIterate.sumOfBigDecimal((List<T>) iterable, function); } if (iterable != null) { return IterableIterate.sumOfBigDecimal(iterable, function); } throw new IllegalArgumentException("Cannot perform an sumOfBigDecimal on null"); }
[ "public", "static", "<", "T", ">", "BigDecimal", "sumOfBigDecimal", "(", "Iterable", "<", "T", ">", "iterable", ",", "Function", "<", "?", "super", "T", ",", "BigDecimal", ">", "function", ")", "{", "if", "(", "iterable", "instanceof", "List", ")", "{", "return", "ListIterate", ".", "sumOfBigDecimal", "(", "(", "List", "<", "T", ">", ")", "iterable", ",", "function", ")", ";", "}", "if", "(", "iterable", "!=", "null", ")", "{", "return", "IterableIterate", ".", "sumOfBigDecimal", "(", "iterable", ",", "function", ")", ";", "}", "throw", "new", "IllegalArgumentException", "(", "\"Cannot perform an sumOfBigDecimal on null\"", ")", ";", "}" ]
Returns the BigDecimal sum of the result of applying the function to each element of the iterable. @since 6.0
[ "Returns", "the", "BigDecimal", "sum", "of", "the", "result", "of", "applying", "the", "function", "to", "each", "element", "of", "the", "iterable", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L2617-L2628
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.getObjects
public JSONObject getObjects(List<String> objectIDs, List<String> attributesToRetrieve, RequestOptions requestOptions) throws AlgoliaException { """ Get several objects from this index @param objectIDs the array of unique identifier of objects to retrieve @param attributesToRetrieve contains the list of attributes to retrieve. @param requestOptions Options to pass to this request """ try { JSONArray requests = new JSONArray(); for (String id : objectIDs) { JSONObject request = new JSONObject(); request.put("indexName", this.indexName); request.put("objectID", id); request.put("attributesToRetrieve", encodeAttributes(attributesToRetrieve, false)); requests.put(request); } JSONObject body = new JSONObject(); body.put("requests", requests); return client.postRequest("/1/indexes/*/objects", body.toString(), false, false, requestOptions); } catch (JSONException e) { throw new AlgoliaException(e.getMessage()); } catch (UnsupportedEncodingException e) { throw new AlgoliaException(e.getMessage()); } }
java
public JSONObject getObjects(List<String> objectIDs, List<String> attributesToRetrieve, RequestOptions requestOptions) throws AlgoliaException { try { JSONArray requests = new JSONArray(); for (String id : objectIDs) { JSONObject request = new JSONObject(); request.put("indexName", this.indexName); request.put("objectID", id); request.put("attributesToRetrieve", encodeAttributes(attributesToRetrieve, false)); requests.put(request); } JSONObject body = new JSONObject(); body.put("requests", requests); return client.postRequest("/1/indexes/*/objects", body.toString(), false, false, requestOptions); } catch (JSONException e) { throw new AlgoliaException(e.getMessage()); } catch (UnsupportedEncodingException e) { throw new AlgoliaException(e.getMessage()); } }
[ "public", "JSONObject", "getObjects", "(", "List", "<", "String", ">", "objectIDs", ",", "List", "<", "String", ">", "attributesToRetrieve", ",", "RequestOptions", "requestOptions", ")", "throws", "AlgoliaException", "{", "try", "{", "JSONArray", "requests", "=", "new", "JSONArray", "(", ")", ";", "for", "(", "String", "id", ":", "objectIDs", ")", "{", "JSONObject", "request", "=", "new", "JSONObject", "(", ")", ";", "request", ".", "put", "(", "\"indexName\"", ",", "this", ".", "indexName", ")", ";", "request", ".", "put", "(", "\"objectID\"", ",", "id", ")", ";", "request", ".", "put", "(", "\"attributesToRetrieve\"", ",", "encodeAttributes", "(", "attributesToRetrieve", ",", "false", ")", ")", ";", "requests", ".", "put", "(", "request", ")", ";", "}", "JSONObject", "body", "=", "new", "JSONObject", "(", ")", ";", "body", ".", "put", "(", "\"requests\"", ",", "requests", ")", ";", "return", "client", ".", "postRequest", "(", "\"/1/indexes/*/objects\"", ",", "body", ".", "toString", "(", ")", ",", "false", ",", "false", ",", "requestOptions", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "throw", "new", "AlgoliaException", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "AlgoliaException", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Get several objects from this index @param objectIDs the array of unique identifier of objects to retrieve @param attributesToRetrieve contains the list of attributes to retrieve. @param requestOptions Options to pass to this request
[ "Get", "several", "objects", "from", "this", "index" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L312-L330
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.photos_getAlbums
public T photos_getAlbums(Collection<Long> albumIds) throws FacebookException, IOException { """ Retrieves album metadata for a list of album IDs. @param albumIds the ids of albums whose metadata is to be retrieved @return album objects @see <a href="http://wiki.developers.facebook.com/index.php/Photos.getAlbums"> Developers Wiki: Photos.getAlbums</a> """ return photos_getAlbums(null, /*userId*/albumIds); }
java
public T photos_getAlbums(Collection<Long> albumIds) throws FacebookException, IOException { return photos_getAlbums(null, /*userId*/albumIds); }
[ "public", "T", "photos_getAlbums", "(", "Collection", "<", "Long", ">", "albumIds", ")", "throws", "FacebookException", ",", "IOException", "{", "return", "photos_getAlbums", "(", "null", ",", "/*userId*/", "albumIds", ")", ";", "}" ]
Retrieves album metadata for a list of album IDs. @param albumIds the ids of albums whose metadata is to be retrieved @return album objects @see <a href="http://wiki.developers.facebook.com/index.php/Photos.getAlbums"> Developers Wiki: Photos.getAlbums</a>
[ "Retrieves", "album", "metadata", "for", "a", "list", "of", "album", "IDs", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1774-L1777
buschmais/jqa-core-framework
analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/TransactionalRuleVisitor.java
TransactionalRuleVisitor.doInXOTransaction
private <T> T doInXOTransaction(TransactionalSupplier<T> txSupplier) throws RuleException { """ Executes a {@link TransactionalSupplier} within a transaction. @param txSupplier The {@link TransactionalSupplier}. @param <T> The return type of the {@link TransactionalSupplier}. @return The value provided by the {@link TransactionalSupplier}. @throws RuleException If the transaction failed due to an underlying {@link XOException}. """ try { store.beginTransaction(); T result = txSupplier.execute(); store.commitTransaction(); return result; } catch (RuleException e) { throw e; } catch (RuntimeException e) { throw new RuleException("Caught unexpected exception from store.", e); } finally { if (store.hasActiveTransaction()) { store.rollbackTransaction(); } } }
java
private <T> T doInXOTransaction(TransactionalSupplier<T> txSupplier) throws RuleException { try { store.beginTransaction(); T result = txSupplier.execute(); store.commitTransaction(); return result; } catch (RuleException e) { throw e; } catch (RuntimeException e) { throw new RuleException("Caught unexpected exception from store.", e); } finally { if (store.hasActiveTransaction()) { store.rollbackTransaction(); } } }
[ "private", "<", "T", ">", "T", "doInXOTransaction", "(", "TransactionalSupplier", "<", "T", ">", "txSupplier", ")", "throws", "RuleException", "{", "try", "{", "store", ".", "beginTransaction", "(", ")", ";", "T", "result", "=", "txSupplier", ".", "execute", "(", ")", ";", "store", ".", "commitTransaction", "(", ")", ";", "return", "result", ";", "}", "catch", "(", "RuleException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "throw", "new", "RuleException", "(", "\"Caught unexpected exception from store.\"", ",", "e", ")", ";", "}", "finally", "{", "if", "(", "store", ".", "hasActiveTransaction", "(", ")", ")", "{", "store", ".", "rollbackTransaction", "(", ")", ";", "}", "}", "}" ]
Executes a {@link TransactionalSupplier} within a transaction. @param txSupplier The {@link TransactionalSupplier}. @param <T> The return type of the {@link TransactionalSupplier}. @return The value provided by the {@link TransactionalSupplier}. @throws RuleException If the transaction failed due to an underlying {@link XOException}.
[ "Executes", "a", "{", "@link", "TransactionalSupplier", "}", "within", "a", "transaction", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/analysis/src/main/java/com/buschmais/jqassistant/core/analysis/impl/TransactionalRuleVisitor.java#L84-L99
ironjacamar/ironjacamar
web/src/main/java/org/ironjacamar/web/console/Server.java
Server.getMBeanAttributeObject
public static Object getMBeanAttributeObject(String name, String attrName) throws JMException { """ Get MBean attribute object @param name The bean name @param attrName The attribute name @return The data @exception JMException Thrown if an error occurs """ MBeanServer server = getMBeanServer(); ObjectName objName = new ObjectName(name); return server.getAttribute(objName, attrName); }
java
public static Object getMBeanAttributeObject(String name, String attrName) throws JMException { MBeanServer server = getMBeanServer(); ObjectName objName = new ObjectName(name); return server.getAttribute(objName, attrName); }
[ "public", "static", "Object", "getMBeanAttributeObject", "(", "String", "name", ",", "String", "attrName", ")", "throws", "JMException", "{", "MBeanServer", "server", "=", "getMBeanServer", "(", ")", ";", "ObjectName", "objName", "=", "new", "ObjectName", "(", "name", ")", ";", "return", "server", ".", "getAttribute", "(", "objName", ",", "attrName", ")", ";", "}" ]
Get MBean attribute object @param name The bean name @param attrName The attribute name @return The data @exception JMException Thrown if an error occurs
[ "Get", "MBean", "attribute", "object" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/web/src/main/java/org/ironjacamar/web/console/Server.java#L168-L174
eobermuhlner/big-math
ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplexMath.java
BigComplexMath.sqrt
public static BigComplex sqrt(BigComplex x, MathContext mathContext) { """ Calculates the square root of {@link BigComplex} x in the complex domain (√x). <p>See <a href="https://en.wikipedia.org/wiki/Square_root#Square_root_of_an_imaginary_number">Wikipedia: Square root (Square root of an imaginary number)</a></p> @param x the {@link BigComplex} to calculate the square root for @param mathContext the {@link MathContext} used for the result @return the calculated square root {@link BigComplex} with the precision specified in the <code>mathContext</code> """ // https://math.stackexchange.com/questions/44406/how-do-i-get-the-square-root-of-a-complex-number MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); BigDecimal magnitude = x.abs(mc); BigComplex a = x.add(magnitude, mc); return a.divide(a.abs(mc), mc).multiply(BigDecimalMath.sqrt(magnitude, mc), mc).round(mathContext); }
java
public static BigComplex sqrt(BigComplex x, MathContext mathContext) { // https://math.stackexchange.com/questions/44406/how-do-i-get-the-square-root-of-a-complex-number MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); BigDecimal magnitude = x.abs(mc); BigComplex a = x.add(magnitude, mc); return a.divide(a.abs(mc), mc).multiply(BigDecimalMath.sqrt(magnitude, mc), mc).round(mathContext); }
[ "public", "static", "BigComplex", "sqrt", "(", "BigComplex", "x", ",", "MathContext", "mathContext", ")", "{", "// https://math.stackexchange.com/questions/44406/how-do-i-get-the-square-root-of-a-complex-number", "MathContext", "mc", "=", "new", "MathContext", "(", "mathContext", ".", "getPrecision", "(", ")", "+", "4", ",", "mathContext", ".", "getRoundingMode", "(", ")", ")", ";", "BigDecimal", "magnitude", "=", "x", ".", "abs", "(", "mc", ")", ";", "BigComplex", "a", "=", "x", ".", "add", "(", "magnitude", ",", "mc", ")", ";", "return", "a", ".", "divide", "(", "a", ".", "abs", "(", "mc", ")", ",", "mc", ")", ".", "multiply", "(", "BigDecimalMath", ".", "sqrt", "(", "magnitude", ",", "mc", ")", ",", "mc", ")", ".", "round", "(", "mathContext", ")", ";", "}" ]
Calculates the square root of {@link BigComplex} x in the complex domain (√x). <p>See <a href="https://en.wikipedia.org/wiki/Square_root#Square_root_of_an_imaginary_number">Wikipedia: Square root (Square root of an imaginary number)</a></p> @param x the {@link BigComplex} to calculate the square root for @param mathContext the {@link MathContext} used for the result @return the calculated square root {@link BigComplex} with the precision specified in the <code>mathContext</code>
[ "Calculates", "the", "square", "root", "of", "{", "@link", "BigComplex", "}", "x", "in", "the", "complex", "domain", "(", "√x", ")", "." ]
train
https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigComplexMath.java#L284-L292
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/birch/CFTree.java
CFTree.rebuildTree
protected void rebuildTree() { """ Rebuild the CFTree to condense it to approximately half the size. """ final int dim = root.getDimensionality(); double t = estimateThreshold(root) / leaves; t *= t; // Never decrease the threshold. thresholdsq = t > thresholdsq ? t : thresholdsq; LOG.debug("New squared threshold: " + thresholdsq); LeafIterator iter = new LeafIterator(root); // Will keep the old root. assert (iter.valid()); ClusteringFeature first = iter.get(); leaves = 0; // Make a new root node: root = new TreeNode(dim, capacity); root.children[0] = first; root.addToStatistics(first); ++leaves; for(iter.advance(); iter.valid(); iter.advance()) { TreeNode other = insert(root, iter.get()); // Handle root overflow: if(other != null) { TreeNode newnode = new TreeNode(dim, capacity); newnode.addToStatistics(newnode.children[0] = root); newnode.addToStatistics(newnode.children[1] = other); root = newnode; } } }
java
protected void rebuildTree() { final int dim = root.getDimensionality(); double t = estimateThreshold(root) / leaves; t *= t; // Never decrease the threshold. thresholdsq = t > thresholdsq ? t : thresholdsq; LOG.debug("New squared threshold: " + thresholdsq); LeafIterator iter = new LeafIterator(root); // Will keep the old root. assert (iter.valid()); ClusteringFeature first = iter.get(); leaves = 0; // Make a new root node: root = new TreeNode(dim, capacity); root.children[0] = first; root.addToStatistics(first); ++leaves; for(iter.advance(); iter.valid(); iter.advance()) { TreeNode other = insert(root, iter.get()); // Handle root overflow: if(other != null) { TreeNode newnode = new TreeNode(dim, capacity); newnode.addToStatistics(newnode.children[0] = root); newnode.addToStatistics(newnode.children[1] = other); root = newnode; } } }
[ "protected", "void", "rebuildTree", "(", ")", "{", "final", "int", "dim", "=", "root", ".", "getDimensionality", "(", ")", ";", "double", "t", "=", "estimateThreshold", "(", "root", ")", "/", "leaves", ";", "t", "*=", "t", ";", "// Never decrease the threshold.", "thresholdsq", "=", "t", ">", "thresholdsq", "?", "t", ":", "thresholdsq", ";", "LOG", ".", "debug", "(", "\"New squared threshold: \"", "+", "thresholdsq", ")", ";", "LeafIterator", "iter", "=", "new", "LeafIterator", "(", "root", ")", ";", "// Will keep the old root.", "assert", "(", "iter", ".", "valid", "(", ")", ")", ";", "ClusteringFeature", "first", "=", "iter", ".", "get", "(", ")", ";", "leaves", "=", "0", ";", "// Make a new root node:", "root", "=", "new", "TreeNode", "(", "dim", ",", "capacity", ")", ";", "root", ".", "children", "[", "0", "]", "=", "first", ";", "root", ".", "addToStatistics", "(", "first", ")", ";", "++", "leaves", ";", "for", "(", "iter", ".", "advance", "(", ")", ";", "iter", ".", "valid", "(", ")", ";", "iter", ".", "advance", "(", ")", ")", "{", "TreeNode", "other", "=", "insert", "(", "root", ",", "iter", ".", "get", "(", ")", ")", ";", "// Handle root overflow:", "if", "(", "other", "!=", "null", ")", "{", "TreeNode", "newnode", "=", "new", "TreeNode", "(", "dim", ",", "capacity", ")", ";", "newnode", ".", "addToStatistics", "(", "newnode", ".", "children", "[", "0", "]", "=", "root", ")", ";", "newnode", ".", "addToStatistics", "(", "newnode", ".", "children", "[", "1", "]", "=", "other", ")", ";", "root", "=", "newnode", ";", "}", "}", "}" ]
Rebuild the CFTree to condense it to approximately half the size.
[ "Rebuild", "the", "CFTree", "to", "condense", "it", "to", "approximately", "half", "the", "size", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/hierarchical/birch/CFTree.java#L168-L196
apache/groovy
subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java
Sql.createPreparedQueryCommand
protected AbstractQueryCommand createPreparedQueryCommand(String sql, List<Object> queryParams) { """ Factory for the PreparedQueryCommand command pattern object allows subclass to supply implementations of the command class. @param sql statement to be executed, including optional parameter placeholders (?) @param queryParams List of parameter values corresponding to parameter placeholders @return a command - invoke its execute() and closeResource() methods @see #createQueryCommand(String) """ return new PreparedQueryCommand(sql, queryParams); }
java
protected AbstractQueryCommand createPreparedQueryCommand(String sql, List<Object> queryParams) { return new PreparedQueryCommand(sql, queryParams); }
[ "protected", "AbstractQueryCommand", "createPreparedQueryCommand", "(", "String", "sql", ",", "List", "<", "Object", ">", "queryParams", ")", "{", "return", "new", "PreparedQueryCommand", "(", "sql", ",", "queryParams", ")", ";", "}" ]
Factory for the PreparedQueryCommand command pattern object allows subclass to supply implementations of the command class. @param sql statement to be executed, including optional parameter placeholders (?) @param queryParams List of parameter values corresponding to parameter placeholders @return a command - invoke its execute() and closeResource() methods @see #createQueryCommand(String)
[ "Factory", "for", "the", "PreparedQueryCommand", "command", "pattern", "object", "allows", "subclass", "to", "supply", "implementations", "of", "the", "command", "class", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java#L4765-L4767
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java
FaceListsImpl.addFaceFromUrlWithServiceResponseAsync
public Observable<ServiceResponse<PersistedFace>> addFaceFromUrlWithServiceResponseAsync(String faceListId, String url, AddFaceFromUrlOptionalParameter addFaceFromUrlOptionalParameter) { """ Add a face to a face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. @param faceListId Id referencing a particular face list. @param url Publicly reachable URL of an image @param addFaceFromUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PersistedFace object """ if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (faceListId == null) { throw new IllegalArgumentException("Parameter faceListId is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final String userData = addFaceFromUrlOptionalParameter != null ? addFaceFromUrlOptionalParameter.userData() : null; final List<Integer> targetFace = addFaceFromUrlOptionalParameter != null ? addFaceFromUrlOptionalParameter.targetFace() : null; return addFaceFromUrlWithServiceResponseAsync(faceListId, url, userData, targetFace); }
java
public Observable<ServiceResponse<PersistedFace>> addFaceFromUrlWithServiceResponseAsync(String faceListId, String url, AddFaceFromUrlOptionalParameter addFaceFromUrlOptionalParameter) { if (this.client.azureRegion() == null) { throw new IllegalArgumentException("Parameter this.client.azureRegion() is required and cannot be null."); } if (faceListId == null) { throw new IllegalArgumentException("Parameter faceListId is required and cannot be null."); } if (url == null) { throw new IllegalArgumentException("Parameter url is required and cannot be null."); } final String userData = addFaceFromUrlOptionalParameter != null ? addFaceFromUrlOptionalParameter.userData() : null; final List<Integer> targetFace = addFaceFromUrlOptionalParameter != null ? addFaceFromUrlOptionalParameter.targetFace() : null; return addFaceFromUrlWithServiceResponseAsync(faceListId, url, userData, targetFace); }
[ "public", "Observable", "<", "ServiceResponse", "<", "PersistedFace", ">", ">", "addFaceFromUrlWithServiceResponseAsync", "(", "String", "faceListId", ",", "String", "url", ",", "AddFaceFromUrlOptionalParameter", "addFaceFromUrlOptionalParameter", ")", "{", "if", "(", "this", ".", "client", ".", "azureRegion", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.azureRegion() is required and cannot be null.\"", ")", ";", "}", "if", "(", "faceListId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter faceListId is required and cannot be null.\"", ")", ";", "}", "if", "(", "url", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter url is required and cannot be null.\"", ")", ";", "}", "final", "String", "userData", "=", "addFaceFromUrlOptionalParameter", "!=", "null", "?", "addFaceFromUrlOptionalParameter", ".", "userData", "(", ")", ":", "null", ";", "final", "List", "<", "Integer", ">", "targetFace", "=", "addFaceFromUrlOptionalParameter", "!=", "null", "?", "addFaceFromUrlOptionalParameter", ".", "targetFace", "(", ")", ":", "null", ";", "return", "addFaceFromUrlWithServiceResponseAsync", "(", "faceListId", ",", "url", ",", "userData", ",", "targetFace", ")", ";", "}" ]
Add a face to a face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire. @param faceListId Id referencing a particular face list. @param url Publicly reachable URL of an image @param addFaceFromUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PersistedFace object
[ "Add", "a", "face", "to", "a", "face", "list", ".", "The", "input", "face", "is", "specified", "as", "an", "image", "with", "a", "targetFace", "rectangle", ".", "It", "returns", "a", "persistedFaceId", "representing", "the", "added", "face", "and", "persistedFaceId", "will", "not", "expire", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FaceListsImpl.java#L796-L810
alkacon/opencms-core
src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleExecutor.java
CmsSqlConsoleExecutor.executeQuery
@SuppressWarnings("resource") private CmsSqlConsoleResults executeQuery(String sentence, String poolName) throws SQLException { """ Executes a single <code>SELECT</code> sql sentence.<p> @param sentence the sentence to execute @param poolName the name of the pool to use @return the list of rows returned by the rdbms @throws SQLException in the case of a error """ Connection conn = null; PreparedStatement stmt = null; ResultSet res = null; CmsSqlManager sqlManager = m_sqlManager; try { conn = sqlManager.getConnection(poolName); stmt = sqlManager.getPreparedStatementForSql(conn, sentence); res = stmt.executeQuery(); // add headings ResultSetMetaData metadata = res.getMetaData(); List<String> heading = new ArrayList<>(); for (int i = 0; i < metadata.getColumnCount(); i++) { heading.add(metadata.getColumnName(i + 1)); } List<List<Object>> data = new ArrayList<List<Object>>(); // add contents while (res.next()) { List<Object> row = new ArrayList<Object>(); for (int i = 0; i < metadata.getColumnCount(); i++) { Object value = res.getObject(i + 1); if ((value instanceof String) || (value instanceof Integer) || (value instanceof Long) || (value instanceof Float) || (value instanceof Double)) { row.add(value); } else if (value == null) { row.add(null); } else { row.add(String.valueOf(value)); } } data.add(row); } return new CmsSqlConsoleResults(heading, data); } finally { sqlManager.closeAll(null, conn, stmt, res); } }
java
@SuppressWarnings("resource") private CmsSqlConsoleResults executeQuery(String sentence, String poolName) throws SQLException { Connection conn = null; PreparedStatement stmt = null; ResultSet res = null; CmsSqlManager sqlManager = m_sqlManager; try { conn = sqlManager.getConnection(poolName); stmt = sqlManager.getPreparedStatementForSql(conn, sentence); res = stmt.executeQuery(); // add headings ResultSetMetaData metadata = res.getMetaData(); List<String> heading = new ArrayList<>(); for (int i = 0; i < metadata.getColumnCount(); i++) { heading.add(metadata.getColumnName(i + 1)); } List<List<Object>> data = new ArrayList<List<Object>>(); // add contents while (res.next()) { List<Object> row = new ArrayList<Object>(); for (int i = 0; i < metadata.getColumnCount(); i++) { Object value = res.getObject(i + 1); if ((value instanceof String) || (value instanceof Integer) || (value instanceof Long) || (value instanceof Float) || (value instanceof Double)) { row.add(value); } else if (value == null) { row.add(null); } else { row.add(String.valueOf(value)); } } data.add(row); } return new CmsSqlConsoleResults(heading, data); } finally { sqlManager.closeAll(null, conn, stmt, res); } }
[ "@", "SuppressWarnings", "(", "\"resource\"", ")", "private", "CmsSqlConsoleResults", "executeQuery", "(", "String", "sentence", ",", "String", "poolName", ")", "throws", "SQLException", "{", "Connection", "conn", "=", "null", ";", "PreparedStatement", "stmt", "=", "null", ";", "ResultSet", "res", "=", "null", ";", "CmsSqlManager", "sqlManager", "=", "m_sqlManager", ";", "try", "{", "conn", "=", "sqlManager", ".", "getConnection", "(", "poolName", ")", ";", "stmt", "=", "sqlManager", ".", "getPreparedStatementForSql", "(", "conn", ",", "sentence", ")", ";", "res", "=", "stmt", ".", "executeQuery", "(", ")", ";", "// add headings", "ResultSetMetaData", "metadata", "=", "res", ".", "getMetaData", "(", ")", ";", "List", "<", "String", ">", "heading", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "metadata", ".", "getColumnCount", "(", ")", ";", "i", "++", ")", "{", "heading", ".", "add", "(", "metadata", ".", "getColumnName", "(", "i", "+", "1", ")", ")", ";", "}", "List", "<", "List", "<", "Object", ">", ">", "data", "=", "new", "ArrayList", "<", "List", "<", "Object", ">", ">", "(", ")", ";", "// add contents", "while", "(", "res", ".", "next", "(", ")", ")", "{", "List", "<", "Object", ">", "row", "=", "new", "ArrayList", "<", "Object", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "metadata", ".", "getColumnCount", "(", ")", ";", "i", "++", ")", "{", "Object", "value", "=", "res", ".", "getObject", "(", "i", "+", "1", ")", ";", "if", "(", "(", "value", "instanceof", "String", ")", "||", "(", "value", "instanceof", "Integer", ")", "||", "(", "value", "instanceof", "Long", ")", "||", "(", "value", "instanceof", "Float", ")", "||", "(", "value", "instanceof", "Double", ")", ")", "{", "row", ".", "add", "(", "value", ")", ";", "}", "else", "if", "(", "value", "==", "null", ")", "{", "row", ".", "add", "(", "null", ")", ";", "}", "else", "{", "row", ".", "add", "(", "String", ".", "valueOf", "(", "value", ")", ")", ";", "}", "}", "data", ".", "add", "(", "row", ")", ";", "}", "return", "new", "CmsSqlConsoleResults", "(", "heading", ",", "data", ")", ";", "}", "finally", "{", "sqlManager", ".", "closeAll", "(", "null", ",", "conn", ",", "stmt", ",", "res", ")", ";", "}", "}" ]
Executes a single <code>SELECT</code> sql sentence.<p> @param sentence the sentence to execute @param poolName the name of the pool to use @return the list of rows returned by the rdbms @throws SQLException in the case of a error
[ "Executes", "a", "single", "<code", ">", "SELECT<", "/", "code", ">", "sql", "sentence", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/dbmanager/sqlconsole/CmsSqlConsoleExecutor.java#L179-L224
feedzai/pdb
src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/PostgreSqlEngine.java
PostgreSqlEngine.getJSONValue
private Object getJSONValue(String val) throws DatabaseEngineException { """ Converts a String value into a PG JSON value ready to be assigned to bind variables in Prepared Statements. @param val The String representation of the JSON value. @return The correspondent JSON value @throws DatabaseEngineException if there is an error creating the value. It should never be thrown. @since 2.1.5 """ try { PGobject dataObject = new PGobject(); dataObject.setType("jsonb"); dataObject.setValue(val); return dataObject; } catch (final SQLException ex) { throw new DatabaseEngineException("Error while mapping variables to database, value = " + val, ex); } }
java
private Object getJSONValue(String val) throws DatabaseEngineException { try { PGobject dataObject = new PGobject(); dataObject.setType("jsonb"); dataObject.setValue(val); return dataObject; } catch (final SQLException ex) { throw new DatabaseEngineException("Error while mapping variables to database, value = " + val, ex); } }
[ "private", "Object", "getJSONValue", "(", "String", "val", ")", "throws", "DatabaseEngineException", "{", "try", "{", "PGobject", "dataObject", "=", "new", "PGobject", "(", ")", ";", "dataObject", ".", "setType", "(", "\"jsonb\"", ")", ";", "dataObject", ".", "setValue", "(", "val", ")", ";", "return", "dataObject", ";", "}", "catch", "(", "final", "SQLException", "ex", ")", "{", "throw", "new", "DatabaseEngineException", "(", "\"Error while mapping variables to database, value = \"", "+", "val", ",", "ex", ")", ";", "}", "}" ]
Converts a String value into a PG JSON value ready to be assigned to bind variables in Prepared Statements. @param val The String representation of the JSON value. @return The correspondent JSON value @throws DatabaseEngineException if there is an error creating the value. It should never be thrown. @since 2.1.5
[ "Converts", "a", "String", "value", "into", "a", "PG", "JSON", "value", "ready", "to", "be", "assigned", "to", "bind", "variables", "in", "Prepared", "Statements", "." ]
train
https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/PostgreSqlEngine.java#L169-L178
mpetazzoni/ttorrent
ttorrent-client/src/main/java/com/turn/ttorrent/client/announce/TrackerClient.java
TrackerClient.fireAnnounceResponseEvent
protected void fireAnnounceResponseEvent(int complete, int incomplete, int interval, String hexInfoHash) { """ Fire the announce response event to all listeners. @param complete The number of seeders on this torrent. @param incomplete The number of leechers on this torrent. @param interval The announce interval requested by the tracker. """ for (AnnounceResponseListener listener : this.listeners) { listener.handleAnnounceResponse(interval, complete, incomplete, hexInfoHash); } }
java
protected void fireAnnounceResponseEvent(int complete, int incomplete, int interval, String hexInfoHash) { for (AnnounceResponseListener listener : this.listeners) { listener.handleAnnounceResponse(interval, complete, incomplete, hexInfoHash); } }
[ "protected", "void", "fireAnnounceResponseEvent", "(", "int", "complete", ",", "int", "incomplete", ",", "int", "interval", ",", "String", "hexInfoHash", ")", "{", "for", "(", "AnnounceResponseListener", "listener", ":", "this", ".", "listeners", ")", "{", "listener", ".", "handleAnnounceResponse", "(", "interval", ",", "complete", ",", "incomplete", ",", "hexInfoHash", ")", ";", "}", "}" ]
Fire the announce response event to all listeners. @param complete The number of seeders on this torrent. @param incomplete The number of leechers on this torrent. @param interval The announce interval requested by the tracker.
[ "Fire", "the", "announce", "response", "event", "to", "all", "listeners", "." ]
train
https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-client/src/main/java/com/turn/ttorrent/client/announce/TrackerClient.java#L199-L203
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java
Unmarshaller.unmarshalBaseEntity
private static <T> T unmarshalBaseEntity(BaseEntity<?> nativeEntity, Class<T> entityClass) { """ Unmarshals the given BaseEntity and returns the equivalent model object. @param nativeEntity the native entity to unmarshal @param entityClass the target type of the model class @return the model object """ if (nativeEntity == null) { return null; } Unmarshaller unmarshaller = new Unmarshaller(nativeEntity, entityClass); return unmarshaller.unmarshal(); }
java
private static <T> T unmarshalBaseEntity(BaseEntity<?> nativeEntity, Class<T> entityClass) { if (nativeEntity == null) { return null; } Unmarshaller unmarshaller = new Unmarshaller(nativeEntity, entityClass); return unmarshaller.unmarshal(); }
[ "private", "static", "<", "T", ">", "T", "unmarshalBaseEntity", "(", "BaseEntity", "<", "?", ">", "nativeEntity", ",", "Class", "<", "T", ">", "entityClass", ")", "{", "if", "(", "nativeEntity", "==", "null", ")", "{", "return", "null", ";", "}", "Unmarshaller", "unmarshaller", "=", "new", "Unmarshaller", "(", "nativeEntity", ",", "entityClass", ")", ";", "return", "unmarshaller", ".", "unmarshal", "(", ")", ";", "}" ]
Unmarshals the given BaseEntity and returns the equivalent model object. @param nativeEntity the native entity to unmarshal @param entityClass the target type of the model class @return the model object
[ "Unmarshals", "the", "given", "BaseEntity", "and", "returns", "the", "equivalent", "model", "object", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Unmarshaller.java#L140-L146
Nordstrom/JUnit-Foundation
src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java
LifecycleHooks.computeIfAbsent
static <K, T> T computeIfAbsent(ConcurrentMap<K, T> map, K key, Function<K, T> fun) { """ If the specified key is not already associated with a value (or is mapped to {@code null}), attempts to compute its value using the given mapping function and enters it into this map unless {@code null}. @param <K> data type of map keys @param <T> data type of map values @param map concurrent map to be manipulated @param key key with which the specified value is to be associated @param fun the function to compute a value @return the current (existing or computed) value associated with the specified key; {@code null} if the computed value is {@code null} """ T val = map.get(key); if (val == null) { T obj = fun.apply(key); val = (val = map.putIfAbsent(key, obj)) == null ? obj : val; } return val; }
java
static <K, T> T computeIfAbsent(ConcurrentMap<K, T> map, K key, Function<K, T> fun) { T val = map.get(key); if (val == null) { T obj = fun.apply(key); val = (val = map.putIfAbsent(key, obj)) == null ? obj : val; } return val; }
[ "static", "<", "K", ",", "T", ">", "T", "computeIfAbsent", "(", "ConcurrentMap", "<", "K", ",", "T", ">", "map", ",", "K", "key", ",", "Function", "<", "K", ",", "T", ">", "fun", ")", "{", "T", "val", "=", "map", ".", "get", "(", "key", ")", ";", "if", "(", "val", "==", "null", ")", "{", "T", "obj", "=", "fun", ".", "apply", "(", "key", ")", ";", "val", "=", "(", "val", "=", "map", ".", "putIfAbsent", "(", "key", ",", "obj", ")", ")", "==", "null", "?", "obj", ":", "val", ";", "}", "return", "val", ";", "}" ]
If the specified key is not already associated with a value (or is mapped to {@code null}), attempts to compute its value using the given mapping function and enters it into this map unless {@code null}. @param <K> data type of map keys @param <T> data type of map values @param map concurrent map to be manipulated @param key key with which the specified value is to be associated @param fun the function to compute a value @return the current (existing or computed) value associated with the specified key; {@code null} if the computed value is {@code null}
[ "If", "the", "specified", "key", "is", "not", "already", "associated", "with", "a", "value", "(", "or", "is", "mapped", "to", "{", "@code", "null", "}", ")", "attempts", "to", "compute", "its", "value", "using", "the", "given", "mapping", "function", "and", "enters", "it", "into", "this", "map", "unless", "{", "@code", "null", "}", "." ]
train
https://github.com/Nordstrom/JUnit-Foundation/blob/f24d91f8677d262c27d18ef29ed633eaac717be5/src/main/java/com/nordstrom/automation/junit/LifecycleHooks.java#L403-L410
OpenLiberty/open-liberty
dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java
TypeConversion.shortToBytes
public static void shortToBytes(short value, byte[] bytes, int offset) { """ A utility method to convert a short into bytes in an array. @param value A short. @param bytes The byte array to which the short should be copied. @param offset The index where the short should start. """ for (int i = offset + 1; i >= offset; --i) { bytes[i] = (byte) value; value = (short) ((value) >> 8); } }
java
public static void shortToBytes(short value, byte[] bytes, int offset) { for (int i = offset + 1; i >= offset; --i) { bytes[i] = (byte) value; value = (short) ((value) >> 8); } }
[ "public", "static", "void", "shortToBytes", "(", "short", "value", ",", "byte", "[", "]", "bytes", ",", "int", "offset", ")", "{", "for", "(", "int", "i", "=", "offset", "+", "1", ";", "i", ">=", "offset", ";", "--", "i", ")", "{", "bytes", "[", "i", "]", "=", "(", "byte", ")", "value", ";", "value", "=", "(", "short", ")", "(", "(", "value", ")", ">>", "8", ")", ";", "}", "}" ]
A utility method to convert a short into bytes in an array. @param value A short. @param bytes The byte array to which the short should be copied. @param offset The index where the short should start.
[ "A", "utility", "method", "to", "convert", "a", "short", "into", "bytes", "in", "an", "array", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java#L126-L131
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuLaunchGrid
@Deprecated public static int cuLaunchGrid(CUfunction f, int grid_width, int grid_height) { """ Launches a CUDA function. <pre> CUresult cuLaunchGrid ( CUfunction f, int grid_width, int grid_height ) </pre> <div> <p>Launches a CUDA function. Deprecated Invokes the kernel <tt>f</tt> on a <tt>grid_width</tt> x <tt>grid_height</tt> grid of blocks. Each block contains the number of threads specified by a previous call to cuFuncSetBlockShape(). </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param f Kernel to launch @param grid_width Width of grid in blocks @param grid_height Height of grid in blocks @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_LAUNCH_FAILED, CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, CUDA_ERROR_LAUNCH_TIMEOUT, CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, CUDA_ERROR_SHARED_OBJECT_INIT_FAILED @see JCudaDriver#cuFuncSetBlockShape @see JCudaDriver#cuFuncSetSharedSize @see JCudaDriver#cuFuncGetAttribute @see JCudaDriver#cuParamSetSize @see JCudaDriver#cuParamSetf @see JCudaDriver#cuParamSeti @see JCudaDriver#cuParamSetv @see JCudaDriver#cuLaunch @see JCudaDriver#cuLaunchGridAsync @see JCudaDriver#cuLaunchKernel @deprecated Deprecated in CUDA """ return checkResult(cuLaunchGridNative(f, grid_width, grid_height)); }
java
@Deprecated public static int cuLaunchGrid(CUfunction f, int grid_width, int grid_height) { return checkResult(cuLaunchGridNative(f, grid_width, grid_height)); }
[ "@", "Deprecated", "public", "static", "int", "cuLaunchGrid", "(", "CUfunction", "f", ",", "int", "grid_width", ",", "int", "grid_height", ")", "{", "return", "checkResult", "(", "cuLaunchGridNative", "(", "f", ",", "grid_width", ",", "grid_height", ")", ")", ";", "}" ]
Launches a CUDA function. <pre> CUresult cuLaunchGrid ( CUfunction f, int grid_width, int grid_height ) </pre> <div> <p>Launches a CUDA function. Deprecated Invokes the kernel <tt>f</tt> on a <tt>grid_width</tt> x <tt>grid_height</tt> grid of blocks. Each block contains the number of threads specified by a previous call to cuFuncSetBlockShape(). </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param f Kernel to launch @param grid_width Width of grid in blocks @param grid_height Height of grid in blocks @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_LAUNCH_FAILED, CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES, CUDA_ERROR_LAUNCH_TIMEOUT, CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING, CUDA_ERROR_SHARED_OBJECT_INIT_FAILED @see JCudaDriver#cuFuncSetBlockShape @see JCudaDriver#cuFuncSetSharedSize @see JCudaDriver#cuFuncGetAttribute @see JCudaDriver#cuParamSetSize @see JCudaDriver#cuParamSetf @see JCudaDriver#cuParamSeti @see JCudaDriver#cuParamSetv @see JCudaDriver#cuLaunch @see JCudaDriver#cuLaunchGridAsync @see JCudaDriver#cuLaunchKernel @deprecated Deprecated in CUDA
[ "Launches", "a", "CUDA", "function", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L13246-L13250
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/DatabaseVulnerabilityAssessmentScansInner.java
DatabaseVulnerabilityAssessmentScansInner.listByDatabaseAsync
public Observable<Page<VulnerabilityAssessmentScanRecordInner>> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { """ Lists the vulnerability assessment scans of a database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VulnerabilityAssessmentScanRecordInner&gt; object """ return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName) .map(new Func1<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>, Page<VulnerabilityAssessmentScanRecordInner>>() { @Override public Page<VulnerabilityAssessmentScanRecordInner> call(ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>> response) { return response.body(); } }); }
java
public Observable<Page<VulnerabilityAssessmentScanRecordInner>> listByDatabaseAsync(final String resourceGroupName, final String serverName, final String databaseName) { return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName) .map(new Func1<ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>>, Page<VulnerabilityAssessmentScanRecordInner>>() { @Override public Page<VulnerabilityAssessmentScanRecordInner> call(ServiceResponse<Page<VulnerabilityAssessmentScanRecordInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "VulnerabilityAssessmentScanRecordInner", ">", ">", "listByDatabaseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "serverName", ",", "final", "String", "databaseName", ")", "{", "return", "listByDatabaseWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "VulnerabilityAssessmentScanRecordInner", ">", ">", ",", "Page", "<", "VulnerabilityAssessmentScanRecordInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "VulnerabilityAssessmentScanRecordInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "VulnerabilityAssessmentScanRecordInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists the vulnerability assessment scans of a database. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VulnerabilityAssessmentScanRecordInner&gt; object
[ "Lists", "the", "vulnerability", "assessment", "scans", "of", "a", "database", "." ]
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/DatabaseVulnerabilityAssessmentScansInner.java#L139-L147
liferay/com-liferay-commerce
commerce-price-list-api/src/main/java/com/liferay/commerce/price/list/service/persistence/CommercePriceListUtil.java
CommercePriceListUtil.findByUUID_G
public static CommercePriceList findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.price.list.exception.NoSuchPriceListException { """ Returns the commerce price list where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchPriceListException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce price list @throws NoSuchPriceListException if a matching commerce price list could not be found """ return getPersistence().findByUUID_G(uuid, groupId); }
java
public static CommercePriceList findByUUID_G(String uuid, long groupId) throws com.liferay.commerce.price.list.exception.NoSuchPriceListException { return getPersistence().findByUUID_G(uuid, groupId); }
[ "public", "static", "CommercePriceList", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "price", ".", "list", ".", "exception", ".", "NoSuchPriceListException", "{", "return", "getPersistence", "(", ")", ".", "findByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "}" ]
Returns the commerce price list where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchPriceListException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce price list @throws NoSuchPriceListException if a matching commerce price list could not be found
[ "Returns", "the", "commerce", "price", "list", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchPriceListException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-api/src/main/java/com/liferay/commerce/price/list/service/persistence/CommercePriceListUtil.java#L280-L283
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemUtils.java
ProxiedFileSystemUtils.createProxiedFileSystemUsingKeytab
static FileSystem createProxiedFileSystemUsingKeytab(String userNameToProxyAs, String superUserName, Path superUserKeytabLocation, URI fsURI, Configuration conf) throws IOException, InterruptedException { """ Creates a {@link FileSystem} that can perform any operations allowed by the specified userNameToProxyAs. This method first logs in as the specified super user. If Hadoop security is enabled, then logging in entails authenticating via Kerberos. So logging in requires contacting the Kerberos infrastructure. A proxy user is then created on behalf of the logged in user, and a {@link FileSystem} object is created using the proxy user's UGI. @param userNameToProxyAs The name of the user the super user should proxy as @param superUserName The name of the super user with secure impersonation priveleges @param superUserKeytabLocation The location of the keytab file for the super user @param fsURI The {@link URI} for the {@link FileSystem} that should be created @param conf The {@link Configuration} for the {@link FileSystem} that should be created @return a {@link FileSystem} that can execute commands on behalf of the specified userNameToProxyAs """ return loginAndProxyAsUser(userNameToProxyAs, superUserName, superUserKeytabLocation) .doAs(new ProxiedFileSystem(fsURI, conf)); }
java
static FileSystem createProxiedFileSystemUsingKeytab(String userNameToProxyAs, String superUserName, Path superUserKeytabLocation, URI fsURI, Configuration conf) throws IOException, InterruptedException { return loginAndProxyAsUser(userNameToProxyAs, superUserName, superUserKeytabLocation) .doAs(new ProxiedFileSystem(fsURI, conf)); }
[ "static", "FileSystem", "createProxiedFileSystemUsingKeytab", "(", "String", "userNameToProxyAs", ",", "String", "superUserName", ",", "Path", "superUserKeytabLocation", ",", "URI", "fsURI", ",", "Configuration", "conf", ")", "throws", "IOException", ",", "InterruptedException", "{", "return", "loginAndProxyAsUser", "(", "userNameToProxyAs", ",", "superUserName", ",", "superUserKeytabLocation", ")", ".", "doAs", "(", "new", "ProxiedFileSystem", "(", "fsURI", ",", "conf", ")", ")", ";", "}" ]
Creates a {@link FileSystem} that can perform any operations allowed by the specified userNameToProxyAs. This method first logs in as the specified super user. If Hadoop security is enabled, then logging in entails authenticating via Kerberos. So logging in requires contacting the Kerberos infrastructure. A proxy user is then created on behalf of the logged in user, and a {@link FileSystem} object is created using the proxy user's UGI. @param userNameToProxyAs The name of the user the super user should proxy as @param superUserName The name of the super user with secure impersonation priveleges @param superUserKeytabLocation The location of the keytab file for the super user @param fsURI The {@link URI} for the {@link FileSystem} that should be created @param conf The {@link Configuration} for the {@link FileSystem} that should be created @return a {@link FileSystem} that can execute commands on behalf of the specified userNameToProxyAs
[ "Creates", "a", "{", "@link", "FileSystem", "}", "that", "can", "perform", "any", "operations", "allowed", "by", "the", "specified", "userNameToProxyAs", ".", "This", "method", "first", "logs", "in", "as", "the", "specified", "super", "user", ".", "If", "Hadoop", "security", "is", "enabled", "then", "logging", "in", "entails", "authenticating", "via", "Kerberos", ".", "So", "logging", "in", "requires", "contacting", "the", "Kerberos", "infrastructure", ".", "A", "proxy", "user", "is", "then", "created", "on", "behalf", "of", "the", "logged", "in", "user", "and", "a", "{", "@link", "FileSystem", "}", "object", "is", "created", "using", "the", "proxy", "user", "s", "UGI", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ProxiedFileSystemUtils.java#L127-L132
aws/aws-sdk-java
aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageResponse.java
MessageResponse.withEndpointResult
public MessageResponse withEndpointResult(java.util.Map<String, EndpointMessageResult> endpointResult) { """ A map containing a multi part response for each address, with the endpointId as the key and the result as the value. @param endpointResult A map containing a multi part response for each address, with the endpointId as the key and the result as the value. @return Returns a reference to this object so that method calls can be chained together. """ setEndpointResult(endpointResult); return this; }
java
public MessageResponse withEndpointResult(java.util.Map<String, EndpointMessageResult> endpointResult) { setEndpointResult(endpointResult); return this; }
[ "public", "MessageResponse", "withEndpointResult", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "EndpointMessageResult", ">", "endpointResult", ")", "{", "setEndpointResult", "(", "endpointResult", ")", ";", "return", "this", ";", "}" ]
A map containing a multi part response for each address, with the endpointId as the key and the result as the value. @param endpointResult A map containing a multi part response for each address, with the endpointId as the key and the result as the value. @return Returns a reference to this object so that method calls can be chained together.
[ "A", "map", "containing", "a", "multi", "part", "response", "for", "each", "address", "with", "the", "endpointId", "as", "the", "key", "and", "the", "result", "as", "the", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pinpoint/src/main/java/com/amazonaws/services/pinpoint/model/MessageResponse.java#L113-L116
wildfly/wildfly-core
jmx/src/main/java/org/jboss/as/jmx/JMXSubsystemAdd.java
JMXSubsystemAdd.getDomainName
static String getDomainName(OperationContext context, ModelNode model, String child) throws OperationFailedException { """ return {@code null} if the {@code child} model is not exposed in JMX. """ if (!model.hasDefined(CommonAttributes.EXPOSE_MODEL)) { return null; } if (!model.get(CommonAttributes.EXPOSE_MODEL).hasDefined(child)) { return null; } ModelNode childModel = model.get(CommonAttributes.EXPOSE_MODEL, child); return ExposeModelResource.getDomainNameAttribute(child).resolveModelAttribute(context, childModel).asString(); }
java
static String getDomainName(OperationContext context, ModelNode model, String child) throws OperationFailedException { if (!model.hasDefined(CommonAttributes.EXPOSE_MODEL)) { return null; } if (!model.get(CommonAttributes.EXPOSE_MODEL).hasDefined(child)) { return null; } ModelNode childModel = model.get(CommonAttributes.EXPOSE_MODEL, child); return ExposeModelResource.getDomainNameAttribute(child).resolveModelAttribute(context, childModel).asString(); }
[ "static", "String", "getDomainName", "(", "OperationContext", "context", ",", "ModelNode", "model", ",", "String", "child", ")", "throws", "OperationFailedException", "{", "if", "(", "!", "model", ".", "hasDefined", "(", "CommonAttributes", ".", "EXPOSE_MODEL", ")", ")", "{", "return", "null", ";", "}", "if", "(", "!", "model", ".", "get", "(", "CommonAttributes", ".", "EXPOSE_MODEL", ")", ".", "hasDefined", "(", "child", ")", ")", "{", "return", "null", ";", "}", "ModelNode", "childModel", "=", "model", ".", "get", "(", "CommonAttributes", ".", "EXPOSE_MODEL", ",", "child", ")", ";", "return", "ExposeModelResource", ".", "getDomainNameAttribute", "(", "child", ")", ".", "resolveModelAttribute", "(", "context", ",", "childModel", ")", ".", "asString", "(", ")", ";", "}" ]
return {@code null} if the {@code child} model is not exposed in JMX.
[ "return", "{" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/jmx/src/main/java/org/jboss/as/jmx/JMXSubsystemAdd.java#L103-L112
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/StringContext.java
StringContext.splitString
public String[] splitString(String text, int maxChars) { """ Split the given string on spaces ensuring the maximum number of characters in each token. @param text The value to split @param maxChars The maximum required characters in each split token @return The array of tokens from splitting the string @see #splitString(String, int, String[]) """ String[] splitVals = {" "}; return splitString(text,maxChars,splitVals); }
java
public String[] splitString(String text, int maxChars) { String[] splitVals = {" "}; return splitString(text,maxChars,splitVals); }
[ "public", "String", "[", "]", "splitString", "(", "String", "text", ",", "int", "maxChars", ")", "{", "String", "[", "]", "splitVals", "=", "{", "\" \"", "}", ";", "return", "splitString", "(", "text", ",", "maxChars", ",", "splitVals", ")", ";", "}" ]
Split the given string on spaces ensuring the maximum number of characters in each token. @param text The value to split @param maxChars The maximum required characters in each split token @return The array of tokens from splitting the string @see #splitString(String, int, String[])
[ "Split", "the", "given", "string", "on", "spaces", "ensuring", "the", "maximum", "number", "of", "characters", "in", "each", "token", "." ]
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/StringContext.java#L471-L474
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/MonetizationApi.java
MonetizationApi.setPricingTier
public DevicePricingTierEnvelope setPricingTier(String did, DevicePricingTierRequest pricingTier) throws ApiException { """ Set a device&#39;s pricing tier Set a device&#39;s pricing tier @param did Device ID (required) @param pricingTier Pricing tier (required) @return DevicePricingTierEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<DevicePricingTierEnvelope> resp = setPricingTierWithHttpInfo(did, pricingTier); return resp.getData(); }
java
public DevicePricingTierEnvelope setPricingTier(String did, DevicePricingTierRequest pricingTier) throws ApiException { ApiResponse<DevicePricingTierEnvelope> resp = setPricingTierWithHttpInfo(did, pricingTier); return resp.getData(); }
[ "public", "DevicePricingTierEnvelope", "setPricingTier", "(", "String", "did", ",", "DevicePricingTierRequest", "pricingTier", ")", "throws", "ApiException", "{", "ApiResponse", "<", "DevicePricingTierEnvelope", ">", "resp", "=", "setPricingTierWithHttpInfo", "(", "did", ",", "pricingTier", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Set a device&#39;s pricing tier Set a device&#39;s pricing tier @param did Device ID (required) @param pricingTier Pricing tier (required) @return DevicePricingTierEnvelope @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Set", "a", "device&#39", ";", "s", "pricing", "tier", "Set", "a", "device&#39", ";", "s", "pricing", "tier" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/MonetizationApi.java#L642-L645
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/AbstractCommonColorsPainter.java
AbstractCommonColorsPainter.getTextBorderPaint
public Paint getTextBorderPaint(CommonControlState type, boolean inToolbar) { """ DOCUMENT ME! @param type DOCUMENT ME! @param inToolbar DOCUMENT ME! @return DOCUMENT ME! """ if (type == CommonControlState.DISABLED) { return textBorderDisabled; } else if (inToolbar) { return textBorderEnabledToolbar; } else { return textBorderEnabled; } }
java
public Paint getTextBorderPaint(CommonControlState type, boolean inToolbar) { if (type == CommonControlState.DISABLED) { return textBorderDisabled; } else if (inToolbar) { return textBorderEnabledToolbar; } else { return textBorderEnabled; } }
[ "public", "Paint", "getTextBorderPaint", "(", "CommonControlState", "type", ",", "boolean", "inToolbar", ")", "{", "if", "(", "type", "==", "CommonControlState", ".", "DISABLED", ")", "{", "return", "textBorderDisabled", ";", "}", "else", "if", "(", "inToolbar", ")", "{", "return", "textBorderEnabledToolbar", ";", "}", "else", "{", "return", "textBorderEnabled", ";", "}", "}" ]
DOCUMENT ME! @param type DOCUMENT ME! @param inToolbar DOCUMENT ME! @return DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/AbstractCommonColorsPainter.java#L252-L260
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/TopScreen.java
TopScreen.getSecurityScreen
public BaseScreen getSecurityScreen(int iErrorCode, BasePanel parentScreen) { """ Display the correct security warning (access denied or the login screen). @param iErrorCode """ BaseScreen screen = null; if (iErrorCode == DBConstants.ACCESS_DENIED) { screen = new BaseScreen(null, null, parentScreen, null, 0, null); String strDisplay = this.getTask().getApplication().getSecurityErrorText(iErrorCode); BaseApplication application = (BaseApplication)this.getTask().getApplication(); String strMessage = application.getResources(ResourceConstants.ERROR_RESOURCE, true).getString(strDisplay); BaseField fldFake = new StringField(null, DBConstants.BLANK, 128, DBConstants.BLANK, null); fldFake.setString(strMessage); new SStaticText(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), screen, fldFake, ScreenConstants.DEFAULT_DISPLAY); } else if ((iErrorCode == DBConstants.LOGIN_REQUIRED) || (iErrorCode == DBConstants.AUTHENTICATION_REQUIRED)) { Record record = Record.makeRecordFromClassName(UserInfoModel.THICK_CLASS, Utility.getRecordOwner(parentScreen)); ScreenLocation itsLocation = this.getScreenLocation(); int docMode = record.commandToDocType(UserInfoModel.LOGIN_SCREEN); Map<String,Object> properties = null; screen = (BaseScreen)record.makeScreen(itsLocation, parentScreen, docMode, properties); } else if (iErrorCode == DBConstants.CREATE_USER_REQUIRED) { Record record = Record.makeRecordFromClassName(UserInfoModel.THICK_CLASS, null); ScreenLocation itsLocation = this.getScreenLocation(); int docMode = record.commandToDocType(UserInfoModel.ENTRY_SCREEN); Map<String,Object> properties = null; screen = (BaseScreen)record.makeScreen(itsLocation, parentScreen, docMode, properties); } return screen; }
java
public BaseScreen getSecurityScreen(int iErrorCode, BasePanel parentScreen) { BaseScreen screen = null; if (iErrorCode == DBConstants.ACCESS_DENIED) { screen = new BaseScreen(null, null, parentScreen, null, 0, null); String strDisplay = this.getTask().getApplication().getSecurityErrorText(iErrorCode); BaseApplication application = (BaseApplication)this.getTask().getApplication(); String strMessage = application.getResources(ResourceConstants.ERROR_RESOURCE, true).getString(strDisplay); BaseField fldFake = new StringField(null, DBConstants.BLANK, 128, DBConstants.BLANK, null); fldFake.setString(strMessage); new SStaticText(screen.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.ANCHOR_DEFAULT), screen, fldFake, ScreenConstants.DEFAULT_DISPLAY); } else if ((iErrorCode == DBConstants.LOGIN_REQUIRED) || (iErrorCode == DBConstants.AUTHENTICATION_REQUIRED)) { Record record = Record.makeRecordFromClassName(UserInfoModel.THICK_CLASS, Utility.getRecordOwner(parentScreen)); ScreenLocation itsLocation = this.getScreenLocation(); int docMode = record.commandToDocType(UserInfoModel.LOGIN_SCREEN); Map<String,Object> properties = null; screen = (BaseScreen)record.makeScreen(itsLocation, parentScreen, docMode, properties); } else if (iErrorCode == DBConstants.CREATE_USER_REQUIRED) { Record record = Record.makeRecordFromClassName(UserInfoModel.THICK_CLASS, null); ScreenLocation itsLocation = this.getScreenLocation(); int docMode = record.commandToDocType(UserInfoModel.ENTRY_SCREEN); Map<String,Object> properties = null; screen = (BaseScreen)record.makeScreen(itsLocation, parentScreen, docMode, properties); } return screen; }
[ "public", "BaseScreen", "getSecurityScreen", "(", "int", "iErrorCode", ",", "BasePanel", "parentScreen", ")", "{", "BaseScreen", "screen", "=", "null", ";", "if", "(", "iErrorCode", "==", "DBConstants", ".", "ACCESS_DENIED", ")", "{", "screen", "=", "new", "BaseScreen", "(", "null", ",", "null", ",", "parentScreen", ",", "null", ",", "0", ",", "null", ")", ";", "String", "strDisplay", "=", "this", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ".", "getSecurityErrorText", "(", "iErrorCode", ")", ";", "BaseApplication", "application", "=", "(", "BaseApplication", ")", "this", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ";", "String", "strMessage", "=", "application", ".", "getResources", "(", "ResourceConstants", ".", "ERROR_RESOURCE", ",", "true", ")", ".", "getString", "(", "strDisplay", ")", ";", "BaseField", "fldFake", "=", "new", "StringField", "(", "null", ",", "DBConstants", ".", "BLANK", ",", "128", ",", "DBConstants", ".", "BLANK", ",", "null", ")", ";", "fldFake", ".", "setString", "(", "strMessage", ")", ";", "new", "SStaticText", "(", "screen", ".", "getNextLocation", "(", "ScreenConstants", ".", "NEXT_LOGICAL", ",", "ScreenConstants", ".", "ANCHOR_DEFAULT", ")", ",", "screen", ",", "fldFake", ",", "ScreenConstants", ".", "DEFAULT_DISPLAY", ")", ";", "}", "else", "if", "(", "(", "iErrorCode", "==", "DBConstants", ".", "LOGIN_REQUIRED", ")", "||", "(", "iErrorCode", "==", "DBConstants", ".", "AUTHENTICATION_REQUIRED", ")", ")", "{", "Record", "record", "=", "Record", ".", "makeRecordFromClassName", "(", "UserInfoModel", ".", "THICK_CLASS", ",", "Utility", ".", "getRecordOwner", "(", "parentScreen", ")", ")", ";", "ScreenLocation", "itsLocation", "=", "this", ".", "getScreenLocation", "(", ")", ";", "int", "docMode", "=", "record", ".", "commandToDocType", "(", "UserInfoModel", ".", "LOGIN_SCREEN", ")", ";", "Map", "<", "String", ",", "Object", ">", "properties", "=", "null", ";", "screen", "=", "(", "BaseScreen", ")", "record", ".", "makeScreen", "(", "itsLocation", ",", "parentScreen", ",", "docMode", ",", "properties", ")", ";", "}", "else", "if", "(", "iErrorCode", "==", "DBConstants", ".", "CREATE_USER_REQUIRED", ")", "{", "Record", "record", "=", "Record", ".", "makeRecordFromClassName", "(", "UserInfoModel", ".", "THICK_CLASS", ",", "null", ")", ";", "ScreenLocation", "itsLocation", "=", "this", ".", "getScreenLocation", "(", ")", ";", "int", "docMode", "=", "record", ".", "commandToDocType", "(", "UserInfoModel", ".", "ENTRY_SCREEN", ")", ";", "Map", "<", "String", ",", "Object", ">", "properties", "=", "null", ";", "screen", "=", "(", "BaseScreen", ")", "record", ".", "makeScreen", "(", "itsLocation", ",", "parentScreen", ",", "docMode", ",", "properties", ")", ";", "}", "return", "screen", ";", "}" ]
Display the correct security warning (access denied or the login screen). @param iErrorCode
[ "Display", "the", "correct", "security", "warning", "(", "access", "denied", "or", "the", "login", "screen", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/TopScreen.java#L394-L424
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/WorkbinsApi.java
WorkbinsApi.subscribeToWorkbinNotifications
public ApiSuccessResponse subscribeToWorkbinNotifications(String workbinId, SubscribeToWorkbinNotificationsData subscribeToWorkbinNotificationsData) throws ApiException { """ Subscribe to be notified of changes of the content of a Workbin. @param workbinId Id of the Workbin (required) @param subscribeToWorkbinNotificationsData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<ApiSuccessResponse> resp = subscribeToWorkbinNotificationsWithHttpInfo(workbinId, subscribeToWorkbinNotificationsData); return resp.getData(); }
java
public ApiSuccessResponse subscribeToWorkbinNotifications(String workbinId, SubscribeToWorkbinNotificationsData subscribeToWorkbinNotificationsData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = subscribeToWorkbinNotificationsWithHttpInfo(workbinId, subscribeToWorkbinNotificationsData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "subscribeToWorkbinNotifications", "(", "String", "workbinId", ",", "SubscribeToWorkbinNotificationsData", "subscribeToWorkbinNotificationsData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "subscribeToWorkbinNotificationsWithHttpInfo", "(", "workbinId", ",", "subscribeToWorkbinNotificationsData", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Subscribe to be notified of changes of the content of a Workbin. @param workbinId Id of the Workbin (required) @param subscribeToWorkbinNotificationsData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Subscribe", "to", "be", "notified", "of", "changes", "of", "the", "content", "of", "a", "Workbin", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/WorkbinsApi.java#L775-L778
liyiorg/weixin-popular
src/main/java/weixin/popular/util/SignatureUtil.java
SignatureUtil.validateSign
public static boolean validateSign(Map<String,String> map,String sign_type,String key) { """ mch 支付、代扣API调用签名验证 @param map 参与签名的参数 @param sign_type HMAC-SHA256 或 MD5 @param key mch key @return boolean """ if(map.get("sign") == null){ return false; } return map.get("sign").equals(generateSign(map,sign_type,key)); }
java
public static boolean validateSign(Map<String,String> map,String sign_type,String key){ if(map.get("sign") == null){ return false; } return map.get("sign").equals(generateSign(map,sign_type,key)); }
[ "public", "static", "boolean", "validateSign", "(", "Map", "<", "String", ",", "String", ">", "map", ",", "String", "sign_type", ",", "String", "key", ")", "{", "if", "(", "map", ".", "get", "(", "\"sign\"", ")", "==", "null", ")", "{", "return", "false", ";", "}", "return", "map", ".", "get", "(", "\"sign\"", ")", ".", "equals", "(", "generateSign", "(", "map", ",", "sign_type", ",", "key", ")", ")", ";", "}" ]
mch 支付、代扣API调用签名验证 @param map 参与签名的参数 @param sign_type HMAC-SHA256 或 MD5 @param key mch key @return boolean
[ "mch", "支付、代扣API调用签名验证" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/SignatureUtil.java#L91-L96
Stratio/stratio-cassandra
src/java/org/apache/cassandra/triggers/TriggerExecutor.java
TriggerExecutor.executeInternal
private List<Mutation> executeInternal(ByteBuffer key, ColumnFamily columnFamily) { """ Switch class loader before using the triggers for the column family, if not loaded them with the custom class loader. """ Map<String, TriggerDefinition> triggers = columnFamily.metadata().getTriggers(); if (triggers.isEmpty()) return null; List<Mutation> tmutations = Lists.newLinkedList(); Thread.currentThread().setContextClassLoader(customClassLoader); try { for (TriggerDefinition td : triggers.values()) { ITrigger trigger = cachedTriggers.get(td.classOption); if (trigger == null) { trigger = loadTriggerInstance(td.classOption); cachedTriggers.put(td.classOption, trigger); } Collection<Mutation> temp = trigger.augment(key, columnFamily); if (temp != null) tmutations.addAll(temp); } return tmutations; } catch (Exception ex) { throw new RuntimeException(String.format("Exception while creating trigger on CF with ID: %s", columnFamily.id()), ex); } finally { Thread.currentThread().setContextClassLoader(parent); } }
java
private List<Mutation> executeInternal(ByteBuffer key, ColumnFamily columnFamily) { Map<String, TriggerDefinition> triggers = columnFamily.metadata().getTriggers(); if (triggers.isEmpty()) return null; List<Mutation> tmutations = Lists.newLinkedList(); Thread.currentThread().setContextClassLoader(customClassLoader); try { for (TriggerDefinition td : triggers.values()) { ITrigger trigger = cachedTriggers.get(td.classOption); if (trigger == null) { trigger = loadTriggerInstance(td.classOption); cachedTriggers.put(td.classOption, trigger); } Collection<Mutation> temp = trigger.augment(key, columnFamily); if (temp != null) tmutations.addAll(temp); } return tmutations; } catch (Exception ex) { throw new RuntimeException(String.format("Exception while creating trigger on CF with ID: %s", columnFamily.id()), ex); } finally { Thread.currentThread().setContextClassLoader(parent); } }
[ "private", "List", "<", "Mutation", ">", "executeInternal", "(", "ByteBuffer", "key", ",", "ColumnFamily", "columnFamily", ")", "{", "Map", "<", "String", ",", "TriggerDefinition", ">", "triggers", "=", "columnFamily", ".", "metadata", "(", ")", ".", "getTriggers", "(", ")", ";", "if", "(", "triggers", ".", "isEmpty", "(", ")", ")", "return", "null", ";", "List", "<", "Mutation", ">", "tmutations", "=", "Lists", ".", "newLinkedList", "(", ")", ";", "Thread", ".", "currentThread", "(", ")", ".", "setContextClassLoader", "(", "customClassLoader", ")", ";", "try", "{", "for", "(", "TriggerDefinition", "td", ":", "triggers", ".", "values", "(", ")", ")", "{", "ITrigger", "trigger", "=", "cachedTriggers", ".", "get", "(", "td", ".", "classOption", ")", ";", "if", "(", "trigger", "==", "null", ")", "{", "trigger", "=", "loadTriggerInstance", "(", "td", ".", "classOption", ")", ";", "cachedTriggers", ".", "put", "(", "td", ".", "classOption", ",", "trigger", ")", ";", "}", "Collection", "<", "Mutation", ">", "temp", "=", "trigger", ".", "augment", "(", "key", ",", "columnFamily", ")", ";", "if", "(", "temp", "!=", "null", ")", "tmutations", ".", "addAll", "(", "temp", ")", ";", "}", "return", "tmutations", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "String", ".", "format", "(", "\"Exception while creating trigger on CF with ID: %s\"", ",", "columnFamily", ".", "id", "(", ")", ")", ",", "ex", ")", ";", "}", "finally", "{", "Thread", ".", "currentThread", "(", ")", ".", "setContextClassLoader", "(", "parent", ")", ";", "}", "}" ]
Switch class loader before using the triggers for the column family, if not loaded them with the custom class loader.
[ "Switch", "class", "loader", "before", "using", "the", "triggers", "for", "the", "column", "family", "if", "not", "loaded", "them", "with", "the", "custom", "class", "loader", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/triggers/TriggerExecutor.java#L174-L205
radkovo/jStyleParser
src/main/java/cz/vutbr/web/css/CSSFactory.java
CSSFactory.getUsedStyles
public static final StyleSheet getUsedStyles(Document doc, String encoding, URL base, MediaSpec media) { """ This is the same as {@link CSSFactory#getUsedStyles(Document, String, URL, MediaSpec)} with the possibility of specifying a custom network processor. @param doc DOM tree @param encoding The default encoding used for the referenced style sheets @param base Base URL against which all files are searched @param media Selected media for style sheet @return the rules of all the style sheets used in the document including the inline styles """ return getUsedStyles(doc, encoding, base, media, getNetworkProcessor()); }
java
public static final StyleSheet getUsedStyles(Document doc, String encoding, URL base, MediaSpec media) { return getUsedStyles(doc, encoding, base, media, getNetworkProcessor()); }
[ "public", "static", "final", "StyleSheet", "getUsedStyles", "(", "Document", "doc", ",", "String", "encoding", ",", "URL", "base", ",", "MediaSpec", "media", ")", "{", "return", "getUsedStyles", "(", "doc", ",", "encoding", ",", "base", ",", "media", ",", "getNetworkProcessor", "(", ")", ")", ";", "}" ]
This is the same as {@link CSSFactory#getUsedStyles(Document, String, URL, MediaSpec)} with the possibility of specifying a custom network processor. @param doc DOM tree @param encoding The default encoding used for the referenced style sheets @param base Base URL against which all files are searched @param media Selected media for style sheet @return the rules of all the style sheets used in the document including the inline styles
[ "This", "is", "the", "same", "as", "{", "@link", "CSSFactory#getUsedStyles", "(", "Document", "String", "URL", "MediaSpec", ")", "}", "with", "the", "possibility", "of", "specifying", "a", "custom", "network", "processor", "." ]
train
https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/css/CSSFactory.java#L596-L599
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java
DisksInner.beginDelete
public OperationStatusResponseInner beginDelete(String resourceGroupName, String diskName) { """ Deletes a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @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 OperationStatusResponseInner object if successful. """ return beginDeleteWithServiceResponseAsync(resourceGroupName, diskName).toBlocking().single().body(); }
java
public OperationStatusResponseInner beginDelete(String resourceGroupName, String diskName) { return beginDeleteWithServiceResponseAsync(resourceGroupName, diskName).toBlocking().single().body(); }
[ "public", "OperationStatusResponseInner", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "diskName", ")", "{", "return", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "diskName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Deletes a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @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 OperationStatusResponseInner object if successful.
[ "Deletes", "a", "disk", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/DisksInner.java#L642-L644
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java
ClassBuilder.buildClassDoc
public void buildClassDoc(XMLNode node, Content contentTree) throws DocletException { """ Handles the {@literal <TypeElement>} tag. @param node the XML element that specifies which components to document @param contentTree the content tree to which the documentation will be added @throws DocletException if there is a problem while building the documentation """ String key; if (isInterface) { key = "doclet.Interface"; } else if (isEnum) { key = "doclet.Enum"; } else { key = "doclet.Class"; } contentTree = writer.getHeader(configuration.getText(key) + " " + utils.getSimpleName(typeElement)); Content classContentTree = writer.getClassContentHeader(); buildChildren(node, classContentTree); writer.addClassContentTree(contentTree, classContentTree); writer.addFooter(contentTree); writer.printDocument(contentTree); copyDocFiles(); }
java
public void buildClassDoc(XMLNode node, Content contentTree) throws DocletException { String key; if (isInterface) { key = "doclet.Interface"; } else if (isEnum) { key = "doclet.Enum"; } else { key = "doclet.Class"; } contentTree = writer.getHeader(configuration.getText(key) + " " + utils.getSimpleName(typeElement)); Content classContentTree = writer.getClassContentHeader(); buildChildren(node, classContentTree); writer.addClassContentTree(contentTree, classContentTree); writer.addFooter(contentTree); writer.printDocument(contentTree); copyDocFiles(); }
[ "public", "void", "buildClassDoc", "(", "XMLNode", "node", ",", "Content", "contentTree", ")", "throws", "DocletException", "{", "String", "key", ";", "if", "(", "isInterface", ")", "{", "key", "=", "\"doclet.Interface\"", ";", "}", "else", "if", "(", "isEnum", ")", "{", "key", "=", "\"doclet.Enum\"", ";", "}", "else", "{", "key", "=", "\"doclet.Class\"", ";", "}", "contentTree", "=", "writer", ".", "getHeader", "(", "configuration", ".", "getText", "(", "key", ")", "+", "\" \"", "+", "utils", ".", "getSimpleName", "(", "typeElement", ")", ")", ";", "Content", "classContentTree", "=", "writer", ".", "getClassContentHeader", "(", ")", ";", "buildChildren", "(", "node", ",", "classContentTree", ")", ";", "writer", ".", "addClassContentTree", "(", "contentTree", ",", "classContentTree", ")", ";", "writer", ".", "addFooter", "(", "contentTree", ")", ";", "writer", ".", "printDocument", "(", "contentTree", ")", ";", "copyDocFiles", "(", ")", ";", "}" ]
Handles the {@literal <TypeElement>} tag. @param node the XML element that specifies which components to document @param contentTree the content tree to which the documentation will be added @throws DocletException if there is a problem while building the documentation
[ "Handles", "the", "{", "@literal", "<TypeElement", ">", "}", "tag", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/ClassBuilder.java#L143-L160
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/independentsamples/MannWhitney.java
MannWhitney.scoreToPvalue
private static double scoreToPvalue(double score, int n1, int n2) { """ Returns the Pvalue for a particular score @param score @param n1 @param n2 @return """ /* if(n1<=10 && n2<=10) { //calculate it from tables too small values } */ double mean=n1*(n1+n2+1.0)/2.0; double variable=n1*n2*(n1+n2+1.0)/12.0; double z=(score-mean)/Math.sqrt(variable); return ContinuousDistributions.gaussCdf(z); }
java
private static double scoreToPvalue(double score, int n1, int n2) { /* if(n1<=10 && n2<=10) { //calculate it from tables too small values } */ double mean=n1*(n1+n2+1.0)/2.0; double variable=n1*n2*(n1+n2+1.0)/12.0; double z=(score-mean)/Math.sqrt(variable); return ContinuousDistributions.gaussCdf(z); }
[ "private", "static", "double", "scoreToPvalue", "(", "double", "score", ",", "int", "n1", ",", "int", "n2", ")", "{", "/*\n if(n1<=10 && n2<=10) {\n //calculate it from tables too small values\n }\n */", "double", "mean", "=", "n1", "*", "(", "n1", "+", "n2", "+", "1.0", ")", "/", "2.0", ";", "double", "variable", "=", "n1", "*", "n2", "*", "(", "n1", "+", "n2", "+", "1.0", ")", "/", "12.0", ";", "double", "z", "=", "(", "score", "-", "mean", ")", "/", "Math", ".", "sqrt", "(", "variable", ")", ";", "return", "ContinuousDistributions", ".", "gaussCdf", "(", "z", ")", ";", "}" ]
Returns the Pvalue for a particular score @param score @param n1 @param n2 @return
[ "Returns", "the", "Pvalue", "for", "a", "particular", "score" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/nonparametrics/independentsamples/MannWhitney.java#L133-L145
audit4j/audit4j-core
src/main/java/org/audit4j/core/ObjectToJsonSerializer.java
ObjectToJsonSerializer.toJson
public final static String toJson(Object object, DeIdentify deidentify) { """ Converts an object to json. @param object an object @param deidentify the deidentify @return a json string of the object """ if (isPrimitive(object)) { Object deidentifiedObj = deidentifyObject(object, deidentify); String primitiveValue = String.valueOf(deidentifiedObj); if (object instanceof String || object instanceof Character || !object.equals(deidentifiedObj)) { primitiveValue = '"' + primitiveValue + '"'; } return primitiveValue; } return JSON.toJSONString(object, JsonFilter.INSTANCE); }
java
public final static String toJson(Object object, DeIdentify deidentify) { if (isPrimitive(object)) { Object deidentifiedObj = deidentifyObject(object, deidentify); String primitiveValue = String.valueOf(deidentifiedObj); if (object instanceof String || object instanceof Character || !object.equals(deidentifiedObj)) { primitiveValue = '"' + primitiveValue + '"'; } return primitiveValue; } return JSON.toJSONString(object, JsonFilter.INSTANCE); }
[ "public", "final", "static", "String", "toJson", "(", "Object", "object", ",", "DeIdentify", "deidentify", ")", "{", "if", "(", "isPrimitive", "(", "object", ")", ")", "{", "Object", "deidentifiedObj", "=", "deidentifyObject", "(", "object", ",", "deidentify", ")", ";", "String", "primitiveValue", "=", "String", ".", "valueOf", "(", "deidentifiedObj", ")", ";", "if", "(", "object", "instanceof", "String", "||", "object", "instanceof", "Character", "||", "!", "object", ".", "equals", "(", "deidentifiedObj", ")", ")", "{", "primitiveValue", "=", "'", "'", "+", "primitiveValue", "+", "'", "'", ";", "}", "return", "primitiveValue", ";", "}", "return", "JSON", ".", "toJSONString", "(", "object", ",", "JsonFilter", ".", "INSTANCE", ")", ";", "}" ]
Converts an object to json. @param object an object @param deidentify the deidentify @return a json string of the object
[ "Converts", "an", "object", "to", "json", "." ]
train
https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/ObjectToJsonSerializer.java#L63-L73
j256/ormlite-core
src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java
DatabaseFieldConfig.findGetMethod
public static Method findGetMethod(Field field, DatabaseType databaseType, boolean throwExceptions) throws IllegalArgumentException { """ Find and return the appropriate getter method for field. @return Get method or null (or throws IllegalArgumentException) if none found. """ Method fieldGetMethod = findMethodFromNames(field, true, throwExceptions, methodFromField(field, "get", databaseType, true), methodFromField(field, "get", databaseType, false), methodFromField(field, "is", databaseType, true), methodFromField(field, "is", databaseType, false)); if (fieldGetMethod == null) { return null; } if (fieldGetMethod.getReturnType() != field.getType()) { if (throwExceptions) { throw new IllegalArgumentException("Return type of get method " + fieldGetMethod.getName() + " does not return " + field.getType()); } else { return null; } } return fieldGetMethod; }
java
public static Method findGetMethod(Field field, DatabaseType databaseType, boolean throwExceptions) throws IllegalArgumentException { Method fieldGetMethod = findMethodFromNames(field, true, throwExceptions, methodFromField(field, "get", databaseType, true), methodFromField(field, "get", databaseType, false), methodFromField(field, "is", databaseType, true), methodFromField(field, "is", databaseType, false)); if (fieldGetMethod == null) { return null; } if (fieldGetMethod.getReturnType() != field.getType()) { if (throwExceptions) { throw new IllegalArgumentException("Return type of get method " + fieldGetMethod.getName() + " does not return " + field.getType()); } else { return null; } } return fieldGetMethod; }
[ "public", "static", "Method", "findGetMethod", "(", "Field", "field", ",", "DatabaseType", "databaseType", ",", "boolean", "throwExceptions", ")", "throws", "IllegalArgumentException", "{", "Method", "fieldGetMethod", "=", "findMethodFromNames", "(", "field", ",", "true", ",", "throwExceptions", ",", "methodFromField", "(", "field", ",", "\"get\"", ",", "databaseType", ",", "true", ")", ",", "methodFromField", "(", "field", ",", "\"get\"", ",", "databaseType", ",", "false", ")", ",", "methodFromField", "(", "field", ",", "\"is\"", ",", "databaseType", ",", "true", ")", ",", "methodFromField", "(", "field", ",", "\"is\"", ",", "databaseType", ",", "false", ")", ")", ";", "if", "(", "fieldGetMethod", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "fieldGetMethod", ".", "getReturnType", "(", ")", "!=", "field", ".", "getType", "(", ")", ")", "{", "if", "(", "throwExceptions", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Return type of get method \"", "+", "fieldGetMethod", ".", "getName", "(", ")", "+", "\" does not return \"", "+", "field", ".", "getType", "(", ")", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}", "return", "fieldGetMethod", ";", "}" ]
Find and return the appropriate getter method for field. @return Get method or null (or throws IllegalArgumentException) if none found.
[ "Find", "and", "return", "the", "appropriate", "getter", "method", "for", "field", "." ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/field/DatabaseFieldConfig.java#L546-L563
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.addEquals
public static void addEquals(DMatrixD1 a , double beta, DMatrixD1 b ) { """ <p>Performs the following operation:<br> <br> a = a + &beta; * b <br> a<sub>ij</sub> = a<sub>ij</sub> + &beta; * b<sub>ij</sub> </p> @param beta The number that matrix 'b' is multiplied by. @param a A Matrix. Modified. @param b A Matrix. Not modified. """ if( a.numCols != b.numCols || a.numRows != b.numRows ) { throw new MatrixDimensionException("The 'a' and 'b' matrices do not have compatible dimensions"); } final int length = a.getNumElements(); for( int i = 0; i < length; i++ ) { a.plus(i, beta * b.get(i)); } }
java
public static void addEquals(DMatrixD1 a , double beta, DMatrixD1 b ) { if( a.numCols != b.numCols || a.numRows != b.numRows ) { throw new MatrixDimensionException("The 'a' and 'b' matrices do not have compatible dimensions"); } final int length = a.getNumElements(); for( int i = 0; i < length; i++ ) { a.plus(i, beta * b.get(i)); } }
[ "public", "static", "void", "addEquals", "(", "DMatrixD1", "a", ",", "double", "beta", ",", "DMatrixD1", "b", ")", "{", "if", "(", "a", ".", "numCols", "!=", "b", ".", "numCols", "||", "a", ".", "numRows", "!=", "b", ".", "numRows", ")", "{", "throw", "new", "MatrixDimensionException", "(", "\"The 'a' and 'b' matrices do not have compatible dimensions\"", ")", ";", "}", "final", "int", "length", "=", "a", ".", "getNumElements", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "a", ".", "plus", "(", "i", ",", "beta", "*", "b", ".", "get", "(", "i", ")", ")", ";", "}", "}" ]
<p>Performs the following operation:<br> <br> a = a + &beta; * b <br> a<sub>ij</sub> = a<sub>ij</sub> + &beta; * b<sub>ij</sub> </p> @param beta The number that matrix 'b' is multiplied by. @param a A Matrix. Modified. @param b A Matrix. Not modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "a", "=", "a", "+", "&beta", ";", "*", "b", "<br", ">", "a<sub", ">", "ij<", "/", "sub", ">", "=", "a<sub", ">", "ij<", "/", "sub", ">", "+", "&beta", ";", "*", "b<sub", ">", "ij<", "/", "sub", ">", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2080-L2091
ManfredTremmel/gwt-bean-validators
gwt-bean-validators-restygwt-jaxrs/src/main/super/de/knightsoftnet/validators/supersource/de/knightsoftnet/validators/shared/impl/PhoneNumberValueRestValidator.java
PhoneNumberValueRestValidator.isValid
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { """ {@inheritDoc} check if given string is a valid gln. @see javax.validation.ConstraintValidator#isValid(java.lang.Object, javax.validation.ConstraintValidatorContext) """ final String valueAsString = Objects.toString(pvalue, null); if (StringUtils.isEmpty(valueAsString)) { // empty field is ok return true; } try { String countryCode = BeanUtils.getProperty(pvalue, fieldCountryCode); final String phoneNumber = BeanUtils.getProperty(pvalue, fieldPhoneNumber); if (StringUtils.isEmpty(phoneNumber)) { return true; } if (allowLowerCaseCountryCode) { countryCode = StringUtils.upperCase(countryCode); } final PathDefinitionInterface pathDefinition = GWT.create(PathDefinitionInterface.class); final String url = pathDefinition.getRestBasePath() + "/" + PhoneNumber.ROOT + "/" + PhoneNumber.VALIDATE // + "?" + Parameters.COUNTRY + "=" + countryCode // + "&" + Parameters.PHONE_NUMBER + "=" + urlEncode(phoneNumber) // + "&" + Parameters.DIN_5008 + "=" + PhoneNumberValueRestValidator.this.allowDin5008 // + "&" + Parameters.E123 + "=" + PhoneNumberValueRestValidator.this.allowE123 // + "&" + Parameters.URI + "=" + PhoneNumberValueRestValidator.this.allowUri // + "&" + Parameters.MS + "=" + PhoneNumberValueRestValidator.this.allowMs // + "&" + Parameters.COMMON + "=" + PhoneNumberValueRestValidator.this.allowCommon; final String restResult = CachedSyncHttpGetCall.syncRestCall(url); if (StringUtils.equalsIgnoreCase("TRUE", restResult)) { return true; } switchContext(pcontext); return false; } catch (final Exception ignore) { switchContext(pcontext); return false; } }
java
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { final String valueAsString = Objects.toString(pvalue, null); if (StringUtils.isEmpty(valueAsString)) { // empty field is ok return true; } try { String countryCode = BeanUtils.getProperty(pvalue, fieldCountryCode); final String phoneNumber = BeanUtils.getProperty(pvalue, fieldPhoneNumber); if (StringUtils.isEmpty(phoneNumber)) { return true; } if (allowLowerCaseCountryCode) { countryCode = StringUtils.upperCase(countryCode); } final PathDefinitionInterface pathDefinition = GWT.create(PathDefinitionInterface.class); final String url = pathDefinition.getRestBasePath() + "/" + PhoneNumber.ROOT + "/" + PhoneNumber.VALIDATE // + "?" + Parameters.COUNTRY + "=" + countryCode // + "&" + Parameters.PHONE_NUMBER + "=" + urlEncode(phoneNumber) // + "&" + Parameters.DIN_5008 + "=" + PhoneNumberValueRestValidator.this.allowDin5008 // + "&" + Parameters.E123 + "=" + PhoneNumberValueRestValidator.this.allowE123 // + "&" + Parameters.URI + "=" + PhoneNumberValueRestValidator.this.allowUri // + "&" + Parameters.MS + "=" + PhoneNumberValueRestValidator.this.allowMs // + "&" + Parameters.COMMON + "=" + PhoneNumberValueRestValidator.this.allowCommon; final String restResult = CachedSyncHttpGetCall.syncRestCall(url); if (StringUtils.equalsIgnoreCase("TRUE", restResult)) { return true; } switchContext(pcontext); return false; } catch (final Exception ignore) { switchContext(pcontext); return false; } }
[ "@", "Override", "public", "final", "boolean", "isValid", "(", "final", "Object", "pvalue", ",", "final", "ConstraintValidatorContext", "pcontext", ")", "{", "final", "String", "valueAsString", "=", "Objects", ".", "toString", "(", "pvalue", ",", "null", ")", ";", "if", "(", "StringUtils", ".", "isEmpty", "(", "valueAsString", ")", ")", "{", "// empty field is ok", "return", "true", ";", "}", "try", "{", "String", "countryCode", "=", "BeanUtils", ".", "getProperty", "(", "pvalue", ",", "fieldCountryCode", ")", ";", "final", "String", "phoneNumber", "=", "BeanUtils", ".", "getProperty", "(", "pvalue", ",", "fieldPhoneNumber", ")", ";", "if", "(", "StringUtils", ".", "isEmpty", "(", "phoneNumber", ")", ")", "{", "return", "true", ";", "}", "if", "(", "allowLowerCaseCountryCode", ")", "{", "countryCode", "=", "StringUtils", ".", "upperCase", "(", "countryCode", ")", ";", "}", "final", "PathDefinitionInterface", "pathDefinition", "=", "GWT", ".", "create", "(", "PathDefinitionInterface", ".", "class", ")", ";", "final", "String", "url", "=", "pathDefinition", ".", "getRestBasePath", "(", ")", "+", "\"/\"", "+", "PhoneNumber", ".", "ROOT", "+", "\"/\"", "+", "PhoneNumber", ".", "VALIDATE", "//", "+", "\"?\"", "+", "Parameters", ".", "COUNTRY", "+", "\"=\"", "+", "countryCode", "//", "+", "\"&\"", "+", "Parameters", ".", "PHONE_NUMBER", "+", "\"=\"", "+", "urlEncode", "(", "phoneNumber", ")", "//", "+", "\"&\"", "+", "Parameters", ".", "DIN_5008", "+", "\"=\"", "+", "PhoneNumberValueRestValidator", ".", "this", ".", "allowDin5008", "//", "+", "\"&\"", "+", "Parameters", ".", "E123", "+", "\"=\"", "+", "PhoneNumberValueRestValidator", ".", "this", ".", "allowE123", "//", "+", "\"&\"", "+", "Parameters", ".", "URI", "+", "\"=\"", "+", "PhoneNumberValueRestValidator", ".", "this", ".", "allowUri", "//", "+", "\"&\"", "+", "Parameters", ".", "MS", "+", "\"=\"", "+", "PhoneNumberValueRestValidator", ".", "this", ".", "allowMs", "//", "+", "\"&\"", "+", "Parameters", ".", "COMMON", "+", "\"=\"", "+", "PhoneNumberValueRestValidator", ".", "this", ".", "allowCommon", ";", "final", "String", "restResult", "=", "CachedSyncHttpGetCall", ".", "syncRestCall", "(", "url", ")", ";", "if", "(", "StringUtils", ".", "equalsIgnoreCase", "(", "\"TRUE\"", ",", "restResult", ")", ")", "{", "return", "true", ";", "}", "switchContext", "(", "pcontext", ")", ";", "return", "false", ";", "}", "catch", "(", "final", "Exception", "ignore", ")", "{", "switchContext", "(", "pcontext", ")", ";", "return", "false", ";", "}", "}" ]
{@inheritDoc} check if given string is a valid gln. @see javax.validation.ConstraintValidator#isValid(java.lang.Object, javax.validation.ConstraintValidatorContext)
[ "{", "@inheritDoc", "}", "check", "if", "given", "string", "is", "a", "valid", "gln", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators-restygwt-jaxrs/src/main/super/de/knightsoftnet/validators/supersource/de/knightsoftnet/validators/shared/impl/PhoneNumberValueRestValidator.java#L112-L150
Hygieia/Hygieia
api-audit/src/main/java/com/capitalone/dashboard/service/DashboardAuditServiceImpl.java
DashboardAuditServiceImpl.getDashboardReviewResponse
@SuppressWarnings("PMD.NPathComplexity") @Override public DashboardReviewResponse getDashboardReviewResponse(String dashboardTitle, DashboardType dashboardType, String businessService, String businessApp, long beginDate, long endDate, Set<AuditType> auditTypes) throws AuditException { """ Calculates audit response for a given dashboard @param dashboardTitle @param dashboardType @param businessService @param businessApp @param beginDate @param endDate @param auditTypes @return @DashboardReviewResponse for a given dashboard @throws AuditException """ validateParameters(dashboardTitle,dashboardType, businessService, businessApp, beginDate, endDate); DashboardReviewResponse dashboardReviewResponse = new DashboardReviewResponse(); Dashboard dashboard = getDashboard(dashboardTitle, dashboardType, businessService, businessApp); if (dashboard == null) { dashboardReviewResponse.addAuditStatus(DashboardAuditStatus.DASHBOARD_NOT_REGISTERED); return dashboardReviewResponse; } dashboardReviewResponse.setDashboardTitle(dashboard.getTitle()); dashboardReviewResponse.setBusinessApplication(StringUtils.isEmpty(businessApp) ? dashboard.getConfigurationItemBusAppName() : businessApp); dashboardReviewResponse.setBusinessService(StringUtils.isEmpty(businessService) ? dashboard.getConfigurationItemBusServName() : businessService); if (auditTypes.contains(AuditType.ALL)) { auditTypes.addAll(Sets.newHashSet(AuditType.values())); auditTypes.remove(AuditType.ALL); } auditTypes.forEach(auditType -> { Evaluator evaluator = auditModel.evaluatorMap().get(auditType); try { Collection<AuditReviewResponse> auditResponse = evaluator.evaluate(dashboard, beginDate, endDate, null); dashboardReviewResponse.addReview(auditType, auditResponse); dashboardReviewResponse.addAuditStatus(auditModel.successStatusMap().get(auditType)); } catch (AuditException e) { if (e.getErrorCode() == AuditException.NO_COLLECTOR_ITEM_CONFIGURED) { dashboardReviewResponse.addAuditStatus(auditModel.errorStatusMap().get(auditType)); } } }); return dashboardReviewResponse; }
java
@SuppressWarnings("PMD.NPathComplexity") @Override public DashboardReviewResponse getDashboardReviewResponse(String dashboardTitle, DashboardType dashboardType, String businessService, String businessApp, long beginDate, long endDate, Set<AuditType> auditTypes) throws AuditException { validateParameters(dashboardTitle,dashboardType, businessService, businessApp, beginDate, endDate); DashboardReviewResponse dashboardReviewResponse = new DashboardReviewResponse(); Dashboard dashboard = getDashboard(dashboardTitle, dashboardType, businessService, businessApp); if (dashboard == null) { dashboardReviewResponse.addAuditStatus(DashboardAuditStatus.DASHBOARD_NOT_REGISTERED); return dashboardReviewResponse; } dashboardReviewResponse.setDashboardTitle(dashboard.getTitle()); dashboardReviewResponse.setBusinessApplication(StringUtils.isEmpty(businessApp) ? dashboard.getConfigurationItemBusAppName() : businessApp); dashboardReviewResponse.setBusinessService(StringUtils.isEmpty(businessService) ? dashboard.getConfigurationItemBusServName() : businessService); if (auditTypes.contains(AuditType.ALL)) { auditTypes.addAll(Sets.newHashSet(AuditType.values())); auditTypes.remove(AuditType.ALL); } auditTypes.forEach(auditType -> { Evaluator evaluator = auditModel.evaluatorMap().get(auditType); try { Collection<AuditReviewResponse> auditResponse = evaluator.evaluate(dashboard, beginDate, endDate, null); dashboardReviewResponse.addReview(auditType, auditResponse); dashboardReviewResponse.addAuditStatus(auditModel.successStatusMap().get(auditType)); } catch (AuditException e) { if (e.getErrorCode() == AuditException.NO_COLLECTOR_ITEM_CONFIGURED) { dashboardReviewResponse.addAuditStatus(auditModel.errorStatusMap().get(auditType)); } } }); return dashboardReviewResponse; }
[ "@", "SuppressWarnings", "(", "\"PMD.NPathComplexity\"", ")", "@", "Override", "public", "DashboardReviewResponse", "getDashboardReviewResponse", "(", "String", "dashboardTitle", ",", "DashboardType", "dashboardType", ",", "String", "businessService", ",", "String", "businessApp", ",", "long", "beginDate", ",", "long", "endDate", ",", "Set", "<", "AuditType", ">", "auditTypes", ")", "throws", "AuditException", "{", "validateParameters", "(", "dashboardTitle", ",", "dashboardType", ",", "businessService", ",", "businessApp", ",", "beginDate", ",", "endDate", ")", ";", "DashboardReviewResponse", "dashboardReviewResponse", "=", "new", "DashboardReviewResponse", "(", ")", ";", "Dashboard", "dashboard", "=", "getDashboard", "(", "dashboardTitle", ",", "dashboardType", ",", "businessService", ",", "businessApp", ")", ";", "if", "(", "dashboard", "==", "null", ")", "{", "dashboardReviewResponse", ".", "addAuditStatus", "(", "DashboardAuditStatus", ".", "DASHBOARD_NOT_REGISTERED", ")", ";", "return", "dashboardReviewResponse", ";", "}", "dashboardReviewResponse", ".", "setDashboardTitle", "(", "dashboard", ".", "getTitle", "(", ")", ")", ";", "dashboardReviewResponse", ".", "setBusinessApplication", "(", "StringUtils", ".", "isEmpty", "(", "businessApp", ")", "?", "dashboard", ".", "getConfigurationItemBusAppName", "(", ")", ":", "businessApp", ")", ";", "dashboardReviewResponse", ".", "setBusinessService", "(", "StringUtils", ".", "isEmpty", "(", "businessService", ")", "?", "dashboard", ".", "getConfigurationItemBusServName", "(", ")", ":", "businessService", ")", ";", "if", "(", "auditTypes", ".", "contains", "(", "AuditType", ".", "ALL", ")", ")", "{", "auditTypes", ".", "addAll", "(", "Sets", ".", "newHashSet", "(", "AuditType", ".", "values", "(", ")", ")", ")", ";", "auditTypes", ".", "remove", "(", "AuditType", ".", "ALL", ")", ";", "}", "auditTypes", ".", "forEach", "(", "auditType", "->", "{", "Evaluator", "evaluator", "=", "auditModel", ".", "evaluatorMap", "(", ")", ".", "get", "(", "auditType", ")", ";", "try", "{", "Collection", "<", "AuditReviewResponse", ">", "auditResponse", "=", "evaluator", ".", "evaluate", "(", "dashboard", ",", "beginDate", ",", "endDate", ",", "null", ")", ";", "dashboardReviewResponse", ".", "addReview", "(", "auditType", ",", "auditResponse", ")", ";", "dashboardReviewResponse", ".", "addAuditStatus", "(", "auditModel", ".", "successStatusMap", "(", ")", ".", "get", "(", "auditType", ")", ")", ";", "}", "catch", "(", "AuditException", "e", ")", "{", "if", "(", "e", ".", "getErrorCode", "(", ")", "==", "AuditException", ".", "NO_COLLECTOR_ITEM_CONFIGURED", ")", "{", "dashboardReviewResponse", ".", "addAuditStatus", "(", "auditModel", ".", "errorStatusMap", "(", ")", ".", "get", "(", "auditType", ")", ")", ";", "}", "}", "}", ")", ";", "return", "dashboardReviewResponse", ";", "}" ]
Calculates audit response for a given dashboard @param dashboardTitle @param dashboardType @param businessService @param businessApp @param beginDate @param endDate @param auditTypes @return @DashboardReviewResponse for a given dashboard @throws AuditException
[ "Calculates", "audit", "response", "for", "a", "given", "dashboard" ]
train
https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/api-audit/src/main/java/com/capitalone/dashboard/service/DashboardAuditServiceImpl.java#L65-L102
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/RuntimeExceptionsFactory.java
RuntimeExceptionsFactory.newNoSuchElementException
public static NoSuchElementException newNoSuchElementException(String message, Object... args) { """ Constructs and initializes a new {@link NoSuchElementException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link NoSuchElementException}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link NoSuchElementException} with the given {@link String message}. @see #newNoSuchElementException(Throwable, String, Object...) @see java.util.NoSuchElementException """ return newNoSuchElementException(null, message, args); }
java
public static NoSuchElementException newNoSuchElementException(String message, Object... args) { return newNoSuchElementException(null, message, args); }
[ "public", "static", "NoSuchElementException", "newNoSuchElementException", "(", "String", "message", ",", "Object", "...", "args", ")", "{", "return", "newNoSuchElementException", "(", "null", ",", "message", ",", "args", ")", ";", "}" ]
Constructs and initializes a new {@link NoSuchElementException} with the given {@link String message} formatted with the given {@link Object[] arguments}. @param message {@link String} describing the {@link NoSuchElementException}. @param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}. @return a new {@link NoSuchElementException} with the given {@link String message}. @see #newNoSuchElementException(Throwable, String, Object...) @see java.util.NoSuchElementException
[ "Constructs", "and", "initializes", "a", "new", "{", "@link", "NoSuchElementException", "}", "with", "the", "given", "{", "@link", "String", "message", "}", "formatted", "with", "the", "given", "{", "@link", "Object", "[]", "arguments", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RuntimeExceptionsFactory.java#L134-L136
maestrano/maestrano-java
src/main/java/com/maestrano/net/ConnecClient.java
ConnecClient.all
public <T> T all(String entityName, String groupId, Class<T> clazz) throws MnoException { """ Return the entities in a typed class. The typed class should contain a field "entityName" with the list of entity class. For example: <pre> {@code class Organizations{ private List<Organization> organizations; public List<Organization> getOrganizations(){ return organizations; } } class Organization{ public String getId(); //etc... } </pre> @param entityName @param groupId @param clazz @return @throws MnoException """ return all(entityName, groupId, null, getAuthenticatedClient(), clazz); }
java
public <T> T all(String entityName, String groupId, Class<T> clazz) throws MnoException { return all(entityName, groupId, null, getAuthenticatedClient(), clazz); }
[ "public", "<", "T", ">", "T", "all", "(", "String", "entityName", ",", "String", "groupId", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "MnoException", "{", "return", "all", "(", "entityName", ",", "groupId", ",", "null", ",", "getAuthenticatedClient", "(", ")", ",", "clazz", ")", ";", "}" ]
Return the entities in a typed class. The typed class should contain a field "entityName" with the list of entity class. For example: <pre> {@code class Organizations{ private List<Organization> organizations; public List<Organization> getOrganizations(){ return organizations; } } class Organization{ public String getId(); //etc... } </pre> @param entityName @param groupId @param clazz @return @throws MnoException
[ "Return", "the", "entities", "in", "a", "typed", "class", ".", "The", "typed", "class", "should", "contain", "a", "field", "entityName", "with", "the", "list", "of", "entity", "class", ".", "For", "example", ":" ]
train
https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/net/ConnecClient.java#L155-L157
apache/flink
flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java
Configuration.addDeprecation
public static void addDeprecation(String key, String newKey) { """ Adds the deprecated key to the global deprecation map when no custom message is provided. It does not override any existing entries in the deprecation map. This is to be used only by the developers in order to add deprecation of keys, and attempts to call this method after loading resources once, would lead to <tt>UnsupportedOperationException</tt> If you have multiple deprecation entries to add, it is more efficient to use #addDeprecations(DeprecationDelta[] deltas) instead. @param key Key that is to be deprecated @param newKey key that takes up the value of deprecated key """ addDeprecation(key, new String[] {newKey}, null); }
java
public static void addDeprecation(String key, String newKey) { addDeprecation(key, new String[] {newKey}, null); }
[ "public", "static", "void", "addDeprecation", "(", "String", "key", ",", "String", "newKey", ")", "{", "addDeprecation", "(", "key", ",", "new", "String", "[", "]", "{", "newKey", "}", ",", "null", ")", ";", "}" ]
Adds the deprecated key to the global deprecation map when no custom message is provided. It does not override any existing entries in the deprecation map. This is to be used only by the developers in order to add deprecation of keys, and attempts to call this method after loading resources once, would lead to <tt>UnsupportedOperationException</tt> If you have multiple deprecation entries to add, it is more efficient to use #addDeprecations(DeprecationDelta[] deltas) instead. @param key Key that is to be deprecated @param newKey key that takes up the value of deprecated key
[ "Adds", "the", "deprecated", "key", "to", "the", "global", "deprecation", "map", "when", "no", "custom", "message", "is", "provided", ".", "It", "does", "not", "override", "any", "existing", "entries", "in", "the", "deprecation", "map", ".", "This", "is", "to", "be", "used", "only", "by", "the", "developers", "in", "order", "to", "add", "deprecation", "of", "keys", "and", "attempts", "to", "call", "this", "method", "after", "loading", "resources", "once", "would", "lead", "to", "<tt", ">", "UnsupportedOperationException<", "/", "tt", ">" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-filesystems/flink-fs-hadoop-shaded/src/main/java/org/apache/hadoop/conf/Configuration.java#L549-L551
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/vectorization/ImageVectorization.java
ImageVectorization.main
public static void main(String args[]) throws Exception { """ Example of SURF extraction, multiVLAD aggregation and PCA-projection of a single image using this class. @param args @throws Exception """ String imageFolder = "C:/images/"; String imagFilename = "test.jpg"; String[] codebookFiles = { "C:/codebook1.csv", "C:/codebook2.csv", "C:/codebook3.csv", "C:/codebook4.csv" }; int[] numCentroids = { 64, 64, 64, 64 }; String pcaFilename = "C:/pca.txt"; int initialLength = numCentroids.length * numCentroids[0] * AbstractFeatureExtractor.SURFLength; int targetLength = 128; ImageVectorization imvec = new ImageVectorization(imageFolder, imagFilename, targetLength, 512 * 384); ImageVectorization.setFeatureExtractor(new SURFExtractor()); double[][][] codebooks = AbstractFeatureAggregator.readQuantizers(codebookFiles, numCentroids, AbstractFeatureExtractor.SURFLength); ImageVectorization.setVladAggregator(new VladAggregatorMultipleVocabularies(codebooks)); if (targetLength < initialLength) { PCA pca = new PCA(targetLength, 1, initialLength, true); pca.loadPCAFromFile(pcaFilename); ImageVectorization.setPcaProjector(pca); } imvec.setDebug(true); ImageVectorizationResult imvr = imvec.call(); System.out.println(imvr.getImageName() + ": " + Arrays.toString(imvr.getImageVector())); }
java
public static void main(String args[]) throws Exception { String imageFolder = "C:/images/"; String imagFilename = "test.jpg"; String[] codebookFiles = { "C:/codebook1.csv", "C:/codebook2.csv", "C:/codebook3.csv", "C:/codebook4.csv" }; int[] numCentroids = { 64, 64, 64, 64 }; String pcaFilename = "C:/pca.txt"; int initialLength = numCentroids.length * numCentroids[0] * AbstractFeatureExtractor.SURFLength; int targetLength = 128; ImageVectorization imvec = new ImageVectorization(imageFolder, imagFilename, targetLength, 512 * 384); ImageVectorization.setFeatureExtractor(new SURFExtractor()); double[][][] codebooks = AbstractFeatureAggregator.readQuantizers(codebookFiles, numCentroids, AbstractFeatureExtractor.SURFLength); ImageVectorization.setVladAggregator(new VladAggregatorMultipleVocabularies(codebooks)); if (targetLength < initialLength) { PCA pca = new PCA(targetLength, 1, initialLength, true); pca.loadPCAFromFile(pcaFilename); ImageVectorization.setPcaProjector(pca); } imvec.setDebug(true); ImageVectorizationResult imvr = imvec.call(); System.out.println(imvr.getImageName() + ": " + Arrays.toString(imvr.getImageVector())); }
[ "public", "static", "void", "main", "(", "String", "args", "[", "]", ")", "throws", "Exception", "{", "String", "imageFolder", "=", "\"C:/images/\"", ";", "String", "imagFilename", "=", "\"test.jpg\"", ";", "String", "[", "]", "codebookFiles", "=", "{", "\"C:/codebook1.csv\"", ",", "\"C:/codebook2.csv\"", ",", "\"C:/codebook3.csv\"", ",", "\"C:/codebook4.csv\"", "}", ";", "int", "[", "]", "numCentroids", "=", "{", "64", ",", "64", ",", "64", ",", "64", "}", ";", "String", "pcaFilename", "=", "\"C:/pca.txt\"", ";", "int", "initialLength", "=", "numCentroids", ".", "length", "*", "numCentroids", "[", "0", "]", "*", "AbstractFeatureExtractor", ".", "SURFLength", ";", "int", "targetLength", "=", "128", ";", "ImageVectorization", "imvec", "=", "new", "ImageVectorization", "(", "imageFolder", ",", "imagFilename", ",", "targetLength", ",", "512", "*", "384", ")", ";", "ImageVectorization", ".", "setFeatureExtractor", "(", "new", "SURFExtractor", "(", ")", ")", ";", "double", "[", "]", "[", "]", "[", "]", "codebooks", "=", "AbstractFeatureAggregator", ".", "readQuantizers", "(", "codebookFiles", ",", "numCentroids", ",", "AbstractFeatureExtractor", ".", "SURFLength", ")", ";", "ImageVectorization", ".", "setVladAggregator", "(", "new", "VladAggregatorMultipleVocabularies", "(", "codebooks", ")", ")", ";", "if", "(", "targetLength", "<", "initialLength", ")", "{", "PCA", "pca", "=", "new", "PCA", "(", "targetLength", ",", "1", ",", "initialLength", ",", "true", ")", ";", "pca", ".", "loadPCAFromFile", "(", "pcaFilename", ")", ";", "ImageVectorization", ".", "setPcaProjector", "(", "pca", ")", ";", "}", "imvec", ".", "setDebug", "(", "true", ")", ";", "ImageVectorizationResult", "imvr", "=", "imvec", ".", "call", "(", ")", ";", "System", ".", "out", ".", "println", "(", "imvr", ".", "getImageName", "(", ")", "+", "\": \"", "+", "Arrays", ".", "toString", "(", "imvr", ".", "getImageVector", "(", ")", ")", ")", ";", "}" ]
Example of SURF extraction, multiVLAD aggregation and PCA-projection of a single image using this class. @param args @throws Exception
[ "Example", "of", "SURF", "extraction", "multiVLAD", "aggregation", "and", "PCA", "-", "projection", "of", "a", "single", "image", "using", "this", "class", "." ]
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/vectorization/ImageVectorization.java#L244-L269
czyzby/gdx-lml
lml-uedi/src/main/java/com/github/czyzby/lml/uedi/LmlApplication.java
LmlApplication.addDefaultComponents
protected void addDefaultComponents() { """ Registers multiple providers and singletons that produce LibGDX-related object instances. """ // Creating components manually to speed up the start-up. final boolean mapSuper = context.isMapSuperTypes(); context.setMapSuperTypes(false); // Assets: final AssetManagerProvider assetManagerProvider = new AssetManagerProvider(); context.addProvider(assetManagerProvider); context.addDestructible(assetManagerProvider); final InjectingAssetManager assetManager = assetManagerProvider.getAssetManager(); context.addProvider(new BitmapFontProvider(assetManager)); context.addProvider(new ModelProvider(assetManager)); context.addProvider(new MusicProvider(assetManager)); context.addProvider(new Particle3dEffectProvider(assetManager)); context.addProvider(new ParticleEffectProvider(assetManager)); context.addProvider(new PixmapProvider(assetManager)); context.addProvider(new SoundProvider(assetManager)); context.addProvider(new TextureAtlasProvider(assetManager)); context.addProvider(new TextureProvider(assetManager)); // Collections: context.addProvider(new ArrayProvider<Object>()); context.addProvider(new ListProvider<Object>()); context.addProvider(new MapProvider<Object, Object>()); context.addProvider(new SetProvider<Object>()); // I18n: i18nBundleProvider = new I18NBundleProvider(assetManager); localePreference = new LocalePreference(i18nBundleProvider); i18nBundleProvider.setLocalePreference(localePreference); context.addProvider(i18nBundleProvider); context.addProperty(localePreference); context.addProvider(localePreference); // Logging: context.addProvider(new LoggerProvider()); // Preferences: context.addProvider(new PreferencesProvider()); // UI: final SpriteBatchProvider spriteBatchProvider = new SpriteBatchProvider(); context.addProvider(new BatchProvider(spriteBatchProvider)); context.addProvider(spriteBatchProvider); context.addDestructible(spriteBatchProvider); context.addProvider(new SkinProvider(assetManager)); final StageProvider stageProvider = new StageProvider(spriteBatchProvider.getBatch()); stage = stageProvider.getStage(); context.addProvider(stageProvider); if (includeMusicService()) { // Music: final MusicOnPreference musicOn = new MusicOnPreference(); final SoundOnPreference soundOn = new SoundOnPreference(); final MusicVolumePreference musicVolume = new MusicVolumePreference(); final SoundVolumePreference soundVolume = new SoundVolumePreference(); context.addProperty(musicOn); context.addProperty(soundOn); context.addProperty(musicVolume); context.addProperty(soundVolume); context.add(new MusicService(stage, musicOn, soundOn, musicVolume, soundVolume)); } context.setMapSuperTypes(mapSuper); // Application listener: context.add(this); }
java
protected void addDefaultComponents() { // Creating components manually to speed up the start-up. final boolean mapSuper = context.isMapSuperTypes(); context.setMapSuperTypes(false); // Assets: final AssetManagerProvider assetManagerProvider = new AssetManagerProvider(); context.addProvider(assetManagerProvider); context.addDestructible(assetManagerProvider); final InjectingAssetManager assetManager = assetManagerProvider.getAssetManager(); context.addProvider(new BitmapFontProvider(assetManager)); context.addProvider(new ModelProvider(assetManager)); context.addProvider(new MusicProvider(assetManager)); context.addProvider(new Particle3dEffectProvider(assetManager)); context.addProvider(new ParticleEffectProvider(assetManager)); context.addProvider(new PixmapProvider(assetManager)); context.addProvider(new SoundProvider(assetManager)); context.addProvider(new TextureAtlasProvider(assetManager)); context.addProvider(new TextureProvider(assetManager)); // Collections: context.addProvider(new ArrayProvider<Object>()); context.addProvider(new ListProvider<Object>()); context.addProvider(new MapProvider<Object, Object>()); context.addProvider(new SetProvider<Object>()); // I18n: i18nBundleProvider = new I18NBundleProvider(assetManager); localePreference = new LocalePreference(i18nBundleProvider); i18nBundleProvider.setLocalePreference(localePreference); context.addProvider(i18nBundleProvider); context.addProperty(localePreference); context.addProvider(localePreference); // Logging: context.addProvider(new LoggerProvider()); // Preferences: context.addProvider(new PreferencesProvider()); // UI: final SpriteBatchProvider spriteBatchProvider = new SpriteBatchProvider(); context.addProvider(new BatchProvider(spriteBatchProvider)); context.addProvider(spriteBatchProvider); context.addDestructible(spriteBatchProvider); context.addProvider(new SkinProvider(assetManager)); final StageProvider stageProvider = new StageProvider(spriteBatchProvider.getBatch()); stage = stageProvider.getStage(); context.addProvider(stageProvider); if (includeMusicService()) { // Music: final MusicOnPreference musicOn = new MusicOnPreference(); final SoundOnPreference soundOn = new SoundOnPreference(); final MusicVolumePreference musicVolume = new MusicVolumePreference(); final SoundVolumePreference soundVolume = new SoundVolumePreference(); context.addProperty(musicOn); context.addProperty(soundOn); context.addProperty(musicVolume); context.addProperty(soundVolume); context.add(new MusicService(stage, musicOn, soundOn, musicVolume, soundVolume)); } context.setMapSuperTypes(mapSuper); // Application listener: context.add(this); }
[ "protected", "void", "addDefaultComponents", "(", ")", "{", "// Creating components manually to speed up the start-up.", "final", "boolean", "mapSuper", "=", "context", ".", "isMapSuperTypes", "(", ")", ";", "context", ".", "setMapSuperTypes", "(", "false", ")", ";", "// Assets:", "final", "AssetManagerProvider", "assetManagerProvider", "=", "new", "AssetManagerProvider", "(", ")", ";", "context", ".", "addProvider", "(", "assetManagerProvider", ")", ";", "context", ".", "addDestructible", "(", "assetManagerProvider", ")", ";", "final", "InjectingAssetManager", "assetManager", "=", "assetManagerProvider", ".", "getAssetManager", "(", ")", ";", "context", ".", "addProvider", "(", "new", "BitmapFontProvider", "(", "assetManager", ")", ")", ";", "context", ".", "addProvider", "(", "new", "ModelProvider", "(", "assetManager", ")", ")", ";", "context", ".", "addProvider", "(", "new", "MusicProvider", "(", "assetManager", ")", ")", ";", "context", ".", "addProvider", "(", "new", "Particle3dEffectProvider", "(", "assetManager", ")", ")", ";", "context", ".", "addProvider", "(", "new", "ParticleEffectProvider", "(", "assetManager", ")", ")", ";", "context", ".", "addProvider", "(", "new", "PixmapProvider", "(", "assetManager", ")", ")", ";", "context", ".", "addProvider", "(", "new", "SoundProvider", "(", "assetManager", ")", ")", ";", "context", ".", "addProvider", "(", "new", "TextureAtlasProvider", "(", "assetManager", ")", ")", ";", "context", ".", "addProvider", "(", "new", "TextureProvider", "(", "assetManager", ")", ")", ";", "// Collections:", "context", ".", "addProvider", "(", "new", "ArrayProvider", "<", "Object", ">", "(", ")", ")", ";", "context", ".", "addProvider", "(", "new", "ListProvider", "<", "Object", ">", "(", ")", ")", ";", "context", ".", "addProvider", "(", "new", "MapProvider", "<", "Object", ",", "Object", ">", "(", ")", ")", ";", "context", ".", "addProvider", "(", "new", "SetProvider", "<", "Object", ">", "(", ")", ")", ";", "// I18n:", "i18nBundleProvider", "=", "new", "I18NBundleProvider", "(", "assetManager", ")", ";", "localePreference", "=", "new", "LocalePreference", "(", "i18nBundleProvider", ")", ";", "i18nBundleProvider", ".", "setLocalePreference", "(", "localePreference", ")", ";", "context", ".", "addProvider", "(", "i18nBundleProvider", ")", ";", "context", ".", "addProperty", "(", "localePreference", ")", ";", "context", ".", "addProvider", "(", "localePreference", ")", ";", "// Logging:", "context", ".", "addProvider", "(", "new", "LoggerProvider", "(", ")", ")", ";", "// Preferences:", "context", ".", "addProvider", "(", "new", "PreferencesProvider", "(", ")", ")", ";", "// UI:", "final", "SpriteBatchProvider", "spriteBatchProvider", "=", "new", "SpriteBatchProvider", "(", ")", ";", "context", ".", "addProvider", "(", "new", "BatchProvider", "(", "spriteBatchProvider", ")", ")", ";", "context", ".", "addProvider", "(", "spriteBatchProvider", ")", ";", "context", ".", "addDestructible", "(", "spriteBatchProvider", ")", ";", "context", ".", "addProvider", "(", "new", "SkinProvider", "(", "assetManager", ")", ")", ";", "final", "StageProvider", "stageProvider", "=", "new", "StageProvider", "(", "spriteBatchProvider", ".", "getBatch", "(", ")", ")", ";", "stage", "=", "stageProvider", ".", "getStage", "(", ")", ";", "context", ".", "addProvider", "(", "stageProvider", ")", ";", "if", "(", "includeMusicService", "(", ")", ")", "{", "// Music:", "final", "MusicOnPreference", "musicOn", "=", "new", "MusicOnPreference", "(", ")", ";", "final", "SoundOnPreference", "soundOn", "=", "new", "SoundOnPreference", "(", ")", ";", "final", "MusicVolumePreference", "musicVolume", "=", "new", "MusicVolumePreference", "(", ")", ";", "final", "SoundVolumePreference", "soundVolume", "=", "new", "SoundVolumePreference", "(", ")", ";", "context", ".", "addProperty", "(", "musicOn", ")", ";", "context", ".", "addProperty", "(", "soundOn", ")", ";", "context", ".", "addProperty", "(", "musicVolume", ")", ";", "context", ".", "addProperty", "(", "soundVolume", ")", ";", "context", ".", "add", "(", "new", "MusicService", "(", "stage", ",", "musicOn", ",", "soundOn", ",", "musicVolume", ",", "soundVolume", ")", ")", ";", "}", "context", ".", "setMapSuperTypes", "(", "mapSuper", ")", ";", "// Application listener:", "context", ".", "add", "(", "this", ")", ";", "}" ]
Registers multiple providers and singletons that produce LibGDX-related object instances.
[ "Registers", "multiple", "providers", "and", "singletons", "that", "produce", "LibGDX", "-", "related", "object", "instances", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml-uedi/src/main/java/com/github/czyzby/lml/uedi/LmlApplication.java#L181-L239
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonDatabindHandle.java
JacksonDatabindHandle.newFactory
static public ContentHandleFactory newFactory(ObjectMapper mapper, Class<?>... pojoClasses) { """ Creates a factory to create a JacksonDatabindHandle instance for POJO instances of the specified classes. @param mapper the Jackson ObjectMapper for marshaling the POJO classes @param pojoClasses the POJO classes for which this factory provides a handle @return the factory """ if (mapper == null || pojoClasses == null || pojoClasses.length == 0) return null; return new JacksonDatabindHandleFactory(mapper, pojoClasses); }
java
static public ContentHandleFactory newFactory(ObjectMapper mapper, Class<?>... pojoClasses) { if (mapper == null || pojoClasses == null || pojoClasses.length == 0) return null; return new JacksonDatabindHandleFactory(mapper, pojoClasses); }
[ "static", "public", "ContentHandleFactory", "newFactory", "(", "ObjectMapper", "mapper", ",", "Class", "<", "?", ">", "...", "pojoClasses", ")", "{", "if", "(", "mapper", "==", "null", "||", "pojoClasses", "==", "null", "||", "pojoClasses", ".", "length", "==", "0", ")", "return", "null", ";", "return", "new", "JacksonDatabindHandleFactory", "(", "mapper", ",", "pojoClasses", ")", ";", "}" ]
Creates a factory to create a JacksonDatabindHandle instance for POJO instances of the specified classes. @param mapper the Jackson ObjectMapper for marshaling the POJO classes @param pojoClasses the POJO classes for which this factory provides a handle @return the factory
[ "Creates", "a", "factory", "to", "create", "a", "JacksonDatabindHandle", "instance", "for", "POJO", "instances", "of", "the", "specified", "classes", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonDatabindHandle.java#L79-L82
FXMisc/RichTextFX
richtextfx/src/main/java/org/fxmisc/richtext/util/UndoUtils.java
UndoUtils.richTextUndoManager
public static <PS, SEG, S> UndoManager<List<RichTextChange<PS, SEG, S>>> richTextUndoManager( GenericStyledArea<PS, SEG, S> area, UndoManagerFactory factory) { """ Returns an UndoManager that can undo/redo {@link RichTextChange}s. New changes emitted from the stream will not be merged with the previous change after {@link #DEFAULT_PREVENT_MERGE_DELAY} """ return richTextUndoManager(area, factory, DEFAULT_PREVENT_MERGE_DELAY); }
java
public static <PS, SEG, S> UndoManager<List<RichTextChange<PS, SEG, S>>> richTextUndoManager( GenericStyledArea<PS, SEG, S> area, UndoManagerFactory factory) { return richTextUndoManager(area, factory, DEFAULT_PREVENT_MERGE_DELAY); }
[ "public", "static", "<", "PS", ",", "SEG", ",", "S", ">", "UndoManager", "<", "List", "<", "RichTextChange", "<", "PS", ",", "SEG", ",", "S", ">", ">", ">", "richTextUndoManager", "(", "GenericStyledArea", "<", "PS", ",", "SEG", ",", "S", ">", "area", ",", "UndoManagerFactory", "factory", ")", "{", "return", "richTextUndoManager", "(", "area", ",", "factory", ",", "DEFAULT_PREVENT_MERGE_DELAY", ")", ";", "}" ]
Returns an UndoManager that can undo/redo {@link RichTextChange}s. New changes emitted from the stream will not be merged with the previous change after {@link #DEFAULT_PREVENT_MERGE_DELAY}
[ "Returns", "an", "UndoManager", "that", "can", "undo", "/", "redo", "{" ]
train
https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/util/UndoUtils.java#L71-L74
seratch/jslack
src/main/java/com/github/seratch/jslack/Slack.java
Slack.rtmConnect
public RTMClient rtmConnect(String apiToken, boolean fullUserInfoRequired) throws IOException { """ Creates an RTM API client using `/rtm.connect`. @see "https://api.slack.com/docs/rate-limits#rtm" """ try { RTMConnectResponse response = methods().rtmConnect(RTMConnectRequest.builder().token(apiToken).build()); if (response.isOk()) { User connectedBotUser = response.getSelf(); if (fullUserInfoRequired) { String userId = response.getSelf().getId(); UsersInfoResponse resp = this.methods().usersInfo(UsersInfoRequest.builder().token(apiToken).user(userId).build()); if (resp.isOk()) { connectedBotUser = resp.getUser(); } else { String errorMessage = "Failed to get fill user info (user id: " + response.getSelf().getId() + ", error: " + resp.getError() + ")"; throw new IllegalStateException(errorMessage); } } return new RTMClient(this, apiToken, response.getUrl(), connectedBotUser); } else { throw new IllegalStateException("Failed to the RTM endpoint URL (error: " + response.getError() + ")"); } } catch (SlackApiException e) { throw new IllegalStateException( "Failed to connect to the RTM API endpoint. (" + "status: " + e.getResponse().code() + ", " + "error: " + e.getError().getError() + ")", e); } catch (URISyntaxException e) { throw new IllegalStateException( "Failed to connect to the RTM API endpoint. (message: " + e.getMessage() + ")", e); } }
java
public RTMClient rtmConnect(String apiToken, boolean fullUserInfoRequired) throws IOException { try { RTMConnectResponse response = methods().rtmConnect(RTMConnectRequest.builder().token(apiToken).build()); if (response.isOk()) { User connectedBotUser = response.getSelf(); if (fullUserInfoRequired) { String userId = response.getSelf().getId(); UsersInfoResponse resp = this.methods().usersInfo(UsersInfoRequest.builder().token(apiToken).user(userId).build()); if (resp.isOk()) { connectedBotUser = resp.getUser(); } else { String errorMessage = "Failed to get fill user info (user id: " + response.getSelf().getId() + ", error: " + resp.getError() + ")"; throw new IllegalStateException(errorMessage); } } return new RTMClient(this, apiToken, response.getUrl(), connectedBotUser); } else { throw new IllegalStateException("Failed to the RTM endpoint URL (error: " + response.getError() + ")"); } } catch (SlackApiException e) { throw new IllegalStateException( "Failed to connect to the RTM API endpoint. (" + "status: " + e.getResponse().code() + ", " + "error: " + e.getError().getError() + ")", e); } catch (URISyntaxException e) { throw new IllegalStateException( "Failed to connect to the RTM API endpoint. (message: " + e.getMessage() + ")", e); } }
[ "public", "RTMClient", "rtmConnect", "(", "String", "apiToken", ",", "boolean", "fullUserInfoRequired", ")", "throws", "IOException", "{", "try", "{", "RTMConnectResponse", "response", "=", "methods", "(", ")", ".", "rtmConnect", "(", "RTMConnectRequest", ".", "builder", "(", ")", ".", "token", "(", "apiToken", ")", ".", "build", "(", ")", ")", ";", "if", "(", "response", ".", "isOk", "(", ")", ")", "{", "User", "connectedBotUser", "=", "response", ".", "getSelf", "(", ")", ";", "if", "(", "fullUserInfoRequired", ")", "{", "String", "userId", "=", "response", ".", "getSelf", "(", ")", ".", "getId", "(", ")", ";", "UsersInfoResponse", "resp", "=", "this", ".", "methods", "(", ")", ".", "usersInfo", "(", "UsersInfoRequest", ".", "builder", "(", ")", ".", "token", "(", "apiToken", ")", ".", "user", "(", "userId", ")", ".", "build", "(", ")", ")", ";", "if", "(", "resp", ".", "isOk", "(", ")", ")", "{", "connectedBotUser", "=", "resp", ".", "getUser", "(", ")", ";", "}", "else", "{", "String", "errorMessage", "=", "\"Failed to get fill user info (user id: \"", "+", "response", ".", "getSelf", "(", ")", ".", "getId", "(", ")", "+", "\", error: \"", "+", "resp", ".", "getError", "(", ")", "+", "\")\"", ";", "throw", "new", "IllegalStateException", "(", "errorMessage", ")", ";", "}", "}", "return", "new", "RTMClient", "(", "this", ",", "apiToken", ",", "response", ".", "getUrl", "(", ")", ",", "connectedBotUser", ")", ";", "}", "else", "{", "throw", "new", "IllegalStateException", "(", "\"Failed to the RTM endpoint URL (error: \"", "+", "response", ".", "getError", "(", ")", "+", "\")\"", ")", ";", "}", "}", "catch", "(", "SlackApiException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Failed to connect to the RTM API endpoint. (\"", "+", "\"status: \"", "+", "e", ".", "getResponse", "(", ")", ".", "code", "(", ")", "+", "\", \"", "+", "\"error: \"", "+", "e", ".", "getError", "(", ")", ".", "getError", "(", ")", "+", "\")\"", ",", "e", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Failed to connect to the RTM API endpoint. (message: \"", "+", "e", ".", "getMessage", "(", ")", "+", "\")\"", ",", "e", ")", ";", "}", "}" ]
Creates an RTM API client using `/rtm.connect`. @see "https://api.slack.com/docs/rate-limits#rtm"
[ "Creates", "an", "RTM", "API", "client", "using", "/", "rtm", ".", "connect", "." ]
train
https://github.com/seratch/jslack/blob/4a09680f13c97b33f59bc9b8271fef488c8e1c3a/src/main/java/com/github/seratch/jslack/Slack.java#L108-L137
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/UpdateItemRequest.java
UpdateItemRequest.withKey
public UpdateItemRequest withKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey) throws IllegalArgumentException { """ Set the hash and range key attributes of the item. <p> For a hash-only table, you only need to provide the hash attribute. For a hash-and-range table, you must provide both. <p> Returns a reference to this object so that method calls can be chained together. @param hashKey a map entry including the name and value of the primary hash key. @param rangeKey a map entry including the name and value of the primary range key, or null if it is a hash-only table. """ setKey(hashKey, rangeKey); return this; }
java
public UpdateItemRequest withKey(java.util.Map.Entry<String, AttributeValue> hashKey, java.util.Map.Entry<String, AttributeValue> rangeKey) throws IllegalArgumentException { setKey(hashKey, rangeKey); return this; }
[ "public", "UpdateItemRequest", "withKey", "(", "java", ".", "util", ".", "Map", ".", "Entry", "<", "String", ",", "AttributeValue", ">", "hashKey", ",", "java", ".", "util", ".", "Map", ".", "Entry", "<", "String", ",", "AttributeValue", ">", "rangeKey", ")", "throws", "IllegalArgumentException", "{", "setKey", "(", "hashKey", ",", "rangeKey", ")", ";", "return", "this", ";", "}" ]
Set the hash and range key attributes of the item. <p> For a hash-only table, you only need to provide the hash attribute. For a hash-and-range table, you must provide both. <p> Returns a reference to this object so that method calls can be chained together. @param hashKey a map entry including the name and value of the primary hash key. @param rangeKey a map entry including the name and value of the primary range key, or null if it is a hash-only table.
[ "Set", "the", "hash", "and", "range", "key", "attributes", "of", "the", "item", ".", "<p", ">", "For", "a", "hash", "-", "only", "table", "you", "only", "need", "to", "provide", "the", "hash", "attribute", ".", "For", "a", "hash", "-", "and", "-", "range", "table", "you", "must", "provide", "both", ".", "<p", ">", "Returns", "a", "reference", "to", "this", "object", "so", "that", "method", "calls", "can", "be", "chained", "together", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/model/UpdateItemRequest.java#L3106-L3110
elki-project/elki
elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTree.java
AbstractRStarTree.initializeFromFile
@Override public void initializeFromFile(TreeIndexHeader header, PageFile<N> file) { """ Initializes this R*-Tree from an existing persistent file. {@inheritDoc} """ super.initializeFromFile(header, file); // compute height this.height = computeHeight(); if(getLogger().isDebugging()) { getLogger().debugFine(new StringBuilder(100).append(getClass()) // .append("\n height = ").append(height).toString()); } }
java
@Override public void initializeFromFile(TreeIndexHeader header, PageFile<N> file) { super.initializeFromFile(header, file); // compute height this.height = computeHeight(); if(getLogger().isDebugging()) { getLogger().debugFine(new StringBuilder(100).append(getClass()) // .append("\n height = ").append(height).toString()); } }
[ "@", "Override", "public", "void", "initializeFromFile", "(", "TreeIndexHeader", "header", ",", "PageFile", "<", "N", ">", "file", ")", "{", "super", ".", "initializeFromFile", "(", "header", ",", "file", ")", ";", "// compute height", "this", ".", "height", "=", "computeHeight", "(", ")", ";", "if", "(", "getLogger", "(", ")", ".", "isDebugging", "(", ")", ")", "{", "getLogger", "(", ")", ".", "debugFine", "(", "new", "StringBuilder", "(", "100", ")", ".", "append", "(", "getClass", "(", ")", ")", "//", ".", "append", "(", "\"\\n height = \"", ")", ".", "append", "(", "height", ")", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Initializes this R*-Tree from an existing persistent file. {@inheritDoc}
[ "Initializes", "this", "R", "*", "-", "Tree", "from", "an", "existing", "persistent", "file", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTree.java#L242-L252
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/Envelope2D.java
Envelope2D.sqrDistance
public double sqrDistance(double xmin_, double ymin_, double xmax_, double ymax_) { """ Calculates minimum squared distance from this envelope to the other. Returns 0 for empty envelopes. @param xmin_ @param ymin_ @param xmax_ @param ymax_ @return Returns the squared distance. """ double dx = 0; double dy = 0; double nn; nn = xmin - xmax_; if (nn > dx) dx = nn; nn = ymin - ymax_; if (nn > dy) dy = nn; nn = xmin_ - xmax; if (nn > dx) dx = nn; nn = ymin_ - ymax; if (nn > dy) dy = nn; return dx * dx + dy * dy; }
java
public double sqrDistance(double xmin_, double ymin_, double xmax_, double ymax_) { double dx = 0; double dy = 0; double nn; nn = xmin - xmax_; if (nn > dx) dx = nn; nn = ymin - ymax_; if (nn > dy) dy = nn; nn = xmin_ - xmax; if (nn > dx) dx = nn; nn = ymin_ - ymax; if (nn > dy) dy = nn; return dx * dx + dy * dy; }
[ "public", "double", "sqrDistance", "(", "double", "xmin_", ",", "double", "ymin_", ",", "double", "xmax_", ",", "double", "ymax_", ")", "{", "double", "dx", "=", "0", ";", "double", "dy", "=", "0", ";", "double", "nn", ";", "nn", "=", "xmin", "-", "xmax_", ";", "if", "(", "nn", ">", "dx", ")", "dx", "=", "nn", ";", "nn", "=", "ymin", "-", "ymax_", ";", "if", "(", "nn", ">", "dy", ")", "dy", "=", "nn", ";", "nn", "=", "xmin_", "-", "xmax", ";", "if", "(", "nn", ">", "dx", ")", "dx", "=", "nn", ";", "nn", "=", "ymin_", "-", "ymax", ";", "if", "(", "nn", ">", "dy", ")", "dy", "=", "nn", ";", "return", "dx", "*", "dx", "+", "dy", "*", "dy", ";", "}" ]
Calculates minimum squared distance from this envelope to the other. Returns 0 for empty envelopes. @param xmin_ @param ymin_ @param xmax_ @param ymax_ @return Returns the squared distance.
[ "Calculates", "minimum", "squared", "distance", "from", "this", "envelope", "to", "the", "other", ".", "Returns", "0", "for", "empty", "envelopes", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Envelope2D.java#L1160-L1183
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1Client.java
ContainerAnalysisV1Beta1Client.listScanConfigs
public final ListScanConfigsPagedResponse listScanConfigs(ProjectName parent, String filter) { """ Lists scan configurations for the specified project. <p>Sample code: <pre><code> try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); String filter = ""; for (ScanConfig element : containerAnalysisV1Beta1Client.listScanConfigs(parent, filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent The name of the project to list scan configurations for in the form of `projects/[PROJECT_ID]`. @param filter The filter expression. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFilter(filter) .build(); return listScanConfigs(request); }
java
public final ListScanConfigsPagedResponse listScanConfigs(ProjectName parent, String filter) { ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFilter(filter) .build(); return listScanConfigs(request); }
[ "public", "final", "ListScanConfigsPagedResponse", "listScanConfigs", "(", "ProjectName", "parent", ",", "String", "filter", ")", "{", "ListScanConfigsRequest", "request", "=", "ListScanConfigsRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", "==", "null", "?", "null", ":", "parent", ".", "toString", "(", ")", ")", ".", "setFilter", "(", "filter", ")", ".", "build", "(", ")", ";", "return", "listScanConfigs", "(", "request", ")", ";", "}" ]
Lists scan configurations for the specified project. <p>Sample code: <pre><code> try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); String filter = ""; for (ScanConfig element : containerAnalysisV1Beta1Client.listScanConfigs(parent, filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent The name of the project to list scan configurations for in the form of `projects/[PROJECT_ID]`. @param filter The filter expression. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "scan", "configurations", "for", "the", "specified", "project", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1Client.java#L674-L681
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.getSubscriptions
public void getSubscriptions( final MFPPushResponseListener<List<String>> listener) { """ Get the list of tags subscribed to @param listener Mandatory listener class. When the list of tags subscribed to are successfully retrieved the {@link MFPPushResponseListener} .onSuccess method is called with the list of tagNames {@link MFPPushResponseListener}.onFailure method is called otherwise """ MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getSubscriptionsUrl(deviceId, null); if (path == DEVICE_ID_NULL) { listener.onFailure(new MFPPushException("The device is not registered yet. Please register device before calling subscriptions API")); return; } MFPPushInvoker invoker = MFPPushInvoker.newInstance(appContext, path, Request.GET, clientSecret); invoker.setResponseListener(new ResponseListener() { @Override public void onSuccess(Response response) { List<String> tagNames = new ArrayList<String>(); try { JSONArray tags = (JSONArray) (new JSONObject(response.getResponseText())) .get(SUBSCRIPTIONS); int tagsCnt = tags.length(); for (int tagsIdx = 0; tagsIdx < tagsCnt; tagsIdx++) { tagNames.add(tags.getJSONObject(tagsIdx) .getString(TAG_NAME)); } listener.onSuccess(tagNames); } catch (JSONException e) { logger.error("MFPPush: getSubscriptions() - Failure while getting subscriptions. Failure response is: " + e.getMessage()); listener.onFailure(new MFPPushException(e)); } } @Override public void onFailure(Response response, Throwable throwable, JSONObject jsonObject) { //Error while getSubscriptions. logger.error("MFPPush: Error while getSubscriptions"); listener.onFailure(getException(response,throwable,jsonObject)); } }); invoker.execute(); }
java
public void getSubscriptions( final MFPPushResponseListener<List<String>> listener) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getSubscriptionsUrl(deviceId, null); if (path == DEVICE_ID_NULL) { listener.onFailure(new MFPPushException("The device is not registered yet. Please register device before calling subscriptions API")); return; } MFPPushInvoker invoker = MFPPushInvoker.newInstance(appContext, path, Request.GET, clientSecret); invoker.setResponseListener(new ResponseListener() { @Override public void onSuccess(Response response) { List<String> tagNames = new ArrayList<String>(); try { JSONArray tags = (JSONArray) (new JSONObject(response.getResponseText())) .get(SUBSCRIPTIONS); int tagsCnt = tags.length(); for (int tagsIdx = 0; tagsIdx < tagsCnt; tagsIdx++) { tagNames.add(tags.getJSONObject(tagsIdx) .getString(TAG_NAME)); } listener.onSuccess(tagNames); } catch (JSONException e) { logger.error("MFPPush: getSubscriptions() - Failure while getting subscriptions. Failure response is: " + e.getMessage()); listener.onFailure(new MFPPushException(e)); } } @Override public void onFailure(Response response, Throwable throwable, JSONObject jsonObject) { //Error while getSubscriptions. logger.error("MFPPush: Error while getSubscriptions"); listener.onFailure(getException(response,throwable,jsonObject)); } }); invoker.execute(); }
[ "public", "void", "getSubscriptions", "(", "final", "MFPPushResponseListener", "<", "List", "<", "String", ">", ">", "listener", ")", "{", "MFPPushUrlBuilder", "builder", "=", "new", "MFPPushUrlBuilder", "(", "applicationId", ")", ";", "String", "path", "=", "builder", ".", "getSubscriptionsUrl", "(", "deviceId", ",", "null", ")", ";", "if", "(", "path", "==", "DEVICE_ID_NULL", ")", "{", "listener", ".", "onFailure", "(", "new", "MFPPushException", "(", "\"The device is not registered yet. Please register device before calling subscriptions API\"", ")", ")", ";", "return", ";", "}", "MFPPushInvoker", "invoker", "=", "MFPPushInvoker", ".", "newInstance", "(", "appContext", ",", "path", ",", "Request", ".", "GET", ",", "clientSecret", ")", ";", "invoker", ".", "setResponseListener", "(", "new", "ResponseListener", "(", ")", "{", "@", "Override", "public", "void", "onSuccess", "(", "Response", "response", ")", "{", "List", "<", "String", ">", "tagNames", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "try", "{", "JSONArray", "tags", "=", "(", "JSONArray", ")", "(", "new", "JSONObject", "(", "response", ".", "getResponseText", "(", ")", ")", ")", ".", "get", "(", "SUBSCRIPTIONS", ")", ";", "int", "tagsCnt", "=", "tags", ".", "length", "(", ")", ";", "for", "(", "int", "tagsIdx", "=", "0", ";", "tagsIdx", "<", "tagsCnt", ";", "tagsIdx", "++", ")", "{", "tagNames", ".", "add", "(", "tags", ".", "getJSONObject", "(", "tagsIdx", ")", ".", "getString", "(", "TAG_NAME", ")", ")", ";", "}", "listener", ".", "onSuccess", "(", "tagNames", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "logger", ".", "error", "(", "\"MFPPush: getSubscriptions() - Failure while getting subscriptions. Failure response is: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "listener", ".", "onFailure", "(", "new", "MFPPushException", "(", "e", ")", ")", ";", "}", "}", "@", "Override", "public", "void", "onFailure", "(", "Response", "response", ",", "Throwable", "throwable", ",", "JSONObject", "jsonObject", ")", "{", "//Error while getSubscriptions.", "logger", ".", "error", "(", "\"MFPPush: Error while getSubscriptions\"", ")", ";", "listener", ".", "onFailure", "(", "getException", "(", "response", ",", "throwable", ",", "jsonObject", ")", ")", ";", "}", "}", ")", ";", "invoker", ".", "execute", "(", ")", ";", "}" ]
Get the list of tags subscribed to @param listener Mandatory listener class. When the list of tags subscribed to are successfully retrieved the {@link MFPPushResponseListener} .onSuccess method is called with the list of tagNames {@link MFPPushResponseListener}.onFailure method is called otherwise
[ "Get", "the", "list", "of", "tags", "subscribed", "to" ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L596-L637
apache/groovy
subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java
DateTimeExtensions.leftShift
public static LocalDateTime leftShift(final LocalDate self, LocalTime time) { """ Returns a {@link java.time.LocalDateTime} from this date and the provided {@link java.time.LocalTime}. @param self a LocalDate @param time a LocalTime @return a LocalDateTime @since 2.5.0 """ return LocalDateTime.of(self, time); }
java
public static LocalDateTime leftShift(final LocalDate self, LocalTime time) { return LocalDateTime.of(self, time); }
[ "public", "static", "LocalDateTime", "leftShift", "(", "final", "LocalDate", "self", ",", "LocalTime", "time", ")", "{", "return", "LocalDateTime", ".", "of", "(", "self", ",", "time", ")", ";", "}" ]
Returns a {@link java.time.LocalDateTime} from this date and the provided {@link java.time.LocalTime}. @param self a LocalDate @param time a LocalTime @return a LocalDateTime @since 2.5.0
[ "Returns", "a", "{", "@link", "java", ".", "time", ".", "LocalDateTime", "}", "from", "this", "date", "and", "the", "provided", "{", "@link", "java", ".", "time", ".", "LocalTime", "}", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L624-L626
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/validation/ServerValidator.java
ServerValidator.validateServerVariables
private void validateServerVariables(ValidationHelper helper, Context context, Set<String> variables, Server t) { """ Ensures that all the serverVariables are defined @param helper the helper to send validation messages @param variables the set of variables to validate """ ServerVariables serverVariables = t.getVariables(); for (String variable : variables) { if (serverVariables == null || !serverVariables.containsKey(variable)) { final String message = Tr.formatMessage(tc, "serverVariableNotDefined", variable); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("variables"), message)); } } }
java
private void validateServerVariables(ValidationHelper helper, Context context, Set<String> variables, Server t) { ServerVariables serverVariables = t.getVariables(); for (String variable : variables) { if (serverVariables == null || !serverVariables.containsKey(variable)) { final String message = Tr.formatMessage(tc, "serverVariableNotDefined", variable); helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("variables"), message)); } } }
[ "private", "void", "validateServerVariables", "(", "ValidationHelper", "helper", ",", "Context", "context", ",", "Set", "<", "String", ">", "variables", ",", "Server", "t", ")", "{", "ServerVariables", "serverVariables", "=", "t", ".", "getVariables", "(", ")", ";", "for", "(", "String", "variable", ":", "variables", ")", "{", "if", "(", "serverVariables", "==", "null", "||", "!", "serverVariables", ".", "containsKey", "(", "variable", ")", ")", "{", "final", "String", "message", "=", "Tr", ".", "formatMessage", "(", "tc", ",", "\"serverVariableNotDefined\"", ",", "variable", ")", ";", "helper", ".", "addValidationEvent", "(", "new", "ValidationEvent", "(", "ValidationEvent", ".", "Severity", ".", "ERROR", ",", "context", ".", "getLocation", "(", "\"variables\"", ")", ",", "message", ")", ")", ";", "}", "}", "}" ]
Ensures that all the serverVariables are defined @param helper the helper to send validation messages @param variables the set of variables to validate
[ "Ensures", "that", "all", "the", "serverVariables", "are", "defined" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/validation/ServerValidator.java#L61-L70
jruby/jcodings
src/org/jcodings/AbstractEncoding.java
AbstractEncoding.applyAllCaseFold
@Override public void applyAllCaseFold(int flag, ApplyAllCaseFoldFunction fun, Object arg) { """ onigenc_ascii_apply_all_case_fold / used also by multibyte encodings """ asciiApplyAllCaseFold(flag, fun, arg); }
java
@Override public void applyAllCaseFold(int flag, ApplyAllCaseFoldFunction fun, Object arg) { asciiApplyAllCaseFold(flag, fun, arg); }
[ "@", "Override", "public", "void", "applyAllCaseFold", "(", "int", "flag", ",", "ApplyAllCaseFoldFunction", "fun", ",", "Object", "arg", ")", "{", "asciiApplyAllCaseFold", "(", "flag", ",", "fun", ",", "arg", ")", ";", "}" ]
onigenc_ascii_apply_all_case_fold / used also by multibyte encodings
[ "onigenc_ascii_apply_all_case_fold", "/", "used", "also", "by", "multibyte", "encodings" ]
train
https://github.com/jruby/jcodings/blob/8e09c6caab59f9a0b9760e57d2708eea185c2de1/src/org/jcodings/AbstractEncoding.java#L83-L86
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java
AnnotationUtility.getAnnotationAttributeAsBoolean
public static Boolean getAnnotationAttributeAsBoolean(ModelWithAnnotation model, Class<? extends Annotation> annotation, AnnotationAttributeType attribute, Boolean defaultValue) { """ Gets the annotation attribute as boolean. @param model the model @param annotation the annotation @param attribute the attribute @param defaultValue the default value @return the annotation attribute as boolean """ return getAnnotationAttribute(model, annotation, attribute, defaultValue, new OnAnnotationAttributeListener<Boolean>() { @Override public Boolean onFound(String value) { return Boolean.valueOf(value); } }); }
java
public static Boolean getAnnotationAttributeAsBoolean(ModelWithAnnotation model, Class<? extends Annotation> annotation, AnnotationAttributeType attribute, Boolean defaultValue) { return getAnnotationAttribute(model, annotation, attribute, defaultValue, new OnAnnotationAttributeListener<Boolean>() { @Override public Boolean onFound(String value) { return Boolean.valueOf(value); } }); }
[ "public", "static", "Boolean", "getAnnotationAttributeAsBoolean", "(", "ModelWithAnnotation", "model", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ",", "AnnotationAttributeType", "attribute", ",", "Boolean", "defaultValue", ")", "{", "return", "getAnnotationAttribute", "(", "model", ",", "annotation", ",", "attribute", ",", "defaultValue", ",", "new", "OnAnnotationAttributeListener", "<", "Boolean", ">", "(", ")", "{", "@", "Override", "public", "Boolean", "onFound", "(", "String", "value", ")", "{", "return", "Boolean", ".", "valueOf", "(", "value", ")", ";", "}", "}", ")", ";", "}" ]
Gets the annotation attribute as boolean. @param model the model @param annotation the annotation @param attribute the attribute @param defaultValue the default value @return the annotation attribute as boolean
[ "Gets", "the", "annotation", "attribute", "as", "boolean", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java#L604-L612
tvesalainen/bcc
src/main/java/org/vesalainen/bcc/MethodCompiler.java
MethodCompiler.tinc
public void tinc(String name, int con) throws IOException { """ Increment local variable by constant <p>Stack: No change @param name local variable name @param con signed byte @throws IOException @see nameArgument @see addVariable """ TypeMirror cn = getLocalType(name); int index = getLocalVariableIndex(name); tinc(cn, index, con); }
java
public void tinc(String name, int con) throws IOException { TypeMirror cn = getLocalType(name); int index = getLocalVariableIndex(name); tinc(cn, index, con); }
[ "public", "void", "tinc", "(", "String", "name", ",", "int", "con", ")", "throws", "IOException", "{", "TypeMirror", "cn", "=", "getLocalType", "(", "name", ")", ";", "int", "index", "=", "getLocalVariableIndex", "(", "name", ")", ";", "tinc", "(", "cn", ",", "index", ",", "con", ")", ";", "}" ]
Increment local variable by constant <p>Stack: No change @param name local variable name @param con signed byte @throws IOException @see nameArgument @see addVariable
[ "Increment", "local", "variable", "by", "constant", "<p", ">", "Stack", ":", "No", "change" ]
train
https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/MethodCompiler.java#L659-L664
belaban/JGroups
src/org/jgroups/protocols/pbcast/ClientGmsImpl.java
ClientGmsImpl.firstOfAllClients
protected boolean firstOfAllClients(final Address joiner, final Responses rsps) { """ Handles the case where no coord responses were received. Returns true if we became the coord (caller needs to terminate the join() call), or false when the caller needs to continue """ log.trace("%s: could not determine coordinator from rsps %s", gms.local_addr, rsps); // so the member to become singleton member (and thus coord) is the first of all clients SortedSet<Address> clients=new TreeSet<>(); clients.add(joiner); // add myself again (was removed by findInitialMembers()) for(PingData response: rsps) clients.add(response.getAddress()); log.trace("%s: nodes to choose new coord from are: %s", gms.local_addr, clients); Address new_coord=clients.first(); if(new_coord.equals(joiner)) { log.trace("%s: I (%s) am the first of the nodes, will become coordinator", gms.local_addr, joiner); becomeSingletonMember(joiner); return true; } log.trace("%s: I (%s) am not the first of the nodes, waiting for another client to become coordinator", gms.local_addr, joiner); // Util.sleep(500); return false; }
java
protected boolean firstOfAllClients(final Address joiner, final Responses rsps) { log.trace("%s: could not determine coordinator from rsps %s", gms.local_addr, rsps); // so the member to become singleton member (and thus coord) is the first of all clients SortedSet<Address> clients=new TreeSet<>(); clients.add(joiner); // add myself again (was removed by findInitialMembers()) for(PingData response: rsps) clients.add(response.getAddress()); log.trace("%s: nodes to choose new coord from are: %s", gms.local_addr, clients); Address new_coord=clients.first(); if(new_coord.equals(joiner)) { log.trace("%s: I (%s) am the first of the nodes, will become coordinator", gms.local_addr, joiner); becomeSingletonMember(joiner); return true; } log.trace("%s: I (%s) am not the first of the nodes, waiting for another client to become coordinator", gms.local_addr, joiner); // Util.sleep(500); return false; }
[ "protected", "boolean", "firstOfAllClients", "(", "final", "Address", "joiner", ",", "final", "Responses", "rsps", ")", "{", "log", ".", "trace", "(", "\"%s: could not determine coordinator from rsps %s\"", ",", "gms", ".", "local_addr", ",", "rsps", ")", ";", "// so the member to become singleton member (and thus coord) is the first of all clients", "SortedSet", "<", "Address", ">", "clients", "=", "new", "TreeSet", "<>", "(", ")", ";", "clients", ".", "add", "(", "joiner", ")", ";", "// add myself again (was removed by findInitialMembers())", "for", "(", "PingData", "response", ":", "rsps", ")", "clients", ".", "(", "response", ".", "getAddress", "(", ")", ")", ";", "log", ".", "trace", "(", "\"%s: nodes to choose new coord from are: %s\"", ",", "gms", ".", "local_addr", ",", "clients", ")", ";", "Address", "new_coord", "=", "clients", ".", "first", "(", ")", ";", "if", "(", "new_coord", ".", "equals", "(", "joiner", ")", ")", "{", "log", ".", "trace", "(", "\"%s: I (%s) am the first of the nodes, will become coordinator\"", ",", "gms", ".", "local_addr", ",", "joiner", ")", ";", "becomeSingletonMember", "(", "joiner", ")", ";", "return", "true", ";", "}", "log", ".", "trace", "(", "\"%s: I (%s) am not the first of the nodes, waiting for another client to become coordinator\"", ",", "gms", ".", "local_addr", ",", "joiner", ")", ";", "// Util.sleep(500);", "return", "false", ";", "}" ]
Handles the case where no coord responses were received. Returns true if we became the coord (caller needs to terminate the join() call), or false when the caller needs to continue
[ "Handles", "the", "case", "where", "no", "coord", "responses", "were", "received", ".", "Returns", "true", "if", "we", "became", "the", "coord", "(", "caller", "needs", "to", "terminate", "the", "join", "()", "call", ")", "or", "false", "when", "the", "caller", "needs", "to", "continue" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/ClientGmsImpl.java#L157-L177
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java
RuleBasedCollator.setVariableTop
@Override @Deprecated public int setVariableTop(String varTop) { """ <strong>[icu]</strong> Sets the variable top to the primary weight of the specified string. <p>Beginning with ICU 53, the variable top is pinned to the top of one of the supported reordering groups, and it must not be beyond the last of those groups. See {@link #setMaxVariable(int)}. @param varTop one or more (if contraction) characters to which the variable top should be set @return variable top primary weight @exception IllegalArgumentException is thrown if varTop argument is not a valid variable top element. A variable top element is invalid when <ul> <li>it is a contraction that does not exist in the Collation order <li>the variable top is beyond the last reordering group supported by setMaxVariable() <li>when the varTop argument is null or zero in length. </ul> @see #getVariableTop @see RuleBasedCollator#setAlternateHandlingShifted @deprecated ICU 53 Call {@link #setMaxVariable(int)} instead. @hide original deprecated declaration """ checkNotFrozen(); if (varTop == null || varTop.length() == 0) { throw new IllegalArgumentException("Variable top argument string can not be null or zero in length."); } boolean numeric = settings.readOnly().isNumeric(); long ce1, ce2; if(settings.readOnly().dontCheckFCD()) { UTF16CollationIterator ci = new UTF16CollationIterator(data, numeric, varTop, 0); ce1 = ci.nextCE(); ce2 = ci.nextCE(); } else { FCDUTF16CollationIterator ci = new FCDUTF16CollationIterator(data, numeric, varTop, 0); ce1 = ci.nextCE(); ce2 = ci.nextCE(); } if(ce1 == Collation.NO_CE || ce2 != Collation.NO_CE) { throw new IllegalArgumentException("Variable top argument string must map to exactly one collation element"); } internalSetVariableTop(ce1 >>> 32); return (int)settings.readOnly().variableTop; }
java
@Override @Deprecated public int setVariableTop(String varTop) { checkNotFrozen(); if (varTop == null || varTop.length() == 0) { throw new IllegalArgumentException("Variable top argument string can not be null or zero in length."); } boolean numeric = settings.readOnly().isNumeric(); long ce1, ce2; if(settings.readOnly().dontCheckFCD()) { UTF16CollationIterator ci = new UTF16CollationIterator(data, numeric, varTop, 0); ce1 = ci.nextCE(); ce2 = ci.nextCE(); } else { FCDUTF16CollationIterator ci = new FCDUTF16CollationIterator(data, numeric, varTop, 0); ce1 = ci.nextCE(); ce2 = ci.nextCE(); } if(ce1 == Collation.NO_CE || ce2 != Collation.NO_CE) { throw new IllegalArgumentException("Variable top argument string must map to exactly one collation element"); } internalSetVariableTop(ce1 >>> 32); return (int)settings.readOnly().variableTop; }
[ "@", "Override", "@", "Deprecated", "public", "int", "setVariableTop", "(", "String", "varTop", ")", "{", "checkNotFrozen", "(", ")", ";", "if", "(", "varTop", "==", "null", "||", "varTop", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Variable top argument string can not be null or zero in length.\"", ")", ";", "}", "boolean", "numeric", "=", "settings", ".", "readOnly", "(", ")", ".", "isNumeric", "(", ")", ";", "long", "ce1", ",", "ce2", ";", "if", "(", "settings", ".", "readOnly", "(", ")", ".", "dontCheckFCD", "(", ")", ")", "{", "UTF16CollationIterator", "ci", "=", "new", "UTF16CollationIterator", "(", "data", ",", "numeric", ",", "varTop", ",", "0", ")", ";", "ce1", "=", "ci", ".", "nextCE", "(", ")", ";", "ce2", "=", "ci", ".", "nextCE", "(", ")", ";", "}", "else", "{", "FCDUTF16CollationIterator", "ci", "=", "new", "FCDUTF16CollationIterator", "(", "data", ",", "numeric", ",", "varTop", ",", "0", ")", ";", "ce1", "=", "ci", ".", "nextCE", "(", ")", ";", "ce2", "=", "ci", ".", "nextCE", "(", ")", ";", "}", "if", "(", "ce1", "==", "Collation", ".", "NO_CE", "||", "ce2", "!=", "Collation", ".", "NO_CE", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Variable top argument string must map to exactly one collation element\"", ")", ";", "}", "internalSetVariableTop", "(", "ce1", ">>>", "32", ")", ";", "return", "(", "int", ")", "settings", ".", "readOnly", "(", ")", ".", "variableTop", ";", "}" ]
<strong>[icu]</strong> Sets the variable top to the primary weight of the specified string. <p>Beginning with ICU 53, the variable top is pinned to the top of one of the supported reordering groups, and it must not be beyond the last of those groups. See {@link #setMaxVariable(int)}. @param varTop one or more (if contraction) characters to which the variable top should be set @return variable top primary weight @exception IllegalArgumentException is thrown if varTop argument is not a valid variable top element. A variable top element is invalid when <ul> <li>it is a contraction that does not exist in the Collation order <li>the variable top is beyond the last reordering group supported by setMaxVariable() <li>when the varTop argument is null or zero in length. </ul> @see #getVariableTop @see RuleBasedCollator#setAlternateHandlingShifted @deprecated ICU 53 Call {@link #setMaxVariable(int)} instead. @hide original deprecated declaration
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Sets", "the", "variable", "top", "to", "the", "primary", "weight", "of", "the", "specified", "string", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L778-L801
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java
FileSystemView.checkEmpty
private void checkEmpty(Directory dir, Path pathForException) throws FileSystemException { """ Checks that given directory is empty, throwing {@link DirectoryNotEmptyException} if not. """ if (!dir.isEmpty()) { throw new DirectoryNotEmptyException(pathForException.toString()); } }
java
private void checkEmpty(Directory dir, Path pathForException) throws FileSystemException { if (!dir.isEmpty()) { throw new DirectoryNotEmptyException(pathForException.toString()); } }
[ "private", "void", "checkEmpty", "(", "Directory", "dir", ",", "Path", "pathForException", ")", "throws", "FileSystemException", "{", "if", "(", "!", "dir", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "DirectoryNotEmptyException", "(", "pathForException", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Checks that given directory is empty, throwing {@link DirectoryNotEmptyException} if not.
[ "Checks", "that", "given", "directory", "is", "empty", "throwing", "{" ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/FileSystemView.java#L491-L495
apache/incubator-gobblin
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/metrics/kafka/KafkaSchemaRegistry.java
KafkaSchemaRegistry.getSchemaByKey
public S getSchemaByKey(K key) throws SchemaRegistryException { """ Get schema from schema registry by key. @throws SchemaRegistryException if failed to get schema by key. """ try { return cachedSchemasByKeys.get(key); } catch (ExecutionException e) { throw new SchemaRegistryException(String.format("Schema with key %s cannot be retrieved", key), e); } }
java
public S getSchemaByKey(K key) throws SchemaRegistryException { try { return cachedSchemasByKeys.get(key); } catch (ExecutionException e) { throw new SchemaRegistryException(String.format("Schema with key %s cannot be retrieved", key), e); } }
[ "public", "S", "getSchemaByKey", "(", "K", "key", ")", "throws", "SchemaRegistryException", "{", "try", "{", "return", "cachedSchemasByKeys", ".", "get", "(", "key", ")", ";", "}", "catch", "(", "ExecutionException", "e", ")", "{", "throw", "new", "SchemaRegistryException", "(", "String", ".", "format", "(", "\"Schema with key %s cannot be retrieved\"", ",", "key", ")", ",", "e", ")", ";", "}", "}" ]
Get schema from schema registry by key. @throws SchemaRegistryException if failed to get schema by key.
[ "Get", "schema", "from", "schema", "registry", "by", "key", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/metrics/kafka/KafkaSchemaRegistry.java#L97-L103
apache/incubator-gobblin
gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java
State.getPropAsShortWithRadix
public short getPropAsShortWithRadix(String key, short def, int radix) { """ Get the value of a property as an short, using the given default value if the property is not set. @param key property key @param def default value @param radix radix used to parse the value @return short value associated with the key or the default value if the property is not set """ return contains(key) ? Short.parseShort(getProp(key), radix) : def; }
java
public short getPropAsShortWithRadix(String key, short def, int radix) { return contains(key) ? Short.parseShort(getProp(key), radix) : def; }
[ "public", "short", "getPropAsShortWithRadix", "(", "String", "key", ",", "short", "def", ",", "int", "radix", ")", "{", "return", "contains", "(", "key", ")", "?", "Short", ".", "parseShort", "(", "getProp", "(", "key", ")", ",", "radix", ")", ":", "def", ";", "}" ]
Get the value of a property as an short, using the given default value if the property is not set. @param key property key @param def default value @param radix radix used to parse the value @return short value associated with the key or the default value if the property is not set
[ "Get", "the", "value", "of", "a", "property", "as", "an", "short", "using", "the", "given", "default", "value", "if", "the", "property", "is", "not", "set", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-api/src/main/java/org/apache/gobblin/configuration/State.java#L428-L430
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/internal/api/converter/WatchRequestConverter.java
WatchRequestConverter.convertRequest
@Override public Object convertRequest(ServiceRequestContext ctx, AggregatedHttpMessage request, Class<?> expectedResultType) throws Exception { """ Converts the specified {@code request} to {@link Optional} which contains {@link WatchRequest} when the request has {@link HttpHeaderNames#IF_NONE_MATCH}. {@link Optional#empty()} otherwise. """ final String ifNoneMatch = request.headers().get(HttpHeaderNames.IF_NONE_MATCH); if (!isNullOrEmpty(ifNoneMatch)) { final Revision lastKnownRevision = new Revision(ifNoneMatch); final String prefer = request.headers().get(HttpHeaderNames.PREFER); final long timeoutMillis; if (!isNullOrEmpty(prefer)) { timeoutMillis = getTimeoutMillis(prefer); } else { timeoutMillis = DEFAULT_TIMEOUT_MILLIS; } // Update timeout according to the watch API specifications. ctx.setRequestTimeoutMillis( WatchTimeout.makeReasonable(timeoutMillis, ctx.requestTimeoutMillis())); return Optional.of(new WatchRequest(lastKnownRevision, timeoutMillis)); } return Optional.empty(); }
java
@Override public Object convertRequest(ServiceRequestContext ctx, AggregatedHttpMessage request, Class<?> expectedResultType) throws Exception { final String ifNoneMatch = request.headers().get(HttpHeaderNames.IF_NONE_MATCH); if (!isNullOrEmpty(ifNoneMatch)) { final Revision lastKnownRevision = new Revision(ifNoneMatch); final String prefer = request.headers().get(HttpHeaderNames.PREFER); final long timeoutMillis; if (!isNullOrEmpty(prefer)) { timeoutMillis = getTimeoutMillis(prefer); } else { timeoutMillis = DEFAULT_TIMEOUT_MILLIS; } // Update timeout according to the watch API specifications. ctx.setRequestTimeoutMillis( WatchTimeout.makeReasonable(timeoutMillis, ctx.requestTimeoutMillis())); return Optional.of(new WatchRequest(lastKnownRevision, timeoutMillis)); } return Optional.empty(); }
[ "@", "Override", "public", "Object", "convertRequest", "(", "ServiceRequestContext", "ctx", ",", "AggregatedHttpMessage", "request", ",", "Class", "<", "?", ">", "expectedResultType", ")", "throws", "Exception", "{", "final", "String", "ifNoneMatch", "=", "request", ".", "headers", "(", ")", ".", "get", "(", "HttpHeaderNames", ".", "IF_NONE_MATCH", ")", ";", "if", "(", "!", "isNullOrEmpty", "(", "ifNoneMatch", ")", ")", "{", "final", "Revision", "lastKnownRevision", "=", "new", "Revision", "(", "ifNoneMatch", ")", ";", "final", "String", "prefer", "=", "request", ".", "headers", "(", ")", ".", "get", "(", "HttpHeaderNames", ".", "PREFER", ")", ";", "final", "long", "timeoutMillis", ";", "if", "(", "!", "isNullOrEmpty", "(", "prefer", ")", ")", "{", "timeoutMillis", "=", "getTimeoutMillis", "(", "prefer", ")", ";", "}", "else", "{", "timeoutMillis", "=", "DEFAULT_TIMEOUT_MILLIS", ";", "}", "// Update timeout according to the watch API specifications.", "ctx", ".", "setRequestTimeoutMillis", "(", "WatchTimeout", ".", "makeReasonable", "(", "timeoutMillis", ",", "ctx", ".", "requestTimeoutMillis", "(", ")", ")", ")", ";", "return", "Optional", ".", "of", "(", "new", "WatchRequest", "(", "lastKnownRevision", ",", "timeoutMillis", ")", ")", ";", "}", "return", "Optional", ".", "empty", "(", ")", ";", "}" ]
Converts the specified {@code request} to {@link Optional} which contains {@link WatchRequest} when the request has {@link HttpHeaderNames#IF_NONE_MATCH}. {@link Optional#empty()} otherwise.
[ "Converts", "the", "specified", "{" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/api/converter/WatchRequestConverter.java#L46-L65
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgSeqend.java
DwgSeqend.readDwgSeqendV15
public void readDwgSeqendV15(int[] data, int offset) throws Exception { """ Read a Seqend in the DWG format Version 15 @param data Array of unsigned bytes obtained from the DWG binary file @param offset The current bit offset where the value begins @throws Exception If an unexpected bit value is found in the DWG file. Occurs when we are looking for LwPolylines. """ int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); bitPos = readObjectTailV15(data, bitPos); }
java
public void readDwgSeqendV15(int[] data, int offset) throws Exception { int bitPos = offset; bitPos = readObjectHeaderV15(data, bitPos); bitPos = readObjectTailV15(data, bitPos); }
[ "public", "void", "readDwgSeqendV15", "(", "int", "[", "]", "data", ",", "int", "offset", ")", "throws", "Exception", "{", "int", "bitPos", "=", "offset", ";", "bitPos", "=", "readObjectHeaderV15", "(", "data", ",", "bitPos", ")", ";", "bitPos", "=", "readObjectTailV15", "(", "data", ",", "bitPos", ")", ";", "}" ]
Read a Seqend in the DWG format Version 15 @param data Array of unsigned bytes obtained from the DWG binary file @param offset The current bit offset where the value begins @throws Exception If an unexpected bit value is found in the DWG file. Occurs when we are looking for LwPolylines.
[ "Read", "a", "Seqend", "in", "the", "DWG", "format", "Version", "15" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/objects/DwgSeqend.java#L38-L42
korpling/ANNIS
annis-service/src/main/java/annis/administration/AdministrationDao.java
AdministrationDao.importSingleFile
private void importSingleFile(String file, String toplevelCorpusName, long corpusRef) { """ Imports a single binary file. @param file Specifies the file to be imported. @param corpusRef Assigns the file this corpus. @param toplevelCorpusName The toplevel corpus name """ BinaryImportHelper preStat = new BinaryImportHelper(file, getRealDataDir(), toplevelCorpusName, corpusRef, mimeTypeMapping); getJdbcTemplate().execute(BinaryImportHelper.SQL, preStat); }
java
private void importSingleFile(String file, String toplevelCorpusName, long corpusRef) { BinaryImportHelper preStat = new BinaryImportHelper(file, getRealDataDir(), toplevelCorpusName, corpusRef, mimeTypeMapping); getJdbcTemplate().execute(BinaryImportHelper.SQL, preStat); }
[ "private", "void", "importSingleFile", "(", "String", "file", ",", "String", "toplevelCorpusName", ",", "long", "corpusRef", ")", "{", "BinaryImportHelper", "preStat", "=", "new", "BinaryImportHelper", "(", "file", ",", "getRealDataDir", "(", ")", ",", "toplevelCorpusName", ",", "corpusRef", ",", "mimeTypeMapping", ")", ";", "getJdbcTemplate", "(", ")", ".", "execute", "(", "BinaryImportHelper", ".", "SQL", ",", "preStat", ")", ";", "}" ]
Imports a single binary file. @param file Specifies the file to be imported. @param corpusRef Assigns the file this corpus. @param toplevelCorpusName The toplevel corpus name
[ "Imports", "a", "single", "binary", "file", "." ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-service/src/main/java/annis/administration/AdministrationDao.java#L1024-L1033
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/dom/client/DOMImplStandardBase.java
DOMImplStandardBase.createScriptElement
@Override public ScriptElement createScriptElement(Document doc, String source) { """ Safari 2 does not support {@link ScriptElement#setText(String)}. """ ScriptElement elem = (ScriptElement) createElement(doc, "script"); elem.setInnerText(source); return elem; }
java
@Override public ScriptElement createScriptElement(Document doc, String source) { ScriptElement elem = (ScriptElement) createElement(doc, "script"); elem.setInnerText(source); return elem; }
[ "@", "Override", "public", "ScriptElement", "createScriptElement", "(", "Document", "doc", ",", "String", "source", ")", "{", "ScriptElement", "elem", "=", "(", "ScriptElement", ")", "createElement", "(", "doc", ",", "\"script\"", ")", ";", "elem", ".", "setInnerText", "(", "source", ")", ";", "return", "elem", ";", "}" ]
Safari 2 does not support {@link ScriptElement#setText(String)}.
[ "Safari", "2", "does", "not", "support", "{" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/super_src/com/google/gwt/dom/client/DOMImplStandardBase.java#L192-L197
mozilla/rhino
src/org/mozilla/javascript/ScriptableObject.java
ScriptableObject.callMethod
public static Object callMethod(Scriptable obj, String methodName, Object[] args) { """ Call a method of an object. @param obj the JavaScript object @param methodName the name of the function property @param args the arguments for the call @see Context#getCurrentContext() """ return callMethod(null, obj, methodName, args); }
java
public static Object callMethod(Scriptable obj, String methodName, Object[] args) { return callMethod(null, obj, methodName, args); }
[ "public", "static", "Object", "callMethod", "(", "Scriptable", "obj", ",", "String", "methodName", ",", "Object", "[", "]", "args", ")", "{", "return", "callMethod", "(", "null", ",", "obj", ",", "methodName", ",", "args", ")", ";", "}" ]
Call a method of an object. @param obj the JavaScript object @param methodName the name of the function property @param args the arguments for the call @see Context#getCurrentContext()
[ "Call", "a", "method", "of", "an", "object", ".", "@param", "obj", "the", "JavaScript", "object", "@param", "methodName", "the", "name", "of", "the", "function", "property", "@param", "args", "the", "arguments", "for", "the", "call" ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L2662-L2666
actorapp/actor-platform
actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/crypto/Curve25519.java
Curve25519.keyGen
public static Curve25519KeyPair keyGen(byte[] randomBytes) { """ Generating KeyPair @param randomBytes 32 random bytes @return generated key pair """ byte[] privateKey = keyGenPrivate(randomBytes); byte[] publicKey = keyGenPublic(privateKey); return new Curve25519KeyPair(publicKey, privateKey); }
java
public static Curve25519KeyPair keyGen(byte[] randomBytes) { byte[] privateKey = keyGenPrivate(randomBytes); byte[] publicKey = keyGenPublic(privateKey); return new Curve25519KeyPair(publicKey, privateKey); }
[ "public", "static", "Curve25519KeyPair", "keyGen", "(", "byte", "[", "]", "randomBytes", ")", "{", "byte", "[", "]", "privateKey", "=", "keyGenPrivate", "(", "randomBytes", ")", ";", "byte", "[", "]", "publicKey", "=", "keyGenPublic", "(", "privateKey", ")", ";", "return", "new", "Curve25519KeyPair", "(", "publicKey", ",", "privateKey", ")", ";", "}" ]
Generating KeyPair @param randomBytes 32 random bytes @return generated key pair
[ "Generating", "KeyPair" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/crypto/Curve25519.java#L23-L27
tvesalainen/util
util/src/main/java/org/vesalainen/util/CharSequences.java
CharSequences.startsWith
public static boolean startsWith(CharSequence seq, CharSequence pattern) { """ Return true if seq start match pattern exactly. @param seq @param pattern @return """ return startsWith(seq, pattern, Funcs::same); }
java
public static boolean startsWith(CharSequence seq, CharSequence pattern) { return startsWith(seq, pattern, Funcs::same); }
[ "public", "static", "boolean", "startsWith", "(", "CharSequence", "seq", ",", "CharSequence", "pattern", ")", "{", "return", "startsWith", "(", "seq", ",", "pattern", ",", "Funcs", "::", "same", ")", ";", "}" ]
Return true if seq start match pattern exactly. @param seq @param pattern @return
[ "Return", "true", "if", "seq", "start", "match", "pattern", "exactly", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/CharSequences.java#L69-L72
GerdHolz/TOVAL
src/de/invation/code/toval/misc/SetUtils.java
SetUtils.getRandomSubsetMax
public static <T> Set<T> getRandomSubsetMax(Set<T> set, int maxCount) { """ Generates a random subset of <code>set</code>, that contains at most <code>maxCount</code> elements. @param <T> Type of set elements @param set Basic set for operation @param maxCount Maximum number of items @return A subset with at most <code>maxCount</code> elements """ int count = rand.nextInt(maxCount) + 1; return getRandomSubset(set, count); }
java
public static <T> Set<T> getRandomSubsetMax(Set<T> set, int maxCount) { int count = rand.nextInt(maxCount) + 1; return getRandomSubset(set, count); }
[ "public", "static", "<", "T", ">", "Set", "<", "T", ">", "getRandomSubsetMax", "(", "Set", "<", "T", ">", "set", ",", "int", "maxCount", ")", "{", "int", "count", "=", "rand", ".", "nextInt", "(", "maxCount", ")", "+", "1", ";", "return", "getRandomSubset", "(", "set", ",", "count", ")", ";", "}" ]
Generates a random subset of <code>set</code>, that contains at most <code>maxCount</code> elements. @param <T> Type of set elements @param set Basic set for operation @param maxCount Maximum number of items @return A subset with at most <code>maxCount</code> elements
[ "Generates", "a", "random", "subset", "of", "<code", ">", "set<", "/", "code", ">", "that", "contains", "at", "most", "<code", ">", "maxCount<", "/", "code", ">", "elements", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/SetUtils.java#L46-L49
Azure/azure-sdk-for-java
policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java
PolicyStatesInner.listQueryResultsForPolicyDefinitionAsync
public Observable<PolicyStatesQueryResultsInner> listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { """ Queries policy states for the subscription level policy definition. @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' @param subscriptionId Microsoft Azure subscription ID. @param policyDefinitionName Policy definition name. @param queryOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PolicyStatesQueryResultsInner object """ return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions).map(new Func1<ServiceResponse<PolicyStatesQueryResultsInner>, PolicyStatesQueryResultsInner>() { @Override public PolicyStatesQueryResultsInner call(ServiceResponse<PolicyStatesQueryResultsInner> response) { return response.body(); } }); }
java
public Observable<PolicyStatesQueryResultsInner> listQueryResultsForPolicyDefinitionAsync(PolicyStatesResource policyStatesResource, String subscriptionId, String policyDefinitionName, QueryOptions queryOptions) { return listQueryResultsForPolicyDefinitionWithServiceResponseAsync(policyStatesResource, subscriptionId, policyDefinitionName, queryOptions).map(new Func1<ServiceResponse<PolicyStatesQueryResultsInner>, PolicyStatesQueryResultsInner>() { @Override public PolicyStatesQueryResultsInner call(ServiceResponse<PolicyStatesQueryResultsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PolicyStatesQueryResultsInner", ">", "listQueryResultsForPolicyDefinitionAsync", "(", "PolicyStatesResource", "policyStatesResource", ",", "String", "subscriptionId", ",", "String", "policyDefinitionName", ",", "QueryOptions", "queryOptions", ")", "{", "return", "listQueryResultsForPolicyDefinitionWithServiceResponseAsync", "(", "policyStatesResource", ",", "subscriptionId", ",", "policyDefinitionName", ",", "queryOptions", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "PolicyStatesQueryResultsInner", ">", ",", "PolicyStatesQueryResultsInner", ">", "(", ")", "{", "@", "Override", "public", "PolicyStatesQueryResultsInner", "call", "(", "ServiceResponse", "<", "PolicyStatesQueryResultsInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Queries policy states for the subscription level policy definition. @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range, 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s). Possible values include: 'default', 'latest' @param subscriptionId Microsoft Azure subscription ID. @param policyDefinitionName Policy definition name. @param queryOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PolicyStatesQueryResultsInner object
[ "Queries", "policy", "states", "for", "the", "subscription", "level", "policy", "definition", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policyinsights/resource-manager/v2018_04_04/src/main/java/com/microsoft/azure/management/policyinsights/v2018_04_04/implementation/PolicyStatesInner.java#L2191-L2198
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java
OdsElements.finalizeContent
public void finalizeContent(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException { """ Flush tables and write end of document @param xmlUtil the util @param writer the stream to write @throws IOException when write fails """ this.contentElement.flushTables(xmlUtil, writer); this.contentElement.writePostamble(xmlUtil, writer); }
java
public void finalizeContent(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException { this.contentElement.flushTables(xmlUtil, writer); this.contentElement.writePostamble(xmlUtil, writer); }
[ "public", "void", "finalizeContent", "(", "final", "XMLUtil", "xmlUtil", ",", "final", "ZipUTF8Writer", "writer", ")", "throws", "IOException", "{", "this", ".", "contentElement", ".", "flushTables", "(", "xmlUtil", ",", "writer", ")", ";", "this", ".", "contentElement", ".", "writePostamble", "(", "xmlUtil", ",", "writer", ")", ";", "}" ]
Flush tables and write end of document @param xmlUtil the util @param writer the stream to write @throws IOException when write fails
[ "Flush", "tables", "and", "write", "end", "of", "document" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L257-L260
ldapchai/ldapchai
src/main/java/com/novell/ldapchai/impl/edir/entry/EdirEntries.java
EdirEntries.createUser
public static ChaiUser createUser( final String userDN, final String sn, final ChaiProvider provider ) throws ChaiOperationException, ChaiUnavailableException { """ Creates a new user entry in the ldap directory. A new "inetOrgPerson" object is created in the ldap directory. Generally, calls to this method will typically be followed by a call to the returned {@link com.novell.ldapchai.ChaiUser}'s write methods to add additional data to the ldap user entry. @param userDN the new userDN. @param sn the last name of @param provider a ldap provider be used to create the group. @return an instance of the ChaiUser entry @throws com.novell.ldapchai.exception.ChaiOperationException If there is an error during the operation @throws com.novell.ldapchai.exception.ChaiUnavailableException If the directory server(s) are unavailable """ final Map<String, String> createAttributes = new HashMap<>(); createAttributes.put( ChaiConstant.ATTR_LDAP_SURNAME, sn ); provider.createEntry( userDN, ChaiConstant.OBJECTCLASS_BASE_LDAP_USER, createAttributes ); //lets create a user object return provider.getEntryFactory().newChaiUser( userDN ); }
java
public static ChaiUser createUser( final String userDN, final String sn, final ChaiProvider provider ) throws ChaiOperationException, ChaiUnavailableException { final Map<String, String> createAttributes = new HashMap<>(); createAttributes.put( ChaiConstant.ATTR_LDAP_SURNAME, sn ); provider.createEntry( userDN, ChaiConstant.OBJECTCLASS_BASE_LDAP_USER, createAttributes ); //lets create a user object return provider.getEntryFactory().newChaiUser( userDN ); }
[ "public", "static", "ChaiUser", "createUser", "(", "final", "String", "userDN", ",", "final", "String", "sn", ",", "final", "ChaiProvider", "provider", ")", "throws", "ChaiOperationException", ",", "ChaiUnavailableException", "{", "final", "Map", "<", "String", ",", "String", ">", "createAttributes", "=", "new", "HashMap", "<>", "(", ")", ";", "createAttributes", ".", "put", "(", "ChaiConstant", ".", "ATTR_LDAP_SURNAME", ",", "sn", ")", ";", "provider", ".", "createEntry", "(", "userDN", ",", "ChaiConstant", ".", "OBJECTCLASS_BASE_LDAP_USER", ",", "createAttributes", ")", ";", "//lets create a user object", "return", "provider", ".", "getEntryFactory", "(", ")", ".", "newChaiUser", "(", "userDN", ")", ";", "}" ]
Creates a new user entry in the ldap directory. A new "inetOrgPerson" object is created in the ldap directory. Generally, calls to this method will typically be followed by a call to the returned {@link com.novell.ldapchai.ChaiUser}'s write methods to add additional data to the ldap user entry. @param userDN the new userDN. @param sn the last name of @param provider a ldap provider be used to create the group. @return an instance of the ChaiUser entry @throws com.novell.ldapchai.exception.ChaiOperationException If there is an error during the operation @throws com.novell.ldapchai.exception.ChaiUnavailableException If the directory server(s) are unavailable
[ "Creates", "a", "new", "user", "entry", "in", "the", "ldap", "directory", ".", "A", "new", "inetOrgPerson", "object", "is", "created", "in", "the", "ldap", "directory", ".", "Generally", "calls", "to", "this", "method", "will", "typically", "be", "followed", "by", "a", "call", "to", "the", "returned", "{", "@link", "com", ".", "novell", ".", "ldapchai", ".", "ChaiUser", "}", "s", "write", "methods", "to", "add", "additional", "data", "to", "the", "ldap", "user", "entry", "." ]
train
https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/impl/edir/entry/EdirEntries.java#L158-L169
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Video.java
Video.setNameconflict
public void setNameconflict(String nameconflict) throws PageException { """ set the value nameconflict Action to take if filename is the same as that of a file in the directory. @param nameconflict value to set @throws ApplicationException """ nameconflict = nameconflict.toLowerCase().trim(); if ("error".equals(nameconflict)) this.nameconflict = NAMECONFLICT_ERROR; else if ("skip".equals(nameconflict)) this.nameconflict = NAMECONFLICT_SKIP; else if ("overwrite".equals(nameconflict)) this.nameconflict = NAMECONFLICT_OVERWRITE; else if ("makeunique".equals(nameconflict)) this.nameconflict = NAMECONFLICT_MAKEUNIQUE; else throw doThrow("invalid value for attribute nameconflict [" + nameconflict + "]", "valid values are [error,skip,overwrite,makeunique]"); }
java
public void setNameconflict(String nameconflict) throws PageException { nameconflict = nameconflict.toLowerCase().trim(); if ("error".equals(nameconflict)) this.nameconflict = NAMECONFLICT_ERROR; else if ("skip".equals(nameconflict)) this.nameconflict = NAMECONFLICT_SKIP; else if ("overwrite".equals(nameconflict)) this.nameconflict = NAMECONFLICT_OVERWRITE; else if ("makeunique".equals(nameconflict)) this.nameconflict = NAMECONFLICT_MAKEUNIQUE; else throw doThrow("invalid value for attribute nameconflict [" + nameconflict + "]", "valid values are [error,skip,overwrite,makeunique]"); }
[ "public", "void", "setNameconflict", "(", "String", "nameconflict", ")", "throws", "PageException", "{", "nameconflict", "=", "nameconflict", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "\"error\"", ".", "equals", "(", "nameconflict", ")", ")", "this", ".", "nameconflict", "=", "NAMECONFLICT_ERROR", ";", "else", "if", "(", "\"skip\"", ".", "equals", "(", "nameconflict", ")", ")", "this", ".", "nameconflict", "=", "NAMECONFLICT_SKIP", ";", "else", "if", "(", "\"overwrite\"", ".", "equals", "(", "nameconflict", ")", ")", "this", ".", "nameconflict", "=", "NAMECONFLICT_OVERWRITE", ";", "else", "if", "(", "\"makeunique\"", ".", "equals", "(", "nameconflict", ")", ")", "this", ".", "nameconflict", "=", "NAMECONFLICT_MAKEUNIQUE", ";", "else", "throw", "doThrow", "(", "\"invalid value for attribute nameconflict [\"", "+", "nameconflict", "+", "\"]\"", ",", "\"valid values are [error,skip,overwrite,makeunique]\"", ")", ";", "}" ]
set the value nameconflict Action to take if filename is the same as that of a file in the directory. @param nameconflict value to set @throws ApplicationException
[ "set", "the", "value", "nameconflict", "Action", "to", "take", "if", "filename", "is", "the", "same", "as", "that", "of", "a", "file", "in", "the", "directory", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Video.java#L221-L228
rythmengine/rythmengine
src/main/java/org/rythmengine/toString/ToStringOption.java
ToStringOption.setAppendStatic
public ToStringOption setAppendStatic(boolean appendStatic) { """ Return a <code>ToStringOption</code> instance with {@link #appendStatic} option set. if the current instance is not {@link #DEFAULT_OPTION default instance} then set on the current instance and return the current instance. Otherwise, clone the default instance and set on the clone and return the clone @param appendStatic @return this option instance or clone if this is the {@link #DEFAULT_OPTION} """ ToStringOption op = this; if (this == DEFAULT_OPTION) { op = new ToStringOption(this.appendStatic, this.appendTransient); } op.appendStatic = appendStatic; return op; }
java
public ToStringOption setAppendStatic(boolean appendStatic) { ToStringOption op = this; if (this == DEFAULT_OPTION) { op = new ToStringOption(this.appendStatic, this.appendTransient); } op.appendStatic = appendStatic; return op; }
[ "public", "ToStringOption", "setAppendStatic", "(", "boolean", "appendStatic", ")", "{", "ToStringOption", "op", "=", "this", ";", "if", "(", "this", "==", "DEFAULT_OPTION", ")", "{", "op", "=", "new", "ToStringOption", "(", "this", ".", "appendStatic", ",", "this", ".", "appendTransient", ")", ";", "}", "op", ".", "appendStatic", "=", "appendStatic", ";", "return", "op", ";", "}" ]
Return a <code>ToStringOption</code> instance with {@link #appendStatic} option set. if the current instance is not {@link #DEFAULT_OPTION default instance} then set on the current instance and return the current instance. Otherwise, clone the default instance and set on the clone and return the clone @param appendStatic @return this option instance or clone if this is the {@link #DEFAULT_OPTION}
[ "Return", "a", "<code", ">", "ToStringOption<", "/", "code", ">", "instance", "with", "{", "@link", "#appendStatic", "}", "option", "set", ".", "if", "the", "current", "instance", "is", "not", "{", "@link", "#DEFAULT_OPTION", "default", "instance", "}", "then", "set", "on", "the", "current", "instance", "and", "return", "the", "current", "instance", ".", "Otherwise", "clone", "the", "default", "instance", "and", "set", "on", "the", "clone", "and", "return", "the", "clone" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/toString/ToStringOption.java#L107-L114
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSurfPlanar.java
DescribePointSurfPlanar.setImage
public void setImage( II grayII , Planar<II> colorII ) { """ Specifies input image shapes. @param grayII integral image of gray scale image @param colorII integral image of color image """ InputSanityCheck.checkSameShape(grayII,colorII); if( colorII.getNumBands() != numBands ) throw new IllegalArgumentException("Expected planar images to have " +numBands+" not "+colorII.getNumBands()); this.grayII = grayII; this.colorII = colorII; }
java
public void setImage( II grayII , Planar<II> colorII ) { InputSanityCheck.checkSameShape(grayII,colorII); if( colorII.getNumBands() != numBands ) throw new IllegalArgumentException("Expected planar images to have " +numBands+" not "+colorII.getNumBands()); this.grayII = grayII; this.colorII = colorII; }
[ "public", "void", "setImage", "(", "II", "grayII", ",", "Planar", "<", "II", ">", "colorII", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "grayII", ",", "colorII", ")", ";", "if", "(", "colorII", ".", "getNumBands", "(", ")", "!=", "numBands", ")", "throw", "new", "IllegalArgumentException", "(", "\"Expected planar images to have \"", "+", "numBands", "+", "\" not \"", "+", "colorII", ".", "getNumBands", "(", ")", ")", ";", "this", ".", "grayII", "=", "grayII", ";", "this", ".", "colorII", "=", "colorII", ";", "}" ]
Specifies input image shapes. @param grayII integral image of gray scale image @param colorII integral image of color image
[ "Specifies", "input", "image", "shapes", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/describe/DescribePointSurfPlanar.java#L87-L95
google/error-prone
check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java
SuggestedFixes.prettyType
public static String prettyType( @Nullable VisitorState state, @Nullable SuggestedFix.Builder fix, Type type) { """ Pretty-prints a Type for use in fixes, qualifying any enclosed type names using {@link #qualifyType}}. """ return type.accept( new DefaultTypeVisitor<String, Void>() { @Override public String visitWildcardType(Type.WildcardType t, Void unused) { StringBuilder sb = new StringBuilder(); sb.append(t.kind); if (t.kind != BoundKind.UNBOUND) { sb.append(t.type.accept(this, null)); } return sb.toString(); } @Override public String visitClassType(Type.ClassType t, Void unused) { StringBuilder sb = new StringBuilder(); if (state == null || fix == null) { sb.append(t.tsym.getSimpleName()); } else { sb.append(qualifyType(state, fix, t.tsym)); } if (t.getTypeArguments().nonEmpty()) { sb.append('<'); sb.append( t.getTypeArguments().stream() .map(a -> a.accept(this, null)) .collect(joining(", "))); sb.append(">"); } return sb.toString(); } @Override public String visitCapturedType(Type.CapturedType t, Void unused) { return t.wildcard.accept(this, null); } @Override public String visitArrayType(Type.ArrayType t, Void unused) { return t.elemtype.accept(this, null) + "[]"; } @Override public String visitType(Type t, Void unused) { return t.toString(); } }, null); }
java
public static String prettyType( @Nullable VisitorState state, @Nullable SuggestedFix.Builder fix, Type type) { return type.accept( new DefaultTypeVisitor<String, Void>() { @Override public String visitWildcardType(Type.WildcardType t, Void unused) { StringBuilder sb = new StringBuilder(); sb.append(t.kind); if (t.kind != BoundKind.UNBOUND) { sb.append(t.type.accept(this, null)); } return sb.toString(); } @Override public String visitClassType(Type.ClassType t, Void unused) { StringBuilder sb = new StringBuilder(); if (state == null || fix == null) { sb.append(t.tsym.getSimpleName()); } else { sb.append(qualifyType(state, fix, t.tsym)); } if (t.getTypeArguments().nonEmpty()) { sb.append('<'); sb.append( t.getTypeArguments().stream() .map(a -> a.accept(this, null)) .collect(joining(", "))); sb.append(">"); } return sb.toString(); } @Override public String visitCapturedType(Type.CapturedType t, Void unused) { return t.wildcard.accept(this, null); } @Override public String visitArrayType(Type.ArrayType t, Void unused) { return t.elemtype.accept(this, null) + "[]"; } @Override public String visitType(Type t, Void unused) { return t.toString(); } }, null); }
[ "public", "static", "String", "prettyType", "(", "@", "Nullable", "VisitorState", "state", ",", "@", "Nullable", "SuggestedFix", ".", "Builder", "fix", ",", "Type", "type", ")", "{", "return", "type", ".", "accept", "(", "new", "DefaultTypeVisitor", "<", "String", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "String", "visitWildcardType", "(", "Type", ".", "WildcardType", "t", ",", "Void", "unused", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "t", ".", "kind", ")", ";", "if", "(", "t", ".", "kind", "!=", "BoundKind", ".", "UNBOUND", ")", "{", "sb", ".", "append", "(", "t", ".", "type", ".", "accept", "(", "this", ",", "null", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}", "@", "Override", "public", "String", "visitClassType", "(", "Type", ".", "ClassType", "t", ",", "Void", "unused", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "state", "==", "null", "||", "fix", "==", "null", ")", "{", "sb", ".", "append", "(", "t", ".", "tsym", ".", "getSimpleName", "(", ")", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "qualifyType", "(", "state", ",", "fix", ",", "t", ".", "tsym", ")", ")", ";", "}", "if", "(", "t", ".", "getTypeArguments", "(", ")", ".", "nonEmpty", "(", ")", ")", "{", "sb", ".", "append", "(", "'", "'", ")", ";", "sb", ".", "append", "(", "t", ".", "getTypeArguments", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "a", "->", "a", ".", "accept", "(", "this", ",", "null", ")", ")", ".", "collect", "(", "joining", "(", "\", \"", ")", ")", ")", ";", "sb", ".", "append", "(", "\">\"", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}", "@", "Override", "public", "String", "visitCapturedType", "(", "Type", ".", "CapturedType", "t", ",", "Void", "unused", ")", "{", "return", "t", ".", "wildcard", ".", "accept", "(", "this", ",", "null", ")", ";", "}", "@", "Override", "public", "String", "visitArrayType", "(", "Type", ".", "ArrayType", "t", ",", "Void", "unused", ")", "{", "return", "t", ".", "elemtype", ".", "accept", "(", "this", ",", "null", ")", "+", "\"[]\"", ";", "}", "@", "Override", "public", "String", "visitType", "(", "Type", "t", ",", "Void", "unused", ")", "{", "return", "t", ".", "toString", "(", ")", ";", "}", "}", ",", "null", ")", ";", "}" ]
Pretty-prints a Type for use in fixes, qualifying any enclosed type names using {@link #qualifyType}}.
[ "Pretty", "-", "prints", "a", "Type", "for", "use", "in", "fixes", "qualifying", "any", "enclosed", "type", "names", "using", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/fixes/SuggestedFixes.java#L867-L916
google/closure-compiler
src/com/google/javascript/jscomp/modules/Binding.java
Binding.from
static Binding from(Module namespaceBoundModule, Node sourceNode) { """ Binding for an entire module namespace created by an <code>import *</code>. """ return new AutoValue_Binding( namespaceBoundModule.metadata(), sourceNode, /* originatingExport= */ null, /* isModuleNamespace= */ true, namespaceBoundModule.closureNamespace(), CreatedBy.IMPORT); }
java
static Binding from(Module namespaceBoundModule, Node sourceNode) { return new AutoValue_Binding( namespaceBoundModule.metadata(), sourceNode, /* originatingExport= */ null, /* isModuleNamespace= */ true, namespaceBoundModule.closureNamespace(), CreatedBy.IMPORT); }
[ "static", "Binding", "from", "(", "Module", "namespaceBoundModule", ",", "Node", "sourceNode", ")", "{", "return", "new", "AutoValue_Binding", "(", "namespaceBoundModule", ".", "metadata", "(", ")", ",", "sourceNode", ",", "/* originatingExport= */", "null", ",", "/* isModuleNamespace= */", "true", ",", "namespaceBoundModule", ".", "closureNamespace", "(", ")", ",", "CreatedBy", ".", "IMPORT", ")", ";", "}" ]
Binding for an entire module namespace created by an <code>import *</code>.
[ "Binding", "for", "an", "entire", "module", "namespace", "created", "by", "an", "<code", ">", "import", "*", "<", "/", "code", ">", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/modules/Binding.java#L120-L128
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java
CPOptionPersistenceImpl.countByG_K
@Override public int countByG_K(long groupId, String key) { """ Returns the number of cp options where groupId = &#63; and key = &#63;. @param groupId the group ID @param key the key @return the number of matching cp options """ FinderPath finderPath = FINDER_PATH_COUNT_BY_G_K; Object[] finderArgs = new Object[] { groupId, key }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPOPTION_WHERE); query.append(_FINDER_COLUMN_G_K_GROUPID_2); boolean bindKey = false; if (key == null) { query.append(_FINDER_COLUMN_G_K_KEY_1); } else if (key.equals("")) { query.append(_FINDER_COLUMN_G_K_KEY_3); } else { bindKey = true; query.append(_FINDER_COLUMN_G_K_KEY_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindKey) { qPos.add(key); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByG_K(long groupId, String key) { FinderPath finderPath = FINDER_PATH_COUNT_BY_G_K; Object[] finderArgs = new Object[] { groupId, key }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPOPTION_WHERE); query.append(_FINDER_COLUMN_G_K_GROUPID_2); boolean bindKey = false; if (key == null) { query.append(_FINDER_COLUMN_G_K_KEY_1); } else if (key.equals("")) { query.append(_FINDER_COLUMN_G_K_KEY_3); } else { bindKey = true; query.append(_FINDER_COLUMN_G_K_KEY_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindKey) { qPos.add(key); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByG_K", "(", "long", "groupId", ",", "String", "key", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_G_K", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "groupId", ",", "key", "}", ";", "Long", "count", "=", "(", "Long", ")", "finderCache", ".", "getResult", "(", "finderPath", ",", "finderArgs", ",", "this", ")", ";", "if", "(", "count", "==", "null", ")", "{", "StringBundler", "query", "=", "new", "StringBundler", "(", "3", ")", ";", "query", ".", "append", "(", "_SQL_COUNT_CPOPTION_WHERE", ")", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_K_GROUPID_2", ")", ";", "boolean", "bindKey", "=", "false", ";", "if", "(", "key", "==", "null", ")", "{", "query", ".", "append", "(", "_FINDER_COLUMN_G_K_KEY_1", ")", ";", "}", "else", "if", "(", "key", ".", "equals", "(", "\"\"", ")", ")", "{", "query", ".", "append", "(", "_FINDER_COLUMN_G_K_KEY_3", ")", ";", "}", "else", "{", "bindKey", "=", "true", ";", "query", ".", "append", "(", "_FINDER_COLUMN_G_K_KEY_2", ")", ";", "}", "String", "sql", "=", "query", ".", "toString", "(", ")", ";", "Session", "session", "=", "null", ";", "try", "{", "session", "=", "openSession", "(", ")", ";", "Query", "q", "=", "session", ".", "createQuery", "(", "sql", ")", ";", "QueryPos", "qPos", "=", "QueryPos", ".", "getInstance", "(", "q", ")", ";", "qPos", ".", "add", "(", "groupId", ")", ";", "if", "(", "bindKey", ")", "{", "qPos", ".", "add", "(", "key", ")", ";", "}", "count", "=", "(", "Long", ")", "q", ".", "uniqueResult", "(", ")", ";", "finderCache", ".", "putResult", "(", "finderPath", ",", "finderArgs", ",", "count", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "finderCache", ".", "removeResult", "(", "finderPath", ",", "finderArgs", ")", ";", "throw", "processException", "(", "e", ")", ";", "}", "finally", "{", "closeSession", "(", "session", ")", ";", "}", "}", "return", "count", ".", "intValue", "(", ")", ";", "}" ]
Returns the number of cp options where groupId = &#63; and key = &#63;. @param groupId the group ID @param key the key @return the number of matching cp options
[ "Returns", "the", "number", "of", "cp", "options", "where", "groupId", "=", "&#63", ";", "and", "key", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L2153-L2214
avaje-common/avaje-resteasy-guice
src/main/java/org/avaje/resteasy/Bootstrap.java
Bootstrap.registerWebSocketEndpoint
protected void registerWebSocketEndpoint(Binding<?> binding) { """ Check if the binding is a WebSocket endpoint. If it is then register the webSocket server endpoint with the servlet container. """//}, ServerEndpoint serverEndpoint) { Object instance = binding.getProvider().get(); Class<?> instanceClass = instance.getClass(); ServerEndpoint serverEndpoint = instanceClass.getAnnotation(ServerEndpoint.class); if (serverEndpoint != null) { try { // register with the servlet container such that the Guice created singleton instance // is the instance that is used (and not an instance created per request etc) log.debug("registering ServerEndpoint [{}] with servlet container", instanceClass); BasicWebSocketConfigurator configurator = new BasicWebSocketConfigurator(instance); serverContainer.addEndpoint(new BasicWebSocketEndpointConfig(instanceClass, serverEndpoint, configurator)); } catch (Exception e) { log.error("Error registering WebSocket Singleton " + instance + " with the servlet container", e); } } }
java
protected void registerWebSocketEndpoint(Binding<?> binding) {//}, ServerEndpoint serverEndpoint) { Object instance = binding.getProvider().get(); Class<?> instanceClass = instance.getClass(); ServerEndpoint serverEndpoint = instanceClass.getAnnotation(ServerEndpoint.class); if (serverEndpoint != null) { try { // register with the servlet container such that the Guice created singleton instance // is the instance that is used (and not an instance created per request etc) log.debug("registering ServerEndpoint [{}] with servlet container", instanceClass); BasicWebSocketConfigurator configurator = new BasicWebSocketConfigurator(instance); serverContainer.addEndpoint(new BasicWebSocketEndpointConfig(instanceClass, serverEndpoint, configurator)); } catch (Exception e) { log.error("Error registering WebSocket Singleton " + instance + " with the servlet container", e); } } }
[ "protected", "void", "registerWebSocketEndpoint", "(", "Binding", "<", "?", ">", "binding", ")", "{", "//}, ServerEndpoint serverEndpoint) {", "Object", "instance", "=", "binding", ".", "getProvider", "(", ")", ".", "get", "(", ")", ";", "Class", "<", "?", ">", "instanceClass", "=", "instance", ".", "getClass", "(", ")", ";", "ServerEndpoint", "serverEndpoint", "=", "instanceClass", ".", "getAnnotation", "(", "ServerEndpoint", ".", "class", ")", ";", "if", "(", "serverEndpoint", "!=", "null", ")", "{", "try", "{", "// register with the servlet container such that the Guice created singleton instance", "// is the instance that is used (and not an instance created per request etc)", "log", ".", "debug", "(", "\"registering ServerEndpoint [{}] with servlet container\"", ",", "instanceClass", ")", ";", "BasicWebSocketConfigurator", "configurator", "=", "new", "BasicWebSocketConfigurator", "(", "instance", ")", ";", "serverContainer", ".", "addEndpoint", "(", "new", "BasicWebSocketEndpointConfig", "(", "instanceClass", ",", "serverEndpoint", ",", "configurator", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Error registering WebSocket Singleton \"", "+", "instance", "+", "\" with the servlet container\"", ",", "e", ")", ";", "}", "}", "}" ]
Check if the binding is a WebSocket endpoint. If it is then register the webSocket server endpoint with the servlet container.
[ "Check", "if", "the", "binding", "is", "a", "WebSocket", "endpoint", ".", "If", "it", "is", "then", "register", "the", "webSocket", "server", "endpoint", "with", "the", "servlet", "container", "." ]
train
https://github.com/avaje-common/avaje-resteasy-guice/blob/a585d8c6b0a6d4fb5ffb679d8950e41a03795929/src/main/java/org/avaje/resteasy/Bootstrap.java#L91-L108
btrplace/scheduler
btrpsl/src/main/java/org/btrplace/btrpsl/element/DefaultBtrpOperand.java
DefaultBtrpOperand.prettyType
public static String prettyType(int degree, Type t) { """ Pretty textual representation of a given element type. @param degree 0 for a literal, 1 for a set, 2 for a set of sets, ... @param t the literal @return a String """ StringBuilder b = new StringBuilder(); for (int i = degree; i > 0; i--) { b.append("set<"); } b.append(t.toString().toLowerCase()); for (int i = 0; i < degree; i++) { b.append(">"); } return b.toString(); }
java
public static String prettyType(int degree, Type t) { StringBuilder b = new StringBuilder(); for (int i = degree; i > 0; i--) { b.append("set<"); } b.append(t.toString().toLowerCase()); for (int i = 0; i < degree; i++) { b.append(">"); } return b.toString(); }
[ "public", "static", "String", "prettyType", "(", "int", "degree", ",", "Type", "t", ")", "{", "StringBuilder", "b", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "degree", ";", "i", ">", "0", ";", "i", "--", ")", "{", "b", ".", "append", "(", "\"set<\"", ")", ";", "}", "b", ".", "append", "(", "t", ".", "toString", "(", ")", ".", "toLowerCase", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "degree", ";", "i", "++", ")", "{", "b", ".", "append", "(", "\">\"", ")", ";", "}", "return", "b", ".", "toString", "(", ")", ";", "}" ]
Pretty textual representation of a given element type. @param degree 0 for a literal, 1 for a set, 2 for a set of sets, ... @param t the literal @return a String
[ "Pretty", "textual", "representation", "of", "a", "given", "element", "type", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/btrpsl/src/main/java/org/btrplace/btrpsl/element/DefaultBtrpOperand.java#L127-L137
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java
VersionsImpl.getAsync
public Observable<VersionInfo> getAsync(UUID appId, String versionId) { """ Gets the version info. @param appId The application ID. @param versionId The version ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VersionInfo object """ return getWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<VersionInfo>, VersionInfo>() { @Override public VersionInfo call(ServiceResponse<VersionInfo> response) { return response.body(); } }); }
java
public Observable<VersionInfo> getAsync(UUID appId, String versionId) { return getWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<VersionInfo>, VersionInfo>() { @Override public VersionInfo call(ServiceResponse<VersionInfo> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VersionInfo", ">", "getAsync", "(", "UUID", "appId", ",", "String", "versionId", ")", "{", "return", "getWithServiceResponseAsync", "(", "appId", ",", "versionId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VersionInfo", ">", ",", "VersionInfo", ">", "(", ")", "{", "@", "Override", "public", "VersionInfo", "call", "(", "ServiceResponse", "<", "VersionInfo", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets the version info. @param appId The application ID. @param versionId The version ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VersionInfo object
[ "Gets", "the", "version", "info", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/VersionsImpl.java#L474-L481
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java
RTMPHandshake.getSharedSecret
protected byte[] getSharedSecret(byte[] publicKeyBytes, KeyAgreement agreement) { """ Determines the validation scheme for given input. @param publicKeyBytes public key bytes @param agreement key agreement @return shared secret bytes if client used a supported validation scheme """ BigInteger otherPublicKeyInt = new BigInteger(1, publicKeyBytes); try { KeyFactory keyFactory = KeyFactory.getInstance("DH"); KeySpec otherPublicKeySpec = new DHPublicKeySpec(otherPublicKeyInt, RTMPHandshake.DH_MODULUS, RTMPHandshake.DH_BASE); PublicKey otherPublicKey = keyFactory.generatePublic(otherPublicKeySpec); agreement.doPhase(otherPublicKey, true); } catch (Exception e) { log.error("Exception getting the shared secret", e); } byte[] sharedSecret = agreement.generateSecret(); log.debug("Shared secret [{}]: {}", sharedSecret.length, Hex.encodeHexString(sharedSecret)); return sharedSecret; }
java
protected byte[] getSharedSecret(byte[] publicKeyBytes, KeyAgreement agreement) { BigInteger otherPublicKeyInt = new BigInteger(1, publicKeyBytes); try { KeyFactory keyFactory = KeyFactory.getInstance("DH"); KeySpec otherPublicKeySpec = new DHPublicKeySpec(otherPublicKeyInt, RTMPHandshake.DH_MODULUS, RTMPHandshake.DH_BASE); PublicKey otherPublicKey = keyFactory.generatePublic(otherPublicKeySpec); agreement.doPhase(otherPublicKey, true); } catch (Exception e) { log.error("Exception getting the shared secret", e); } byte[] sharedSecret = agreement.generateSecret(); log.debug("Shared secret [{}]: {}", sharedSecret.length, Hex.encodeHexString(sharedSecret)); return sharedSecret; }
[ "protected", "byte", "[", "]", "getSharedSecret", "(", "byte", "[", "]", "publicKeyBytes", ",", "KeyAgreement", "agreement", ")", "{", "BigInteger", "otherPublicKeyInt", "=", "new", "BigInteger", "(", "1", ",", "publicKeyBytes", ")", ";", "try", "{", "KeyFactory", "keyFactory", "=", "KeyFactory", ".", "getInstance", "(", "\"DH\"", ")", ";", "KeySpec", "otherPublicKeySpec", "=", "new", "DHPublicKeySpec", "(", "otherPublicKeyInt", ",", "RTMPHandshake", ".", "DH_MODULUS", ",", "RTMPHandshake", ".", "DH_BASE", ")", ";", "PublicKey", "otherPublicKey", "=", "keyFactory", ".", "generatePublic", "(", "otherPublicKeySpec", ")", ";", "agreement", ".", "doPhase", "(", "otherPublicKey", ",", "true", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Exception getting the shared secret\"", ",", "e", ")", ";", "}", "byte", "[", "]", "sharedSecret", "=", "agreement", ".", "generateSecret", "(", ")", ";", "log", ".", "debug", "(", "\"Shared secret [{}]: {}\"", ",", "sharedSecret", ".", "length", ",", "Hex", ".", "encodeHexString", "(", "sharedSecret", ")", ")", ";", "return", "sharedSecret", ";", "}" ]
Determines the validation scheme for given input. @param publicKeyBytes public key bytes @param agreement key agreement @return shared secret bytes if client used a supported validation scheme
[ "Determines", "the", "validation", "scheme", "for", "given", "input", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/RTMPHandshake.java#L284-L297
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.skewDivergence
public static <E> double skewDivergence(Counter<E> c1, Counter<E> c2, double skew) { """ Calculates the skew divergence between the two counters. That is, it calculates KL(c1 || (c2*skew + c1*(1-skew))) . In other words, how well can c1 be represented by a "smoothed" c2. @return The skew divergence between the distributions """ Counter<E> average = linearCombination(c2, skew, c1, (1.0 - skew)); return klDivergence(c1, average); }
java
public static <E> double skewDivergence(Counter<E> c1, Counter<E> c2, double skew) { Counter<E> average = linearCombination(c2, skew, c1, (1.0 - skew)); return klDivergence(c1, average); }
[ "public", "static", "<", "E", ">", "double", "skewDivergence", "(", "Counter", "<", "E", ">", "c1", ",", "Counter", "<", "E", ">", "c2", ",", "double", "skew", ")", "{", "Counter", "<", "E", ">", "average", "=", "linearCombination", "(", "c2", ",", "skew", ",", "c1", ",", "(", "1.0", "-", "skew", ")", ")", ";", "return", "klDivergence", "(", "c1", ",", "average", ")", ";", "}" ]
Calculates the skew divergence between the two counters. That is, it calculates KL(c1 || (c2*skew + c1*(1-skew))) . In other words, how well can c1 be represented by a "smoothed" c2. @return The skew divergence between the distributions
[ "Calculates", "the", "skew", "divergence", "between", "the", "two", "counters", ".", "That", "is", "it", "calculates", "KL", "(", "c1", "||", "(", "c2", "*", "skew", "+", "c1", "*", "(", "1", "-", "skew", ")))", ".", "In", "other", "words", "how", "well", "can", "c1", "be", "represented", "by", "a", "smoothed", "c2", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L1248-L1251
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/EntityGroupImpl.java
EntityGroupImpl.primAddMember
private void primAddMember(IGroupMember gm) throws GroupsException { """ Adds the <code>IGroupMember</code> key to the appropriate member key cache by copying the cache, adding to the copy, and then replacing the original with the copy. At this point, <code>gm</code> does not yet have <code>this</code> in its containing group cache. That cache entry is not added until update(), when changes are committed to the store. @param gm org.apereo.portal.groups.IGroupMember """ final EntityIdentifier cacheKey = getUnderlyingEntityIdentifier(); Element element = childrenCache.get(cacheKey); @SuppressWarnings("unchecked") final Set<IGroupMember> set = element != null ? (Set<IGroupMember>) element.getObjectValue() : buildChildrenSet(); final Set<IGroupMember> children = new HashSet<>(set); children.add(gm); childrenCache.put(new Element(cacheKey, children)); }
java
private void primAddMember(IGroupMember gm) throws GroupsException { final EntityIdentifier cacheKey = getUnderlyingEntityIdentifier(); Element element = childrenCache.get(cacheKey); @SuppressWarnings("unchecked") final Set<IGroupMember> set = element != null ? (Set<IGroupMember>) element.getObjectValue() : buildChildrenSet(); final Set<IGroupMember> children = new HashSet<>(set); children.add(gm); childrenCache.put(new Element(cacheKey, children)); }
[ "private", "void", "primAddMember", "(", "IGroupMember", "gm", ")", "throws", "GroupsException", "{", "final", "EntityIdentifier", "cacheKey", "=", "getUnderlyingEntityIdentifier", "(", ")", ";", "Element", "element", "=", "childrenCache", ".", "get", "(", "cacheKey", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "Set", "<", "IGroupMember", ">", "set", "=", "element", "!=", "null", "?", "(", "Set", "<", "IGroupMember", ">", ")", "element", ".", "getObjectValue", "(", ")", ":", "buildChildrenSet", "(", ")", ";", "final", "Set", "<", "IGroupMember", ">", "children", "=", "new", "HashSet", "<>", "(", "set", ")", ";", "children", ".", "add", "(", "gm", ")", ";", "childrenCache", ".", "put", "(", "new", "Element", "(", "cacheKey", ",", "children", ")", ")", ";", "}" ]
Adds the <code>IGroupMember</code> key to the appropriate member key cache by copying the cache, adding to the copy, and then replacing the original with the copy. At this point, <code>gm</code> does not yet have <code>this</code> in its containing group cache. That cache entry is not added until update(), when changes are committed to the store. @param gm org.apereo.portal.groups.IGroupMember
[ "Adds", "the", "<code", ">", "IGroupMember<", "/", "code", ">", "key", "to", "the", "appropriate", "member", "key", "cache", "by", "copying", "the", "cache", "adding", "to", "the", "copy", "and", "then", "replacing", "the", "original", "with", "the", "copy", ".", "At", "this", "point", "<code", ">", "gm<", "/", "code", ">", "does", "not", "yet", "have", "<code", ">", "this<", "/", "code", ">", "in", "its", "containing", "group", "cache", ".", "That", "cache", "entry", "is", "not", "added", "until", "update", "()", "when", "changes", "are", "committed", "to", "the", "store", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/EntityGroupImpl.java#L396-L407
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/Node.java
Node.registerContext
Context registerContext(final String path, final List<String> virtualHosts) { """ Register a context. @param path the context path @return the created context """ VHostMapping host = null; for (final VHostMapping vhost : vHosts) { if (virtualHosts.equals(vhost.getAliases())) { host = vhost; break; } } if (host == null) { host = new VHostMapping(this, virtualHosts); vHosts.add(host); } final Context context = new Context(path, host, this); contexts.add(context); return context; }
java
Context registerContext(final String path, final List<String> virtualHosts) { VHostMapping host = null; for (final VHostMapping vhost : vHosts) { if (virtualHosts.equals(vhost.getAliases())) { host = vhost; break; } } if (host == null) { host = new VHostMapping(this, virtualHosts); vHosts.add(host); } final Context context = new Context(path, host, this); contexts.add(context); return context; }
[ "Context", "registerContext", "(", "final", "String", "path", ",", "final", "List", "<", "String", ">", "virtualHosts", ")", "{", "VHostMapping", "host", "=", "null", ";", "for", "(", "final", "VHostMapping", "vhost", ":", "vHosts", ")", "{", "if", "(", "virtualHosts", ".", "equals", "(", "vhost", ".", "getAliases", "(", ")", ")", ")", "{", "host", "=", "vhost", ";", "break", ";", "}", "}", "if", "(", "host", "==", "null", ")", "{", "host", "=", "new", "VHostMapping", "(", "this", ",", "virtualHosts", ")", ";", "vHosts", ".", "add", "(", "host", ")", ";", "}", "final", "Context", "context", "=", "new", "Context", "(", "path", ",", "host", ",", "this", ")", ";", "contexts", ".", "add", "(", "context", ")", ";", "return", "context", ";", "}" ]
Register a context. @param path the context path @return the created context
[ "Register", "a", "context", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/proxy/mod_cluster/Node.java#L251-L266
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIData.java
UIData.processColumnFacets
private void processColumnFacets(FacesContext context, int processAction) { """ Invoke the specified phase on all facets of all UIColumn children of this component. Note that no methods are called on the UIColumn child objects themselves. @param context is the current faces context. @param processAction specifies a JSF phase: decode, validate or update. """ for (int i = 0, childCount = getChildCount(); i < childCount; i++) { UIComponent child = getChildren().get(i); if (child instanceof UIColumn) { if (! _ComponentUtils.isRendered(context, child)) { // Column is not visible continue; } if (child.getFacetCount() > 0) { for (UIComponent facet : child.getFacets().values()) { process(context, facet, processAction); } } } } }
java
private void processColumnFacets(FacesContext context, int processAction) { for (int i = 0, childCount = getChildCount(); i < childCount; i++) { UIComponent child = getChildren().get(i); if (child instanceof UIColumn) { if (! _ComponentUtils.isRendered(context, child)) { // Column is not visible continue; } if (child.getFacetCount() > 0) { for (UIComponent facet : child.getFacets().values()) { process(context, facet, processAction); } } } } }
[ "private", "void", "processColumnFacets", "(", "FacesContext", "context", ",", "int", "processAction", ")", "{", "for", "(", "int", "i", "=", "0", ",", "childCount", "=", "getChildCount", "(", ")", ";", "i", "<", "childCount", ";", "i", "++", ")", "{", "UIComponent", "child", "=", "getChildren", "(", ")", ".", "get", "(", "i", ")", ";", "if", "(", "child", "instanceof", "UIColumn", ")", "{", "if", "(", "!", "_ComponentUtils", ".", "isRendered", "(", "context", ",", "child", ")", ")", "{", "// Column is not visible", "continue", ";", "}", "if", "(", "child", ".", "getFacetCount", "(", ")", ">", "0", ")", "{", "for", "(", "UIComponent", "facet", ":", "child", ".", "getFacets", "(", ")", ".", "values", "(", ")", ")", "{", "process", "(", "context", ",", "facet", ",", "processAction", ")", ";", "}", "}", "}", "}", "}" ]
Invoke the specified phase on all facets of all UIColumn children of this component. Note that no methods are called on the UIColumn child objects themselves. @param context is the current faces context. @param processAction specifies a JSF phase: decode, validate or update.
[ "Invoke", "the", "specified", "phase", "on", "all", "facets", "of", "all", "UIColumn", "children", "of", "this", "component", ".", "Note", "that", "no", "methods", "are", "called", "on", "the", "UIColumn", "child", "objects", "themselves", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/UIData.java#L1934-L1956
dlemmermann/CalendarFX
CalendarFXView/src/main/java/com/calendarfx/model/Entry.java
Entry.changeEndTime
public final void changeEndTime(LocalTime time, boolean keepDuration) { """ Changes the end time of the entry interval. @param time the new end time @param keepDuration if true then this method will also change the start time in such a way that the total duration of the entry will not change. If false then this method will ensure that the entry's interval stays valid, which means that the start time will be before the end time and that the duration of the entry will be at least the duration defined by the {@link #minimumDurationProperty()}. """ requireNonNull(time); Interval interval = getInterval(); LocalDateTime newEndDateTime = getEndAsLocalDateTime().with(time); LocalDateTime startDateTime = getStartAsLocalDateTime(); if (keepDuration) { startDateTime = newEndDateTime.minus(getDuration()); setInterval(startDateTime, newEndDateTime, getZoneId()); } else { /* * We might have a problem if the new end time is BEFORE the current start time. */ if (newEndDateTime.isBefore(startDateTime.plus(getMinimumDuration()))) { interval = interval.withStartDateTime(newEndDateTime.minus(getMinimumDuration())); } setInterval(interval.withEndTime(time)); } }
java
public final void changeEndTime(LocalTime time, boolean keepDuration) { requireNonNull(time); Interval interval = getInterval(); LocalDateTime newEndDateTime = getEndAsLocalDateTime().with(time); LocalDateTime startDateTime = getStartAsLocalDateTime(); if (keepDuration) { startDateTime = newEndDateTime.minus(getDuration()); setInterval(startDateTime, newEndDateTime, getZoneId()); } else { /* * We might have a problem if the new end time is BEFORE the current start time. */ if (newEndDateTime.isBefore(startDateTime.plus(getMinimumDuration()))) { interval = interval.withStartDateTime(newEndDateTime.minus(getMinimumDuration())); } setInterval(interval.withEndTime(time)); } }
[ "public", "final", "void", "changeEndTime", "(", "LocalTime", "time", ",", "boolean", "keepDuration", ")", "{", "requireNonNull", "(", "time", ")", ";", "Interval", "interval", "=", "getInterval", "(", ")", ";", "LocalDateTime", "newEndDateTime", "=", "getEndAsLocalDateTime", "(", ")", ".", "with", "(", "time", ")", ";", "LocalDateTime", "startDateTime", "=", "getStartAsLocalDateTime", "(", ")", ";", "if", "(", "keepDuration", ")", "{", "startDateTime", "=", "newEndDateTime", ".", "minus", "(", "getDuration", "(", ")", ")", ";", "setInterval", "(", "startDateTime", ",", "newEndDateTime", ",", "getZoneId", "(", ")", ")", ";", "}", "else", "{", "/*\n * We might have a problem if the new end time is BEFORE the current start time.\n */", "if", "(", "newEndDateTime", ".", "isBefore", "(", "startDateTime", ".", "plus", "(", "getMinimumDuration", "(", ")", ")", ")", ")", "{", "interval", "=", "interval", ".", "withStartDateTime", "(", "newEndDateTime", ".", "minus", "(", "getMinimumDuration", "(", ")", ")", ")", ";", "}", "setInterval", "(", "interval", ".", "withEndTime", "(", "time", ")", ")", ";", "}", "}" ]
Changes the end time of the entry interval. @param time the new end time @param keepDuration if true then this method will also change the start time in such a way that the total duration of the entry will not change. If false then this method will ensure that the entry's interval stays valid, which means that the start time will be before the end time and that the duration of the entry will be at least the duration defined by the {@link #minimumDurationProperty()}.
[ "Changes", "the", "end", "time", "of", "the", "entry", "interval", "." ]
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXView/src/main/java/com/calendarfx/model/Entry.java#L527-L548
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/validation/RelsValidator.java
RelsValidator.checkResourceURI
private void checkResourceURI(String resourceURI, String relName) throws SAXException { """ checkResourceURI: ensure that the target resource is a proper URI. @param resourceURI the URI value of the RDF 'resource' attribute @param relName the name of the relationship property being evaluated @throws SAXException """ URI uri; try { uri = new URI(resourceURI); } catch (Exception e) { throw new SAXException("RelsExtValidator:" + "Error in relationship '" + relName + "'." + " The RDF 'resource' is not a valid URI."); } if (!uri.isAbsolute()) { throw new SAXException("RelsValidator:" + "Error in relationship '" + relName + "'." + " The specified RDF 'resource' is not an absolute URI."); } }
java
private void checkResourceURI(String resourceURI, String relName) throws SAXException { URI uri; try { uri = new URI(resourceURI); } catch (Exception e) { throw new SAXException("RelsExtValidator:" + "Error in relationship '" + relName + "'." + " The RDF 'resource' is not a valid URI."); } if (!uri.isAbsolute()) { throw new SAXException("RelsValidator:" + "Error in relationship '" + relName + "'." + " The specified RDF 'resource' is not an absolute URI."); } }
[ "private", "void", "checkResourceURI", "(", "String", "resourceURI", ",", "String", "relName", ")", "throws", "SAXException", "{", "URI", "uri", ";", "try", "{", "uri", "=", "new", "URI", "(", "resourceURI", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "SAXException", "(", "\"RelsExtValidator:\"", "+", "\"Error in relationship '\"", "+", "relName", "+", "\"'.\"", "+", "\" The RDF 'resource' is not a valid URI.\"", ")", ";", "}", "if", "(", "!", "uri", ".", "isAbsolute", "(", ")", ")", "{", "throw", "new", "SAXException", "(", "\"RelsValidator:\"", "+", "\"Error in relationship '\"", "+", "relName", "+", "\"'.\"", "+", "\" The specified RDF 'resource' is not an absolute URI.\"", ")", ";", "}", "}" ]
checkResourceURI: ensure that the target resource is a proper URI. @param resourceURI the URI value of the RDF 'resource' attribute @param relName the name of the relationship property being evaluated @throws SAXException
[ "checkResourceURI", ":", "ensure", "that", "the", "target", "resource", "is", "a", "proper", "URI", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/validation/RelsValidator.java#L432-L449
modelmapper/modelmapper
core/src/main/java/org/modelmapper/internal/PropertyInfoRegistry.java
PropertyInfoRegistry.accessorFor
static synchronized Accessor accessorFor(Class<?> type, Method method, Configuration configuration, String name) { """ Returns an Accessor for the given accessor method. The method must be externally validated to ensure that it accepts zero arguments and does not return void.class. """ PropertyInfoKey key = new PropertyInfoKey(type, name, configuration); Accessor accessor = ACCESSOR_CACHE.get(key); if (accessor == null) { accessor = new MethodAccessor(type, method, name); ACCESSOR_CACHE.put(key, accessor); } return accessor; }
java
static synchronized Accessor accessorFor(Class<?> type, Method method, Configuration configuration, String name) { PropertyInfoKey key = new PropertyInfoKey(type, name, configuration); Accessor accessor = ACCESSOR_CACHE.get(key); if (accessor == null) { accessor = new MethodAccessor(type, method, name); ACCESSOR_CACHE.put(key, accessor); } return accessor; }
[ "static", "synchronized", "Accessor", "accessorFor", "(", "Class", "<", "?", ">", "type", ",", "Method", "method", ",", "Configuration", "configuration", ",", "String", "name", ")", "{", "PropertyInfoKey", "key", "=", "new", "PropertyInfoKey", "(", "type", ",", "name", ",", "configuration", ")", ";", "Accessor", "accessor", "=", "ACCESSOR_CACHE", ".", "get", "(", "key", ")", ";", "if", "(", "accessor", "==", "null", ")", "{", "accessor", "=", "new", "MethodAccessor", "(", "type", ",", "method", ",", "name", ")", ";", "ACCESSOR_CACHE", ".", "put", "(", "key", ",", "accessor", ")", ";", "}", "return", "accessor", ";", "}" ]
Returns an Accessor for the given accessor method. The method must be externally validated to ensure that it accepts zero arguments and does not return void.class.
[ "Returns", "an", "Accessor", "for", "the", "given", "accessor", "method", ".", "The", "method", "must", "be", "externally", "validated", "to", "ensure", "that", "it", "accepts", "zero", "arguments", "and", "does", "not", "return", "void", ".", "class", "." ]
train
https://github.com/modelmapper/modelmapper/blob/491d165ded9dc9aba7ce8b56984249e1a1363204/core/src/main/java/org/modelmapper/internal/PropertyInfoRegistry.java#L98-L108
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/qe/StorableIndexSet.java
StorableIndexSet.addIndexes
public void addIndexes(StorableInfo<S> info, Direction defaultDirection) { """ Adds all the indexes of the given storable. @param defaultDirection default ordering direction to apply to each index property @throws IllegalArgumentException if any argument is null """ for (int i=info.getIndexCount(); --i>=0; ) { add(info.getIndex(i).setDefaultDirection(defaultDirection)); } }
java
public void addIndexes(StorableInfo<S> info, Direction defaultDirection) { for (int i=info.getIndexCount(); --i>=0; ) { add(info.getIndex(i).setDefaultDirection(defaultDirection)); } }
[ "public", "void", "addIndexes", "(", "StorableInfo", "<", "S", ">", "info", ",", "Direction", "defaultDirection", ")", "{", "for", "(", "int", "i", "=", "info", ".", "getIndexCount", "(", ")", ";", "--", "i", ">=", "0", ";", ")", "{", "add", "(", "info", ".", "getIndex", "(", "i", ")", ".", "setDefaultDirection", "(", "defaultDirection", ")", ")", ";", "}", "}" ]
Adds all the indexes of the given storable. @param defaultDirection default ordering direction to apply to each index property @throws IllegalArgumentException if any argument is null
[ "Adds", "all", "the", "indexes", "of", "the", "given", "storable", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/qe/StorableIndexSet.java#L86-L90
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/transform/analysis/DataAnalysis.java
DataAnalysis.fromJson
public static DataAnalysis fromJson(String json) { """ Deserialize a JSON DataAnalysis String that was previously serialized with {@link #toJson()} """ try{ return new JsonSerializer().getObjectMapper().readValue(json, DataAnalysis.class); } catch (Exception e){ //Legacy format ObjectMapper om = new JsonSerializer().getObjectMapper(); return fromMapper(om, json); } }
java
public static DataAnalysis fromJson(String json) { try{ return new JsonSerializer().getObjectMapper().readValue(json, DataAnalysis.class); } catch (Exception e){ //Legacy format ObjectMapper om = new JsonSerializer().getObjectMapper(); return fromMapper(om, json); } }
[ "public", "static", "DataAnalysis", "fromJson", "(", "String", "json", ")", "{", "try", "{", "return", "new", "JsonSerializer", "(", ")", ".", "getObjectMapper", "(", ")", ".", "readValue", "(", "json", ",", "DataAnalysis", ".", "class", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "//Legacy format", "ObjectMapper", "om", "=", "new", "JsonSerializer", "(", ")", ".", "getObjectMapper", "(", ")", ";", "return", "fromMapper", "(", "om", ",", "json", ")", ";", "}", "}" ]
Deserialize a JSON DataAnalysis String that was previously serialized with {@link #toJson()}
[ "Deserialize", "a", "JSON", "DataAnalysis", "String", "that", "was", "previously", "serialized", "with", "{" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/analysis/DataAnalysis.java#L116-L124
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java
WaybackRequest.createReplayRequest
public static WaybackRequest createReplayRequest(String url, String replay, String start, String end) { """ create WaybackRequet for Replay request. @param url target URL @param replay requested date @param start start timestamp (14-digit) @param end end timestamp (14-digit) @return WaybackRequet """ WaybackRequest r = new WaybackRequest(); r.setReplayRequest(); r.setRequestUrl(url); r.setReplayTimestamp(replay); r.setStartTimestamp(start); r.setEndTimestamp(end); return r; }
java
public static WaybackRequest createReplayRequest(String url, String replay, String start, String end) { WaybackRequest r = new WaybackRequest(); r.setReplayRequest(); r.setRequestUrl(url); r.setReplayTimestamp(replay); r.setStartTimestamp(start); r.setEndTimestamp(end); return r; }
[ "public", "static", "WaybackRequest", "createReplayRequest", "(", "String", "url", ",", "String", "replay", ",", "String", "start", ",", "String", "end", ")", "{", "WaybackRequest", "r", "=", "new", "WaybackRequest", "(", ")", ";", "r", ".", "setReplayRequest", "(", ")", ";", "r", ".", "setRequestUrl", "(", "url", ")", ";", "r", ".", "setReplayTimestamp", "(", "replay", ")", ";", "r", ".", "setStartTimestamp", "(", "start", ")", ";", "r", ".", "setEndTimestamp", "(", "end", ")", ";", "return", "r", ";", "}" ]
create WaybackRequet for Replay request. @param url target URL @param replay requested date @param start start timestamp (14-digit) @param end end timestamp (14-digit) @return WaybackRequet
[ "create", "WaybackRequet", "for", "Replay", "request", "." ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java#L503-L511
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/AcroFields.java
AcroFields.extractRevision
public InputStream extractRevision(String field) throws IOException { """ Extracts a revision from the document. @param field the signature field name @return an <CODE>InputStream</CODE> covering the revision. Returns <CODE>null</CODE> if it's not a signature field @throws IOException on error """ getSignatureNames(); field = getTranslatedFieldName(field); if (!sigNames.containsKey(field)) return null; int length = ((int[])sigNames.get(field))[0]; RandomAccessFileOrArray raf = reader.getSafeFile(); raf.reOpen(); raf.seek(0); return new RevisionStream(raf, length); }
java
public InputStream extractRevision(String field) throws IOException { getSignatureNames(); field = getTranslatedFieldName(field); if (!sigNames.containsKey(field)) return null; int length = ((int[])sigNames.get(field))[0]; RandomAccessFileOrArray raf = reader.getSafeFile(); raf.reOpen(); raf.seek(0); return new RevisionStream(raf, length); }
[ "public", "InputStream", "extractRevision", "(", "String", "field", ")", "throws", "IOException", "{", "getSignatureNames", "(", ")", ";", "field", "=", "getTranslatedFieldName", "(", "field", ")", ";", "if", "(", "!", "sigNames", ".", "containsKey", "(", "field", ")", ")", "return", "null", ";", "int", "length", "=", "(", "(", "int", "[", "]", ")", "sigNames", ".", "get", "(", "field", ")", ")", "[", "0", "]", ";", "RandomAccessFileOrArray", "raf", "=", "reader", ".", "getSafeFile", "(", ")", ";", "raf", ".", "reOpen", "(", ")", ";", "raf", ".", "seek", "(", "0", ")", ";", "return", "new", "RevisionStream", "(", "raf", ",", "length", ")", ";", "}" ]
Extracts a revision from the document. @param field the signature field name @return an <CODE>InputStream</CODE> covering the revision. Returns <CODE>null</CODE> if it's not a signature field @throws IOException on error
[ "Extracts", "a", "revision", "from", "the", "document", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/AcroFields.java#L2280-L2290
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneId.java
ZoneId.of
static ZoneId of(String zoneId, boolean checkAvailable) { """ Parses the ID, taking a flag to indicate whether {@code ZoneRulesException} should be thrown or not, used in deserialization. @param zoneId the time-zone ID, not null @param checkAvailable whether to check if the zone ID is available @return the zone ID, not null @throws DateTimeException if the ID format is invalid @throws ZoneRulesException if checking availability and the ID cannot be found """ Objects.requireNonNull(zoneId, "zoneId"); if (zoneId.length() <= 1 || zoneId.startsWith("+") || zoneId.startsWith("-")) { return ZoneOffset.of(zoneId); } else if (zoneId.startsWith("UTC") || zoneId.startsWith("GMT")) { return ofWithPrefix(zoneId, 3, checkAvailable); } else if (zoneId.startsWith("UT")) { return ofWithPrefix(zoneId, 2, checkAvailable); } return ZoneRegion.ofId(zoneId, checkAvailable); }
java
static ZoneId of(String zoneId, boolean checkAvailable) { Objects.requireNonNull(zoneId, "zoneId"); if (zoneId.length() <= 1 || zoneId.startsWith("+") || zoneId.startsWith("-")) { return ZoneOffset.of(zoneId); } else if (zoneId.startsWith("UTC") || zoneId.startsWith("GMT")) { return ofWithPrefix(zoneId, 3, checkAvailable); } else if (zoneId.startsWith("UT")) { return ofWithPrefix(zoneId, 2, checkAvailable); } return ZoneRegion.ofId(zoneId, checkAvailable); }
[ "static", "ZoneId", "of", "(", "String", "zoneId", ",", "boolean", "checkAvailable", ")", "{", "Objects", ".", "requireNonNull", "(", "zoneId", ",", "\"zoneId\"", ")", ";", "if", "(", "zoneId", ".", "length", "(", ")", "<=", "1", "||", "zoneId", ".", "startsWith", "(", "\"+\"", ")", "||", "zoneId", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "return", "ZoneOffset", ".", "of", "(", "zoneId", ")", ";", "}", "else", "if", "(", "zoneId", ".", "startsWith", "(", "\"UTC\"", ")", "||", "zoneId", ".", "startsWith", "(", "\"GMT\"", ")", ")", "{", "return", "ofWithPrefix", "(", "zoneId", ",", "3", ",", "checkAvailable", ")", ";", "}", "else", "if", "(", "zoneId", ".", "startsWith", "(", "\"UT\"", ")", ")", "{", "return", "ofWithPrefix", "(", "zoneId", ",", "2", ",", "checkAvailable", ")", ";", "}", "return", "ZoneRegion", ".", "ofId", "(", "zoneId", ",", "checkAvailable", ")", ";", "}" ]
Parses the ID, taking a flag to indicate whether {@code ZoneRulesException} should be thrown or not, used in deserialization. @param zoneId the time-zone ID, not null @param checkAvailable whether to check if the zone ID is available @return the zone ID, not null @throws DateTimeException if the ID format is invalid @throws ZoneRulesException if checking availability and the ID cannot be found
[ "Parses", "the", "ID", "taking", "a", "flag", "to", "indicate", "whether", "{", "@code", "ZoneRulesException", "}", "should", "be", "thrown", "or", "not", "used", "in", "deserialization", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneId.java#L410-L420
kiegroup/droolsjbpm-knowledge
kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java
CommandFactory.newInsertElements
public static Command newInsertElements(Collection objects, String outIdentifier, boolean returnObject, String entryPoint) { """ Iterate and insert each of the elements of the Collection. @param objects The objects to insert @param outIdentifier Identifier to lookup the returned objects @param returnObject boolean to specify whether the inserted Collection is part of the ExecutionResults @param entryPoint Optional EntryPoint for the insertions @return """ return getCommandFactoryProvider().newInsertElements( objects, outIdentifier, returnObject, entryPoint ); }
java
public static Command newInsertElements(Collection objects, String outIdentifier, boolean returnObject, String entryPoint) { return getCommandFactoryProvider().newInsertElements( objects, outIdentifier, returnObject, entryPoint ); }
[ "public", "static", "Command", "newInsertElements", "(", "Collection", "objects", ",", "String", "outIdentifier", ",", "boolean", "returnObject", ",", "String", "entryPoint", ")", "{", "return", "getCommandFactoryProvider", "(", ")", ".", "newInsertElements", "(", "objects", ",", "outIdentifier", ",", "returnObject", ",", "entryPoint", ")", ";", "}" ]
Iterate and insert each of the elements of the Collection. @param objects The objects to insert @param outIdentifier Identifier to lookup the returned objects @param returnObject boolean to specify whether the inserted Collection is part of the ExecutionResults @param entryPoint Optional EntryPoint for the insertions @return
[ "Iterate", "and", "insert", "each", "of", "the", "elements", "of", "the", "Collection", "." ]
train
https://github.com/kiegroup/droolsjbpm-knowledge/blob/fbe6de817c9f27cd4f6ef07e808e5c7bc946d4e5/kie-internal/src/main/java/org/kie/internal/command/CommandFactory.java#L120-L122
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java
ModelsEngine.henderson
public static double henderson( double[][] data, int tp ) { """ Interpolates the width function in a given tp. @param data @param tp @return """ int rows = data.length; int j = 1, n = 0; double dt = 0, muno, mdue, a, b, x, y, ydue, s_uno, s_due, smax = 0, tstar; for( int i = 1; i < rows; i++ ) { if (data[i][0] + tp <= data[(rows - 1)][0]) { /** * ***trovo parametri geometrici del segmento di retta y=muno * x+a****** */ muno = (data[i][1] - data[(i - 1)][1]) / (data[i][0] - data[(i - 1)][0]); a = data[i][1] - (data[i][0] + tp) * muno; /** * ***trovo i valori di x per l'intersezione tra y=(muno x+tp)+a * e y=mdue x+b ****** */ for( j = 1; j <= (rows - 1); j++ ) { mdue = (data[j][1] - data[(j - 1)][1]) / (data[j][0] - data[(j - 1)][0]); b = data[j][1] - data[j][0] * mdue; x = (a - b) / (mdue - muno); y = muno * x + a; if (x >= data[(j - 1)][0] && x <= data[j][0] && x - tp >= data[(i - 1)][0] && x - tp <= data[i][0]) { ydue = width_interpolate(data, x - tp, 0, 1); n++; s_uno = width_interpolate(data, x - tp, 0, 2); s_due = width_interpolate(data, x, 0, 2); if (s_due - s_uno > smax) { smax = s_due - s_uno; dt = x - tp; tstar = x; } } } } } return dt; }
java
public static double henderson( double[][] data, int tp ) { int rows = data.length; int j = 1, n = 0; double dt = 0, muno, mdue, a, b, x, y, ydue, s_uno, s_due, smax = 0, tstar; for( int i = 1; i < rows; i++ ) { if (data[i][0] + tp <= data[(rows - 1)][0]) { /** * ***trovo parametri geometrici del segmento di retta y=muno * x+a****** */ muno = (data[i][1] - data[(i - 1)][1]) / (data[i][0] - data[(i - 1)][0]); a = data[i][1] - (data[i][0] + tp) * muno; /** * ***trovo i valori di x per l'intersezione tra y=(muno x+tp)+a * e y=mdue x+b ****** */ for( j = 1; j <= (rows - 1); j++ ) { mdue = (data[j][1] - data[(j - 1)][1]) / (data[j][0] - data[(j - 1)][0]); b = data[j][1] - data[j][0] * mdue; x = (a - b) / (mdue - muno); y = muno * x + a; if (x >= data[(j - 1)][0] && x <= data[j][0] && x - tp >= data[(i - 1)][0] && x - tp <= data[i][0]) { ydue = width_interpolate(data, x - tp, 0, 1); n++; s_uno = width_interpolate(data, x - tp, 0, 2); s_due = width_interpolate(data, x, 0, 2); if (s_due - s_uno > smax) { smax = s_due - s_uno; dt = x - tp; tstar = x; } } } } } return dt; }
[ "public", "static", "double", "henderson", "(", "double", "[", "]", "[", "]", "data", ",", "int", "tp", ")", "{", "int", "rows", "=", "data", ".", "length", ";", "int", "j", "=", "1", ",", "n", "=", "0", ";", "double", "dt", "=", "0", ",", "muno", ",", "mdue", ",", "a", ",", "b", ",", "x", ",", "y", ",", "ydue", ",", "s_uno", ",", "s_due", ",", "smax", "=", "0", ",", "tstar", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "rows", ";", "i", "++", ")", "{", "if", "(", "data", "[", "i", "]", "[", "0", "]", "+", "tp", "<=", "data", "[", "(", "rows", "-", "1", ")", "]", "[", "0", "]", ")", "{", "/**\n * ***trovo parametri geometrici del segmento di retta y=muno\n * x+a******\n */", "muno", "=", "(", "data", "[", "i", "]", "[", "1", "]", "-", "data", "[", "(", "i", "-", "1", ")", "]", "[", "1", "]", ")", "/", "(", "data", "[", "i", "]", "[", "0", "]", "-", "data", "[", "(", "i", "-", "1", ")", "]", "[", "0", "]", ")", ";", "a", "=", "data", "[", "i", "]", "[", "1", "]", "-", "(", "data", "[", "i", "]", "[", "0", "]", "+", "tp", ")", "*", "muno", ";", "/**\n * ***trovo i valori di x per l'intersezione tra y=(muno x+tp)+a\n * e y=mdue x+b ******\n */", "for", "(", "j", "=", "1", ";", "j", "<=", "(", "rows", "-", "1", ")", ";", "j", "++", ")", "{", "mdue", "=", "(", "data", "[", "j", "]", "[", "1", "]", "-", "data", "[", "(", "j", "-", "1", ")", "]", "[", "1", "]", ")", "/", "(", "data", "[", "j", "]", "[", "0", "]", "-", "data", "[", "(", "j", "-", "1", ")", "]", "[", "0", "]", ")", ";", "b", "=", "data", "[", "j", "]", "[", "1", "]", "-", "data", "[", "j", "]", "[", "0", "]", "*", "mdue", ";", "x", "=", "(", "a", "-", "b", ")", "/", "(", "mdue", "-", "muno", ")", ";", "y", "=", "muno", "*", "x", "+", "a", ";", "if", "(", "x", ">=", "data", "[", "(", "j", "-", "1", ")", "]", "[", "0", "]", "&&", "x", "<=", "data", "[", "j", "]", "[", "0", "]", "&&", "x", "-", "tp", ">=", "data", "[", "(", "i", "-", "1", ")", "]", "[", "0", "]", "&&", "x", "-", "tp", "<=", "data", "[", "i", "]", "[", "0", "]", ")", "{", "ydue", "=", "width_interpolate", "(", "data", ",", "x", "-", "tp", ",", "0", ",", "1", ")", ";", "n", "++", ";", "s_uno", "=", "width_interpolate", "(", "data", ",", "x", "-", "tp", ",", "0", ",", "2", ")", ";", "s_due", "=", "width_interpolate", "(", "data", ",", "x", ",", "0", ",", "2", ")", ";", "if", "(", "s_due", "-", "s_uno", ">", "smax", ")", "{", "smax", "=", "s_due", "-", "s_uno", ";", "dt", "=", "x", "-", "tp", ";", "tstar", "=", "x", ";", "}", "}", "}", "}", "}", "return", "dt", ";", "}" ]
Interpolates the width function in a given tp. @param data @param tp @return
[ "Interpolates", "the", "width", "function", "in", "a", "given", "tp", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/ModelsEngine.java#L1041-L1091