repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
junit-team/junit4
src/main/java/org/junit/runner/Computer.java
Computer.getRunner
protected Runner getRunner(RunnerBuilder builder, Class<?> testClass) throws Throwable { """ Create a single-class runner for {@code testClass}, using {@code builder} """ return builder.runnerForClass(testClass); }
java
protected Runner getRunner(RunnerBuilder builder, Class<?> testClass) throws Throwable { return builder.runnerForClass(testClass); }
[ "protected", "Runner", "getRunner", "(", "RunnerBuilder", "builder", ",", "Class", "<", "?", ">", "testClass", ")", "throws", "Throwable", "{", "return", "builder", ".", "runnerForClass", "(", "testClass", ")", ";", "}" ]
Create a single-class runner for {@code testClass}, using {@code builder}
[ "Create", "a", "single", "-", "class", "runner", "for", "{" ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runner/Computer.java#L49-L51
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java
DataFrameJoiner.rightOuter
public Table rightOuter(Table table2, String[] col2Names) { """ Joins the joiner to the table2, using the given columns for the second table and returns the resulting table @param table2 The table to join with @param col2Names The columns to join on. If a name refers to a double column, the join is performed after rounding to integers. @return The resulting table """ return rightOuter(table2, false, col2Names); }
java
public Table rightOuter(Table table2, String[] col2Names) { return rightOuter(table2, false, col2Names); }
[ "public", "Table", "rightOuter", "(", "Table", "table2", ",", "String", "[", "]", "col2Names", ")", "{", "return", "rightOuter", "(", "table2", ",", "false", ",", "col2Names", ")", ";", "}" ]
Joins the joiner to the table2, using the given columns for the second table and returns the resulting table @param table2 The table to join with @param col2Names The columns to join on. If a name refers to a double column, the join is performed after rounding to integers. @return The resulting table
[ "Joins", "the", "joiner", "to", "the", "table2", "using", "the", "given", "columns", "for", "the", "second", "table", "and", "returns", "the", "resulting", "table" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/joining/DataFrameJoiner.java#L590-L592
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketUtil.java
WebSocketUtil.randomNumber
static int randomNumber(int minimum, int maximum) { """ Generates a pseudo-random number @param minimum The minimum allowable value @param maximum The maximum allowable value @return A pseudo-random number """ assert minimum < maximum; double fraction = PlatformDependent.threadLocalRandom().nextDouble(); // the idea here is that nextDouble gives us a random value // // 0 <= fraction <= 1 // // the distance from min to max declared as // // dist = max - min // // satisfies the following // // min + dist = max // // taking into account // // 0 <= fraction * dist <= dist // // we've got // // min <= min + fraction * dist <= max return (int) (minimum + fraction * (maximum - minimum)); }
java
static int randomNumber(int minimum, int maximum) { assert minimum < maximum; double fraction = PlatformDependent.threadLocalRandom().nextDouble(); // the idea here is that nextDouble gives us a random value // // 0 <= fraction <= 1 // // the distance from min to max declared as // // dist = max - min // // satisfies the following // // min + dist = max // // taking into account // // 0 <= fraction * dist <= dist // // we've got // // min <= min + fraction * dist <= max return (int) (minimum + fraction * (maximum - minimum)); }
[ "static", "int", "randomNumber", "(", "int", "minimum", ",", "int", "maximum", ")", "{", "assert", "minimum", "<", "maximum", ";", "double", "fraction", "=", "PlatformDependent", ".", "threadLocalRandom", "(", ")", ".", "nextDouble", "(", ")", ";", "// the idea here is that nextDouble gives us a random value", "//", "// 0 <= fraction <= 1", "//", "// the distance from min to max declared as", "//", "// dist = max - min", "//", "// satisfies the following", "//", "// min + dist = max", "//", "// taking into account", "//", "// 0 <= fraction * dist <= dist", "//", "// we've got", "//", "// min <= min + fraction * dist <= max", "return", "(", "int", ")", "(", "minimum", "+", "fraction", "*", "(", "maximum", "-", "minimum", ")", ")", ";", "}" ]
Generates a pseudo-random number @param minimum The minimum allowable value @param maximum The maximum allowable value @return A pseudo-random number
[ "Generates", "a", "pseudo", "-", "random", "number" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketUtil.java#L120-L144
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java
TaskSlotTable.isValidTimeout
public boolean isValidTimeout(AllocationID allocationId, UUID ticket) { """ Check whether the timeout with ticket is valid for the given allocation id. @param allocationId to check against @param ticket of the timeout @return True if the timeout is valid; otherwise false """ checkInit(); return timerService.isValid(allocationId, ticket); }
java
public boolean isValidTimeout(AllocationID allocationId, UUID ticket) { checkInit(); return timerService.isValid(allocationId, ticket); }
[ "public", "boolean", "isValidTimeout", "(", "AllocationID", "allocationId", ",", "UUID", "ticket", ")", "{", "checkInit", "(", ")", ";", "return", "timerService", ".", "isValid", "(", "allocationId", ",", "ticket", ")", ";", "}" ]
Check whether the timeout with ticket is valid for the given allocation id. @param allocationId to check against @param ticket of the timeout @return True if the timeout is valid; otherwise false
[ "Check", "whether", "the", "timeout", "with", "ticket", "is", "valid", "for", "the", "given", "allocation", "id", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/taskexecutor/slot/TaskSlotTable.java#L361-L365
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecCollector.java
CodecCollector.computeTermvectorNumberBasic
private static TermvectorNumberBasic computeTermvectorNumberBasic( List<Integer> docSet, int termDocId, TermsEnum termsEnum, LeafReader r, LeafReaderContext lrc, PostingsEnum postingsEnum) throws IOException { """ Compute termvector number basic. @param docSet the doc set @param termDocId the term doc id @param termsEnum the terms enum @param r the r @param lrc the lrc @param postingsEnum the postings enum @return the termvector number basic @throws IOException Signals that an I/O exception has occurred. """ TermvectorNumberBasic result = new TermvectorNumberBasic(); boolean hasDeletedDocuments = (r.getLiveDocs() != null); if ((docSet.size() == r.numDocs()) && !hasDeletedDocuments) { try { return computeTermvectorNumberBasic(termsEnum, r); } catch (IOException e) { log.debug("problem", e); // problem } } result.docNumber = 0; result.valueSum[0] = 0; int localTermDocId = termDocId; Iterator<Integer> docIterator = docSet.iterator(); postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.FREQS); int docId; while (docIterator.hasNext()) { docId = docIterator.next() - lrc.docBase; if (docId >= localTermDocId && ((docId == localTermDocId) || ((localTermDocId = postingsEnum.advance(docId)) == docId))) { result.docNumber++; result.valueSum[0] += postingsEnum.freq(); } if (localTermDocId == DocIdSetIterator.NO_MORE_DOCS) { break; } } return result; }
java
private static TermvectorNumberBasic computeTermvectorNumberBasic( List<Integer> docSet, int termDocId, TermsEnum termsEnum, LeafReader r, LeafReaderContext lrc, PostingsEnum postingsEnum) throws IOException { TermvectorNumberBasic result = new TermvectorNumberBasic(); boolean hasDeletedDocuments = (r.getLiveDocs() != null); if ((docSet.size() == r.numDocs()) && !hasDeletedDocuments) { try { return computeTermvectorNumberBasic(termsEnum, r); } catch (IOException e) { log.debug("problem", e); // problem } } result.docNumber = 0; result.valueSum[0] = 0; int localTermDocId = termDocId; Iterator<Integer> docIterator = docSet.iterator(); postingsEnum = termsEnum.postings(postingsEnum, PostingsEnum.FREQS); int docId; while (docIterator.hasNext()) { docId = docIterator.next() - lrc.docBase; if (docId >= localTermDocId && ((docId == localTermDocId) || ((localTermDocId = postingsEnum.advance(docId)) == docId))) { result.docNumber++; result.valueSum[0] += postingsEnum.freq(); } if (localTermDocId == DocIdSetIterator.NO_MORE_DOCS) { break; } } return result; }
[ "private", "static", "TermvectorNumberBasic", "computeTermvectorNumberBasic", "(", "List", "<", "Integer", ">", "docSet", ",", "int", "termDocId", ",", "TermsEnum", "termsEnum", ",", "LeafReader", "r", ",", "LeafReaderContext", "lrc", ",", "PostingsEnum", "postingsEnum", ")", "throws", "IOException", "{", "TermvectorNumberBasic", "result", "=", "new", "TermvectorNumberBasic", "(", ")", ";", "boolean", "hasDeletedDocuments", "=", "(", "r", ".", "getLiveDocs", "(", ")", "!=", "null", ")", ";", "if", "(", "(", "docSet", ".", "size", "(", ")", "==", "r", ".", "numDocs", "(", ")", ")", "&&", "!", "hasDeletedDocuments", ")", "{", "try", "{", "return", "computeTermvectorNumberBasic", "(", "termsEnum", ",", "r", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "log", ".", "debug", "(", "\"problem\"", ",", "e", ")", ";", "// problem", "}", "}", "result", ".", "docNumber", "=", "0", ";", "result", ".", "valueSum", "[", "0", "]", "=", "0", ";", "int", "localTermDocId", "=", "termDocId", ";", "Iterator", "<", "Integer", ">", "docIterator", "=", "docSet", ".", "iterator", "(", ")", ";", "postingsEnum", "=", "termsEnum", ".", "postings", "(", "postingsEnum", ",", "PostingsEnum", ".", "FREQS", ")", ";", "int", "docId", ";", "while", "(", "docIterator", ".", "hasNext", "(", ")", ")", "{", "docId", "=", "docIterator", ".", "next", "(", ")", "-", "lrc", ".", "docBase", ";", "if", "(", "docId", ">=", "localTermDocId", "&&", "(", "(", "docId", "==", "localTermDocId", ")", "||", "(", "(", "localTermDocId", "=", "postingsEnum", ".", "advance", "(", "docId", ")", ")", "==", "docId", ")", ")", ")", "{", "result", ".", "docNumber", "++", ";", "result", ".", "valueSum", "[", "0", "]", "+=", "postingsEnum", ".", "freq", "(", ")", ";", "}", "if", "(", "localTermDocId", "==", "DocIdSetIterator", ".", "NO_MORE_DOCS", ")", "{", "break", ";", "}", "}", "return", "result", ";", "}" ]
Compute termvector number basic. @param docSet the doc set @param termDocId the term doc id @param termsEnum the terms enum @param r the r @param lrc the lrc @param postingsEnum the postings enum @return the termvector number basic @throws IOException Signals that an I/O exception has occurred.
[ "Compute", "termvector", "number", "basic", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecCollector.java#L4163-L4194
ManfredTremmel/gwt-bean-validators
gwt-bean-validators/src/main/java/de/knightsoftnet/validators/rebind/BeanHelperCache.java
BeanHelperCache.createHelper
BeanHelper createHelper(final JClassType pjtype, final TreeLogger plogger, final GeneratorContext pcontext) throws UnableToCompleteException { """ Creates a BeanHelper and writes an interface containing its instance. Also, recursively creates any BeanHelpers on its constrained properties. """ final JClassType erasedType = pjtype.getErasedType(); try { final Class<?> clazz = Class.forName(erasedType.getQualifiedBinaryName()); return doCreateHelper(clazz, erasedType, plogger, pcontext); } catch (final ClassNotFoundException e) { plogger.log(TreeLogger.ERROR, "Unable to create BeanHelper for " + erasedType, e); throw new UnableToCompleteException(); // NOPMD } }
java
BeanHelper createHelper(final JClassType pjtype, final TreeLogger plogger, final GeneratorContext pcontext) throws UnableToCompleteException { final JClassType erasedType = pjtype.getErasedType(); try { final Class<?> clazz = Class.forName(erasedType.getQualifiedBinaryName()); return doCreateHelper(clazz, erasedType, plogger, pcontext); } catch (final ClassNotFoundException e) { plogger.log(TreeLogger.ERROR, "Unable to create BeanHelper for " + erasedType, e); throw new UnableToCompleteException(); // NOPMD } }
[ "BeanHelper", "createHelper", "(", "final", "JClassType", "pjtype", ",", "final", "TreeLogger", "plogger", ",", "final", "GeneratorContext", "pcontext", ")", "throws", "UnableToCompleteException", "{", "final", "JClassType", "erasedType", "=", "pjtype", ".", "getErasedType", "(", ")", ";", "try", "{", "final", "Class", "<", "?", ">", "clazz", "=", "Class", ".", "forName", "(", "erasedType", ".", "getQualifiedBinaryName", "(", ")", ")", ";", "return", "doCreateHelper", "(", "clazz", ",", "erasedType", ",", "plogger", ",", "pcontext", ")", ";", "}", "catch", "(", "final", "ClassNotFoundException", "e", ")", "{", "plogger", ".", "log", "(", "TreeLogger", ".", "ERROR", ",", "\"Unable to create BeanHelper for \"", "+", "erasedType", ",", "e", ")", ";", "throw", "new", "UnableToCompleteException", "(", ")", ";", "// NOPMD", "}", "}" ]
Creates a BeanHelper and writes an interface containing its instance. Also, recursively creates any BeanHelpers on its constrained properties.
[ "Creates", "a", "BeanHelper", "and", "writes", "an", "interface", "containing", "its", "instance", ".", "Also", "recursively", "creates", "any", "BeanHelpers", "on", "its", "constrained", "properties", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/java/de/knightsoftnet/validators/rebind/BeanHelperCache.java#L84-L94
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ConfigurationStore.java
ConfigurationStore.deserializeConfigurationData
ExtendedConfigurationImpl deserializeConfigurationData(String pid) throws IOException { """ If a serialized file does not exist, a null is returned. If a serialized file exists for the given pid, it deserializes configuration dictionary and bound location and returns in an array of size 2. Index 0 of returning array contains configuration dictionary. Index 1 of returning array contains bound bundle location in String Index 2 of returning array contains whether Meta-Type processsing was done or not (if CMConstants.METATYPE_PROCESSED, then yes. if null, then no.) @param pid """ ExtendedConfigurationImpl config = null; File configFile = persistedConfig.getConfigFile(pid); if (configFile != null) { if (configFile.length() > 0) { FileInputStream fis = null; ObjectInputStream ois = null; try { fis = new FileInputStream(configFile); ois = new ObjectInputStream(new BufferedInputStream(fis)); @SuppressWarnings("unchecked") Dictionary<String, Object> d = (Dictionary<String, Object>) ois.readObject(); String location; location = (String) ois.readObject(); ois.readBoolean(); @SuppressWarnings("unchecked") Set<ConfigID> references = (Set<ConfigID>) ois.readObject(); @SuppressWarnings("unchecked") Set<String> uniqueVariables = (Set<String>) ois.readObject(); String factoryPid = (String) d.get(ConfigurationAdmin.SERVICE_FACTORYPID); VariableRegistry variableRegistry = caFactory.getVariableRegistry(); for (String variable : uniqueVariables) { variableRegistry.addVariable(variable, ConfigAdminConstants.VAR_IN_USE); } config = new ExtendedConfigurationImpl(caFactory, location, factoryPid, pid, d, references, uniqueVariables); } catch (ClassNotFoundException e) { throw new IOException(e); } finally { ConfigUtil.closeIO(ois); ConfigUtil.closeIO(fis); } } } return config; }
java
ExtendedConfigurationImpl deserializeConfigurationData(String pid) throws IOException { ExtendedConfigurationImpl config = null; File configFile = persistedConfig.getConfigFile(pid); if (configFile != null) { if (configFile.length() > 0) { FileInputStream fis = null; ObjectInputStream ois = null; try { fis = new FileInputStream(configFile); ois = new ObjectInputStream(new BufferedInputStream(fis)); @SuppressWarnings("unchecked") Dictionary<String, Object> d = (Dictionary<String, Object>) ois.readObject(); String location; location = (String) ois.readObject(); ois.readBoolean(); @SuppressWarnings("unchecked") Set<ConfigID> references = (Set<ConfigID>) ois.readObject(); @SuppressWarnings("unchecked") Set<String> uniqueVariables = (Set<String>) ois.readObject(); String factoryPid = (String) d.get(ConfigurationAdmin.SERVICE_FACTORYPID); VariableRegistry variableRegistry = caFactory.getVariableRegistry(); for (String variable : uniqueVariables) { variableRegistry.addVariable(variable, ConfigAdminConstants.VAR_IN_USE); } config = new ExtendedConfigurationImpl(caFactory, location, factoryPid, pid, d, references, uniqueVariables); } catch (ClassNotFoundException e) { throw new IOException(e); } finally { ConfigUtil.closeIO(ois); ConfigUtil.closeIO(fis); } } } return config; }
[ "ExtendedConfigurationImpl", "deserializeConfigurationData", "(", "String", "pid", ")", "throws", "IOException", "{", "ExtendedConfigurationImpl", "config", "=", "null", ";", "File", "configFile", "=", "persistedConfig", ".", "getConfigFile", "(", "pid", ")", ";", "if", "(", "configFile", "!=", "null", ")", "{", "if", "(", "configFile", ".", "length", "(", ")", ">", "0", ")", "{", "FileInputStream", "fis", "=", "null", ";", "ObjectInputStream", "ois", "=", "null", ";", "try", "{", "fis", "=", "new", "FileInputStream", "(", "configFile", ")", ";", "ois", "=", "new", "ObjectInputStream", "(", "new", "BufferedInputStream", "(", "fis", ")", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Dictionary", "<", "String", ",", "Object", ">", "d", "=", "(", "Dictionary", "<", "String", ",", "Object", ">", ")", "ois", ".", "readObject", "(", ")", ";", "String", "location", ";", "location", "=", "(", "String", ")", "ois", ".", "readObject", "(", ")", ";", "ois", ".", "readBoolean", "(", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Set", "<", "ConfigID", ">", "references", "=", "(", "Set", "<", "ConfigID", ">", ")", "ois", ".", "readObject", "(", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Set", "<", "String", ">", "uniqueVariables", "=", "(", "Set", "<", "String", ">", ")", "ois", ".", "readObject", "(", ")", ";", "String", "factoryPid", "=", "(", "String", ")", "d", ".", "get", "(", "ConfigurationAdmin", ".", "SERVICE_FACTORYPID", ")", ";", "VariableRegistry", "variableRegistry", "=", "caFactory", ".", "getVariableRegistry", "(", ")", ";", "for", "(", "String", "variable", ":", "uniqueVariables", ")", "{", "variableRegistry", ".", "addVariable", "(", "variable", ",", "ConfigAdminConstants", ".", "VAR_IN_USE", ")", ";", "}", "config", "=", "new", "ExtendedConfigurationImpl", "(", "caFactory", ",", "location", ",", "factoryPid", ",", "pid", ",", "d", ",", "references", ",", "uniqueVariables", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "IOException", "(", "e", ")", ";", "}", "finally", "{", "ConfigUtil", ".", "closeIO", "(", "ois", ")", ";", "ConfigUtil", ".", "closeIO", "(", "fis", ")", ";", "}", "}", "}", "return", "config", ";", "}" ]
If a serialized file does not exist, a null is returned. If a serialized file exists for the given pid, it deserializes configuration dictionary and bound location and returns in an array of size 2. Index 0 of returning array contains configuration dictionary. Index 1 of returning array contains bound bundle location in String Index 2 of returning array contains whether Meta-Type processsing was done or not (if CMConstants.METATYPE_PROCESSED, then yes. if null, then no.) @param pid
[ "If", "a", "serialized", "file", "does", "not", "exist", "a", "null", "is", "returned", ".", "If", "a", "serialized", "file", "exists", "for", "the", "given", "pid", "it", "deserializes", "configuration", "dictionary", "and", "bound", "location", "and", "returns", "in", "an", "array", "of", "size", "2", ".", "Index", "0", "of", "returning", "array", "contains", "configuration", "dictionary", ".", "Index", "1", "of", "returning", "array", "contains", "bound", "bundle", "location", "in", "String", "Index", "2", "of", "returning", "array", "contains", "whether", "Meta", "-", "Type", "processsing", "was", "done", "or", "not", "(", "if", "CMConstants", ".", "METATYPE_PROCESSED", "then", "yes", ".", "if", "null", "then", "no", ".", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/admin/internal/ConfigurationStore.java#L230-L270
netty/netty
transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java
EpollSocketChannelConfig.setTcpMd5Sig
public EpollSocketChannelConfig setTcpMd5Sig(Map<InetAddress, byte[]> keys) { """ Set the {@code TCP_MD5SIG} option on the socket. See {@code linux/tcp.h} for more details. Keys can only be set on, not read to prevent a potential leak, as they are confidential. Allowing them being read would mean anyone with access to the channel could get them. """ try { ((EpollSocketChannel) channel).setTcpMd5Sig(keys); return this; } catch (IOException e) { throw new ChannelException(e); } }
java
public EpollSocketChannelConfig setTcpMd5Sig(Map<InetAddress, byte[]> keys) { try { ((EpollSocketChannel) channel).setTcpMd5Sig(keys); return this; } catch (IOException e) { throw new ChannelException(e); } }
[ "public", "EpollSocketChannelConfig", "setTcpMd5Sig", "(", "Map", "<", "InetAddress", ",", "byte", "[", "]", ">", "keys", ")", "{", "try", "{", "(", "(", "EpollSocketChannel", ")", "channel", ")", ".", "setTcpMd5Sig", "(", "keys", ")", ";", "return", "this", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "ChannelException", "(", "e", ")", ";", "}", "}" ]
Set the {@code TCP_MD5SIG} option on the socket. See {@code linux/tcp.h} for more details. Keys can only be set on, not read to prevent a potential leak, as they are confidential. Allowing them being read would mean anyone with access to the channel could get them.
[ "Set", "the", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollSocketChannelConfig.java#L518-L525
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getRegexEntityInfos
public List<RegexEntityExtractor> getRegexEntityInfos(UUID appId, String versionId, GetRegexEntityInfosOptionalParameter getRegexEntityInfosOptionalParameter) { """ Gets information about the regex entity models. @param appId The application ID. @param versionId The version ID. @param getRegexEntityInfosOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;RegexEntityExtractor&gt; object if successful. """ return getRegexEntityInfosWithServiceResponseAsync(appId, versionId, getRegexEntityInfosOptionalParameter).toBlocking().single().body(); }
java
public List<RegexEntityExtractor> getRegexEntityInfos(UUID appId, String versionId, GetRegexEntityInfosOptionalParameter getRegexEntityInfosOptionalParameter) { return getRegexEntityInfosWithServiceResponseAsync(appId, versionId, getRegexEntityInfosOptionalParameter).toBlocking().single().body(); }
[ "public", "List", "<", "RegexEntityExtractor", ">", "getRegexEntityInfos", "(", "UUID", "appId", ",", "String", "versionId", ",", "GetRegexEntityInfosOptionalParameter", "getRegexEntityInfosOptionalParameter", ")", "{", "return", "getRegexEntityInfosWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "getRegexEntityInfosOptionalParameter", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Gets information about the regex entity models. @param appId The application ID. @param versionId The version ID. @param getRegexEntityInfosOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;RegexEntityExtractor&gt; object if successful.
[ "Gets", "information", "about", "the", "regex", "entity", "models", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L7120-L7122
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CfInterfaceCodeGen.java
CfInterfaceCodeGen.writeConnection
private void writeConnection(Definition def, Writer out, int indent) throws IOException { """ Output Connection method @param def definition @param out Writer @param indent space number @throws IOException ioException """ writeWithIndent(out, indent, "/** \n"); writeWithIndent(out, indent, " * Get connection from factory\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " instance\n"); writeWithIndent(out, indent, " * @exception ResourceException Thrown if a connection can't be obtained\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " getConnection() throws ResourceException;\n"); }
java
private void writeConnection(Definition def, Writer out, int indent) throws IOException { writeWithIndent(out, indent, "/** \n"); writeWithIndent(out, indent, " * Get connection from factory\n"); writeWithIndent(out, indent, " *\n"); writeWithIndent(out, indent, " * @return " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " instance\n"); writeWithIndent(out, indent, " * @exception ResourceException Thrown if a connection can't be obtained\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + def.getMcfDefs().get(getNumOfMcf()).getConnInterfaceClass() + " getConnection() throws ResourceException;\n"); }
[ "private", "void", "writeConnection", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ")", "throws", "IOException", "{", "writeWithIndent", "(", "out", ",", "indent", ",", "\"/** \\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * Get connection from factory\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" *\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @return \"", "+", "def", ".", "getMcfDefs", "(", ")", ".", "get", "(", "getNumOfMcf", "(", ")", ")", ".", "getConnInterfaceClass", "(", ")", "+", "\" instance\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" * @exception ResourceException Thrown if a connection can't be obtained\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\" */\\n\"", ")", ";", "writeWithIndent", "(", "out", ",", "indent", ",", "\"public \"", "+", "def", ".", "getMcfDefs", "(", ")", ".", "get", "(", "getNumOfMcf", "(", ")", ")", ".", "getConnInterfaceClass", "(", ")", "+", "\" getConnection() throws ResourceException;\\n\"", ")", ";", "}" ]
Output Connection method @param def definition @param out Writer @param indent space number @throws IOException ioException
[ "Output", "Connection", "method" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/CfInterfaceCodeGen.java#L91-L103
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/GenericAuditEventMessageImpl.java
GenericAuditEventMessageImpl.setAuditSourceId
public void setAuditSourceId(String sourceId, String enterpriseSiteId, RFC3881AuditSourceTypeCodes[] typeCodes) { """ Sets a Audit Source Identification block for a given Audit Source ID, Audit Source Enterprise Site ID, and a list of audit source type codes @param sourceId The Audit Source ID to use @param enterpriseSiteId The Audit Enterprise Site ID to use @param typeCodes The RFC 3881 Audit Source Type codes to use @deprecated use {@link #setAuditSourceId(String, String, RFC3881AuditSourceTypes[])} """ addAuditSourceIdentification(sourceId, enterpriseSiteId, typeCodes); }
java
public void setAuditSourceId(String sourceId, String enterpriseSiteId, RFC3881AuditSourceTypeCodes[] typeCodes) { addAuditSourceIdentification(sourceId, enterpriseSiteId, typeCodes); }
[ "public", "void", "setAuditSourceId", "(", "String", "sourceId", ",", "String", "enterpriseSiteId", ",", "RFC3881AuditSourceTypeCodes", "[", "]", "typeCodes", ")", "{", "addAuditSourceIdentification", "(", "sourceId", ",", "enterpriseSiteId", ",", "typeCodes", ")", ";", "}" ]
Sets a Audit Source Identification block for a given Audit Source ID, Audit Source Enterprise Site ID, and a list of audit source type codes @param sourceId The Audit Source ID to use @param enterpriseSiteId The Audit Enterprise Site ID to use @param typeCodes The RFC 3881 Audit Source Type codes to use @deprecated use {@link #setAuditSourceId(String, String, RFC3881AuditSourceTypes[])}
[ "Sets", "a", "Audit", "Source", "Identification", "block", "for", "a", "given", "Audit", "Source", "ID", "Audit", "Source", "Enterprise", "Site", "ID", "and", "a", "list", "of", "audit", "source", "type", "codes", "@param", "sourceId", "The", "Audit", "Source", "ID", "to", "use", "@param", "enterpriseSiteId", "The", "Audit", "Enterprise", "Site", "ID", "to", "use", "@param", "typeCodes", "The", "RFC", "3881", "Audit", "Source", "Type", "codes", "to", "use" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/GenericAuditEventMessageImpl.java#L91-L94
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/Validate.java
Validate.isInstanceOf
@GwtIncompatible("incompatible method") public static void isInstanceOf(final Class<?> type, final Object obj) { """ Validates that the argument is an instance of the specified class, if not throws an exception. <p>This method is useful when validating according to an arbitrary class</p> <pre>Validate.isInstanceOf(OkClass.class, object);</pre> <p>The message of the exception is &quot;Expected type: {type}, actual: {obj_type}&quot;</p> @param type the class the object must be validated against, not null @param obj the object to check, null throws an exception @throws IllegalArgumentException if argument is not of specified class @see #isInstanceOf(Class, Object, String, Object...) @since 3.0 """ // TODO when breaking BC, consider returning obj if (!type.isInstance(obj)) { throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_IS_INSTANCE_OF_EX_MESSAGE, type.getName(), obj == null ? "null" : obj.getClass().getName())); } }
java
@GwtIncompatible("incompatible method") public static void isInstanceOf(final Class<?> type, final Object obj) { // TODO when breaking BC, consider returning obj if (!type.isInstance(obj)) { throw new IllegalArgumentException(StringUtils.simpleFormat(DEFAULT_IS_INSTANCE_OF_EX_MESSAGE, type.getName(), obj == null ? "null" : obj.getClass().getName())); } }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "void", "isInstanceOf", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "Object", "obj", ")", "{", "// TODO when breaking BC, consider returning obj", "if", "(", "!", "type", ".", "isInstance", "(", "obj", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "StringUtils", ".", "simpleFormat", "(", "DEFAULT_IS_INSTANCE_OF_EX_MESSAGE", ",", "type", ".", "getName", "(", ")", ",", "obj", "==", "null", "?", "\"null\"", ":", "obj", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ")", ";", "}", "}" ]
Validates that the argument is an instance of the specified class, if not throws an exception. <p>This method is useful when validating according to an arbitrary class</p> <pre>Validate.isInstanceOf(OkClass.class, object);</pre> <p>The message of the exception is &quot;Expected type: {type}, actual: {obj_type}&quot;</p> @param type the class the object must be validated against, not null @param obj the object to check, null throws an exception @throws IllegalArgumentException if argument is not of specified class @see #isInstanceOf(Class, Object, String, Object...) @since 3.0
[ "Validates", "that", "the", "argument", "is", "an", "instance", "of", "the", "specified", "class", "if", "not", "throws", "an", "exception", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/Validate.java#L1266-L1273
javabits/yar
yar-api/src/main/java/org/javabits/yar/TimeoutException.java
TimeoutException.getTimeoutMessage
public static String getTimeoutMessage(long timeout, TimeUnit unit) { """ Utility method that produce the message of the timeout. @param timeout the maximum time to wait. @param unit the time unit of the timeout argument @return formatted string that contains the timeout information. """ return String.format("Timeout of %d %s reached", timeout, requireNonNull(unit, "unit")); }
java
public static String getTimeoutMessage(long timeout, TimeUnit unit) { return String.format("Timeout of %d %s reached", timeout, requireNonNull(unit, "unit")); }
[ "public", "static", "String", "getTimeoutMessage", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "return", "String", ".", "format", "(", "\"Timeout of %d %s reached\"", ",", "timeout", ",", "requireNonNull", "(", "unit", ",", "\"unit\"", ")", ")", ";", "}" ]
Utility method that produce the message of the timeout. @param timeout the maximum time to wait. @param unit the time unit of the timeout argument @return formatted string that contains the timeout information.
[ "Utility", "method", "that", "produce", "the", "message", "of", "the", "timeout", "." ]
train
https://github.com/javabits/yar/blob/e146a86611ca4831e8334c9a98fd7086cee9c03e/yar-api/src/main/java/org/javabits/yar/TimeoutException.java#L91-L93
igniterealtime/Smack
smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java
OpenPgpPubSubUtil.fetchPubkeysList
public static PublicKeysListElement fetchPubkeysList(XMPPConnection connection, BareJid contact) throws InterruptedException, XMPPException.XMPPErrorException, SmackException.NoResponseException, PubSubException.NotALeafNodeException, SmackException.NotConnectedException, PubSubException.NotAPubSubNodeException { """ Consult the public key metadata node of {@code contact} to fetch the list of their published OpenPGP public keys. @see <a href="https://xmpp.org/extensions/xep-0373.html#discover-pubkey-list"> XEP-0373 §4.3: Discovering Public Keys of a User</a> @param connection XMPP connection @param contact {@link BareJid} of the user we want to fetch the list from. @return content of {@code contact}'s metadata node. @throws InterruptedException if the thread gets interrupted. @throws XMPPException.XMPPErrorException in case of an XMPP protocol exception. @throws SmackException.NoResponseException in case the server doesn't respond @throws PubSubException.NotALeafNodeException in case the queried node is not a {@link LeafNode} @throws SmackException.NotConnectedException in case we are not connected @throws PubSubException.NotAPubSubNodeException in case the queried entity is not a PubSub node """ PubSubManager pm = PubSubManager.getInstanceFor(connection, contact); LeafNode node = getLeafNode(pm, PEP_NODE_PUBLIC_KEYS); List<PayloadItem<PublicKeysListElement>> list = node.getItems(1); if (list.isEmpty()) { return null; } return list.get(0).getPayload(); }
java
public static PublicKeysListElement fetchPubkeysList(XMPPConnection connection, BareJid contact) throws InterruptedException, XMPPException.XMPPErrorException, SmackException.NoResponseException, PubSubException.NotALeafNodeException, SmackException.NotConnectedException, PubSubException.NotAPubSubNodeException { PubSubManager pm = PubSubManager.getInstanceFor(connection, contact); LeafNode node = getLeafNode(pm, PEP_NODE_PUBLIC_KEYS); List<PayloadItem<PublicKeysListElement>> list = node.getItems(1); if (list.isEmpty()) { return null; } return list.get(0).getPayload(); }
[ "public", "static", "PublicKeysListElement", "fetchPubkeysList", "(", "XMPPConnection", "connection", ",", "BareJid", "contact", ")", "throws", "InterruptedException", ",", "XMPPException", ".", "XMPPErrorException", ",", "SmackException", ".", "NoResponseException", ",", "PubSubException", ".", "NotALeafNodeException", ",", "SmackException", ".", "NotConnectedException", ",", "PubSubException", ".", "NotAPubSubNodeException", "{", "PubSubManager", "pm", "=", "PubSubManager", ".", "getInstanceFor", "(", "connection", ",", "contact", ")", ";", "LeafNode", "node", "=", "getLeafNode", "(", "pm", ",", "PEP_NODE_PUBLIC_KEYS", ")", ";", "List", "<", "PayloadItem", "<", "PublicKeysListElement", ">", ">", "list", "=", "node", ".", "getItems", "(", "1", ")", ";", "if", "(", "list", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "return", "list", ".", "get", "(", "0", ")", ".", "getPayload", "(", ")", ";", "}" ]
Consult the public key metadata node of {@code contact} to fetch the list of their published OpenPGP public keys. @see <a href="https://xmpp.org/extensions/xep-0373.html#discover-pubkey-list"> XEP-0373 §4.3: Discovering Public Keys of a User</a> @param connection XMPP connection @param contact {@link BareJid} of the user we want to fetch the list from. @return content of {@code contact}'s metadata node. @throws InterruptedException if the thread gets interrupted. @throws XMPPException.XMPPErrorException in case of an XMPP protocol exception. @throws SmackException.NoResponseException in case the server doesn't respond @throws PubSubException.NotALeafNodeException in case the queried node is not a {@link LeafNode} @throws SmackException.NotConnectedException in case we are not connected @throws PubSubException.NotAPubSubNodeException in case the queried entity is not a PubSub node
[ "Consult", "the", "public", "key", "metadata", "node", "of", "{", "@code", "contact", "}", "to", "fetch", "the", "list", "of", "their", "published", "OpenPGP", "public", "keys", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java#L204-L217
jglobus/JGlobus
ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java
BouncyCastleCertProcessingFactory.createCertificate
public X509Certificate createCertificate(InputStream certRequestInputStream, X509Certificate cert, PrivateKey privateKey, int lifetime, GSIConstants.CertificateType certType) throws IOException, GeneralSecurityException { """ Creates a proxy certificate from the certificate request. @see #createCertificate(InputStream, X509Certificate, PrivateKey, int, int, X509ExtensionSet, String) createCertificate """ return createCertificate(certRequestInputStream, cert, privateKey, lifetime, certType, (X509ExtensionSet) null, null); }
java
public X509Certificate createCertificate(InputStream certRequestInputStream, X509Certificate cert, PrivateKey privateKey, int lifetime, GSIConstants.CertificateType certType) throws IOException, GeneralSecurityException { return createCertificate(certRequestInputStream, cert, privateKey, lifetime, certType, (X509ExtensionSet) null, null); }
[ "public", "X509Certificate", "createCertificate", "(", "InputStream", "certRequestInputStream", ",", "X509Certificate", "cert", ",", "PrivateKey", "privateKey", ",", "int", "lifetime", ",", "GSIConstants", ".", "CertificateType", "certType", ")", "throws", "IOException", ",", "GeneralSecurityException", "{", "return", "createCertificate", "(", "certRequestInputStream", ",", "cert", ",", "privateKey", ",", "lifetime", ",", "certType", ",", "(", "X509ExtensionSet", ")", "null", ",", "null", ")", ";", "}" ]
Creates a proxy certificate from the certificate request. @see #createCertificate(InputStream, X509Certificate, PrivateKey, int, int, X509ExtensionSet, String) createCertificate
[ "Creates", "a", "proxy", "certificate", "from", "the", "certificate", "request", "." ]
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/ssl-proxies/src/main/java/org/globus/gsi/bc/BouncyCastleCertProcessingFactory.java#L519-L524
azkaban/azkaban
azkaban-web-server/src/main/java/azkaban/webapp/servlet/ProjectManagerServlet.java
ProjectManagerServlet.lockFlowsForProject
private void lockFlowsForProject(Project project, List<String> lockedFlows) { """ Lock the specified flows for the project. @param project the project @param lockedFlows list of flow IDs of flows to lock """ for (String flowId: lockedFlows) { Flow flow = project.getFlow(flowId); if (flow != null) { flow.setLocked(true); } } }
java
private void lockFlowsForProject(Project project, List<String> lockedFlows) { for (String flowId: lockedFlows) { Flow flow = project.getFlow(flowId); if (flow != null) { flow.setLocked(true); } } }
[ "private", "void", "lockFlowsForProject", "(", "Project", "project", ",", "List", "<", "String", ">", "lockedFlows", ")", "{", "for", "(", "String", "flowId", ":", "lockedFlows", ")", "{", "Flow", "flow", "=", "project", ".", "getFlow", "(", "flowId", ")", ";", "if", "(", "flow", "!=", "null", ")", "{", "flow", ".", "setLocked", "(", "true", ")", ";", "}", "}", "}" ]
Lock the specified flows for the project. @param project the project @param lockedFlows list of flow IDs of flows to lock
[ "Lock", "the", "specified", "flows", "for", "the", "project", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/webapp/servlet/ProjectManagerServlet.java#L1925-L1932
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java
MagickUtil.createIndexColorModel
public static IndexColorModel createIndexColorModel(PixelPacket[] pColormap, boolean pAlpha) { """ Creates an {@code IndexColorModel} from an array of {@code PixelPacket}s. @param pColormap the original colormap as a {@code PixelPacket} array @param pAlpha keep alpha channel @return a new {@code IndexColorModel} """ int[] colors = new int[pColormap.length]; // TODO: Verify if this is correct for alpha...? int trans = pAlpha ? colors.length - 1 : -1; //for (int i = 0; i < pColormap.length; i++) { for (int i = pColormap.length - 1; i != 0; i--) { PixelPacket color = pColormap[i]; if (pAlpha) { colors[i] = (0xff - (color.getOpacity() & 0xff)) << 24 | (color.getRed() & 0xff) << 16 | (color.getGreen() & 0xff) << 8 | (color.getBlue() & 0xff); } else { colors[i] = (color.getRed() & 0xff) << 16 | (color.getGreen() & 0xff) << 8 | (color.getBlue() & 0xff); } } return new InverseColorMapIndexColorModel(8, colors.length, colors, 0, pAlpha, trans, DataBuffer.TYPE_BYTE); }
java
public static IndexColorModel createIndexColorModel(PixelPacket[] pColormap, boolean pAlpha) { int[] colors = new int[pColormap.length]; // TODO: Verify if this is correct for alpha...? int trans = pAlpha ? colors.length - 1 : -1; //for (int i = 0; i < pColormap.length; i++) { for (int i = pColormap.length - 1; i != 0; i--) { PixelPacket color = pColormap[i]; if (pAlpha) { colors[i] = (0xff - (color.getOpacity() & 0xff)) << 24 | (color.getRed() & 0xff) << 16 | (color.getGreen() & 0xff) << 8 | (color.getBlue() & 0xff); } else { colors[i] = (color.getRed() & 0xff) << 16 | (color.getGreen() & 0xff) << 8 | (color.getBlue() & 0xff); } } return new InverseColorMapIndexColorModel(8, colors.length, colors, 0, pAlpha, trans, DataBuffer.TYPE_BYTE); }
[ "public", "static", "IndexColorModel", "createIndexColorModel", "(", "PixelPacket", "[", "]", "pColormap", ",", "boolean", "pAlpha", ")", "{", "int", "[", "]", "colors", "=", "new", "int", "[", "pColormap", ".", "length", "]", ";", "// TODO: Verify if this is correct for alpha...?\r", "int", "trans", "=", "pAlpha", "?", "colors", ".", "length", "-", "1", ":", "-", "1", ";", "//for (int i = 0; i < pColormap.length; i++) {\r", "for", "(", "int", "i", "=", "pColormap", ".", "length", "-", "1", ";", "i", "!=", "0", ";", "i", "--", ")", "{", "PixelPacket", "color", "=", "pColormap", "[", "i", "]", ";", "if", "(", "pAlpha", ")", "{", "colors", "[", "i", "]", "=", "(", "0xff", "-", "(", "color", ".", "getOpacity", "(", ")", "&", "0xff", ")", ")", "<<", "24", "|", "(", "color", ".", "getRed", "(", ")", "&", "0xff", ")", "<<", "16", "|", "(", "color", ".", "getGreen", "(", ")", "&", "0xff", ")", "<<", "8", "|", "(", "color", ".", "getBlue", "(", ")", "&", "0xff", ")", ";", "}", "else", "{", "colors", "[", "i", "]", "=", "(", "color", ".", "getRed", "(", ")", "&", "0xff", ")", "<<", "16", "|", "(", "color", ".", "getGreen", "(", ")", "&", "0xff", ")", "<<", "8", "|", "(", "color", ".", "getBlue", "(", ")", "&", "0xff", ")", ";", "}", "}", "return", "new", "InverseColorMapIndexColorModel", "(", "8", ",", "colors", ".", "length", ",", "colors", ",", "0", ",", "pAlpha", ",", "trans", ",", "DataBuffer", ".", "TYPE_BYTE", ")", ";", "}" ]
Creates an {@code IndexColorModel} from an array of {@code PixelPacket}s. @param pColormap the original colormap as a {@code PixelPacket} array @param pAlpha keep alpha channel @return a new {@code IndexColorModel}
[ "Creates", "an", "{", "@code", "IndexColorModel", "}", "from", "an", "array", "of", "{", "@code", "PixelPacket", "}", "s", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/MagickUtil.java#L499-L522
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java
PrettyMarkers.plotGray
protected void plotGray(SVGPlot plot, Element parent, double x, double y, double size) { """ Plot a replacement marker when an object is to be plotted as "disabled", usually gray. @param plot Plot to draw to @param parent Parent element @param x X position @param y Y position @param size Size """ Element marker = plot.svgCircle(x, y, size * .5); SVGUtil.setStyle(marker, SVGConstants.CSS_FILL_PROPERTY + ":" + greycolor); parent.appendChild(marker); }
java
protected void plotGray(SVGPlot plot, Element parent, double x, double y, double size) { Element marker = plot.svgCircle(x, y, size * .5); SVGUtil.setStyle(marker, SVGConstants.CSS_FILL_PROPERTY + ":" + greycolor); parent.appendChild(marker); }
[ "protected", "void", "plotGray", "(", "SVGPlot", "plot", ",", "Element", "parent", ",", "double", "x", ",", "double", "y", ",", "double", "size", ")", "{", "Element", "marker", "=", "plot", ".", "svgCircle", "(", "x", ",", "y", ",", "size", "*", ".5", ")", ";", "SVGUtil", ".", "setStyle", "(", "marker", ",", "SVGConstants", ".", "CSS_FILL_PROPERTY", "+", "\":\"", "+", "greycolor", ")", ";", "parent", ".", "appendChild", "(", "marker", ")", ";", "}" ]
Plot a replacement marker when an object is to be plotted as "disabled", usually gray. @param plot Plot to draw to @param parent Parent element @param x X position @param y Y position @param size Size
[ "Plot", "a", "replacement", "marker", "when", "an", "object", "is", "to", "be", "plotted", "as", "disabled", "usually", "gray", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/style/marker/PrettyMarkers.java#L251-L255
sagiegurari/fax4j
src/main/java/org/fax4j/spi/windows/WindowsProcessFaxClientSpi.java
WindowsProcessFaxClientSpi.addCommandLineArgument
protected void addCommandLineArgument(StringBuilder buffer,String argument,String value) { """ This function adds the given command line argument to the buffer. @param buffer The buffer @param argument The argument @param value The argument value """ if((value!=null)&&(value.length()>0)) { buffer.append(argument); buffer.append(Fax4jExeConstants.SPACE_STR); buffer.append(Fax4jExeConstants.VALUE_WRAPPER); buffer.append(value); buffer.append(Fax4jExeConstants.VALUE_WRAPPER); buffer.append(Fax4jExeConstants.SPACE_STR); } }
java
protected void addCommandLineArgument(StringBuilder buffer,String argument,String value) { if((value!=null)&&(value.length()>0)) { buffer.append(argument); buffer.append(Fax4jExeConstants.SPACE_STR); buffer.append(Fax4jExeConstants.VALUE_WRAPPER); buffer.append(value); buffer.append(Fax4jExeConstants.VALUE_WRAPPER); buffer.append(Fax4jExeConstants.SPACE_STR); } }
[ "protected", "void", "addCommandLineArgument", "(", "StringBuilder", "buffer", ",", "String", "argument", ",", "String", "value", ")", "{", "if", "(", "(", "value", "!=", "null", ")", "&&", "(", "value", ".", "length", "(", ")", ">", "0", ")", ")", "{", "buffer", ".", "append", "(", "argument", ")", ";", "buffer", ".", "append", "(", "Fax4jExeConstants", ".", "SPACE_STR", ")", ";", "buffer", ".", "append", "(", "Fax4jExeConstants", ".", "VALUE_WRAPPER", ")", ";", "buffer", ".", "append", "(", "value", ")", ";", "buffer", ".", "append", "(", "Fax4jExeConstants", ".", "VALUE_WRAPPER", ")", ";", "buffer", ".", "append", "(", "Fax4jExeConstants", ".", "SPACE_STR", ")", ";", "}", "}" ]
This function adds the given command line argument to the buffer. @param buffer The buffer @param argument The argument @param value The argument value
[ "This", "function", "adds", "the", "given", "command", "line", "argument", "to", "the", "buffer", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/windows/WindowsProcessFaxClientSpi.java#L299-L310
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/user/AbstractUserObject.java
AbstractUserObject.unassignFromUserObjectInDb
protected void unassignFromUserObjectInDb(final Type _unassignType, final JAASSystem _jaasSystem, final AbstractUserObject _object) throws EFapsException { """ Unassign this user object from the given user object for given JAAS system. @param _unassignType type used to unassign (in other words the relationship type) @param _jaasSystem JAAS system for which this user object is unassigned from given object @param _object user object from which this user object is unassigned @throws EFapsException if unassignment could not be done """ Connection con = null; try { con = Context.getConnection(); Statement stmt = null; final StringBuilder cmd = new StringBuilder(); try { cmd.append("delete from ").append(_unassignType.getMainTable().getSqlTable()).append(" ").append( "where USERJAASSYSTEM=").append(_jaasSystem.getId()).append(" ").append( "and USERABSTRACTFROM=").append(getId()).append(" ").append("and USERABSTRACTTO=") .append(_object.getId()); stmt = con.createStatement(); stmt.executeUpdate(cmd.toString()); } catch (final SQLException e) { AbstractUserObject.LOG.error("could not execute '" + cmd.toString() + "' to unassign user object '" + toString() + "' from object '" + _object + "' for JAAS system '" + _jaasSystem + "' ", e); throw new EFapsException(getClass(), "unassignFromUserObjectInDb.SQLException", e, cmd.toString(), getName()); } finally { try { if (stmt != null) { stmt.close(); } con.commit(); } catch (final SQLException e) { AbstractUserObject.LOG.error("Could not close a statement.", e); } } } finally { try { if (con != null && !con.isClosed()) { con.close(); } } catch (final SQLException e) { throw new CacheReloadException("Cannot read a type for an attribute.", e); } } }
java
protected void unassignFromUserObjectInDb(final Type _unassignType, final JAASSystem _jaasSystem, final AbstractUserObject _object) throws EFapsException { Connection con = null; try { con = Context.getConnection(); Statement stmt = null; final StringBuilder cmd = new StringBuilder(); try { cmd.append("delete from ").append(_unassignType.getMainTable().getSqlTable()).append(" ").append( "where USERJAASSYSTEM=").append(_jaasSystem.getId()).append(" ").append( "and USERABSTRACTFROM=").append(getId()).append(" ").append("and USERABSTRACTTO=") .append(_object.getId()); stmt = con.createStatement(); stmt.executeUpdate(cmd.toString()); } catch (final SQLException e) { AbstractUserObject.LOG.error("could not execute '" + cmd.toString() + "' to unassign user object '" + toString() + "' from object '" + _object + "' for JAAS system '" + _jaasSystem + "' ", e); throw new EFapsException(getClass(), "unassignFromUserObjectInDb.SQLException", e, cmd.toString(), getName()); } finally { try { if (stmt != null) { stmt.close(); } con.commit(); } catch (final SQLException e) { AbstractUserObject.LOG.error("Could not close a statement.", e); } } } finally { try { if (con != null && !con.isClosed()) { con.close(); } } catch (final SQLException e) { throw new CacheReloadException("Cannot read a type for an attribute.", e); } } }
[ "protected", "void", "unassignFromUserObjectInDb", "(", "final", "Type", "_unassignType", ",", "final", "JAASSystem", "_jaasSystem", ",", "final", "AbstractUserObject", "_object", ")", "throws", "EFapsException", "{", "Connection", "con", "=", "null", ";", "try", "{", "con", "=", "Context", ".", "getConnection", "(", ")", ";", "Statement", "stmt", "=", "null", ";", "final", "StringBuilder", "cmd", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "cmd", ".", "append", "(", "\"delete from \"", ")", ".", "append", "(", "_unassignType", ".", "getMainTable", "(", ")", ".", "getSqlTable", "(", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "\"where USERJAASSYSTEM=\"", ")", ".", "append", "(", "_jaasSystem", ".", "getId", "(", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "\"and USERABSTRACTFROM=\"", ")", ".", "append", "(", "getId", "(", ")", ")", ".", "append", "(", "\" \"", ")", ".", "append", "(", "\"and USERABSTRACTTO=\"", ")", ".", "append", "(", "_object", ".", "getId", "(", ")", ")", ";", "stmt", "=", "con", ".", "createStatement", "(", ")", ";", "stmt", ".", "executeUpdate", "(", "cmd", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "final", "SQLException", "e", ")", "{", "AbstractUserObject", ".", "LOG", ".", "error", "(", "\"could not execute '\"", "+", "cmd", ".", "toString", "(", ")", "+", "\"' to unassign user object '\"", "+", "toString", "(", ")", "+", "\"' from object '\"", "+", "_object", "+", "\"' for JAAS system '\"", "+", "_jaasSystem", "+", "\"' \"", ",", "e", ")", ";", "throw", "new", "EFapsException", "(", "getClass", "(", ")", ",", "\"unassignFromUserObjectInDb.SQLException\"", ",", "e", ",", "cmd", ".", "toString", "(", ")", ",", "getName", "(", ")", ")", ";", "}", "finally", "{", "try", "{", "if", "(", "stmt", "!=", "null", ")", "{", "stmt", ".", "close", "(", ")", ";", "}", "con", ".", "commit", "(", ")", ";", "}", "catch", "(", "final", "SQLException", "e", ")", "{", "AbstractUserObject", ".", "LOG", ".", "error", "(", "\"Could not close a statement.\"", ",", "e", ")", ";", "}", "}", "}", "finally", "{", "try", "{", "if", "(", "con", "!=", "null", "&&", "!", "con", ".", "isClosed", "(", ")", ")", "{", "con", ".", "close", "(", ")", ";", "}", "}", "catch", "(", "final", "SQLException", "e", ")", "{", "throw", "new", "CacheReloadException", "(", "\"Cannot read a type for an attribute.\"", ",", "e", ")", ";", "}", "}", "}" ]
Unassign this user object from the given user object for given JAAS system. @param _unassignType type used to unassign (in other words the relationship type) @param _jaasSystem JAAS system for which this user object is unassigned from given object @param _object user object from which this user object is unassigned @throws EFapsException if unassignment could not be done
[ "Unassign", "this", "user", "object", "from", "the", "given", "user", "object", "for", "given", "JAAS", "system", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/user/AbstractUserObject.java#L280-L324
ZieIony/Carbon
carbon/src/main/java/carbon/drawable/ripple/TypedArrayCompat.java
TypedArrayCompat.getDrawable
public static Drawable getDrawable(Resources.Theme theme, TypedArray a, TypedValue[] values, int index) { """ Retrieve the Drawable for the attribute at <var>index</var>. @param index Index of attribute to retrieve. @return Drawable for the attribute, or null if not defined. """ if (values != null && theme != null) { TypedValue v = values[index]; if (v.type == TypedValue.TYPE_ATTRIBUTE) { TEMP_ARRAY[0] = v.data; TypedArray tmp = theme.obtainStyledAttributes(null, TEMP_ARRAY, 0, 0); try { return tmp.getDrawable(0); } finally { tmp.recycle(); } } } if (a != null) { return LollipopDrawablesCompat.getDrawable(a, index, theme); } return null; }
java
public static Drawable getDrawable(Resources.Theme theme, TypedArray a, TypedValue[] values, int index) { if (values != null && theme != null) { TypedValue v = values[index]; if (v.type == TypedValue.TYPE_ATTRIBUTE) { TEMP_ARRAY[0] = v.data; TypedArray tmp = theme.obtainStyledAttributes(null, TEMP_ARRAY, 0, 0); try { return tmp.getDrawable(0); } finally { tmp.recycle(); } } } if (a != null) { return LollipopDrawablesCompat.getDrawable(a, index, theme); } return null; }
[ "public", "static", "Drawable", "getDrawable", "(", "Resources", ".", "Theme", "theme", ",", "TypedArray", "a", ",", "TypedValue", "[", "]", "values", ",", "int", "index", ")", "{", "if", "(", "values", "!=", "null", "&&", "theme", "!=", "null", ")", "{", "TypedValue", "v", "=", "values", "[", "index", "]", ";", "if", "(", "v", ".", "type", "==", "TypedValue", ".", "TYPE_ATTRIBUTE", ")", "{", "TEMP_ARRAY", "[", "0", "]", "=", "v", ".", "data", ";", "TypedArray", "tmp", "=", "theme", ".", "obtainStyledAttributes", "(", "null", ",", "TEMP_ARRAY", ",", "0", ",", "0", ")", ";", "try", "{", "return", "tmp", ".", "getDrawable", "(", "0", ")", ";", "}", "finally", "{", "tmp", ".", "recycle", "(", ")", ";", "}", "}", "}", "if", "(", "a", "!=", "null", ")", "{", "return", "LollipopDrawablesCompat", ".", "getDrawable", "(", "a", ",", "index", ",", "theme", ")", ";", "}", "return", "null", ";", "}" ]
Retrieve the Drawable for the attribute at <var>index</var>. @param index Index of attribute to retrieve. @return Drawable for the attribute, or null if not defined.
[ "Retrieve", "the", "Drawable", "for", "the", "attribute", "at", "<var", ">", "index<", "/", "var", ">", "." ]
train
https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/TypedArrayCompat.java#L77-L98
Ordinastie/MalisisCore
src/main/java/net/malisis/core/renderer/animation/transformation/Transformation.java
Transformation.forTicks
public T forTicks(int duration, int delay) { """ Sets the duration and delay for this {@link Transformation}. @param duration the duration @param delay the delay @return the t """ this.duration = Timer.tickToTime(duration); this.delay = Timer.tickToTime(delay); return self(); }
java
public T forTicks(int duration, int delay) { this.duration = Timer.tickToTime(duration); this.delay = Timer.tickToTime(delay); return self(); }
[ "public", "T", "forTicks", "(", "int", "duration", ",", "int", "delay", ")", "{", "this", ".", "duration", "=", "Timer", ".", "tickToTime", "(", "duration", ")", ";", "this", ".", "delay", "=", "Timer", ".", "tickToTime", "(", "delay", ")", ";", "return", "self", "(", ")", ";", "}" ]
Sets the duration and delay for this {@link Transformation}. @param duration the duration @param delay the delay @return the t
[ "Sets", "the", "duration", "and", "delay", "for", "this", "{", "@link", "Transformation", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/Transformation.java#L93-L99
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java
BugInstance.addMethod
@Nonnull public BugInstance addMethod(@SlashedClassName String className, String methodName, String methodSig, int accessFlags) { """ Add a method annotation. If this is the first method annotation added, it becomes the primary method annotation. @param className name of the class containing the method @param methodName name of the method @param methodSig type signature of the method @param accessFlags accessFlags for the method @return this object """ addMethod(MethodAnnotation.fromForeignMethod(className, methodName, methodSig, accessFlags)); return this; }
java
@Nonnull public BugInstance addMethod(@SlashedClassName String className, String methodName, String methodSig, int accessFlags) { addMethod(MethodAnnotation.fromForeignMethod(className, methodName, methodSig, accessFlags)); return this; }
[ "@", "Nonnull", "public", "BugInstance", "addMethod", "(", "@", "SlashedClassName", "String", "className", ",", "String", "methodName", ",", "String", "methodSig", ",", "int", "accessFlags", ")", "{", "addMethod", "(", "MethodAnnotation", ".", "fromForeignMethod", "(", "className", ",", "methodName", ",", "methodSig", ",", "accessFlags", ")", ")", ";", "return", "this", ";", "}" ]
Add a method annotation. If this is the first method annotation added, it becomes the primary method annotation. @param className name of the class containing the method @param methodName name of the method @param methodSig type signature of the method @param accessFlags accessFlags for the method @return this object
[ "Add", "a", "method", "annotation", ".", "If", "this", "is", "the", "first", "method", "annotation", "added", "it", "becomes", "the", "primary", "method", "annotation", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/BugInstance.java#L1325-L1329
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java
RedundentExprEliminator.createIteratorFromSteps
protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps) { """ Create a new WalkingIterator from the steps in another WalkingIterator. @param wi The iterator from where the steps will be taken. @param numSteps The number of steps from the first to copy into the new iterator. @return The new iterator. """ WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver()); try { AxesWalker walker = (AxesWalker)wi.getFirstWalker().clone(); newIter.setFirstWalker(walker); walker.setLocPathIterator(newIter); for(int i = 1; i < numSteps; i++) { AxesWalker next = (AxesWalker)walker.getNextWalker().clone(); walker.setNextWalker(next); next.setLocPathIterator(newIter); walker = next; } walker.setNextWalker(null); } catch(CloneNotSupportedException cnse) { throw new WrappedRuntimeException(cnse); } return newIter; }
java
protected WalkingIterator createIteratorFromSteps(final WalkingIterator wi, int numSteps) { WalkingIterator newIter = new WalkingIterator(wi.getPrefixResolver()); try { AxesWalker walker = (AxesWalker)wi.getFirstWalker().clone(); newIter.setFirstWalker(walker); walker.setLocPathIterator(newIter); for(int i = 1; i < numSteps; i++) { AxesWalker next = (AxesWalker)walker.getNextWalker().clone(); walker.setNextWalker(next); next.setLocPathIterator(newIter); walker = next; } walker.setNextWalker(null); } catch(CloneNotSupportedException cnse) { throw new WrappedRuntimeException(cnse); } return newIter; }
[ "protected", "WalkingIterator", "createIteratorFromSteps", "(", "final", "WalkingIterator", "wi", ",", "int", "numSteps", ")", "{", "WalkingIterator", "newIter", "=", "new", "WalkingIterator", "(", "wi", ".", "getPrefixResolver", "(", ")", ")", ";", "try", "{", "AxesWalker", "walker", "=", "(", "AxesWalker", ")", "wi", ".", "getFirstWalker", "(", ")", ".", "clone", "(", ")", ";", "newIter", ".", "setFirstWalker", "(", "walker", ")", ";", "walker", ".", "setLocPathIterator", "(", "newIter", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "numSteps", ";", "i", "++", ")", "{", "AxesWalker", "next", "=", "(", "AxesWalker", ")", "walker", ".", "getNextWalker", "(", ")", ".", "clone", "(", ")", ";", "walker", ".", "setNextWalker", "(", "next", ")", ";", "next", ".", "setLocPathIterator", "(", "newIter", ")", ";", "walker", "=", "next", ";", "}", "walker", ".", "setNextWalker", "(", "null", ")", ";", "}", "catch", "(", "CloneNotSupportedException", "cnse", ")", "{", "throw", "new", "WrappedRuntimeException", "(", "cnse", ")", ";", "}", "return", "newIter", ";", "}" ]
Create a new WalkingIterator from the steps in another WalkingIterator. @param wi The iterator from where the steps will be taken. @param numSteps The number of steps from the first to copy into the new iterator. @return The new iterator.
[ "Create", "a", "new", "WalkingIterator", "from", "the", "steps", "in", "another", "WalkingIterator", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/RedundentExprEliminator.java#L487-L509
azkaban/azkaban
azkaban-common/src/main/java/azkaban/project/ProjectManager.java
ProjectManager.purgeProject
public synchronized Project purgeProject(final Project project, final User deleter) throws ProjectManagerException { """ Permanently delete all project files and properties data for all versions of a project and log event in project_events table """ this.projectLoader.cleanOlderProjectVersion(project.getId(), project.getVersion() + 1, Collections.emptyList()); this.projectLoader .postEvent(project, EventType.PURGE, deleter.getUserId(), String .format("Purged versions before %d", project.getVersion() + 1)); return project; }
java
public synchronized Project purgeProject(final Project project, final User deleter) throws ProjectManagerException { this.projectLoader.cleanOlderProjectVersion(project.getId(), project.getVersion() + 1, Collections.emptyList()); this.projectLoader .postEvent(project, EventType.PURGE, deleter.getUserId(), String .format("Purged versions before %d", project.getVersion() + 1)); return project; }
[ "public", "synchronized", "Project", "purgeProject", "(", "final", "Project", "project", ",", "final", "User", "deleter", ")", "throws", "ProjectManagerException", "{", "this", ".", "projectLoader", ".", "cleanOlderProjectVersion", "(", "project", ".", "getId", "(", ")", ",", "project", ".", "getVersion", "(", ")", "+", "1", ",", "Collections", ".", "emptyList", "(", ")", ")", ";", "this", ".", "projectLoader", ".", "postEvent", "(", "project", ",", "EventType", ".", "PURGE", ",", "deleter", ".", "getUserId", "(", ")", ",", "String", ".", "format", "(", "\"Purged versions before %d\"", ",", "project", ".", "getVersion", "(", ")", "+", "1", ")", ")", ";", "return", "project", ";", "}" ]
Permanently delete all project files and properties data for all versions of a project and log event in project_events table
[ "Permanently", "delete", "all", "project", "files", "and", "properties", "data", "for", "all", "versions", "of", "a", "project", "and", "log", "event", "in", "project_events", "table" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/project/ProjectManager.java#L315-L323
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/cachekeygenerator/KeyGenUtil.java
KeyGenUtil.generateKey
static public String generateKey(HttpServletRequest request, Iterable<ICacheKeyGenerator> keyGens) { """ Generates a cache key by aggregating (concatenating) the output of each of the cache key generators in the array. @param request The request object @param keyGens The array @return The aggregated cache key """ StringBuffer sb = new StringBuffer(); for (ICacheKeyGenerator keyGen : keyGens) { String key = keyGen.generateKey(request); if (key != null && key.length() > 0) { sb.append(sb.length() > 0 ? ";" : "").append(key); //$NON-NLS-1$ //$NON-NLS-2$ } } return sb.toString(); }
java
static public String generateKey(HttpServletRequest request, Iterable<ICacheKeyGenerator> keyGens) { StringBuffer sb = new StringBuffer(); for (ICacheKeyGenerator keyGen : keyGens) { String key = keyGen.generateKey(request); if (key != null && key.length() > 0) { sb.append(sb.length() > 0 ? ";" : "").append(key); //$NON-NLS-1$ //$NON-NLS-2$ } } return sb.toString(); }
[ "static", "public", "String", "generateKey", "(", "HttpServletRequest", "request", ",", "Iterable", "<", "ICacheKeyGenerator", ">", "keyGens", ")", "{", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "ICacheKeyGenerator", "keyGen", ":", "keyGens", ")", "{", "String", "key", "=", "keyGen", ".", "generateKey", "(", "request", ")", ";", "if", "(", "key", "!=", "null", "&&", "key", ".", "length", "(", ")", ">", "0", ")", "{", "sb", ".", "append", "(", "sb", ".", "length", "(", ")", ">", "0", "?", "\";\"", ":", "\"\"", ")", ".", "append", "(", "key", ")", ";", "//$NON-NLS-1$ //$NON-NLS-2$\r", "}", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Generates a cache key by aggregating (concatenating) the output of each of the cache key generators in the array. @param request The request object @param keyGens The array @return The aggregated cache key
[ "Generates", "a", "cache", "key", "by", "aggregating", "(", "concatenating", ")", "the", "output", "of", "each", "of", "the", "cache", "key", "generators", "in", "the", "array", "." ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/cachekeygenerator/KeyGenUtil.java#L58-L67
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java
CmsContainerpageHandler.createViewOnlineEntry
protected I_CmsContextMenuEntry createViewOnlineEntry() { """ Creates the view online entry, if an online link is available.<p> @return the menu entry or null, if not available """ final String onlineLink = m_controller.getData().getOnlineLink(); CmsContextMenuEntry entry = null; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(onlineLink)) { I_CmsContextMenuCommand command = new I_CmsContextMenuCommand() { public void execute( CmsUUID structureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { Window.open(onlineLink, "opencms-online", null); } public A_CmsContextMenuItem getItemWidget( CmsUUID structureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { return null; } public boolean hasItemWidget() { return false; } }; entry = new CmsContextMenuEntry(this, null, command); CmsContextMenuEntryBean entryBean = new CmsContextMenuEntryBean(); entryBean.setLabel(Messages.get().key(Messages.GUI_VIEW_ONLINE_0)); entryBean.setActive(true); entryBean.setVisible(true); entry.setBean(entryBean); } return entry; }
java
protected I_CmsContextMenuEntry createViewOnlineEntry() { final String onlineLink = m_controller.getData().getOnlineLink(); CmsContextMenuEntry entry = null; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(onlineLink)) { I_CmsContextMenuCommand command = new I_CmsContextMenuCommand() { public void execute( CmsUUID structureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { Window.open(onlineLink, "opencms-online", null); } public A_CmsContextMenuItem getItemWidget( CmsUUID structureId, I_CmsContextMenuHandler handler, CmsContextMenuEntryBean bean) { return null; } public boolean hasItemWidget() { return false; } }; entry = new CmsContextMenuEntry(this, null, command); CmsContextMenuEntryBean entryBean = new CmsContextMenuEntryBean(); entryBean.setLabel(Messages.get().key(Messages.GUI_VIEW_ONLINE_0)); entryBean.setActive(true); entryBean.setVisible(true); entry.setBean(entryBean); } return entry; }
[ "protected", "I_CmsContextMenuEntry", "createViewOnlineEntry", "(", ")", "{", "final", "String", "onlineLink", "=", "m_controller", ".", "getData", "(", ")", ".", "getOnlineLink", "(", ")", ";", "CmsContextMenuEntry", "entry", "=", "null", ";", "if", "(", "CmsStringUtil", ".", "isNotEmptyOrWhitespaceOnly", "(", "onlineLink", ")", ")", "{", "I_CmsContextMenuCommand", "command", "=", "new", "I_CmsContextMenuCommand", "(", ")", "{", "public", "void", "execute", "(", "CmsUUID", "structureId", ",", "I_CmsContextMenuHandler", "handler", ",", "CmsContextMenuEntryBean", "bean", ")", "{", "Window", ".", "open", "(", "onlineLink", ",", "\"opencms-online\"", ",", "null", ")", ";", "}", "public", "A_CmsContextMenuItem", "getItemWidget", "(", "CmsUUID", "structureId", ",", "I_CmsContextMenuHandler", "handler", ",", "CmsContextMenuEntryBean", "bean", ")", "{", "return", "null", ";", "}", "public", "boolean", "hasItemWidget", "(", ")", "{", "return", "false", ";", "}", "}", ";", "entry", "=", "new", "CmsContextMenuEntry", "(", "this", ",", "null", ",", "command", ")", ";", "CmsContextMenuEntryBean", "entryBean", "=", "new", "CmsContextMenuEntryBean", "(", ")", ";", "entryBean", ".", "setLabel", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_VIEW_ONLINE_0", ")", ")", ";", "entryBean", ".", "setActive", "(", "true", ")", ";", "entryBean", ".", "setVisible", "(", "true", ")", ";", "entry", ".", "setBean", "(", "entryBean", ")", ";", "}", "return", "entry", ";", "}" ]
Creates the view online entry, if an online link is available.<p> @return the menu entry or null, if not available
[ "Creates", "the", "view", "online", "entry", "if", "an", "online", "link", "is", "available", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageHandler.java#L1451-L1487
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersInner.java
ServersInner.beginUpdate
public ServerInner beginUpdate(String resourceGroupName, String serverName, ServerUpdate parameters) { """ Updates a server. @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 parameters The requested server resource state. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ServerInner object if successful. """ return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); }
java
public ServerInner beginUpdate(String resourceGroupName, String serverName, ServerUpdate parameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).toBlocking().single().body(); }
[ "public", "ServerInner", "beginUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "ServerUpdate", "parameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates a server. @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 parameters The requested server resource state. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ServerInner object if successful.
[ "Updates", "a", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServersInner.java#L839-L841
facebookarchive/nifty
nifty-ssl/src/main/java/com/facebook/nifty/ssl/TicketSeedFileParser.java
TicketSeedFileParser.deriveKeyFromSeed
private SessionTicketKey deriveKeyFromSeed(String seed) { """ Derives a {@link SessionTicketKey} from the given ticket seed using the {@link CryptoUtil#hkdf} function. @param seed the ticket seed. @return the ticket key. """ byte[] seedBin = decodeHex(seed); byte[] keyName = hkdf(seedBin, salt, NAME_BYTES, SessionTicketKey.NAME_SIZE); byte[] aesKey = hkdf(seedBin, salt, AES_BYTES, SessionTicketKey.AES_KEY_SIZE); byte[] hmacKey = hkdf(seedBin, salt, HMAC_BYTES, SessionTicketKey.HMAC_KEY_SIZE); return new SessionTicketKey(keyName, hmacKey, aesKey); }
java
private SessionTicketKey deriveKeyFromSeed(String seed) { byte[] seedBin = decodeHex(seed); byte[] keyName = hkdf(seedBin, salt, NAME_BYTES, SessionTicketKey.NAME_SIZE); byte[] aesKey = hkdf(seedBin, salt, AES_BYTES, SessionTicketKey.AES_KEY_SIZE); byte[] hmacKey = hkdf(seedBin, salt, HMAC_BYTES, SessionTicketKey.HMAC_KEY_SIZE); return new SessionTicketKey(keyName, hmacKey, aesKey); }
[ "private", "SessionTicketKey", "deriveKeyFromSeed", "(", "String", "seed", ")", "{", "byte", "[", "]", "seedBin", "=", "decodeHex", "(", "seed", ")", ";", "byte", "[", "]", "keyName", "=", "hkdf", "(", "seedBin", ",", "salt", ",", "NAME_BYTES", ",", "SessionTicketKey", ".", "NAME_SIZE", ")", ";", "byte", "[", "]", "aesKey", "=", "hkdf", "(", "seedBin", ",", "salt", ",", "AES_BYTES", ",", "SessionTicketKey", ".", "AES_KEY_SIZE", ")", ";", "byte", "[", "]", "hmacKey", "=", "hkdf", "(", "seedBin", ",", "salt", ",", "HMAC_BYTES", ",", "SessionTicketKey", ".", "HMAC_KEY_SIZE", ")", ";", "return", "new", "SessionTicketKey", "(", "keyName", ",", "hmacKey", ",", "aesKey", ")", ";", "}" ]
Derives a {@link SessionTicketKey} from the given ticket seed using the {@link CryptoUtil#hkdf} function. @param seed the ticket seed. @return the ticket key.
[ "Derives", "a", "{", "@link", "SessionTicketKey", "}", "from", "the", "given", "ticket", "seed", "using", "the", "{", "@link", "CryptoUtil#hkdf", "}", "function", "." ]
train
https://github.com/facebookarchive/nifty/blob/ccacff7f0a723abe0b9ed399bcc3bc85784e7396/nifty-ssl/src/main/java/com/facebook/nifty/ssl/TicketSeedFileParser.java#L189-L195
Drivemode/TypefaceHelper
TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java
TypefaceHelper.setTypeface
public void setTypeface(Activity activity, String typefaceName, int style) { """ Set the typeface to the all text views belong to the activity. Note that we use decor view of the activity so that the typeface will also be applied to action bar. @param activity the activity. @param typefaceName typeface name. @param style the typeface style. """ setTypeface((ViewGroup) activity.getWindow().getDecorView(), typefaceName, style); }
java
public void setTypeface(Activity activity, String typefaceName, int style) { setTypeface((ViewGroup) activity.getWindow().getDecorView(), typefaceName, style); }
[ "public", "void", "setTypeface", "(", "Activity", "activity", ",", "String", "typefaceName", ",", "int", "style", ")", "{", "setTypeface", "(", "(", "ViewGroup", ")", "activity", ".", "getWindow", "(", ")", ".", "getDecorView", "(", ")", ",", "typefaceName", ",", "style", ")", ";", "}" ]
Set the typeface to the all text views belong to the activity. Note that we use decor view of the activity so that the typeface will also be applied to action bar. @param activity the activity. @param typefaceName typeface name. @param style the typeface style.
[ "Set", "the", "typeface", "to", "the", "all", "text", "views", "belong", "to", "the", "activity", ".", "Note", "that", "we", "use", "decor", "view", "of", "the", "activity", "so", "that", "the", "typeface", "will", "also", "be", "applied", "to", "action", "bar", "." ]
train
https://github.com/Drivemode/TypefaceHelper/blob/86bef9ce16b9626b7076559e846db1b9f043c008/TypefaceHelper/src/main/java/com/drivemode/android/typeface/TypefaceHelper.java#L336-L338
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/log/LogViewSerialization.java
LogViewSerialization.write
public static void write(LogView logView, String path) throws IOException { """ Serializes the log view under the given path. @param logView Log view to serialize. @param path Target path of the serialized log view. @throws IOException If the log view can't be written under the given path. """ String xml = xstream.toXML(logView); try (BufferedWriter out = new BufferedWriter(new FileWriter(path))) { out.write(xml); } }
java
public static void write(LogView logView, String path) throws IOException { String xml = xstream.toXML(logView); try (BufferedWriter out = new BufferedWriter(new FileWriter(path))) { out.write(xml); } }
[ "public", "static", "void", "write", "(", "LogView", "logView", ",", "String", "path", ")", "throws", "IOException", "{", "String", "xml", "=", "xstream", ".", "toXML", "(", "logView", ")", ";", "try", "(", "BufferedWriter", "out", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "path", ")", ")", ")", "{", "out", ".", "write", "(", "xml", ")", ";", "}", "}" ]
Serializes the log view under the given path. @param logView Log view to serialize. @param path Target path of the serialized log view. @throws IOException If the log view can't be written under the given path.
[ "Serializes", "the", "log", "view", "under", "the", "given", "path", "." ]
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/log/LogViewSerialization.java#L160-L165
wkgcass/Style
src/main/java/net/cassite/style/IfBlock.java
IfBlock.ElseIf
public IfBlock<T, INIT> ElseIf(RFunc0<INIT> init, RFunc1<T, INIT> body) { """ define an ElseIf block.<br> @param init lambda expression returns an object or boolean value, init==null || init.equals(false) will be considered <b>false</b> in traditional if expression. in other cases, considered true @param body takes in INIT value, and return body's return value if init is considered true @return if body """ return ElseIf(init, $(body)); }
java
public IfBlock<T, INIT> ElseIf(RFunc0<INIT> init, RFunc1<T, INIT> body) { return ElseIf(init, $(body)); }
[ "public", "IfBlock", "<", "T", ",", "INIT", ">", "ElseIf", "(", "RFunc0", "<", "INIT", ">", "init", ",", "RFunc1", "<", "T", ",", "INIT", ">", "body", ")", "{", "return", "ElseIf", "(", "init", ",", "$", "(", "body", ")", ")", ";", "}" ]
define an ElseIf block.<br> @param init lambda expression returns an object or boolean value, init==null || init.equals(false) will be considered <b>false</b> in traditional if expression. in other cases, considered true @param body takes in INIT value, and return body's return value if init is considered true @return if body
[ "define", "an", "ElseIf", "block", ".", "<br", ">" ]
train
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/IfBlock.java#L208-L210
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/PropertyColumnTableDescription.java
PropertyColumnTableDescription.addPropertyColumn
public void addPropertyColumn(String propertyName, Class propertyType, TableCellEditor editor) { """ WARNING: propertyType is discarded, it should be fetched from the entityType through introspection. @deprecated @see #addPropertyColumn(String) @see PropertyColumn#withEditor(javax.swing.table.TableCellEditor) """ addPropertyColumn(propertyName).withEditor(editor); }
java
public void addPropertyColumn(String propertyName, Class propertyType, TableCellEditor editor) { addPropertyColumn(propertyName).withEditor(editor); }
[ "public", "void", "addPropertyColumn", "(", "String", "propertyName", ",", "Class", "propertyType", ",", "TableCellEditor", "editor", ")", "{", "addPropertyColumn", "(", "propertyName", ")", ".", "withEditor", "(", "editor", ")", ";", "}" ]
WARNING: propertyType is discarded, it should be fetched from the entityType through introspection. @deprecated @see #addPropertyColumn(String) @see PropertyColumn#withEditor(javax.swing.table.TableCellEditor)
[ "WARNING", ":", "propertyType", "is", "discarded", "it", "should", "be", "fetched", "from", "the", "entityType", "through", "introspection", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/widget/table/PropertyColumnTableDescription.java#L240-L243
Pixplicity/EasyPrefs
library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java
Prefs.putStringSet
@SuppressWarnings("WeakerAccess") @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void putStringSet(final String key, final Set<String> value) { """ Stores a Set of Strings. On Honeycomb and later this will call the native implementation in SharedPreferences.Editor, on older SDKs this will call {@link #putOrderedStringSet(String, Set)}. <strong>Note that the native implementation of {@link Editor#putStringSet(String, Set)} does not reliably preserve the order of the Strings in the Set.</strong> @param key The name of the preference to modify. @param value The new value for the preference. @see android.content.SharedPreferences.Editor#putStringSet(String, java.util.Set) @see #putOrderedStringSet(String, Set) """ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { final Editor editor = getPreferences().edit(); editor.putStringSet(key, value); editor.apply(); } else { // Workaround for pre-HC's lack of StringSets putOrderedStringSet(key, value); } }
java
@SuppressWarnings("WeakerAccess") @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static void putStringSet(final String key, final Set<String> value) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { final Editor editor = getPreferences().edit(); editor.putStringSet(key, value); editor.apply(); } else { // Workaround for pre-HC's lack of StringSets putOrderedStringSet(key, value); } }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "public", "static", "void", "putStringSet", "(", "final", "String", "key", ",", "final", "Set", "<", "String", ">", "value", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "HONEYCOMB", ")", "{", "final", "Editor", "editor", "=", "getPreferences", "(", ")", ".", "edit", "(", ")", ";", "editor", ".", "putStringSet", "(", "key", ",", "value", ")", ";", "editor", ".", "apply", "(", ")", ";", "}", "else", "{", "// Workaround for pre-HC's lack of StringSets", "putOrderedStringSet", "(", "key", ",", "value", ")", ";", "}", "}" ]
Stores a Set of Strings. On Honeycomb and later this will call the native implementation in SharedPreferences.Editor, on older SDKs this will call {@link #putOrderedStringSet(String, Set)}. <strong>Note that the native implementation of {@link Editor#putStringSet(String, Set)} does not reliably preserve the order of the Strings in the Set.</strong> @param key The name of the preference to modify. @param value The new value for the preference. @see android.content.SharedPreferences.Editor#putStringSet(String, java.util.Set) @see #putOrderedStringSet(String, Set)
[ "Stores", "a", "Set", "of", "Strings", ".", "On", "Honeycomb", "and", "later", "this", "will", "call", "the", "native", "implementation", "in", "SharedPreferences", ".", "Editor", "on", "older", "SDKs", "this", "will", "call", "{", "@link", "#putOrderedStringSet", "(", "String", "Set", ")", "}", ".", "<strong", ">", "Note", "that", "the", "native", "implementation", "of", "{", "@link", "Editor#putStringSet", "(", "String", "Set", ")", "}", "does", "not", "reliably", "preserve", "the", "order", "of", "the", "Strings", "in", "the", "Set", ".", "<", "/", "strong", ">" ]
train
https://github.com/Pixplicity/EasyPrefs/blob/0ca13a403bf099019a13d68b38edcf55fca5a653/library/src/main/java/com/pixplicity/easyprefs/library/Prefs.java#L360-L371
stickfigure/batchfb
src/main/java/com/googlecode/batchfb/impl/Batch.java
Batch.query
private <T> QueryRequest<T> query(String fql, JavaType type) { """ Implementation now that we have chosen a Jackson JavaType for the return value """ this.checkForBatchExecution(); if (this.multiqueryRequest == null) { this.multiqueryRequest = new MultiqueryRequest(mapper, this.createUnmappedChain()); this.graphRequests.add(this.multiqueryRequest); } // There is a circular reference between the extractor and request, so construction of the chain // is a little complicated QueryNodeExtractor extractor = new QueryNodeExtractor(this.multiqueryRequest); String name = "__q" + this.generatedQueryNameIndex++; QueryRequest<T> q = new QueryRequest<T>(fql, name, new MapperWrapper<T>(type, this.mapper, extractor)); extractor.setRequest(q); this.multiqueryRequest.addQuery(q); return q; }
java
private <T> QueryRequest<T> query(String fql, JavaType type) { this.checkForBatchExecution(); if (this.multiqueryRequest == null) { this.multiqueryRequest = new MultiqueryRequest(mapper, this.createUnmappedChain()); this.graphRequests.add(this.multiqueryRequest); } // There is a circular reference between the extractor and request, so construction of the chain // is a little complicated QueryNodeExtractor extractor = new QueryNodeExtractor(this.multiqueryRequest); String name = "__q" + this.generatedQueryNameIndex++; QueryRequest<T> q = new QueryRequest<T>(fql, name, new MapperWrapper<T>(type, this.mapper, extractor)); extractor.setRequest(q); this.multiqueryRequest.addQuery(q); return q; }
[ "private", "<", "T", ">", "QueryRequest", "<", "T", ">", "query", "(", "String", "fql", ",", "JavaType", "type", ")", "{", "this", ".", "checkForBatchExecution", "(", ")", ";", "if", "(", "this", ".", "multiqueryRequest", "==", "null", ")", "{", "this", ".", "multiqueryRequest", "=", "new", "MultiqueryRequest", "(", "mapper", ",", "this", ".", "createUnmappedChain", "(", ")", ")", ";", "this", ".", "graphRequests", ".", "add", "(", "this", ".", "multiqueryRequest", ")", ";", "}", "// There is a circular reference between the extractor and request, so construction of the chain\r", "// is a little complicated\r", "QueryNodeExtractor", "extractor", "=", "new", "QueryNodeExtractor", "(", "this", ".", "multiqueryRequest", ")", ";", "String", "name", "=", "\"__q\"", "+", "this", ".", "generatedQueryNameIndex", "++", ";", "QueryRequest", "<", "T", ">", "q", "=", "new", "QueryRequest", "<", "T", ">", "(", "fql", ",", "name", ",", "new", "MapperWrapper", "<", "T", ">", "(", "type", ",", "this", ".", "mapper", ",", "extractor", ")", ")", ";", "extractor", ".", "setRequest", "(", "q", ")", ";", "this", ".", "multiqueryRequest", ".", "addQuery", "(", "q", ")", ";", "return", "q", ";", "}" ]
Implementation now that we have chosen a Jackson JavaType for the return value
[ "Implementation", "now", "that", "we", "have", "chosen", "a", "Jackson", "JavaType", "for", "the", "return", "value" ]
train
https://github.com/stickfigure/batchfb/blob/ceeda78aa6d8397eec032ab1d8997adb7378e9e2/src/main/java/com/googlecode/batchfb/impl/Batch.java#L233-L255
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java
DocBookBuilder.buildTranslatedBook
public HashMap<String, byte[]> buildTranslatedBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions buildingOptions, final Map<String, byte[]> overrideFiles, final ZanataDetails zanataDetails) throws BuilderCreationException, BuildProcessingException { """ Builds a DocBook Formatted Book using a Content Specification to define the structure and contents of the book. @param contentSpec The content specification to build from. @param requester The user who requested the build. @param buildingOptions The options to be used when building. @param overrideFiles @param zanataDetails The Zanata server details to be used when populating links @return Returns a mapping of file names/locations to files. This HashMap can be used to build a ZIP archive. @throws BuilderCreationException Thrown if the builder is unable to start due to incorrect passed variables. @throws BuildProcessingException Any build issue that should not occur under normal circumstances. Ie a Template can't be converted to a DOM Document. """ return buildBook(contentSpec, requester, buildingOptions, overrideFiles, zanataDetails, true); }
java
public HashMap<String, byte[]> buildTranslatedBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions buildingOptions, final Map<String, byte[]> overrideFiles, final ZanataDetails zanataDetails) throws BuilderCreationException, BuildProcessingException { return buildBook(contentSpec, requester, buildingOptions, overrideFiles, zanataDetails, true); }
[ "public", "HashMap", "<", "String", ",", "byte", "[", "]", ">", "buildTranslatedBook", "(", "final", "ContentSpec", "contentSpec", ",", "final", "String", "requester", ",", "final", "DocBookBuildingOptions", "buildingOptions", ",", "final", "Map", "<", "String", ",", "byte", "[", "]", ">", "overrideFiles", ",", "final", "ZanataDetails", "zanataDetails", ")", "throws", "BuilderCreationException", ",", "BuildProcessingException", "{", "return", "buildBook", "(", "contentSpec", ",", "requester", ",", "buildingOptions", ",", "overrideFiles", ",", "zanataDetails", ",", "true", ")", ";", "}" ]
Builds a DocBook Formatted Book using a Content Specification to define the structure and contents of the book. @param contentSpec The content specification to build from. @param requester The user who requested the build. @param buildingOptions The options to be used when building. @param overrideFiles @param zanataDetails The Zanata server details to be used when populating links @return Returns a mapping of file names/locations to files. This HashMap can be used to build a ZIP archive. @throws BuilderCreationException Thrown if the builder is unable to start due to incorrect passed variables. @throws BuildProcessingException Any build issue that should not occur under normal circumstances. Ie a Template can't be converted to a DOM Document.
[ "Builds", "a", "DocBook", "Formatted", "Book", "using", "a", "Content", "Specification", "to", "define", "the", "structure", "and", "contents", "of", "the", "book", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L442-L446
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/authorization/authorizationpolicy_binding.java
authorizationpolicy_binding.get
public static authorizationpolicy_binding get(nitro_service service, String name) throws Exception { """ Use this API to fetch authorizationpolicy_binding resource of given name . """ authorizationpolicy_binding obj = new authorizationpolicy_binding(); obj.set_name(name); authorizationpolicy_binding response = (authorizationpolicy_binding) obj.get_resource(service); return response; }
java
public static authorizationpolicy_binding get(nitro_service service, String name) throws Exception{ authorizationpolicy_binding obj = new authorizationpolicy_binding(); obj.set_name(name); authorizationpolicy_binding response = (authorizationpolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "authorizationpolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "authorizationpolicy_binding", "obj", "=", "new", "authorizationpolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "authorizationpolicy_binding", "response", "=", "(", "authorizationpolicy_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch authorizationpolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "authorizationpolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/authorization/authorizationpolicy_binding.java#L147-L152
Coveros/selenified
src/main/java/com/coveros/selenified/element/Element.java
Element.isNotDisplayed
private boolean isNotDisplayed(String action, String expected, String extra) { """ Determines if the element is displayed. If it isn't, it'll wait up to the default time (5 seconds) for the element to be displayed @param action - what action is occurring @param expected - what is the expected result @param extra - what actually is occurring @return Boolean: is the element displayed? """ // wait for element to be displayed if (!is.displayed()) { waitForState.displayed(); } if (!is.displayed()) { reporter.fail(action, expected, extra + prettyOutput() + NOT_DISPLAYED); // indicates element not displayed return true; } return false; }
java
private boolean isNotDisplayed(String action, String expected, String extra) { // wait for element to be displayed if (!is.displayed()) { waitForState.displayed(); } if (!is.displayed()) { reporter.fail(action, expected, extra + prettyOutput() + NOT_DISPLAYED); // indicates element not displayed return true; } return false; }
[ "private", "boolean", "isNotDisplayed", "(", "String", "action", ",", "String", "expected", ",", "String", "extra", ")", "{", "// wait for element to be displayed", "if", "(", "!", "is", ".", "displayed", "(", ")", ")", "{", "waitForState", ".", "displayed", "(", ")", ";", "}", "if", "(", "!", "is", ".", "displayed", "(", ")", ")", "{", "reporter", ".", "fail", "(", "action", ",", "expected", ",", "extra", "+", "prettyOutput", "(", ")", "+", "NOT_DISPLAYED", ")", ";", "// indicates element not displayed", "return", "true", ";", "}", "return", "false", ";", "}" ]
Determines if the element is displayed. If it isn't, it'll wait up to the default time (5 seconds) for the element to be displayed @param action - what action is occurring @param expected - what is the expected result @param extra - what actually is occurring @return Boolean: is the element displayed?
[ "Determines", "if", "the", "element", "is", "displayed", ".", "If", "it", "isn", "t", "it", "ll", "wait", "up", "to", "the", "default", "time", "(", "5", "seconds", ")", "for", "the", "element", "to", "be", "displayed" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/Element.java#L615-L626
netty/netty
transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java
EmbeddedChannel.writeOneOutbound
public ChannelFuture writeOneOutbound(Object msg, ChannelPromise promise) { """ Writes one message to the outbound of this {@link Channel} and does not flush it. This method is conceptually equivalent to {@link #write(Object, ChannelPromise)}. @see #writeOneInbound(Object, ChannelPromise) """ if (checkOpen(true)) { return write(msg, promise); } return checkException(promise); }
java
public ChannelFuture writeOneOutbound(Object msg, ChannelPromise promise) { if (checkOpen(true)) { return write(msg, promise); } return checkException(promise); }
[ "public", "ChannelFuture", "writeOneOutbound", "(", "Object", "msg", ",", "ChannelPromise", "promise", ")", "{", "if", "(", "checkOpen", "(", "true", ")", ")", "{", "return", "write", "(", "msg", ",", "promise", ")", ";", "}", "return", "checkException", "(", "promise", ")", ";", "}" ]
Writes one message to the outbound of this {@link Channel} and does not flush it. This method is conceptually equivalent to {@link #write(Object, ChannelPromise)}. @see #writeOneInbound(Object, ChannelPromise)
[ "Writes", "one", "message", "to", "the", "outbound", "of", "this", "{", "@link", "Channel", "}", "and", "does", "not", "flush", "it", ".", "This", "method", "is", "conceptually", "equivalent", "to", "{", "@link", "#write", "(", "Object", "ChannelPromise", ")", "}", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/embedded/EmbeddedChannel.java#L431-L436
JDBDT/jdbdt
src/main/java/org/jdbdt/DataSetBuilder.java
DataSetBuilder.ensureValidRange
private static <T extends Comparable<T>> void ensureValidRange(T min, T max) { """ Range validation utility method. @param <T> Type of data. @param min Minimum value. @param max Maximum value. @throws InvalidOperationException if the range is not valid. """ if (min == null) { throw new InvalidOperationException("Null value for minimum."); } if (max == null) { throw new InvalidOperationException("Null value for maximum."); } if (min.compareTo(max) >= 0) { throw new InvalidOperationException("Invalid range: " + min + " >= " + max); } }
java
private static <T extends Comparable<T>> void ensureValidRange(T min, T max) { if (min == null) { throw new InvalidOperationException("Null value for minimum."); } if (max == null) { throw new InvalidOperationException("Null value for maximum."); } if (min.compareTo(max) >= 0) { throw new InvalidOperationException("Invalid range: " + min + " >= " + max); } }
[ "private", "static", "<", "T", "extends", "Comparable", "<", "T", ">", ">", "void", "ensureValidRange", "(", "T", "min", ",", "T", "max", ")", "{", "if", "(", "min", "==", "null", ")", "{", "throw", "new", "InvalidOperationException", "(", "\"Null value for minimum.\"", ")", ";", "}", "if", "(", "max", "==", "null", ")", "{", "throw", "new", "InvalidOperationException", "(", "\"Null value for maximum.\"", ")", ";", "}", "if", "(", "min", ".", "compareTo", "(", "max", ")", ">=", "0", ")", "{", "throw", "new", "InvalidOperationException", "(", "\"Invalid range: \"", "+", "min", "+", "\" >= \"", "+", "max", ")", ";", "}", "}" ]
Range validation utility method. @param <T> Type of data. @param min Minimum value. @param max Maximum value. @throws InvalidOperationException if the range is not valid.
[ "Range", "validation", "utility", "method", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DataSetBuilder.java#L1043-L1053
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/util/CmsSlideAnimation.java
CmsSlideAnimation.slideOut
public static CmsSlideAnimation slideOut(Element element, Command callback, int duration) { """ Slides the given element out of view executing the callback afterwards.<p> @param element the element to slide out @param callback the callback @param duration the animation duration @return the running animation object """ CmsSlideAnimation animation = new CmsSlideAnimation(element, false, callback); animation.run(duration); return animation; }
java
public static CmsSlideAnimation slideOut(Element element, Command callback, int duration) { CmsSlideAnimation animation = new CmsSlideAnimation(element, false, callback); animation.run(duration); return animation; }
[ "public", "static", "CmsSlideAnimation", "slideOut", "(", "Element", "element", ",", "Command", "callback", ",", "int", "duration", ")", "{", "CmsSlideAnimation", "animation", "=", "new", "CmsSlideAnimation", "(", "element", ",", "false", ",", "callback", ")", ";", "animation", ".", "run", "(", "duration", ")", ";", "return", "animation", ";", "}" ]
Slides the given element out of view executing the callback afterwards.<p> @param element the element to slide out @param callback the callback @param duration the animation duration @return the running animation object
[ "Slides", "the", "given", "element", "out", "of", "view", "executing", "the", "callback", "afterwards", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsSlideAnimation.java#L102-L107
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.alternateCalls
public void alternateCalls(String connId, String heldConnId) throws WorkspaceApiException { """ Alternate two calls so that you retrieve a call on hold and place the established call on hold instead. This is a shortcut for doing `holdCall()` and `retrieveCall()` separately. @param connId The connection ID of the established call that should be placed on hold. @param heldConnId The connection ID of the held call that should be retrieved. """ this.alternateCalls(connId, heldConnId, null, null); }
java
public void alternateCalls(String connId, String heldConnId) throws WorkspaceApiException { this.alternateCalls(connId, heldConnId, null, null); }
[ "public", "void", "alternateCalls", "(", "String", "connId", ",", "String", "heldConnId", ")", "throws", "WorkspaceApiException", "{", "this", ".", "alternateCalls", "(", "connId", ",", "heldConnId", ",", "null", ",", "null", ")", ";", "}" ]
Alternate two calls so that you retrieve a call on hold and place the established call on hold instead. This is a shortcut for doing `holdCall()` and `retrieveCall()` separately. @param connId The connection ID of the established call that should be placed on hold. @param heldConnId The connection ID of the held call that should be retrieved.
[ "Alternate", "two", "calls", "so", "that", "you", "retrieve", "a", "call", "on", "hold", "and", "place", "the", "established", "call", "on", "hold", "instead", ".", "This", "is", "a", "shortcut", "for", "doing", "holdCall", "()", "and", "retrieveCall", "()", "separately", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L868-L870
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasView.java
CmsAliasView.setData
public void setData(List<CmsAliasTableRow> data, List<CmsRewriteAliasTableRow> rewriteData) { """ Replaces the contents of the live data row list with another list of rows.<p> @param data the new list of rows to be placed into the live data list @param rewriteData the list of rewrite alias data """ m_table.getLiveDataList().clear(); m_table.getLiveDataList().addAll(data); m_rewriteTable.getLiveDataList().clear(); m_rewriteTable.getLiveDataList().addAll(rewriteData); }
java
public void setData(List<CmsAliasTableRow> data, List<CmsRewriteAliasTableRow> rewriteData) { m_table.getLiveDataList().clear(); m_table.getLiveDataList().addAll(data); m_rewriteTable.getLiveDataList().clear(); m_rewriteTable.getLiveDataList().addAll(rewriteData); }
[ "public", "void", "setData", "(", "List", "<", "CmsAliasTableRow", ">", "data", ",", "List", "<", "CmsRewriteAliasTableRow", ">", "rewriteData", ")", "{", "m_table", ".", "getLiveDataList", "(", ")", ".", "clear", "(", ")", ";", "m_table", ".", "getLiveDataList", "(", ")", ".", "addAll", "(", "data", ")", ";", "m_rewriteTable", ".", "getLiveDataList", "(", ")", ".", "clear", "(", ")", ";", "m_rewriteTable", ".", "getLiveDataList", "(", ")", ".", "addAll", "(", "rewriteData", ")", ";", "}" ]
Replaces the contents of the live data row list with another list of rows.<p> @param data the new list of rows to be placed into the live data list @param rewriteData the list of rewrite alias data
[ "Replaces", "the", "contents", "of", "the", "live", "data", "row", "list", "with", "another", "list", "of", "rows", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/alias/CmsAliasView.java#L299-L305
OpenLiberty/open-liberty
dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java
CommonMpJwtFat.badAppExpectations
public Expectations badAppExpectations(String errorMessage) throws Exception { """ Set bad app check expectations - sets checks for a 401 status code and the expected error message in the server's messages.log @param errorMessage - the error message to search for in the server's messages.log file @return - newly created Expectations @throws Exception """ Expectations expectations = new Expectations(); expectations.addExpectation(new ResponseStatusExpectation(HttpServletResponse.SC_UNAUTHORIZED)); expectations.addExpectation(new ResponseMessageExpectation(MpJwtFatConstants.STRING_CONTAINS, errorMessage, "Did not find the error message: " + errorMessage)); return expectations; }
java
public Expectations badAppExpectations(String errorMessage) throws Exception { Expectations expectations = new Expectations(); expectations.addExpectation(new ResponseStatusExpectation(HttpServletResponse.SC_UNAUTHORIZED)); expectations.addExpectation(new ResponseMessageExpectation(MpJwtFatConstants.STRING_CONTAINS, errorMessage, "Did not find the error message: " + errorMessage)); return expectations; }
[ "public", "Expectations", "badAppExpectations", "(", "String", "errorMessage", ")", "throws", "Exception", "{", "Expectations", "expectations", "=", "new", "Expectations", "(", ")", ";", "expectations", ".", "addExpectation", "(", "new", "ResponseStatusExpectation", "(", "HttpServletResponse", ".", "SC_UNAUTHORIZED", ")", ")", ";", "expectations", ".", "addExpectation", "(", "new", "ResponseMessageExpectation", "(", "MpJwtFatConstants", ".", "STRING_CONTAINS", ",", "errorMessage", ",", "\"Did not find the error message: \"", "+", "errorMessage", ")", ")", ";", "return", "expectations", ";", "}" ]
Set bad app check expectations - sets checks for a 401 status code and the expected error message in the server's messages.log @param errorMessage - the error message to search for in the server's messages.log file @return - newly created Expectations @throws Exception
[ "Set", "bad", "app", "check", "expectations", "-", "sets", "checks", "for", "a", "401", "status", "code", "and", "the", "expected", "error", "message", "in", "the", "server", "s", "messages", ".", "log" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L111-L118
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java
JsonUtil.getValueString
public static String getValueString(Object value, int type, MappingRules mapping) { """ Embeds the property type in the string value if the formats scope is 'value'. @param value @param type @param mapping @return """ String string = value.toString(); if (type != PropertyType.STRING && mapping.propertyFormat.embedType && mapping.propertyFormat.scope == MappingRules.PropertyFormat.Scope.value) { string = "{" + PropertyType.nameFromValue(type) + "}" + string; } return string; }
java
public static String getValueString(Object value, int type, MappingRules mapping) { String string = value.toString(); if (type != PropertyType.STRING && mapping.propertyFormat.embedType && mapping.propertyFormat.scope == MappingRules.PropertyFormat.Scope.value) { string = "{" + PropertyType.nameFromValue(type) + "}" + string; } return string; }
[ "public", "static", "String", "getValueString", "(", "Object", "value", ",", "int", "type", ",", "MappingRules", "mapping", ")", "{", "String", "string", "=", "value", ".", "toString", "(", ")", ";", "if", "(", "type", "!=", "PropertyType", ".", "STRING", "&&", "mapping", ".", "propertyFormat", ".", "embedType", "&&", "mapping", ".", "propertyFormat", ".", "scope", "==", "MappingRules", ".", "PropertyFormat", ".", "Scope", ".", "value", ")", "{", "string", "=", "\"{\"", "+", "PropertyType", ".", "nameFromValue", "(", "type", ")", "+", "\"}\"", "+", "string", ";", "}", "return", "string", ";", "}" ]
Embeds the property type in the string value if the formats scope is 'value'. @param value @param type @param mapping @return
[ "Embeds", "the", "property", "type", "in", "the", "string", "value", "if", "the", "formats", "scope", "is", "value", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/util/JsonUtil.java#L948-L956
sothawo/mapjfx
src/main/java/com/sothawo/mapjfx/MapView.java
JavaConnector.singleClickAt
public void singleClickAt(double lat, double lon) { """ called when the user has single-clicked in the map. the coordinates are EPSG:4326 (WGS) values. @param lat new latitude value @param lon new longitude value """ final Coordinate coordinate = new Coordinate(lat, lon); if (logger.isTraceEnabled()) { logger.trace("JS reports single click at {}", coordinate); } fireEvent(new MapViewEvent(MapViewEvent.MAP_CLICKED, coordinate)); }
java
public void singleClickAt(double lat, double lon) { final Coordinate coordinate = new Coordinate(lat, lon); if (logger.isTraceEnabled()) { logger.trace("JS reports single click at {}", coordinate); } fireEvent(new MapViewEvent(MapViewEvent.MAP_CLICKED, coordinate)); }
[ "public", "void", "singleClickAt", "(", "double", "lat", ",", "double", "lon", ")", "{", "final", "Coordinate", "coordinate", "=", "new", "Coordinate", "(", "lat", ",", "lon", ")", ";", "if", "(", "logger", ".", "isTraceEnabled", "(", ")", ")", "{", "logger", ".", "trace", "(", "\"JS reports single click at {}\"", ",", "coordinate", ")", ";", "}", "fireEvent", "(", "new", "MapViewEvent", "(", "MapViewEvent", ".", "MAP_CLICKED", ",", "coordinate", ")", ")", ";", "}" ]
called when the user has single-clicked in the map. the coordinates are EPSG:4326 (WGS) values. @param lat new latitude value @param lon new longitude value
[ "called", "when", "the", "user", "has", "single", "-", "clicked", "in", "the", "map", ".", "the", "coordinates", "are", "EPSG", ":", "4326", "(", "WGS", ")", "values", "." ]
train
https://github.com/sothawo/mapjfx/blob/202091de492ab7a8b000c77efd833029f7f0ef92/src/main/java/com/sothawo/mapjfx/MapView.java#L1372-L1378
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/common/ByteCode.java
ByteCode.getConstantLDC
public static <T> T getConstantLDC(InstructionHandle h, ConstantPoolGen cpg, Class<T> clazz) { """ Get the constant value of the given instruction. (The instruction must refer to the Constant Pool otherwise null is return) &lt;T&gt; is the Type of the constant value return This utility method should be used only when the taint analysis is not needed. For example, to detect api where the value will typically be hardcoded. (Call such as setConfig("valueHardcoded"), setActivateStuff(true) ) @param h Instruction Handle @param cpg Constant Pool @param clazz Type of the constant being read @return The constant value if any is found """ Instruction prevIns = h.getInstruction(); if (prevIns instanceof LDC) { LDC ldcInst = (LDC) prevIns; Object val = ldcInst.getValue(cpg); if (val.getClass().equals(clazz)) { return clazz.cast(val); } } else if(clazz.equals(String.class) && prevIns instanceof INVOKESPECIAL) { //This additionnal call allow the support of hardcoded value passed to String constructor //new String("HARDCODE") INVOKESPECIAL invoke = (INVOKESPECIAL) prevIns; if(invoke.getMethodName(cpg).equals("<init>") && invoke.getClassName(cpg).equals("java.lang.String") && invoke.getSignature(cpg).equals("(Ljava/lang/String;)V")) { return getConstantLDC(h.getPrev(), cpg, clazz); } } return null; }
java
public static <T> T getConstantLDC(InstructionHandle h, ConstantPoolGen cpg, Class<T> clazz) { Instruction prevIns = h.getInstruction(); if (prevIns instanceof LDC) { LDC ldcInst = (LDC) prevIns; Object val = ldcInst.getValue(cpg); if (val.getClass().equals(clazz)) { return clazz.cast(val); } } else if(clazz.equals(String.class) && prevIns instanceof INVOKESPECIAL) { //This additionnal call allow the support of hardcoded value passed to String constructor //new String("HARDCODE") INVOKESPECIAL invoke = (INVOKESPECIAL) prevIns; if(invoke.getMethodName(cpg).equals("<init>") && invoke.getClassName(cpg).equals("java.lang.String") && invoke.getSignature(cpg).equals("(Ljava/lang/String;)V")) { return getConstantLDC(h.getPrev(), cpg, clazz); } } return null; }
[ "public", "static", "<", "T", ">", "T", "getConstantLDC", "(", "InstructionHandle", "h", ",", "ConstantPoolGen", "cpg", ",", "Class", "<", "T", ">", "clazz", ")", "{", "Instruction", "prevIns", "=", "h", ".", "getInstruction", "(", ")", ";", "if", "(", "prevIns", "instanceof", "LDC", ")", "{", "LDC", "ldcInst", "=", "(", "LDC", ")", "prevIns", ";", "Object", "val", "=", "ldcInst", ".", "getValue", "(", "cpg", ")", ";", "if", "(", "val", ".", "getClass", "(", ")", ".", "equals", "(", "clazz", ")", ")", "{", "return", "clazz", ".", "cast", "(", "val", ")", ";", "}", "}", "else", "if", "(", "clazz", ".", "equals", "(", "String", ".", "class", ")", "&&", "prevIns", "instanceof", "INVOKESPECIAL", ")", "{", "//This additionnal call allow the support of hardcoded value passed to String constructor", "//new String(\"HARDCODE\")", "INVOKESPECIAL", "invoke", "=", "(", "INVOKESPECIAL", ")", "prevIns", ";", "if", "(", "invoke", ".", "getMethodName", "(", "cpg", ")", ".", "equals", "(", "\"<init>\"", ")", "&&", "invoke", ".", "getClassName", "(", "cpg", ")", ".", "equals", "(", "\"java.lang.String\"", ")", "&&", "invoke", ".", "getSignature", "(", "cpg", ")", ".", "equals", "(", "\"(Ljava/lang/String;)V\"", ")", ")", "{", "return", "getConstantLDC", "(", "h", ".", "getPrev", "(", ")", ",", "cpg", ",", "clazz", ")", ";", "}", "}", "return", "null", ";", "}" ]
Get the constant value of the given instruction. (The instruction must refer to the Constant Pool otherwise null is return) &lt;T&gt; is the Type of the constant value return This utility method should be used only when the taint analysis is not needed. For example, to detect api where the value will typically be hardcoded. (Call such as setConfig("valueHardcoded"), setActivateStuff(true) ) @param h Instruction Handle @param cpg Constant Pool @param clazz Type of the constant being read @return The constant value if any is found
[ "Get", "the", "constant", "value", "of", "the", "given", "instruction", ".", "(", "The", "instruction", "must", "refer", "to", "the", "Constant", "Pool", "otherwise", "null", "is", "return", ")" ]
train
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/common/ByteCode.java#L97-L117
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/ProcessedInput.java
ProcessedInput.fillParameterValues
public void fillParameterValues(Map<String, Object> valuesMap) { """ Utility function. Fills this ProcessedInput with values. This function iterates over parameter names list and loads corresponding value from MAp @param valuesMap Map of values which would be loaded """ AssertUtils.assertNotNull(valuesMap, "Value map cannot be null"); if (this.sqlParameterNames != null) { String parameterName = null; this.sqlParameterValues = new ArrayList<Object>(); // using for instead of iterator because this way I control position // I am getting. for (int i = 0; i < this.sqlParameterNames.size(); i++) { parameterName = this.sqlParameterNames.get(i); if (valuesMap.containsKey(parameterName) == true) { this.sqlParameterValues.add(valuesMap.get(parameterName)); } else { throw new IllegalArgumentException(String.format(HandlersConstants.ERROR_PARAMETER_NOT_FOUND, parameterName)); } } } }
java
public void fillParameterValues(Map<String, Object> valuesMap) { AssertUtils.assertNotNull(valuesMap, "Value map cannot be null"); if (this.sqlParameterNames != null) { String parameterName = null; this.sqlParameterValues = new ArrayList<Object>(); // using for instead of iterator because this way I control position // I am getting. for (int i = 0; i < this.sqlParameterNames.size(); i++) { parameterName = this.sqlParameterNames.get(i); if (valuesMap.containsKey(parameterName) == true) { this.sqlParameterValues.add(valuesMap.get(parameterName)); } else { throw new IllegalArgumentException(String.format(HandlersConstants.ERROR_PARAMETER_NOT_FOUND, parameterName)); } } } }
[ "public", "void", "fillParameterValues", "(", "Map", "<", "String", ",", "Object", ">", "valuesMap", ")", "{", "AssertUtils", ".", "assertNotNull", "(", "valuesMap", ",", "\"Value map cannot be null\"", ")", ";", "if", "(", "this", ".", "sqlParameterNames", "!=", "null", ")", "{", "String", "parameterName", "=", "null", ";", "this", ".", "sqlParameterValues", "=", "new", "ArrayList", "<", "Object", ">", "(", ")", ";", "// using for instead of iterator because this way I control position\r", "// I am getting.\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "sqlParameterNames", ".", "size", "(", ")", ";", "i", "++", ")", "{", "parameterName", "=", "this", ".", "sqlParameterNames", ".", "get", "(", "i", ")", ";", "if", "(", "valuesMap", ".", "containsKey", "(", "parameterName", ")", "==", "true", ")", "{", "this", ".", "sqlParameterValues", ".", "add", "(", "valuesMap", ".", "get", "(", "parameterName", ")", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "HandlersConstants", ".", "ERROR_PARAMETER_NOT_FOUND", ",", "parameterName", ")", ")", ";", "}", "}", "}", "}" ]
Utility function. Fills this ProcessedInput with values. This function iterates over parameter names list and loads corresponding value from MAp @param valuesMap Map of values which would be loaded
[ "Utility", "function", ".", "Fills", "this", "ProcessedInput", "with", "values", ".", "This", "function", "iterates", "over", "parameter", "names", "list", "and", "loads", "corresponding", "value", "from", "MAp" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/model/ProcessedInput.java#L316-L336
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/CollectionUtils.java
CollectionUtils.removeObject
public static <T> boolean removeObject(List<T> l, T o) { """ Removes the first occurrence in the list of the specified object, using object identity (==) not equality as the criterion for object presence. If this list does not contain the element, it is unchanged. @param l The {@link List} from which to remove the object @param o The object to be removed. @return Whether or not the List was changed. """ int i = 0; for (Object o1 : l) { if (o == o1) { l.remove(i); return true; } else i++; } return false; }
java
public static <T> boolean removeObject(List<T> l, T o) { int i = 0; for (Object o1 : l) { if (o == o1) { l.remove(i); return true; } else i++; } return false; }
[ "public", "static", "<", "T", ">", "boolean", "removeObject", "(", "List", "<", "T", ">", "l", ",", "T", "o", ")", "{", "int", "i", "=", "0", ";", "for", "(", "Object", "o1", ":", "l", ")", "{", "if", "(", "o", "==", "o1", ")", "{", "l", ".", "remove", "(", "i", ")", ";", "return", "true", ";", "}", "else", "i", "++", ";", "}", "return", "false", ";", "}" ]
Removes the first occurrence in the list of the specified object, using object identity (==) not equality as the criterion for object presence. If this list does not contain the element, it is unchanged. @param l The {@link List} from which to remove the object @param o The object to be removed. @return Whether or not the List was changed.
[ "Removes", "the", "first", "occurrence", "in", "the", "list", "of", "the", "specified", "object", "using", "object", "identity", "(", "==", ")", "not", "equality", "as", "the", "criterion", "for", "object", "presence", ".", "If", "this", "list", "does", "not", "contain", "the", "element", "it", "is", "unchanged", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/CollectionUtils.java#L261-L271
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java
JPAUtils.getKeyQuery
public static String getKeyQuery(String queryString, String name) { """ Gets Query String for selecting primary keys @param queryString the original query @param name primary key name @return query string """ Matcher m = FROM_PATTERN.matcher(queryString); if (m.find()) { StringBuilder sb = new StringBuilder("SELECT "); sb.append(getAlias(queryString)); sb.append("."); sb.append(name); sb.append(" "); sb.append(m.group()); return sb.toString(); } return null; }
java
public static String getKeyQuery(String queryString, String name) { Matcher m = FROM_PATTERN.matcher(queryString); if (m.find()) { StringBuilder sb = new StringBuilder("SELECT "); sb.append(getAlias(queryString)); sb.append("."); sb.append(name); sb.append(" "); sb.append(m.group()); return sb.toString(); } return null; }
[ "public", "static", "String", "getKeyQuery", "(", "String", "queryString", ",", "String", "name", ")", "{", "Matcher", "m", "=", "FROM_PATTERN", ".", "matcher", "(", "queryString", ")", ";", "if", "(", "m", ".", "find", "(", ")", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\"SELECT \"", ")", ";", "sb", ".", "append", "(", "getAlias", "(", "queryString", ")", ")", ";", "sb", ".", "append", "(", "\".\"", ")", ";", "sb", ".", "append", "(", "name", ")", ";", "sb", ".", "append", "(", "\" \"", ")", ";", "sb", ".", "append", "(", "m", ".", "group", "(", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}", "return", "null", ";", "}" ]
Gets Query String for selecting primary keys @param queryString the original query @param name primary key name @return query string
[ "Gets", "Query", "String", "for", "selecting", "primary", "keys" ]
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/utils/JPAUtils.java#L233-L246
primefaces/primefaces
src/main/java/org/primefaces/util/FileUploadUtils.java
FileUploadUtils.isValidType
public static boolean isValidType(FileUpload fileUpload, String fileName, InputStream inputStream) { """ Check if an uploaded file meets all specifications regarding its filename and content type. It evaluates {@link FileUpload#getAllowTypes} as well as {@link FileUpload#getAccept} and uses the installed {@link java.nio.file.spi.FileTypeDetector} implementation. For most reliable content type checking it's recommended to plug in Apache Tika as an implementation. @param fileUpload the fileUpload component @param fileName the name of the uploaded file @param inputStream the input stream to receive the file's content from @return <code>true</code>, if all validations regarding filename and content type passed, <code>false</code> else """ try { boolean validType = isValidFileName(fileUpload, fileName) && isValidFileContent(fileUpload, fileName, inputStream); if (validType) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(String.format("The uploaded file %s meets the filename and content type specifications", fileName)); } } return validType; } catch (IOException | ScriptException ex) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, String.format("The type of the uploaded file %s could not be validated", fileName), ex); } return false; } }
java
public static boolean isValidType(FileUpload fileUpload, String fileName, InputStream inputStream) { try { boolean validType = isValidFileName(fileUpload, fileName) && isValidFileContent(fileUpload, fileName, inputStream); if (validType) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(String.format("The uploaded file %s meets the filename and content type specifications", fileName)); } } return validType; } catch (IOException | ScriptException ex) { if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.log(Level.WARNING, String.format("The type of the uploaded file %s could not be validated", fileName), ex); } return false; } }
[ "public", "static", "boolean", "isValidType", "(", "FileUpload", "fileUpload", ",", "String", "fileName", ",", "InputStream", "inputStream", ")", "{", "try", "{", "boolean", "validType", "=", "isValidFileName", "(", "fileUpload", ",", "fileName", ")", "&&", "isValidFileContent", "(", "fileUpload", ",", "fileName", ",", "inputStream", ")", ";", "if", "(", "validType", ")", "{", "if", "(", "LOGGER", ".", "isLoggable", "(", "Level", ".", "FINE", ")", ")", "{", "LOGGER", ".", "fine", "(", "String", ".", "format", "(", "\"The uploaded file %s meets the filename and content type specifications\"", ",", "fileName", ")", ")", ";", "}", "}", "return", "validType", ";", "}", "catch", "(", "IOException", "|", "ScriptException", "ex", ")", "{", "if", "(", "LOGGER", ".", "isLoggable", "(", "Level", ".", "WARNING", ")", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "WARNING", ",", "String", ".", "format", "(", "\"The type of the uploaded file %s could not be validated\"", ",", "fileName", ")", ",", "ex", ")", ";", "}", "return", "false", ";", "}", "}" ]
Check if an uploaded file meets all specifications regarding its filename and content type. It evaluates {@link FileUpload#getAllowTypes} as well as {@link FileUpload#getAccept} and uses the installed {@link java.nio.file.spi.FileTypeDetector} implementation. For most reliable content type checking it's recommended to plug in Apache Tika as an implementation. @param fileUpload the fileUpload component @param fileName the name of the uploaded file @param inputStream the input stream to receive the file's content from @return <code>true</code>, if all validations regarding filename and content type passed, <code>false</code> else
[ "Check", "if", "an", "uploaded", "file", "meets", "all", "specifications", "regarding", "its", "filename", "and", "content", "type", ".", "It", "evaluates", "{" ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/util/FileUploadUtils.java#L143-L159
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/spatialite/SpatialDbsImportUtils.java
SpatialDbsImportUtils.createTableFromShp
public static String createTableFromShp( ASpatialDb db, File shapeFile, String newTableName, boolean avoidSpatialIndex ) throws Exception { """ Create a spatial table using a shapefile as schema. @param db the database to use. @param shapeFile the shapefile to use. @param newTableName the new name of the table. If null, the shp name is used. @return the name of the created table. @param avoidSpatialIndex if <code>true</code>, no spatial index will be created. This is useful if many records have to be inserted and the index will be created later manually. @return the name of the created table. @throws Exception """ FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile); SimpleFeatureSource featureSource = store.getFeatureSource(); SimpleFeatureType schema = featureSource.getSchema(); if (newTableName == null) { newTableName = FileUtilities.getNameWithoutExtention(shapeFile); } return createTableFromSchema(db, schema, newTableName, avoidSpatialIndex); }
java
public static String createTableFromShp( ASpatialDb db, File shapeFile, String newTableName, boolean avoidSpatialIndex ) throws Exception { FileDataStore store = FileDataStoreFinder.getDataStore(shapeFile); SimpleFeatureSource featureSource = store.getFeatureSource(); SimpleFeatureType schema = featureSource.getSchema(); if (newTableName == null) { newTableName = FileUtilities.getNameWithoutExtention(shapeFile); } return createTableFromSchema(db, schema, newTableName, avoidSpatialIndex); }
[ "public", "static", "String", "createTableFromShp", "(", "ASpatialDb", "db", ",", "File", "shapeFile", ",", "String", "newTableName", ",", "boolean", "avoidSpatialIndex", ")", "throws", "Exception", "{", "FileDataStore", "store", "=", "FileDataStoreFinder", ".", "getDataStore", "(", "shapeFile", ")", ";", "SimpleFeatureSource", "featureSource", "=", "store", ".", "getFeatureSource", "(", ")", ";", "SimpleFeatureType", "schema", "=", "featureSource", ".", "getSchema", "(", ")", ";", "if", "(", "newTableName", "==", "null", ")", "{", "newTableName", "=", "FileUtilities", ".", "getNameWithoutExtention", "(", "shapeFile", ")", ";", "}", "return", "createTableFromSchema", "(", "db", ",", "schema", ",", "newTableName", ",", "avoidSpatialIndex", ")", ";", "}" ]
Create a spatial table using a shapefile as schema. @param db the database to use. @param shapeFile the shapefile to use. @param newTableName the new name of the table. If null, the shp name is used. @return the name of the created table. @param avoidSpatialIndex if <code>true</code>, no spatial index will be created. This is useful if many records have to be inserted and the index will be created later manually. @return the name of the created table. @throws Exception
[ "Create", "a", "spatial", "table", "using", "a", "shapefile", "as", "schema", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/spatialite/SpatialDbsImportUtils.java#L88-L97
bazaarvoice/emodb
table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTableDAO.java
AstyanaxTableDAO.tableFromJson
@VisibleForTesting Table tableFromJson(TableJson json) { """ Parse the persistent JSON object into an AstyanaxTable. If the master placement doesn't belong to this datacenter, this method will: a. try to find a facade for this table that belongs to this datacenter b. If no facade is found, it will return the table in the master placement. """ if (json.isDropped()) { return null; } String name = json.getTable(); Map<String, Object> attributes = json.getAttributeMap(); Storage masterStorage = json.getMasterStorage(); String masterPlacement = masterStorage.getPlacement(); Collection<Storage> facades = json.getFacades(); TableOptions options = new TableOptionsBuilder() .setPlacement(masterPlacement) .setFacades(ImmutableList.copyOf(Iterables.transform(facades, new Function<Storage, FacadeOptions>() { @Override public FacadeOptions apply(Storage facade) { return new FacadeOptions(facade.getPlacement()); } }))) .build(); Storage storageForDc = masterStorage; boolean available = true; if (!_placementFactory.isAvailablePlacement(masterPlacement)) { available = false; // The master placement does not belong to this datacenter. Let's see if we have a // facade that belongs to this datacenter. If not, we'll stick with the masterStorage. for (Storage facade : facades) { if (_placementFactory.isAvailablePlacement(facade.getPlacement())) { if (storageForDc.isFacade()) { // We found multiple facades for the same datacenter. throw new TableExistsException(format("Multiple facades found for table %s in %s", name, _selfDataCenter), name); } storageForDc = facade; available = true; } } } return newTable(name, options, attributes, available, storageForDc); }
java
@VisibleForTesting Table tableFromJson(TableJson json) { if (json.isDropped()) { return null; } String name = json.getTable(); Map<String, Object> attributes = json.getAttributeMap(); Storage masterStorage = json.getMasterStorage(); String masterPlacement = masterStorage.getPlacement(); Collection<Storage> facades = json.getFacades(); TableOptions options = new TableOptionsBuilder() .setPlacement(masterPlacement) .setFacades(ImmutableList.copyOf(Iterables.transform(facades, new Function<Storage, FacadeOptions>() { @Override public FacadeOptions apply(Storage facade) { return new FacadeOptions(facade.getPlacement()); } }))) .build(); Storage storageForDc = masterStorage; boolean available = true; if (!_placementFactory.isAvailablePlacement(masterPlacement)) { available = false; // The master placement does not belong to this datacenter. Let's see if we have a // facade that belongs to this datacenter. If not, we'll stick with the masterStorage. for (Storage facade : facades) { if (_placementFactory.isAvailablePlacement(facade.getPlacement())) { if (storageForDc.isFacade()) { // We found multiple facades for the same datacenter. throw new TableExistsException(format("Multiple facades found for table %s in %s", name, _selfDataCenter), name); } storageForDc = facade; available = true; } } } return newTable(name, options, attributes, available, storageForDc); }
[ "@", "VisibleForTesting", "Table", "tableFromJson", "(", "TableJson", "json", ")", "{", "if", "(", "json", ".", "isDropped", "(", ")", ")", "{", "return", "null", ";", "}", "String", "name", "=", "json", ".", "getTable", "(", ")", ";", "Map", "<", "String", ",", "Object", ">", "attributes", "=", "json", ".", "getAttributeMap", "(", ")", ";", "Storage", "masterStorage", "=", "json", ".", "getMasterStorage", "(", ")", ";", "String", "masterPlacement", "=", "masterStorage", ".", "getPlacement", "(", ")", ";", "Collection", "<", "Storage", ">", "facades", "=", "json", ".", "getFacades", "(", ")", ";", "TableOptions", "options", "=", "new", "TableOptionsBuilder", "(", ")", ".", "setPlacement", "(", "masterPlacement", ")", ".", "setFacades", "(", "ImmutableList", ".", "copyOf", "(", "Iterables", ".", "transform", "(", "facades", ",", "new", "Function", "<", "Storage", ",", "FacadeOptions", ">", "(", ")", "{", "@", "Override", "public", "FacadeOptions", "apply", "(", "Storage", "facade", ")", "{", "return", "new", "FacadeOptions", "(", "facade", ".", "getPlacement", "(", ")", ")", ";", "}", "}", ")", ")", ")", ".", "build", "(", ")", ";", "Storage", "storageForDc", "=", "masterStorage", ";", "boolean", "available", "=", "true", ";", "if", "(", "!", "_placementFactory", ".", "isAvailablePlacement", "(", "masterPlacement", ")", ")", "{", "available", "=", "false", ";", "// The master placement does not belong to this datacenter. Let's see if we have a", "// facade that belongs to this datacenter. If not, we'll stick with the masterStorage.", "for", "(", "Storage", "facade", ":", "facades", ")", "{", "if", "(", "_placementFactory", ".", "isAvailablePlacement", "(", "facade", ".", "getPlacement", "(", ")", ")", ")", "{", "if", "(", "storageForDc", ".", "isFacade", "(", ")", ")", "{", "// We found multiple facades for the same datacenter.", "throw", "new", "TableExistsException", "(", "format", "(", "\"Multiple facades found for table %s in %s\"", ",", "name", ",", "_selfDataCenter", ")", ",", "name", ")", ";", "}", "storageForDc", "=", "facade", ";", "available", "=", "true", ";", "}", "}", "}", "return", "newTable", "(", "name", ",", "options", ",", "attributes", ",", "available", ",", "storageForDc", ")", ";", "}" ]
Parse the persistent JSON object into an AstyanaxTable. If the master placement doesn't belong to this datacenter, this method will: a. try to find a facade for this table that belongs to this datacenter b. If no facade is found, it will return the table in the master placement.
[ "Parse", "the", "persistent", "JSON", "object", "into", "an", "AstyanaxTable", ".", "If", "the", "master", "placement", "doesn", "t", "belong", "to", "this", "datacenter", "this", "method", "will", ":", "a", ".", "try", "to", "find", "a", "facade", "for", "this", "table", "that", "belongs", "to", "this", "datacenter", "b", ".", "If", "no", "facade", "is", "found", "it", "will", "return", "the", "table", "in", "the", "master", "placement", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/table/src/main/java/com/bazaarvoice/emodb/table/db/astyanax/AstyanaxTableDAO.java#L1228-L1268
samskivert/pythagoras
src/main/java/pythagoras/f/Quaternion.java
Quaternion.fromAngles
public Quaternion fromAngles (Vector3 angles) { """ Sets this quaternion to one that first rotates about x by the specified number of radians, then rotates about y, then about z. """ return fromAngles(angles.x, angles.y, angles.z); }
java
public Quaternion fromAngles (Vector3 angles) { return fromAngles(angles.x, angles.y, angles.z); }
[ "public", "Quaternion", "fromAngles", "(", "Vector3", "angles", ")", "{", "return", "fromAngles", "(", "angles", ".", "x", ",", "angles", ".", "y", ",", "angles", ".", "z", ")", ";", "}" ]
Sets this quaternion to one that first rotates about x by the specified number of radians, then rotates about y, then about z.
[ "Sets", "this", "quaternion", "to", "one", "that", "first", "rotates", "about", "x", "by", "the", "specified", "number", "of", "radians", "then", "rotates", "about", "y", "then", "about", "z", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Quaternion.java#L206-L208
fuinorg/utils4j
src/main/java/org/fuin/utils4j/PropertiesUtils.java
PropertiesUtils.saveProperties
public static void saveProperties(final File file, final Properties props, final String comment) { """ Save properties to a file. @param file Destination file - Cannot be <code>null</code> and parent directory must exist. @param props Properties to save - Cannot be <code>null</code>. @param comment Comment for the file. """ checkNotNull("file", file); checkNotNull("props", props); if (!file.getParentFile().exists()) { throw new IllegalArgumentException("The parent directory '" + file.getParentFile() + "' does not exist [file='" + file + "']!"); } try (final OutputStream outStream = new FileOutputStream(file)) { props.store(outStream, comment); } catch (final IOException ex) { throw new RuntimeException(ex); } }
java
public static void saveProperties(final File file, final Properties props, final String comment) { checkNotNull("file", file); checkNotNull("props", props); if (!file.getParentFile().exists()) { throw new IllegalArgumentException("The parent directory '" + file.getParentFile() + "' does not exist [file='" + file + "']!"); } try (final OutputStream outStream = new FileOutputStream(file)) { props.store(outStream, comment); } catch (final IOException ex) { throw new RuntimeException(ex); } }
[ "public", "static", "void", "saveProperties", "(", "final", "File", "file", ",", "final", "Properties", "props", ",", "final", "String", "comment", ")", "{", "checkNotNull", "(", "\"file\"", ",", "file", ")", ";", "checkNotNull", "(", "\"props\"", ",", "props", ")", ";", "if", "(", "!", "file", ".", "getParentFile", "(", ")", ".", "exists", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The parent directory '\"", "+", "file", ".", "getParentFile", "(", ")", "+", "\"' does not exist [file='\"", "+", "file", "+", "\"']!\"", ")", ";", "}", "try", "(", "final", "OutputStream", "outStream", "=", "new", "FileOutputStream", "(", "file", ")", ")", "{", "props", ".", "store", "(", "outStream", ",", "comment", ")", ";", "}", "catch", "(", "final", "IOException", "ex", ")", "{", "throw", "new", "RuntimeException", "(", "ex", ")", ";", "}", "}" ]
Save properties to a file. @param file Destination file - Cannot be <code>null</code> and parent directory must exist. @param props Properties to save - Cannot be <code>null</code>. @param comment Comment for the file.
[ "Save", "properties", "to", "a", "file", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/PropertiesUtils.java#L123-L135
ihaolin/session
session-api/src/main/java/me/hao0/session/util/WebUtil.java
WebUtil.findCookie
public static Cookie findCookie(HttpServletRequest request, String name) { """ find cookie from request @param request current request @param name cookie name @return cookie value or null """ if (request != null) { Cookie[] cookies = request.getCookies(); if (cookies != null && cookies.length > 0) { for (Cookie cookie : cookies) { if (cookie.getName().equals(name)) { return cookie; } } } } return null; }
java
public static Cookie findCookie(HttpServletRequest request, String name) { if (request != null) { Cookie[] cookies = request.getCookies(); if (cookies != null && cookies.length > 0) { for (Cookie cookie : cookies) { if (cookie.getName().equals(name)) { return cookie; } } } } return null; }
[ "public", "static", "Cookie", "findCookie", "(", "HttpServletRequest", "request", ",", "String", "name", ")", "{", "if", "(", "request", "!=", "null", ")", "{", "Cookie", "[", "]", "cookies", "=", "request", ".", "getCookies", "(", ")", ";", "if", "(", "cookies", "!=", "null", "&&", "cookies", ".", "length", ">", "0", ")", "{", "for", "(", "Cookie", "cookie", ":", "cookies", ")", "{", "if", "(", "cookie", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", ")", "{", "return", "cookie", ";", "}", "}", "}", "}", "return", "null", ";", "}" ]
find cookie from request @param request current request @param name cookie name @return cookie value or null
[ "find", "cookie", "from", "request" ]
train
https://github.com/ihaolin/session/blob/322c3a9f47b305a39345135fa8163dd7e065b4f8/session-api/src/main/java/me/hao0/session/util/WebUtil.java#L61-L73
facebookarchive/hadoop-20
src/core/org/apache/hadoop/util/MRAsyncDiskService.java
MRAsyncDiskService.moveAndDeleteRelativePath
public boolean moveAndDeleteRelativePath(String volume, String pathName) throws IOException { """ Move the path name on one volume to a temporary location and then delete them. This functions returns when the moves are done, but not necessarily all deletions are done. This is usually good enough because applications won't see the path name under the old name anyway after the move. @param volume The disk volume @param pathName The path name relative to volume root. @throws IOException If the move failed @return false if the file is not found """ volume = normalizePath(volume); // Move the file right now, so that it can be deleted later String newPathName = format.format(new Date()) + "_" + uniqueId.getAndIncrement(); newPathName = TOBEDELETED + Path.SEPARATOR_CHAR + newPathName; Path source = new Path(volume, pathName); Path target = new Path(volume, newPathName); try { if (!localFileSystem.rename(source, target)) { // If the source does not exists, return false. // This is necessary because rename can return false if the source // does not exists. if (!localFileSystem.exists(source)) { return false; } // Try to recreate the parent directory just in case it gets deleted. if (!localFileSystem.mkdirs(new Path(volume, TOBEDELETED))) { throw new IOException("Cannot create " + TOBEDELETED + " under " + volume); } // Try rename again. If it fails, return false. if (!localFileSystem.rename(source, target)) { throw new IOException("Cannot rename " + source + " to " + target); } } } catch (FileNotFoundException e) { // Return false in case that the file is not found. return false; } DeleteTask task = new DeleteTask(volume, pathName, newPathName); execute(volume, task); return true; }
java
public boolean moveAndDeleteRelativePath(String volume, String pathName) throws IOException { volume = normalizePath(volume); // Move the file right now, so that it can be deleted later String newPathName = format.format(new Date()) + "_" + uniqueId.getAndIncrement(); newPathName = TOBEDELETED + Path.SEPARATOR_CHAR + newPathName; Path source = new Path(volume, pathName); Path target = new Path(volume, newPathName); try { if (!localFileSystem.rename(source, target)) { // If the source does not exists, return false. // This is necessary because rename can return false if the source // does not exists. if (!localFileSystem.exists(source)) { return false; } // Try to recreate the parent directory just in case it gets deleted. if (!localFileSystem.mkdirs(new Path(volume, TOBEDELETED))) { throw new IOException("Cannot create " + TOBEDELETED + " under " + volume); } // Try rename again. If it fails, return false. if (!localFileSystem.rename(source, target)) { throw new IOException("Cannot rename " + source + " to " + target); } } } catch (FileNotFoundException e) { // Return false in case that the file is not found. return false; } DeleteTask task = new DeleteTask(volume, pathName, newPathName); execute(volume, task); return true; }
[ "public", "boolean", "moveAndDeleteRelativePath", "(", "String", "volume", ",", "String", "pathName", ")", "throws", "IOException", "{", "volume", "=", "normalizePath", "(", "volume", ")", ";", "// Move the file right now, so that it can be deleted later", "String", "newPathName", "=", "format", ".", "format", "(", "new", "Date", "(", ")", ")", "+", "\"_\"", "+", "uniqueId", ".", "getAndIncrement", "(", ")", ";", "newPathName", "=", "TOBEDELETED", "+", "Path", ".", "SEPARATOR_CHAR", "+", "newPathName", ";", "Path", "source", "=", "new", "Path", "(", "volume", ",", "pathName", ")", ";", "Path", "target", "=", "new", "Path", "(", "volume", ",", "newPathName", ")", ";", "try", "{", "if", "(", "!", "localFileSystem", ".", "rename", "(", "source", ",", "target", ")", ")", "{", "// If the source does not exists, return false.", "// This is necessary because rename can return false if the source ", "// does not exists.", "if", "(", "!", "localFileSystem", ".", "exists", "(", "source", ")", ")", "{", "return", "false", ";", "}", "// Try to recreate the parent directory just in case it gets deleted.", "if", "(", "!", "localFileSystem", ".", "mkdirs", "(", "new", "Path", "(", "volume", ",", "TOBEDELETED", ")", ")", ")", "{", "throw", "new", "IOException", "(", "\"Cannot create \"", "+", "TOBEDELETED", "+", "\" under \"", "+", "volume", ")", ";", "}", "// Try rename again. If it fails, return false.", "if", "(", "!", "localFileSystem", ".", "rename", "(", "source", ",", "target", ")", ")", "{", "throw", "new", "IOException", "(", "\"Cannot rename \"", "+", "source", "+", "\" to \"", "+", "target", ")", ";", "}", "}", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "// Return false in case that the file is not found. ", "return", "false", ";", "}", "DeleteTask", "task", "=", "new", "DeleteTask", "(", "volume", ",", "pathName", ",", "newPathName", ")", ";", "execute", "(", "volume", ",", "task", ")", ";", "return", "true", ";", "}" ]
Move the path name on one volume to a temporary location and then delete them. This functions returns when the moves are done, but not necessarily all deletions are done. This is usually good enough because applications won't see the path name under the old name anyway after the move. @param volume The disk volume @param pathName The path name relative to volume root. @throws IOException If the move failed @return false if the file is not found
[ "Move", "the", "path", "name", "on", "one", "volume", "to", "a", "temporary", "location", "and", "then", "delete", "them", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/MRAsyncDiskService.java#L251-L290
52inc/android-52Kit
library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java
Drawer.formatNavDrawerItem
private void formatNavDrawerItem(DrawerItem item, boolean selected) { """ Format a nav drawer item based on current selected states @param item @param selected """ if (item instanceof SeperatorDrawerItem || item instanceof SwitchDrawerItem) { // not applicable return; } // Get the associated view View view = mNavDrawerItemViews.get(item.getId()); ImageView iconView = (ImageView) view.findViewById(R.id.icon); TextView titleView = (TextView) view.findViewById(R.id.title); // configure its appearance according to whether or not it's selected titleView.setTextColor(selected ? mConfig.getItemHighlightColor(mActivity) : UIUtils.getColorAttr(mActivity, android.R.attr.textColorPrimary)); iconView.setColorFilter(selected ? mConfig.getItemHighlightColor(mActivity) : getResources().getColor(R.color.navdrawer_icon_tint), PorterDuff.Mode.SRC_ATOP); }
java
private void formatNavDrawerItem(DrawerItem item, boolean selected) { if (item instanceof SeperatorDrawerItem || item instanceof SwitchDrawerItem) { // not applicable return; } // Get the associated view View view = mNavDrawerItemViews.get(item.getId()); ImageView iconView = (ImageView) view.findViewById(R.id.icon); TextView titleView = (TextView) view.findViewById(R.id.title); // configure its appearance according to whether or not it's selected titleView.setTextColor(selected ? mConfig.getItemHighlightColor(mActivity) : UIUtils.getColorAttr(mActivity, android.R.attr.textColorPrimary)); iconView.setColorFilter(selected ? mConfig.getItemHighlightColor(mActivity) : getResources().getColor(R.color.navdrawer_icon_tint), PorterDuff.Mode.SRC_ATOP); }
[ "private", "void", "formatNavDrawerItem", "(", "DrawerItem", "item", ",", "boolean", "selected", ")", "{", "if", "(", "item", "instanceof", "SeperatorDrawerItem", "||", "item", "instanceof", "SwitchDrawerItem", ")", "{", "// not applicable", "return", ";", "}", "// Get the associated view", "View", "view", "=", "mNavDrawerItemViews", ".", "get", "(", "item", ".", "getId", "(", ")", ")", ";", "ImageView", "iconView", "=", "(", "ImageView", ")", "view", ".", "findViewById", "(", "R", ".", "id", ".", "icon", ")", ";", "TextView", "titleView", "=", "(", "TextView", ")", "view", ".", "findViewById", "(", "R", ".", "id", ".", "title", ")", ";", "// configure its appearance according to whether or not it's selected", "titleView", ".", "setTextColor", "(", "selected", "?", "mConfig", ".", "getItemHighlightColor", "(", "mActivity", ")", ":", "UIUtils", ".", "getColorAttr", "(", "mActivity", ",", "android", ".", "R", ".", "attr", ".", "textColorPrimary", ")", ")", ";", "iconView", ".", "setColorFilter", "(", "selected", "?", "mConfig", ".", "getItemHighlightColor", "(", "mActivity", ")", ":", "getResources", "(", ")", ".", "getColor", "(", "R", ".", "color", ".", "navdrawer_icon_tint", ")", ",", "PorterDuff", ".", "Mode", ".", "SRC_ATOP", ")", ";", "}" ]
Format a nav drawer item based on current selected states @param item @param selected
[ "Format", "a", "nav", "drawer", "item", "based", "on", "current", "selected", "states" ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library-drawer/src/main/java/com/ftinc/kit/drawer/Drawer.java#L536-L556
vladmihalcea/flexy-pool
flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java
ReflectionUtils.invokeSetter
public static void invokeSetter(Object target, String property, Object parameter) { """ Invoke setter method with the given parameter @param target target object @param property property @param parameter setter parameter """ Method setter = getSetter(target, property, parameter.getClass()); try { setter.invoke(target, parameter); } catch (IllegalAccessException e) { throw handleException(setter.getName(), e); } catch (InvocationTargetException e) { throw handleException(setter.getName(), e); } }
java
public static void invokeSetter(Object target, String property, Object parameter) { Method setter = getSetter(target, property, parameter.getClass()); try { setter.invoke(target, parameter); } catch (IllegalAccessException e) { throw handleException(setter.getName(), e); } catch (InvocationTargetException e) { throw handleException(setter.getName(), e); } }
[ "public", "static", "void", "invokeSetter", "(", "Object", "target", ",", "String", "property", ",", "Object", "parameter", ")", "{", "Method", "setter", "=", "getSetter", "(", "target", ",", "property", ",", "parameter", ".", "getClass", "(", ")", ")", ";", "try", "{", "setter", ".", "invoke", "(", "target", ",", "parameter", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "handleException", "(", "setter", ".", "getName", "(", ")", ",", "e", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "handleException", "(", "setter", ".", "getName", "(", ")", ",", "e", ")", ";", "}", "}" ]
Invoke setter method with the given parameter @param target target object @param property property @param parameter setter parameter
[ "Invoke", "setter", "method", "with", "the", "given", "parameter" ]
train
https://github.com/vladmihalcea/flexy-pool/blob/d763d359e68299c2b4e28e4b67770581ae083431/flexy-pool-core/src/main/java/com/vladmihalcea/flexypool/util/ReflectionUtils.java#L142-L151
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/spi/LoggerRegistry.java
LoggerRegistry.hasLogger
public boolean hasLogger(final String name, final MessageFactory messageFactory) { """ Detects if a Logger with the specified name and MessageFactory exists. @param name The Logger name to search for. @param messageFactory The message factory to search for. @return true if the Logger exists, false otherwise. @since 2.5 """ return getOrCreateInnerMap(factoryKey(messageFactory)).containsKey(name); }
java
public boolean hasLogger(final String name, final MessageFactory messageFactory) { return getOrCreateInnerMap(factoryKey(messageFactory)).containsKey(name); }
[ "public", "boolean", "hasLogger", "(", "final", "String", "name", ",", "final", "MessageFactory", "messageFactory", ")", "{", "return", "getOrCreateInnerMap", "(", "factoryKey", "(", "messageFactory", ")", ")", ".", "containsKey", "(", "name", ")", ";", "}" ]
Detects if a Logger with the specified name and MessageFactory exists. @param name The Logger name to search for. @param messageFactory The message factory to search for. @return true if the Logger exists, false otherwise. @since 2.5
[ "Detects", "if", "a", "Logger", "with", "the", "specified", "name", "and", "MessageFactory", "exists", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/spi/LoggerRegistry.java#L164-L166
gallandarakhneorg/afc
advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/BufferedAttributeCollection.java
BufferedAttributeCollection.setAttributeFromRawValue
protected Attribute setAttributeFromRawValue(String name, AttributeValue value) throws AttributeException { """ Set the attribute value. @param name is the name of the attribute @param value is the raw value to store. @return the new created attribute @throws AttributeException on error. """ return setAttributeFromRawValue(name, value.getType(), value.getValue()); }
java
protected Attribute setAttributeFromRawValue(String name, AttributeValue value) throws AttributeException { return setAttributeFromRawValue(name, value.getType(), value.getValue()); }
[ "protected", "Attribute", "setAttributeFromRawValue", "(", "String", "name", ",", "AttributeValue", "value", ")", "throws", "AttributeException", "{", "return", "setAttributeFromRawValue", "(", "name", ",", "value", ".", "getType", "(", ")", ",", "value", ".", "getValue", "(", ")", ")", ";", "}" ]
Set the attribute value. @param name is the name of the attribute @param value is the raw value to store. @return the new created attribute @throws AttributeException on error.
[ "Set", "the", "attribute", "value", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/BufferedAttributeCollection.java#L229-L231
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/Strings.java
Strings.leftPad
public static String leftPad(String str, int size, char padChar) { """ <p> Left pad a String with a specified character. </p> <p> Pad to a size of {@code size}. </p> <pre> leftPad(null, *, *) = null leftPad("", 3, 'z') = "zzz" leftPad("bat", 3, 'z') = "bat" leftPad("bat", 5, 'z') = "zzbat" leftPad("bat", 1, 'z') = "bat" leftPad("bat", -1, 'z') = "bat" </pre> @param str the String to pad out, may be null @param size the size to pad to @param padChar the character to pad with @return left padded String or original String if no padding is necessary, {@code null} if null String input @since 3.0 """ if (str == null) { return null; } int pads = size - str.length(); if (pads <= 0) { return str; // returns original String when possible } return repeat(padChar, pads).concat(str); }
java
public static String leftPad(String str, int size, char padChar) { if (str == null) { return null; } int pads = size - str.length(); if (pads <= 0) { return str; // returns original String when possible } return repeat(padChar, pads).concat(str); }
[ "public", "static", "String", "leftPad", "(", "String", "str", ",", "int", "size", ",", "char", "padChar", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "null", ";", "}", "int", "pads", "=", "size", "-", "str", ".", "length", "(", ")", ";", "if", "(", "pads", "<=", "0", ")", "{", "return", "str", ";", "// returns original String when possible", "}", "return", "repeat", "(", "padChar", ",", "pads", ")", ".", "concat", "(", "str", ")", ";", "}" ]
<p> Left pad a String with a specified character. </p> <p> Pad to a size of {@code size}. </p> <pre> leftPad(null, *, *) = null leftPad("", 3, 'z') = "zzz" leftPad("bat", 3, 'z') = "bat" leftPad("bat", 5, 'z') = "zzbat" leftPad("bat", 1, 'z') = "bat" leftPad("bat", -1, 'z') = "bat" </pre> @param str the String to pad out, may be null @param size the size to pad to @param padChar the character to pad with @return left padded String or original String if no padding is necessary, {@code null} if null String input @since 3.0
[ "<p", ">", "Left", "pad", "a", "String", "with", "a", "specified", "character", ".", "<", "/", "p", ">", "<p", ">", "Pad", "to", "a", "size", "of", "{", "@code", "size", "}", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L522-L528
allengeorge/libraft
libraft-agent/src/main/java/io/libraft/agent/protocol/RaftRPC.java
RaftRPC.setupCustomCommandSerializationAndDeserialization
public static void setupCustomCommandSerializationAndDeserialization(ObjectMapper mapper, CommandSerializer commandSerializer, CommandDeserializer commandDeserializer) { """ Setup custom serialization and deserialization for POJO {@link Command} subclasses. <p/> See {@code RaftAgent} for more on which {@code Command} types are supported. @param mapper instance of {@code ObjectMapper} with which the serialization/deserialization mapping is registered @param commandSerializer instance of {@code CommandSerializer} that can serialize a POJO {@code Command} instance into binary @param commandDeserializer instance of {@code CommandDeserializer} that can deserialize binary into a POJO {@code Command} instance @see io.libraft.agent.RaftAgent """ SimpleModule module = new SimpleModule("raftrpc-custom-command-module", new Version(0, 0, 0, "inline", "io.libraft", "raftrpc-command-module")); module.addSerializer(Command.class, new RaftRPCCommand.Serializer(commandSerializer)); module.addDeserializer(Command.class, new RaftRPCCommand.Deserializer(commandDeserializer)); mapper.registerModule(module); }
java
public static void setupCustomCommandSerializationAndDeserialization(ObjectMapper mapper, CommandSerializer commandSerializer, CommandDeserializer commandDeserializer) { SimpleModule module = new SimpleModule("raftrpc-custom-command-module", new Version(0, 0, 0, "inline", "io.libraft", "raftrpc-command-module")); module.addSerializer(Command.class, new RaftRPCCommand.Serializer(commandSerializer)); module.addDeserializer(Command.class, new RaftRPCCommand.Deserializer(commandDeserializer)); mapper.registerModule(module); }
[ "public", "static", "void", "setupCustomCommandSerializationAndDeserialization", "(", "ObjectMapper", "mapper", ",", "CommandSerializer", "commandSerializer", ",", "CommandDeserializer", "commandDeserializer", ")", "{", "SimpleModule", "module", "=", "new", "SimpleModule", "(", "\"raftrpc-custom-command-module\"", ",", "new", "Version", "(", "0", ",", "0", ",", "0", ",", "\"inline\"", ",", "\"io.libraft\"", ",", "\"raftrpc-command-module\"", ")", ")", ";", "module", ".", "addSerializer", "(", "Command", ".", "class", ",", "new", "RaftRPCCommand", ".", "Serializer", "(", "commandSerializer", ")", ")", ";", "module", ".", "addDeserializer", "(", "Command", ".", "class", ",", "new", "RaftRPCCommand", ".", "Deserializer", "(", "commandDeserializer", ")", ")", ";", "mapper", ".", "registerModule", "(", "module", ")", ";", "}" ]
Setup custom serialization and deserialization for POJO {@link Command} subclasses. <p/> See {@code RaftAgent} for more on which {@code Command} types are supported. @param mapper instance of {@code ObjectMapper} with which the serialization/deserialization mapping is registered @param commandSerializer instance of {@code CommandSerializer} that can serialize a POJO {@code Command} instance into binary @param commandDeserializer instance of {@code CommandDeserializer} that can deserialize binary into a POJO {@code Command} instance @see io.libraft.agent.RaftAgent
[ "Setup", "custom", "serialization", "and", "deserialization", "for", "POJO", "{", "@link", "Command", "}", "subclasses", ".", "<p", "/", ">", "See", "{", "@code", "RaftAgent", "}", "for", "more", "on", "which", "{", "@code", "Command", "}", "types", "are", "supported", "." ]
train
https://github.com/allengeorge/libraft/blob/00d68bb5e68d4020af59df3c8a9a14380108ac89/libraft-agent/src/main/java/io/libraft/agent/protocol/RaftRPC.java#L113-L120
google/closure-compiler
src/com/google/javascript/jscomp/CheckJSDoc.java
CheckJSDoc.validateNoSideEffects
private void validateNoSideEffects(Node n, JSDocInfo info) { """ Check that @nosideeeffects annotations are only present in externs. """ // Cannot have @modifies or @nosideeffects in regular (non externs) js. Report errors. if (info == null) { return; } if (n.isFromExterns()) { return; } if (info.hasSideEffectsArgumentsAnnotation() || info.modifiesThis()) { report(n, INVALID_MODIFIES_ANNOTATION); } if (info.isNoSideEffects()) { report(n, INVALID_NO_SIDE_EFFECT_ANNOTATION); } }
java
private void validateNoSideEffects(Node n, JSDocInfo info) { // Cannot have @modifies or @nosideeffects in regular (non externs) js. Report errors. if (info == null) { return; } if (n.isFromExterns()) { return; } if (info.hasSideEffectsArgumentsAnnotation() || info.modifiesThis()) { report(n, INVALID_MODIFIES_ANNOTATION); } if (info.isNoSideEffects()) { report(n, INVALID_NO_SIDE_EFFECT_ANNOTATION); } }
[ "private", "void", "validateNoSideEffects", "(", "Node", "n", ",", "JSDocInfo", "info", ")", "{", "// Cannot have @modifies or @nosideeffects in regular (non externs) js. Report errors.", "if", "(", "info", "==", "null", ")", "{", "return", ";", "}", "if", "(", "n", ".", "isFromExterns", "(", ")", ")", "{", "return", ";", "}", "if", "(", "info", ".", "hasSideEffectsArgumentsAnnotation", "(", ")", "||", "info", ".", "modifiesThis", "(", ")", ")", "{", "report", "(", "n", ",", "INVALID_MODIFIES_ANNOTATION", ")", ";", "}", "if", "(", "info", ".", "isNoSideEffects", "(", ")", ")", "{", "report", "(", "n", ",", "INVALID_NO_SIDE_EFFECT_ANNOTATION", ")", ";", "}", "}" ]
Check that @nosideeeffects annotations are only present in externs.
[ "Check", "that" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckJSDoc.java#L657-L673
derari/cthul
objects/src/main/java/org/cthul/objects/Boxing.java
Boxing.deepBox
public static Object[] deepBox(Class<?> resultType, final Object src) { """ Returns any multidimensional array into an array of boxed values. @param resultType target type @param src source array @return multidimensional array """ Class<?> compType = resultType.getComponentType(); if (compType.isArray()) { final Object[] src2 = (Object[]) src; final Object[] result = (Object[]) newArray(compType, src2.length); for (int i = 0; i < src2.length; i++) { result[i] = deepBox(compType, src2[i]); } return result; } else { return boxAll(compType, src, 0, -1); } }
java
public static Object[] deepBox(Class<?> resultType, final Object src) { Class<?> compType = resultType.getComponentType(); if (compType.isArray()) { final Object[] src2 = (Object[]) src; final Object[] result = (Object[]) newArray(compType, src2.length); for (int i = 0; i < src2.length; i++) { result[i] = deepBox(compType, src2[i]); } return result; } else { return boxAll(compType, src, 0, -1); } }
[ "public", "static", "Object", "[", "]", "deepBox", "(", "Class", "<", "?", ">", "resultType", ",", "final", "Object", "src", ")", "{", "Class", "<", "?", ">", "compType", "=", "resultType", ".", "getComponentType", "(", ")", ";", "if", "(", "compType", ".", "isArray", "(", ")", ")", "{", "final", "Object", "[", "]", "src2", "=", "(", "Object", "[", "]", ")", "src", ";", "final", "Object", "[", "]", "result", "=", "(", "Object", "[", "]", ")", "newArray", "(", "compType", ",", "src2", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "src2", ".", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "deepBox", "(", "compType", ",", "src2", "[", "i", "]", ")", ";", "}", "return", "result", ";", "}", "else", "{", "return", "boxAll", "(", "compType", ",", "src", ",", "0", ",", "-", "1", ")", ";", "}", "}" ]
Returns any multidimensional array into an array of boxed values. @param resultType target type @param src source array @return multidimensional array
[ "Returns", "any", "multidimensional", "array", "into", "an", "array", "of", "boxed", "values", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/Boxing.java#L724-L736
pravega/pravega
shared/cluster/src/main/java/io/pravega/common/cluster/ClusterException.java
ClusterException.create
public static ClusterException create(Type type, String message) { """ Factory method to construct Store exceptions. @param type Type of Exception. @param message Exception message @return Instance of ClusterException. """ switch (type) { case METASTORE: return new MetaStoreException(message); default: throw new IllegalArgumentException("Invalid exception type"); } }
java
public static ClusterException create(Type type, String message) { switch (type) { case METASTORE: return new MetaStoreException(message); default: throw new IllegalArgumentException("Invalid exception type"); } }
[ "public", "static", "ClusterException", "create", "(", "Type", "type", ",", "String", "message", ")", "{", "switch", "(", "type", ")", "{", "case", "METASTORE", ":", "return", "new", "MetaStoreException", "(", "message", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Invalid exception type\"", ")", ";", "}", "}" ]
Factory method to construct Store exceptions. @param type Type of Exception. @param message Exception message @return Instance of ClusterException.
[ "Factory", "method", "to", "construct", "Store", "exceptions", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/shared/cluster/src/main/java/io/pravega/common/cluster/ClusterException.java#L32-L39
Impetus/Kundera
src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBClient.java
KuduDBClient.populateEntity
public void populateEntity(Object entity, RowResult result, EntityType entityType, MetamodelImpl metaModel) { """ Populate entity. @param entity the entity @param result the result @param entityType the entity type @param metaModel the meta model """ Set<Attribute> attributes = entityType.getAttributes(); Iterator<Attribute> iterator = attributes.iterator(); iterateAndPopulateEntity(entity, result, metaModel, iterator); }
java
public void populateEntity(Object entity, RowResult result, EntityType entityType, MetamodelImpl metaModel) { Set<Attribute> attributes = entityType.getAttributes(); Iterator<Attribute> iterator = attributes.iterator(); iterateAndPopulateEntity(entity, result, metaModel, iterator); }
[ "public", "void", "populateEntity", "(", "Object", "entity", ",", "RowResult", "result", ",", "EntityType", "entityType", ",", "MetamodelImpl", "metaModel", ")", "{", "Set", "<", "Attribute", ">", "attributes", "=", "entityType", ".", "getAttributes", "(", ")", ";", "Iterator", "<", "Attribute", ">", "iterator", "=", "attributes", ".", "iterator", "(", ")", ";", "iterateAndPopulateEntity", "(", "entity", ",", "result", ",", "metaModel", ",", "iterator", ")", ";", "}" ]
Populate entity. @param entity the entity @param result the result @param entityType the entity type @param metaModel the meta model
[ "Populate", "entity", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBClient.java#L286-L291
brunocvcunha/inutils4j
src/main/java/org/brunocvcunha/inutils4j/reflection/MyReflectionUtils.java
MyReflectionUtils.buildInstanceForMap
public static <T> T buildInstanceForMap(Class<T> clazz, Map<String, Object> values, MyReflectionDifferenceHandler differenceHandler) throws InstantiationException, IllegalAccessException, IntrospectionException, IllegalArgumentException, InvocationTargetException { """ Builds a instance of the class for a map containing the values @param clazz Class to build @param values Values map @param differenceHandler The difference handler @return The created instance @throws InstantiationException Error instantiating @throws IllegalAccessException Access error @throws IntrospectionException Introspection error @throws IllegalArgumentException Argument invalid @throws InvocationTargetException Invalid target """ log.debug("Building new instance of Class " + clazz.getName()); T instance = clazz.newInstance(); for (String key : values.keySet()) { Object value = values.get(key); if (value == null) { log.debug("Value for field " + key + " is null, so ignoring it..."); continue; } log.debug( "Invoke setter for " + key + " (" + value.getClass() + " / " + value.toString() + ")"); Method setter = null; try { setter = new PropertyDescriptor(key.replace('.', '_'), clazz).getWriteMethod(); } catch (Exception e) { throw new IllegalArgumentException("Setter for field " + key + " was not found", e); } Class<?> argumentType = setter.getParameterTypes()[0]; if (argumentType.isAssignableFrom(value.getClass())) { setter.invoke(instance, value); } else { Object newValue = differenceHandler.handleDifference(value, setter.getParameterTypes()[0]); setter.invoke(instance, newValue); } } return instance; }
java
public static <T> T buildInstanceForMap(Class<T> clazz, Map<String, Object> values, MyReflectionDifferenceHandler differenceHandler) throws InstantiationException, IllegalAccessException, IntrospectionException, IllegalArgumentException, InvocationTargetException { log.debug("Building new instance of Class " + clazz.getName()); T instance = clazz.newInstance(); for (String key : values.keySet()) { Object value = values.get(key); if (value == null) { log.debug("Value for field " + key + " is null, so ignoring it..."); continue; } log.debug( "Invoke setter for " + key + " (" + value.getClass() + " / " + value.toString() + ")"); Method setter = null; try { setter = new PropertyDescriptor(key.replace('.', '_'), clazz).getWriteMethod(); } catch (Exception e) { throw new IllegalArgumentException("Setter for field " + key + " was not found", e); } Class<?> argumentType = setter.getParameterTypes()[0]; if (argumentType.isAssignableFrom(value.getClass())) { setter.invoke(instance, value); } else { Object newValue = differenceHandler.handleDifference(value, setter.getParameterTypes()[0]); setter.invoke(instance, newValue); } } return instance; }
[ "public", "static", "<", "T", ">", "T", "buildInstanceForMap", "(", "Class", "<", "T", ">", "clazz", ",", "Map", "<", "String", ",", "Object", ">", "values", ",", "MyReflectionDifferenceHandler", "differenceHandler", ")", "throws", "InstantiationException", ",", "IllegalAccessException", ",", "IntrospectionException", ",", "IllegalArgumentException", ",", "InvocationTargetException", "{", "log", ".", "debug", "(", "\"Building new instance of Class \"", "+", "clazz", ".", "getName", "(", ")", ")", ";", "T", "instance", "=", "clazz", ".", "newInstance", "(", ")", ";", "for", "(", "String", "key", ":", "values", ".", "keySet", "(", ")", ")", "{", "Object", "value", "=", "values", ".", "get", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "log", ".", "debug", "(", "\"Value for field \"", "+", "key", "+", "\" is null, so ignoring it...\"", ")", ";", "continue", ";", "}", "log", ".", "debug", "(", "\"Invoke setter for \"", "+", "key", "+", "\" (\"", "+", "value", ".", "getClass", "(", ")", "+", "\" / \"", "+", "value", ".", "toString", "(", ")", "+", "\")\"", ")", ";", "Method", "setter", "=", "null", ";", "try", "{", "setter", "=", "new", "PropertyDescriptor", "(", "key", ".", "replace", "(", "'", "'", ",", "'", "'", ")", ",", "clazz", ")", ".", "getWriteMethod", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Setter for field \"", "+", "key", "+", "\" was not found\"", ",", "e", ")", ";", "}", "Class", "<", "?", ">", "argumentType", "=", "setter", ".", "getParameterTypes", "(", ")", "[", "0", "]", ";", "if", "(", "argumentType", ".", "isAssignableFrom", "(", "value", ".", "getClass", "(", ")", ")", ")", "{", "setter", ".", "invoke", "(", "instance", ",", "value", ")", ";", "}", "else", "{", "Object", "newValue", "=", "differenceHandler", ".", "handleDifference", "(", "value", ",", "setter", ".", "getParameterTypes", "(", ")", "[", "0", "]", ")", ";", "setter", ".", "invoke", "(", "instance", ",", "newValue", ")", ";", "}", "}", "return", "instance", ";", "}" ]
Builds a instance of the class for a map containing the values @param clazz Class to build @param values Values map @param differenceHandler The difference handler @return The created instance @throws InstantiationException Error instantiating @throws IllegalAccessException Access error @throws IntrospectionException Introspection error @throws IllegalArgumentException Argument invalid @throws InvocationTargetException Invalid target
[ "Builds", "a", "instance", "of", "the", "class", "for", "a", "map", "containing", "the", "values" ]
train
https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/reflection/MyReflectionUtils.java#L68-L106
googleapis/google-cloud-java
google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/JobServiceClient.java
JobServiceClient.listJobs
public final ListJobsPagedResponse listJobs(String parent, String filter) { """ Lists jobs by filter. <p>Sample code: <pre><code> try (JobServiceClient jobServiceClient = JobServiceClient.create()) { TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]"); String filter = ""; for (Job element : jobServiceClient.listJobs(parent.toString(), filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent Required. <p>The resource name of the tenant under which the job is created. <p>The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". <p>Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project". @param filter Required. <p>The filter string specifies the jobs to be enumerated. <p>Supported operator: =, AND <p>The fields eligible for filtering are: <p>&#42; `companyName` (Required) &#42; `requisitionId` (Optional) &#42; `status` (Optional) Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if no value is specified. <p>Sample Query: <p>&#42; companyName = "projects/api-test-project/tenants/foo/companies/bar" &#42; companyName = "projects/api-test-project/tenants/foo/companies/bar" AND requisitionId = "req-1" &#42; companyName = "projects/api-test-project/tenants/foo/companies/bar" AND status = "EXPIRED" @throws com.google.api.gax.rpc.ApiException if the remote call fails """ ListJobsRequest request = ListJobsRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listJobs(request); }
java
public final ListJobsPagedResponse listJobs(String parent, String filter) { ListJobsRequest request = ListJobsRequest.newBuilder().setParent(parent).setFilter(filter).build(); return listJobs(request); }
[ "public", "final", "ListJobsPagedResponse", "listJobs", "(", "String", "parent", ",", "String", "filter", ")", "{", "ListJobsRequest", "request", "=", "ListJobsRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "setFilter", "(", "filter", ")", ".", "build", "(", ")", ";", "return", "listJobs", "(", "request", ")", ";", "}" ]
Lists jobs by filter. <p>Sample code: <pre><code> try (JobServiceClient jobServiceClient = JobServiceClient.create()) { TenantOrProjectName parent = TenantName.of("[PROJECT]", "[TENANT]"); String filter = ""; for (Job element : jobServiceClient.listJobs(parent.toString(), filter).iterateAll()) { // doThingsWith(element); } } </code></pre> @param parent Required. <p>The resource name of the tenant under which the job is created. <p>The format is "projects/{project_id}/tenants/{tenant_id}", for example, "projects/api-test-project/tenant/foo". <p>Tenant id is optional and the default tenant is used if unspecified, for example, "projects/api-test-project". @param filter Required. <p>The filter string specifies the jobs to be enumerated. <p>Supported operator: =, AND <p>The fields eligible for filtering are: <p>&#42; `companyName` (Required) &#42; `requisitionId` (Optional) &#42; `status` (Optional) Available values: OPEN, EXPIRED, ALL. Defaults to OPEN if no value is specified. <p>Sample Query: <p>&#42; companyName = "projects/api-test-project/tenants/foo/companies/bar" &#42; companyName = "projects/api-test-project/tenants/foo/companies/bar" AND requisitionId = "req-1" &#42; companyName = "projects/api-test-project/tenants/foo/companies/bar" AND status = "EXPIRED" @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "jobs", "by", "filter", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/JobServiceClient.java#L642-L646
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsContainerElementBean.java
CmsContainerElementBean.cloneWithFormatter
public static CmsContainerElementBean cloneWithFormatter(CmsContainerElementBean source, CmsUUID formatterId) { """ Clones the given element bean with a different formatter.<p> @param source the element to clone @param formatterId the new formatter id @return the element bean """ CmsContainerElementBean result = source.clone(); result.m_formatterId = formatterId; return result; }
java
public static CmsContainerElementBean cloneWithFormatter(CmsContainerElementBean source, CmsUUID formatterId) { CmsContainerElementBean result = source.clone(); result.m_formatterId = formatterId; return result; }
[ "public", "static", "CmsContainerElementBean", "cloneWithFormatter", "(", "CmsContainerElementBean", "source", ",", "CmsUUID", "formatterId", ")", "{", "CmsContainerElementBean", "result", "=", "source", ".", "clone", "(", ")", ";", "result", ".", "m_formatterId", "=", "formatterId", ";", "return", "result", ";", "}" ]
Clones the given element bean with a different formatter.<p> @param source the element to clone @param formatterId the new formatter id @return the element bean
[ "Clones", "the", "given", "element", "bean", "with", "a", "different", "formatter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsContainerElementBean.java#L211-L216
to2mbn/JMCCC
jmccc/src/main/java/org/to2mbn/jmccc/util/ExtraArgumentsTemplates.java
ExtraArgumentsTemplates.OSX_DOCK_ICON
public static String OSX_DOCK_ICON(MinecraftDirectory minecraftDir, Version version) throws IOException { """ Caution: This option is available only on OSX. @param minecraftDir the minecraft directory @param version the minecraft version @return a <code>-Xdock:icon</code> option, null if the assets cannot be resolved @throws IOException if an I/O error has occurred during resolving asset index @see #OSX_DOCK_ICON(MinecraftDirectory, Set) @see #OSX_DOCK_NAME """ Set<Asset> assetIndex = Versions.resolveAssets(minecraftDir, version); if (assetIndex == null) return null; return OSX_DOCK_ICON(minecraftDir, assetIndex); }
java
public static String OSX_DOCK_ICON(MinecraftDirectory minecraftDir, Version version) throws IOException { Set<Asset> assetIndex = Versions.resolveAssets(minecraftDir, version); if (assetIndex == null) return null; return OSX_DOCK_ICON(minecraftDir, assetIndex); }
[ "public", "static", "String", "OSX_DOCK_ICON", "(", "MinecraftDirectory", "minecraftDir", ",", "Version", "version", ")", "throws", "IOException", "{", "Set", "<", "Asset", ">", "assetIndex", "=", "Versions", ".", "resolveAssets", "(", "minecraftDir", ",", "version", ")", ";", "if", "(", "assetIndex", "==", "null", ")", "return", "null", ";", "return", "OSX_DOCK_ICON", "(", "minecraftDir", ",", "assetIndex", ")", ";", "}" ]
Caution: This option is available only on OSX. @param minecraftDir the minecraft directory @param version the minecraft version @return a <code>-Xdock:icon</code> option, null if the assets cannot be resolved @throws IOException if an I/O error has occurred during resolving asset index @see #OSX_DOCK_ICON(MinecraftDirectory, Set) @see #OSX_DOCK_NAME
[ "Caution", ":", "This", "option", "is", "available", "only", "on", "OSX", "." ]
train
https://github.com/to2mbn/JMCCC/blob/17e5b1b56ff18255cfd60976dca1a24598946647/jmccc/src/main/java/org/to2mbn/jmccc/util/ExtraArgumentsTemplates.java#L63-L69
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/SerializeInterceptor.java
SerializeInterceptor.getMime
private String getMime(String name, String delimiter) { """ Method get the mime value from the given file name @param name the filename @param delimiter the delimiter @return String the mime value """ if (StringUtils.hasText(name)) { return name.substring(name.lastIndexOf(delimiter), name.length()); } return null; }
java
private String getMime(String name, String delimiter) { if (StringUtils.hasText(name)) { return name.substring(name.lastIndexOf(delimiter), name.length()); } return null; }
[ "private", "String", "getMime", "(", "String", "name", ",", "String", "delimiter", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "name", ")", ")", "{", "return", "name", ".", "substring", "(", "name", ".", "lastIndexOf", "(", "delimiter", ")", ",", "name", ".", "length", "(", ")", ")", ";", "}", "return", "null", ";", "}" ]
Method get the mime value from the given file name @param name the filename @param delimiter the delimiter @return String the mime value
[ "Method", "get", "the", "mime", "value", "from", "the", "given", "file", "name" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/SerializeInterceptor.java#L203-L208
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java
DictionaryFactory.createSingletonDictionary
public static ADictionary createSingletonDictionary(JcsegTaskConfig config, boolean loadDic) { """ create a singleton ADictionary object according to the JcsegTaskConfig @param config @param loadDic @return ADictionary """ synchronized (LOCK) { if ( singletonDic == null ) { singletonDic = createDefaultDictionary(config, loadDic); } } return singletonDic; }
java
public static ADictionary createSingletonDictionary(JcsegTaskConfig config, boolean loadDic) { synchronized (LOCK) { if ( singletonDic == null ) { singletonDic = createDefaultDictionary(config, loadDic); } } return singletonDic; }
[ "public", "static", "ADictionary", "createSingletonDictionary", "(", "JcsegTaskConfig", "config", ",", "boolean", "loadDic", ")", "{", "synchronized", "(", "LOCK", ")", "{", "if", "(", "singletonDic", "==", "null", ")", "{", "singletonDic", "=", "createDefaultDictionary", "(", "config", ",", "loadDic", ")", ";", "}", "}", "return", "singletonDic", ";", "}" ]
create a singleton ADictionary object according to the JcsegTaskConfig @param config @param loadDic @return ADictionary
[ "create", "a", "singleton", "ADictionary", "object", "according", "to", "the", "JcsegTaskConfig" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java#L147-L156
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java
ByteUtils.bytesToBool
public static final boolean bytesToBool( byte[] data, int[] offset ) { """ Return the <code>boolean</code> represented by the bytes in <code>data</code> staring at offset <code>offset[0]</code>. @param data the array from which to read @param offset A single element array whose first element is the index in data from which to begin reading on function entry, and which on function exit has been incremented by the number of bytes read. @return the value of the <code>boolean</code> decoded """ boolean result = true; if (data[offset[0]] == 0) { result = false; } offset[0] += SIZE_BOOL; return result; }
java
public static final boolean bytesToBool( byte[] data, int[] offset ) { boolean result = true; if (data[offset[0]] == 0) { result = false; } offset[0] += SIZE_BOOL; return result; }
[ "public", "static", "final", "boolean", "bytesToBool", "(", "byte", "[", "]", "data", ",", "int", "[", "]", "offset", ")", "{", "boolean", "result", "=", "true", ";", "if", "(", "data", "[", "offset", "[", "0", "]", "]", "==", "0", ")", "{", "result", "=", "false", ";", "}", "offset", "[", "0", "]", "+=", "SIZE_BOOL", ";", "return", "result", ";", "}" ]
Return the <code>boolean</code> represented by the bytes in <code>data</code> staring at offset <code>offset[0]</code>. @param data the array from which to read @param offset A single element array whose first element is the index in data from which to begin reading on function entry, and which on function exit has been incremented by the number of bytes read. @return the value of the <code>boolean</code> decoded
[ "Return", "the", "<code", ">", "boolean<", "/", "code", ">", "represented", "by", "the", "bytes", "in", "<code", ">", "data<", "/", "code", ">", "staring", "at", "offset", "<code", ">", "offset", "[", "0", "]", "<", "/", "code", ">", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/ByteUtils.java#L312-L322
RestComm/sip-servlets
sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/ExtendedListeningPoint.java
ExtendedListeningPoint.createContactHeader
public ContactHeader createContactHeader(String displayName, String userName, boolean usePublicAddress, String outboundInterface) { """ Create a Contact Header based on the host, port and transport of this listening point @param usePublicAddress if true, the host will be the global ip address found by STUN otherwise it will be the local network interface ipaddress @param displayName the display name to use @param outboundInterface the outbound interface ip address to be used for the host part of the Contact header @return the Contact header """ try { // FIXME : the SIP URI can be cached to improve performance String host = null; if(outboundInterface!=null){ javax.sip.address.SipURI outboundInterfaceURI = (javax.sip.address.SipURI) SipFactoryImpl.addressFactory.createURI(outboundInterface); host = outboundInterfaceURI.getHost(); } else { host = getIpAddress(usePublicAddress); } javax.sip.address.SipURI sipURI = SipFactoryImpl.addressFactory.createSipURI(userName, host); sipURI.setHost(host); sipURI.setPort(port); // Issue 1150 : we assume that if the transport match the default protocol of the transport protocol used it is not added // See RFC 32661 Section 19.1.2 Character Escaping Requirements : // (2): The default transport is scheme dependent. For sip:, it is UDP. For sips:, it is TCP. if((!sipURI.isSecure() && !ListeningPoint.UDP.equalsIgnoreCase(transport)) || (sipURI.isSecure() && !ListeningPoint.TCP.equalsIgnoreCase(transport))) { sipURI.setTransportParam(transport); } javax.sip.address.Address contactAddress = SipFactoryImpl.addressFactory.createAddress(sipURI); ContactHeader contact = SipFactoryImpl.headerFactory.createContactHeader(contactAddress); if(displayName != null && displayName.length() > 0) { contactAddress.setDisplayName(displayName); } return contact; } catch (ParseException ex) { logger.error ("Unexpected error while creating the contact header for the extended listening point",ex); throw new IllegalArgumentException("Unexpected exception when creating a sip URI", ex); } }
java
public ContactHeader createContactHeader(String displayName, String userName, boolean usePublicAddress, String outboundInterface) { try { // FIXME : the SIP URI can be cached to improve performance String host = null; if(outboundInterface!=null){ javax.sip.address.SipURI outboundInterfaceURI = (javax.sip.address.SipURI) SipFactoryImpl.addressFactory.createURI(outboundInterface); host = outboundInterfaceURI.getHost(); } else { host = getIpAddress(usePublicAddress); } javax.sip.address.SipURI sipURI = SipFactoryImpl.addressFactory.createSipURI(userName, host); sipURI.setHost(host); sipURI.setPort(port); // Issue 1150 : we assume that if the transport match the default protocol of the transport protocol used it is not added // See RFC 32661 Section 19.1.2 Character Escaping Requirements : // (2): The default transport is scheme dependent. For sip:, it is UDP. For sips:, it is TCP. if((!sipURI.isSecure() && !ListeningPoint.UDP.equalsIgnoreCase(transport)) || (sipURI.isSecure() && !ListeningPoint.TCP.equalsIgnoreCase(transport))) { sipURI.setTransportParam(transport); } javax.sip.address.Address contactAddress = SipFactoryImpl.addressFactory.createAddress(sipURI); ContactHeader contact = SipFactoryImpl.headerFactory.createContactHeader(contactAddress); if(displayName != null && displayName.length() > 0) { contactAddress.setDisplayName(displayName); } return contact; } catch (ParseException ex) { logger.error ("Unexpected error while creating the contact header for the extended listening point",ex); throw new IllegalArgumentException("Unexpected exception when creating a sip URI", ex); } }
[ "public", "ContactHeader", "createContactHeader", "(", "String", "displayName", ",", "String", "userName", ",", "boolean", "usePublicAddress", ",", "String", "outboundInterface", ")", "{", "try", "{", "// FIXME : the SIP URI can be cached to improve performance ", "String", "host", "=", "null", ";", "if", "(", "outboundInterface", "!=", "null", ")", "{", "javax", ".", "sip", ".", "address", ".", "SipURI", "outboundInterfaceURI", "=", "(", "javax", ".", "sip", ".", "address", ".", "SipURI", ")", "SipFactoryImpl", ".", "addressFactory", ".", "createURI", "(", "outboundInterface", ")", ";", "host", "=", "outboundInterfaceURI", ".", "getHost", "(", ")", ";", "}", "else", "{", "host", "=", "getIpAddress", "(", "usePublicAddress", ")", ";", "}", "javax", ".", "sip", ".", "address", ".", "SipURI", "sipURI", "=", "SipFactoryImpl", ".", "addressFactory", ".", "createSipURI", "(", "userName", ",", "host", ")", ";", "sipURI", ".", "setHost", "(", "host", ")", ";", "sipURI", ".", "setPort", "(", "port", ")", ";", "// Issue 1150 : we assume that if the transport match the default protocol of the transport protocol used it is not added", "// See RFC 32661 Section 19.1.2 Character Escaping Requirements :", "// (2): The default transport is scheme dependent. For sip:, it is UDP. For sips:, it is TCP.", "if", "(", "(", "!", "sipURI", ".", "isSecure", "(", ")", "&&", "!", "ListeningPoint", ".", "UDP", ".", "equalsIgnoreCase", "(", "transport", ")", ")", "||", "(", "sipURI", ".", "isSecure", "(", ")", "&&", "!", "ListeningPoint", ".", "TCP", ".", "equalsIgnoreCase", "(", "transport", ")", ")", ")", "{", "sipURI", ".", "setTransportParam", "(", "transport", ")", ";", "}", "javax", ".", "sip", ".", "address", ".", "Address", "contactAddress", "=", "SipFactoryImpl", ".", "addressFactory", ".", "createAddress", "(", "sipURI", ")", ";", "ContactHeader", "contact", "=", "SipFactoryImpl", ".", "headerFactory", ".", "createContactHeader", "(", "contactAddress", ")", ";", "if", "(", "displayName", "!=", "null", "&&", "displayName", ".", "length", "(", ")", ">", "0", ")", "{", "contactAddress", ".", "setDisplayName", "(", "displayName", ")", ";", "}", "return", "contact", ";", "}", "catch", "(", "ParseException", "ex", ")", "{", "logger", ".", "error", "(", "\"Unexpected error while creating the contact header for the extended listening point\"", ",", "ex", ")", ";", "throw", "new", "IllegalArgumentException", "(", "\"Unexpected exception when creating a sip URI\"", ",", "ex", ")", ";", "}", "}" ]
Create a Contact Header based on the host, port and transport of this listening point @param usePublicAddress if true, the host will be the global ip address found by STUN otherwise it will be the local network interface ipaddress @param displayName the display name to use @param outboundInterface the outbound interface ip address to be used for the host part of the Contact header @return the Contact header
[ "Create", "a", "Contact", "Header", "based", "on", "the", "host", "port", "and", "transport", "of", "this", "listening", "point" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/ExtendedListeningPoint.java#L143-L174
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATMainConsumer.java
CATMainConsumer.unsetAsynchConsumerCallback
public void unsetAsynchConsumerCallback(int requestNumber, boolean stoppable) //SIB0115d.comms { """ This method will unset the asynch consumer callback. This means that the client has requested that the session should be converted from asynchronous to synchronous and so the sub consumer must be changed @param requestNumber """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unsetAsynchConsumerCallback", "requestNumber="+requestNumber+",stoppable="+stoppable); checkNotBrowserSession(); // F171893 if (subConsumer != null) { subConsumer.unsetAsynchConsumerCallback(requestNumber, stoppable); //SIB0115d.comms } subConsumer = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unsetAsynchConsumerCallback"); }
java
public void unsetAsynchConsumerCallback(int requestNumber, boolean stoppable) //SIB0115d.comms { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unsetAsynchConsumerCallback", "requestNumber="+requestNumber+",stoppable="+stoppable); checkNotBrowserSession(); // F171893 if (subConsumer != null) { subConsumer.unsetAsynchConsumerCallback(requestNumber, stoppable); //SIB0115d.comms } subConsumer = null; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unsetAsynchConsumerCallback"); }
[ "public", "void", "unsetAsynchConsumerCallback", "(", "int", "requestNumber", ",", "boolean", "stoppable", ")", "//SIB0115d.comms", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ",", "\"unsetAsynchConsumerCallback\"", ",", "\"requestNumber=\"", "+", "requestNumber", "+", "\",stoppable=\"", "+", "stoppable", ")", ";", "checkNotBrowserSession", "(", ")", ";", "// F171893", "if", "(", "subConsumer", "!=", "null", ")", "{", "subConsumer", ".", "unsetAsynchConsumerCallback", "(", "requestNumber", ",", "stoppable", ")", ";", "//SIB0115d.comms", "}", "subConsumer", "=", "null", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "this", ",", "tc", ",", "\"unsetAsynchConsumerCallback\"", ")", ";", "}" ]
This method will unset the asynch consumer callback. This means that the client has requested that the session should be converted from asynchronous to synchronous and so the sub consumer must be changed @param requestNumber
[ "This", "method", "will", "unset", "the", "asynch", "consumer", "callback", ".", "This", "means", "that", "the", "client", "has", "requested", "that", "the", "session", "should", "be", "converted", "from", "asynchronous", "to", "synchronous", "and", "so", "the", "sub", "consumer", "must", "be", "changed" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATMainConsumer.java#L594-L608
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.getIterationPerformanceWithServiceResponseAsync
public Observable<ServiceResponse<IterationPerformance>> getIterationPerformanceWithServiceResponseAsync(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter) { """ Get detailed performance information about an iteration. @param projectId The id of the project the iteration belongs to @param iterationId The id of the iteration to get @param getIterationPerformanceOptionalParameter 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 IterationPerformance object """ if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (iterationId == null) { throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final Double threshold = getIterationPerformanceOptionalParameter != null ? getIterationPerformanceOptionalParameter.threshold() : null; final Double overlapThreshold = getIterationPerformanceOptionalParameter != null ? getIterationPerformanceOptionalParameter.overlapThreshold() : null; return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, threshold, overlapThreshold); }
java
public Observable<ServiceResponse<IterationPerformance>> getIterationPerformanceWithServiceResponseAsync(UUID projectId, UUID iterationId, GetIterationPerformanceOptionalParameter getIterationPerformanceOptionalParameter) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (iterationId == null) { throw new IllegalArgumentException("Parameter iterationId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final Double threshold = getIterationPerformanceOptionalParameter != null ? getIterationPerformanceOptionalParameter.threshold() : null; final Double overlapThreshold = getIterationPerformanceOptionalParameter != null ? getIterationPerformanceOptionalParameter.overlapThreshold() : null; return getIterationPerformanceWithServiceResponseAsync(projectId, iterationId, threshold, overlapThreshold); }
[ "public", "Observable", "<", "ServiceResponse", "<", "IterationPerformance", ">", ">", "getIterationPerformanceWithServiceResponseAsync", "(", "UUID", "projectId", ",", "UUID", "iterationId", ",", "GetIterationPerformanceOptionalParameter", "getIterationPerformanceOptionalParameter", ")", "{", "if", "(", "projectId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter projectId is required and cannot be null.\"", ")", ";", "}", "if", "(", "iterationId", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter iterationId is required and cannot be null.\"", ")", ";", "}", "if", "(", "this", ".", "client", ".", "apiKey", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter this.client.apiKey() is required and cannot be null.\"", ")", ";", "}", "final", "Double", "threshold", "=", "getIterationPerformanceOptionalParameter", "!=", "null", "?", "getIterationPerformanceOptionalParameter", ".", "threshold", "(", ")", ":", "null", ";", "final", "Double", "overlapThreshold", "=", "getIterationPerformanceOptionalParameter", "!=", "null", "?", "getIterationPerformanceOptionalParameter", ".", "overlapThreshold", "(", ")", ":", "null", ";", "return", "getIterationPerformanceWithServiceResponseAsync", "(", "projectId", ",", "iterationId", ",", "threshold", ",", "overlapThreshold", ")", ";", "}" ]
Get detailed performance information about an iteration. @param projectId The id of the project the iteration belongs to @param iterationId The id of the iteration to get @param getIterationPerformanceOptionalParameter 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 IterationPerformance object
[ "Get", "detailed", "performance", "information", "about", "an", "iteration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L1661-L1675
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.createStream
public CreateStreamResponse createStream(CreateStreamRequest request) { """ Create a domain stream in the live stream service. @param request The request object containing all options for creating domain stream @return the response """ checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPlayDomain(), "playDomain should NOT be empty."); checkStringNotEmpty(request.getApp(), "app should NOT be empty."); checkNotNull(request.getPublish(), "publish should NOT be null."); checkStringNotEmpty(request.getPublish().getPushStream(), "pushStream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_STREAM); return invokeHttpClient(internalRequest, CreateStreamResponse.class); }
java
public CreateStreamResponse createStream(CreateStreamRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getPlayDomain(), "playDomain should NOT be empty."); checkStringNotEmpty(request.getApp(), "app should NOT be empty."); checkNotNull(request.getPublish(), "publish should NOT be null."); checkStringNotEmpty(request.getPublish().getPushStream(), "pushStream should NOT be empty."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_DOMAIN, request.getPlayDomain(), LIVE_STREAM); return invokeHttpClient(internalRequest, CreateStreamResponse.class); }
[ "public", "CreateStreamResponse", "createStream", "(", "CreateStreamRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPlayDomain", "(", ")", ",", "\"playDomain should NOT be empty.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getApp", "(", ")", ",", "\"app should NOT be empty.\"", ")", ";", "checkNotNull", "(", "request", ".", "getPublish", "(", ")", ",", "\"publish should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getPublish", "(", ")", ".", "getPushStream", "(", ")", ",", "\"pushStream should NOT be empty.\"", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "POST", ",", "request", ",", "LIVE_DOMAIN", ",", "request", ".", "getPlayDomain", "(", ")", ",", "LIVE_STREAM", ")", ";", "return", "invokeHttpClient", "(", "internalRequest", ",", "CreateStreamResponse", ".", "class", ")", ";", "}" ]
Create a domain stream in the live stream service. @param request The request object containing all options for creating domain stream @return the response
[ "Create", "a", "domain", "stream", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1358-L1369
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java
CudaAffinityManager.tagLocation
@Override public void tagLocation(INDArray array, Location location) { """ This method marks given INDArray as actual in specific location (either host, device, or both) @param array @param location """ if (location == Location.HOST) AtomicAllocator.getInstance().getAllocationPoint(array).tickHostWrite(); else if (location == Location.DEVICE) AtomicAllocator.getInstance().getAllocationPoint(array).tickDeviceWrite(); else if (location == Location.EVERYWHERE) { AtomicAllocator.getInstance().getAllocationPoint(array).tickDeviceWrite(); AtomicAllocator.getInstance().getAllocationPoint(array).tickHostRead(); } }
java
@Override public void tagLocation(INDArray array, Location location) { if (location == Location.HOST) AtomicAllocator.getInstance().getAllocationPoint(array).tickHostWrite(); else if (location == Location.DEVICE) AtomicAllocator.getInstance().getAllocationPoint(array).tickDeviceWrite(); else if (location == Location.EVERYWHERE) { AtomicAllocator.getInstance().getAllocationPoint(array).tickDeviceWrite(); AtomicAllocator.getInstance().getAllocationPoint(array).tickHostRead(); } }
[ "@", "Override", "public", "void", "tagLocation", "(", "INDArray", "array", ",", "Location", "location", ")", "{", "if", "(", "location", "==", "Location", ".", "HOST", ")", "AtomicAllocator", ".", "getInstance", "(", ")", ".", "getAllocationPoint", "(", "array", ")", ".", "tickHostWrite", "(", ")", ";", "else", "if", "(", "location", "==", "Location", ".", "DEVICE", ")", "AtomicAllocator", ".", "getInstance", "(", ")", ".", "getAllocationPoint", "(", "array", ")", ".", "tickDeviceWrite", "(", ")", ";", "else", "if", "(", "location", "==", "Location", ".", "EVERYWHERE", ")", "{", "AtomicAllocator", ".", "getInstance", "(", ")", ".", "getAllocationPoint", "(", "array", ")", ".", "tickDeviceWrite", "(", ")", ";", "AtomicAllocator", ".", "getInstance", "(", ")", ".", "getAllocationPoint", "(", "array", ")", ".", "tickHostRead", "(", ")", ";", "}", "}" ]
This method marks given INDArray as actual in specific location (either host, device, or both) @param array @param location
[ "This", "method", "marks", "given", "INDArray", "as", "actual", "in", "specific", "location", "(", "either", "host", "device", "or", "both", ")" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java#L339-L349
gresrun/jesque
src/main/java/net/greghaines/jesque/utils/ScriptUtils.java
ScriptUtils.readScript
public static String readScript(final String resourceName) throws IOException { """ Read a script into a single-line string suitable for use in a Redis <code>EVAL</code> statement. @param resourceName the name of the script resource to read @return the string form of the script @throws IOException if something goes wrong """ final StringBuilder buf = new StringBuilder(); try (final InputStream inputStream = ScriptUtils.class.getResourceAsStream(resourceName)) { if (inputStream == null) { throw new IOException("Could not find script resource: " + resourceName); } try (final BufferedReader reader = new BufferedReader( new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { String prefix = ""; String line; while ((line = reader.readLine()) != null) { line = line.trim(); if (line.length() > 0) { buf.append(prefix).append(line.trim()); prefix = "\n"; } } } } return buf.toString(); }
java
public static String readScript(final String resourceName) throws IOException { final StringBuilder buf = new StringBuilder(); try (final InputStream inputStream = ScriptUtils.class.getResourceAsStream(resourceName)) { if (inputStream == null) { throw new IOException("Could not find script resource: " + resourceName); } try (final BufferedReader reader = new BufferedReader( new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { String prefix = ""; String line; while ((line = reader.readLine()) != null) { line = line.trim(); if (line.length() > 0) { buf.append(prefix).append(line.trim()); prefix = "\n"; } } } } return buf.toString(); }
[ "public", "static", "String", "readScript", "(", "final", "String", "resourceName", ")", "throws", "IOException", "{", "final", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "try", "(", "final", "InputStream", "inputStream", "=", "ScriptUtils", ".", "class", ".", "getResourceAsStream", "(", "resourceName", ")", ")", "{", "if", "(", "inputStream", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Could not find script resource: \"", "+", "resourceName", ")", ";", "}", "try", "(", "final", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "inputStream", ",", "StandardCharsets", ".", "UTF_8", ")", ")", ")", "{", "String", "prefix", "=", "\"\"", ";", "String", "line", ";", "while", "(", "(", "line", "=", "reader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "line", "=", "line", ".", "trim", "(", ")", ";", "if", "(", "line", ".", "length", "(", ")", ">", "0", ")", "{", "buf", ".", "append", "(", "prefix", ")", ".", "append", "(", "line", ".", "trim", "(", ")", ")", ";", "prefix", "=", "\"\\n\"", ";", "}", "}", "}", "}", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Read a script into a single-line string suitable for use in a Redis <code>EVAL</code> statement. @param resourceName the name of the script resource to read @return the string form of the script @throws IOException if something goes wrong
[ "Read", "a", "script", "into", "a", "single", "-", "line", "string", "suitable", "for", "use", "in", "a", "Redis", "<code", ">", "EVAL<", "/", "code", ">", "statement", "." ]
train
https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/ScriptUtils.java#L35-L55
jpmml/jpmml-evaluator
pmml-evaluator/src/main/java/org/jpmml/evaluator/TypeUtil.java
TypeUtil.toDouble
static private Double toDouble(Object value) { """ <p> Casts the specified value to Double data type. </p> @see DataType#DOUBLE """ if(value instanceof Double){ return (Double)value; } else if((value instanceof Float) || (value instanceof Long) || (value instanceof Integer) || (value instanceof Short) || (value instanceof Byte)){ Number number = (Number)value; return toDouble(number.doubleValue()); } else if(value instanceof Boolean){ Boolean flag = (Boolean)value; return (flag.booleanValue() ? Numbers.DOUBLE_ONE : Numbers.DOUBLE_ZERO); } else if((value instanceof DaysSinceDate) || (value instanceof SecondsSinceDate) || (value instanceof SecondsSinceMidnight)){ Number number = (Number)value; return toDouble(number.doubleValue()); } throw new TypeCheckException(DataType.DOUBLE, value); }
java
static private Double toDouble(Object value){ if(value instanceof Double){ return (Double)value; } else if((value instanceof Float) || (value instanceof Long) || (value instanceof Integer) || (value instanceof Short) || (value instanceof Byte)){ Number number = (Number)value; return toDouble(number.doubleValue()); } else if(value instanceof Boolean){ Boolean flag = (Boolean)value; return (flag.booleanValue() ? Numbers.DOUBLE_ONE : Numbers.DOUBLE_ZERO); } else if((value instanceof DaysSinceDate) || (value instanceof SecondsSinceDate) || (value instanceof SecondsSinceMidnight)){ Number number = (Number)value; return toDouble(number.doubleValue()); } throw new TypeCheckException(DataType.DOUBLE, value); }
[ "static", "private", "Double", "toDouble", "(", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "Double", ")", "{", "return", "(", "Double", ")", "value", ";", "}", "else", "if", "(", "(", "value", "instanceof", "Float", ")", "||", "(", "value", "instanceof", "Long", ")", "||", "(", "value", "instanceof", "Integer", ")", "||", "(", "value", "instanceof", "Short", ")", "||", "(", "value", "instanceof", "Byte", ")", ")", "{", "Number", "number", "=", "(", "Number", ")", "value", ";", "return", "toDouble", "(", "number", ".", "doubleValue", "(", ")", ")", ";", "}", "else", "if", "(", "value", "instanceof", "Boolean", ")", "{", "Boolean", "flag", "=", "(", "Boolean", ")", "value", ";", "return", "(", "flag", ".", "booleanValue", "(", ")", "?", "Numbers", ".", "DOUBLE_ONE", ":", "Numbers", ".", "DOUBLE_ZERO", ")", ";", "}", "else", "if", "(", "(", "value", "instanceof", "DaysSinceDate", ")", "||", "(", "value", "instanceof", "SecondsSinceDate", ")", "||", "(", "value", "instanceof", "SecondsSinceMidnight", ")", ")", "{", "Number", "number", "=", "(", "Number", ")", "value", ";", "return", "toDouble", "(", "number", ".", "doubleValue", "(", ")", ")", ";", "}", "throw", "new", "TypeCheckException", "(", "DataType", ".", "DOUBLE", ",", "value", ")", ";", "}" ]
<p> Casts the specified value to Double data type. </p> @see DataType#DOUBLE
[ "<p", ">", "Casts", "the", "specified", "value", "to", "Double", "data", "type", ".", "<", "/", "p", ">" ]
train
https://github.com/jpmml/jpmml-evaluator/blob/ac8a48775877b6fa9dbc5f259871f3278489cc61/pmml-evaluator/src/main/java/org/jpmml/evaluator/TypeUtil.java#L688-L714
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java
AbstractCachedGenerator.addLinkedResources
protected void addLinkedResources(String path, GeneratorContext context, FilePathMapping fMapping) { """ Adds the linked resource to the linked resource map @param path the resource path @param context the generator context @param fMapping the file path mapping linked to the resource """ addLinkedResources(path, context, Arrays.asList(fMapping)); }
java
protected void addLinkedResources(String path, GeneratorContext context, FilePathMapping fMapping) { addLinkedResources(path, context, Arrays.asList(fMapping)); }
[ "protected", "void", "addLinkedResources", "(", "String", "path", ",", "GeneratorContext", "context", ",", "FilePathMapping", "fMapping", ")", "{", "addLinkedResources", "(", "path", ",", "context", ",", "Arrays", ".", "asList", "(", "fMapping", ")", ")", ";", "}" ]
Adds the linked resource to the linked resource map @param path the resource path @param context the generator context @param fMapping the file path mapping linked to the resource
[ "Adds", "the", "linked", "resource", "to", "the", "linked", "resource", "map" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCachedGenerator.java#L361-L363
optimaize/anythingworks
client/rest/src/main/java/com/optimaize/anythingworks/client/rest/http/HeaderParams.java
HeaderParams.put
public HeaderParams put(String name, String value) { """ Overwrites in case there is a value already associated with that name. @return the same instance """ values.put(cleanAndValidate(name), cleanAndValidate(value)); return this; }
java
public HeaderParams put(String name, String value) { values.put(cleanAndValidate(name), cleanAndValidate(value)); return this; }
[ "public", "HeaderParams", "put", "(", "String", "name", ",", "String", "value", ")", "{", "values", ".", "put", "(", "cleanAndValidate", "(", "name", ")", ",", "cleanAndValidate", "(", "value", ")", ")", ";", "return", "this", ";", "}" ]
Overwrites in case there is a value already associated with that name. @return the same instance
[ "Overwrites", "in", "case", "there", "is", "a", "value", "already", "associated", "with", "that", "name", "." ]
train
https://github.com/optimaize/anythingworks/blob/23e5f1c63cd56d935afaac4ad033c7996b32a1f2/client/rest/src/main/java/com/optimaize/anythingworks/client/rest/http/HeaderParams.java#L47-L50
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java
ReviewsImpl.publishVideoReviewAsync
public Observable<Void> publishVideoReviewAsync(String teamName, String reviewId) { """ Publish video review to make it available for review. @param teamName Your team name. @param reviewId Id of the review. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return publishVideoReviewWithServiceResponseAsync(teamName, reviewId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> publishVideoReviewAsync(String teamName, String reviewId) { return publishVideoReviewWithServiceResponseAsync(teamName, reviewId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "publishVideoReviewAsync", "(", "String", "teamName", ",", "String", "reviewId", ")", "{", "return", "publishVideoReviewWithServiceResponseAsync", "(", "teamName", ",", "reviewId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Publish video review to make it available for review. @param teamName Your team name. @param reviewId Id of the review. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Publish", "video", "review", "to", "make", "it", "available", "for", "review", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ReviewsImpl.java#L1635-L1642
jMetal/jMetal
jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/espea/util/ScalarizationUtils.java
ScalarizationUtils.weightedProduct
public static <S extends Solution<?>> void weightedProduct(List<S> solutionsList, double[] weights) { """ Objectives are exponentiated by a positive weight and afterwards multiplied. @param solutionsList A list of solutions. @param weights Weights by objectives are exponentiated """ for (S solution : solutionsList) { double product = Math.pow(solution.getObjective(0), weights[0]); for (int i = 1; i < solution.getNumberOfObjectives(); i++) { product *= Math.pow(solution.getObjective(i), weights[i]); } setScalarizationValue(solution, product); } }
java
public static <S extends Solution<?>> void weightedProduct(List<S> solutionsList, double[] weights) { for (S solution : solutionsList) { double product = Math.pow(solution.getObjective(0), weights[0]); for (int i = 1; i < solution.getNumberOfObjectives(); i++) { product *= Math.pow(solution.getObjective(i), weights[i]); } setScalarizationValue(solution, product); } }
[ "public", "static", "<", "S", "extends", "Solution", "<", "?", ">", ">", "void", "weightedProduct", "(", "List", "<", "S", ">", "solutionsList", ",", "double", "[", "]", "weights", ")", "{", "for", "(", "S", "solution", ":", "solutionsList", ")", "{", "double", "product", "=", "Math", ".", "pow", "(", "solution", ".", "getObjective", "(", "0", ")", ",", "weights", "[", "0", "]", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "solution", ".", "getNumberOfObjectives", "(", ")", ";", "i", "++", ")", "{", "product", "*=", "Math", ".", "pow", "(", "solution", ".", "getObjective", "(", "i", ")", ",", "weights", "[", "i", "]", ")", ";", "}", "setScalarizationValue", "(", "solution", ",", "product", ")", ";", "}", "}" ]
Objectives are exponentiated by a positive weight and afterwards multiplied. @param solutionsList A list of solutions. @param weights Weights by objectives are exponentiated
[ "Objectives", "are", "exponentiated", "by", "a", "positive", "weight", "and", "afterwards", "multiplied", "." ]
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-algorithm/src/main/java/org/uma/jmetal/algorithm/multiobjective/espea/util/ScalarizationUtils.java#L161-L169
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.listPreparationAndReleaseTaskStatusAsync
public ServiceFuture<List<JobPreparationAndReleaseTaskExecutionInformation>> listPreparationAndReleaseTaskStatusAsync(final String jobId, final ListOperationCallback<JobPreparationAndReleaseTaskExecutionInformation> serviceCallback) { """ Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. @param jobId The ID of the job. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return AzureServiceFuture.fromHeaderPageResponse( listPreparationAndReleaseTaskStatusSinglePageAsync(jobId), new Func1<String, Observable<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>> call(String nextPageLink) { return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, null); } }, serviceCallback); }
java
public ServiceFuture<List<JobPreparationAndReleaseTaskExecutionInformation>> listPreparationAndReleaseTaskStatusAsync(final String jobId, final ListOperationCallback<JobPreparationAndReleaseTaskExecutionInformation> serviceCallback) { return AzureServiceFuture.fromHeaderPageResponse( listPreparationAndReleaseTaskStatusSinglePageAsync(jobId), new Func1<String, Observable<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<Page<JobPreparationAndReleaseTaskExecutionInformation>, JobListPreparationAndReleaseTaskStatusHeaders>> call(String nextPageLink) { return listPreparationAndReleaseTaskStatusNextSinglePageAsync(nextPageLink, null); } }, serviceCallback); }
[ "public", "ServiceFuture", "<", "List", "<", "JobPreparationAndReleaseTaskExecutionInformation", ">", ">", "listPreparationAndReleaseTaskStatusAsync", "(", "final", "String", "jobId", ",", "final", "ListOperationCallback", "<", "JobPreparationAndReleaseTaskExecutionInformation", ">", "serviceCallback", ")", "{", "return", "AzureServiceFuture", ".", "fromHeaderPageResponse", "(", "listPreparationAndReleaseTaskStatusSinglePageAsync", "(", "jobId", ")", ",", "new", "Func1", "<", "String", ",", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "JobPreparationAndReleaseTaskExecutionInformation", ">", ",", "JobListPreparationAndReleaseTaskStatusHeaders", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "JobPreparationAndReleaseTaskExecutionInformation", ">", ",", "JobListPreparationAndReleaseTaskStatusHeaders", ">", ">", "call", "(", "String", "nextPageLink", ")", "{", "return", "listPreparationAndReleaseTaskStatusNextSinglePageAsync", "(", "nextPageLink", ",", "null", ")", ";", "}", "}", ",", "serviceCallback", ")", ";", "}" ]
Lists the execution status of the Job Preparation and Job Release task for the specified job across the compute nodes where the job has run. This API returns the Job Preparation and Job Release task status on all compute nodes that have run the Job Preparation or Job Release task. This includes nodes which have since been removed from the pool. If this API is invoked on a job which has no Job Preparation or Job Release task, the Batch service returns HTTP status code 409 (Conflict) with an error code of JobPreparationTaskNotSpecified. @param jobId The ID of the job. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Lists", "the", "execution", "status", "of", "the", "Job", "Preparation", "and", "Job", "Release", "task", "for", "the", "specified", "job", "across", "the", "compute", "nodes", "where", "the", "job", "has", "run", ".", "This", "API", "returns", "the", "Job", "Preparation", "and", "Job", "Release", "task", "status", "on", "all", "compute", "nodes", "that", "have", "run", "the", "Job", "Preparation", "or", "Job", "Release", "task", ".", "This", "includes", "nodes", "which", "have", "since", "been", "removed", "from", "the", "pool", ".", "If", "this", "API", "is", "invoked", "on", "a", "job", "which", "has", "no", "Job", "Preparation", "or", "Job", "Release", "task", "the", "Batch", "service", "returns", "HTTP", "status", "code", "409", "(", "Conflict", ")", "with", "an", "error", "code", "of", "JobPreparationTaskNotSpecified", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L2833-L2843
google/gson
codegen/src/main/java/com/google/gson/codegen/JavaWriter.java
JavaWriter.beginType
public void beginType(String type, String kind, int modifiers) throws IOException { """ Emits a type declaration. @param kind such as "class", "interface" or "enum". """ beginType(type, kind, modifiers, null); }
java
public void beginType(String type, String kind, int modifiers) throws IOException { beginType(type, kind, modifiers, null); }
[ "public", "void", "beginType", "(", "String", "type", ",", "String", "kind", ",", "int", "modifiers", ")", "throws", "IOException", "{", "beginType", "(", "type", ",", "kind", ",", "modifiers", ",", "null", ")", ";", "}" ]
Emits a type declaration. @param kind such as "class", "interface" or "enum".
[ "Emits", "a", "type", "declaration", "." ]
train
https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/codegen/src/main/java/com/google/gson/codegen/JavaWriter.java#L134-L136
FrodeRanders/java-vopn
src/main/java/org/gautelis/vopn/xml/XPath.java
XPath.getElementFrom
public OMElement getElementFrom(OMNode element, String expression) throws XmlException { """ /* Upon failure to find element, the default behaviour is to throw an exception. """ return getElementFrom(element, namespaces, expression, /* accept failure? */ false); }
java
public OMElement getElementFrom(OMNode element, String expression) throws XmlException { return getElementFrom(element, namespaces, expression, /* accept failure? */ false); }
[ "public", "OMElement", "getElementFrom", "(", "OMNode", "element", ",", "String", "expression", ")", "throws", "XmlException", "{", "return", "getElementFrom", "(", "element", ",", "namespaces", ",", "expression", ",", "/* accept failure? */", "false", ")", ";", "}" ]
/* Upon failure to find element, the default behaviour is to throw an exception.
[ "/", "*", "Upon", "failure", "to", "find", "element", "the", "default", "behaviour", "is", "to", "throw", "an", "exception", "." ]
train
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/xml/XPath.java#L95-L97
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/ResourceHandle.java
ResourceHandle.findUpwards
public ResourceHandle findUpwards(String basePath, Pattern namePattern, String childType) { """ Retrieves a child of this resource or a parent specified by its base path, name pattern and type; for example findUpwards("jcr:content", Pattern.compile("^some.*$"), "sling:Folder"). """ ResourceHandle current = this; while (current != null && current.isValid()) { ResourceHandle base = ResourceHandle.use(current.getChild(basePath)); if (base.isValid()) { for (ResourceHandle child : base.getChildrenByType(childType)) { if (namePattern.matcher(child.getName()).matches()) { return child; } } } current = current.getParent(); } return null; }
java
public ResourceHandle findUpwards(String basePath, Pattern namePattern, String childType) { ResourceHandle current = this; while (current != null && current.isValid()) { ResourceHandle base = ResourceHandle.use(current.getChild(basePath)); if (base.isValid()) { for (ResourceHandle child : base.getChildrenByType(childType)) { if (namePattern.matcher(child.getName()).matches()) { return child; } } } current = current.getParent(); } return null; }
[ "public", "ResourceHandle", "findUpwards", "(", "String", "basePath", ",", "Pattern", "namePattern", ",", "String", "childType", ")", "{", "ResourceHandle", "current", "=", "this", ";", "while", "(", "current", "!=", "null", "&&", "current", ".", "isValid", "(", ")", ")", "{", "ResourceHandle", "base", "=", "ResourceHandle", ".", "use", "(", "current", ".", "getChild", "(", "basePath", ")", ")", ";", "if", "(", "base", ".", "isValid", "(", ")", ")", "{", "for", "(", "ResourceHandle", "child", ":", "base", ".", "getChildrenByType", "(", "childType", ")", ")", "{", "if", "(", "namePattern", ".", "matcher", "(", "child", ".", "getName", "(", ")", ")", ".", "matches", "(", ")", ")", "{", "return", "child", ";", "}", "}", "}", "current", "=", "current", ".", "getParent", "(", ")", ";", "}", "return", "null", ";", "}" ]
Retrieves a child of this resource or a parent specified by its base path, name pattern and type; for example findUpwards("jcr:content", Pattern.compile("^some.*$"), "sling:Folder").
[ "Retrieves", "a", "child", "of", "this", "resource", "or", "a", "parent", "specified", "by", "its", "base", "path", "name", "pattern", "and", "type", ";", "for", "example", "findUpwards", "(", "jcr", ":", "content", "Pattern", ".", "compile", "(", "^some", ".", "*", "$", ")", "sling", ":", "Folder", ")", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/ResourceHandle.java#L426-L440
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/ser/bean/ObjectIdSerializer.java
ObjectIdSerializer.serializeId
public void serializeId( JsonWriter writer, JsonSerializationContext ctx ) { """ <p>serializeId</p> @param writer a {@link com.github.nmorel.gwtjackson.client.stream.JsonWriter} object. @param ctx a {@link com.github.nmorel.gwtjackson.client.JsonSerializationContext} object. """ serializer.serialize( writer, id, ctx ); }
java
public void serializeId( JsonWriter writer, JsonSerializationContext ctx ) { serializer.serialize( writer, id, ctx ); }
[ "public", "void", "serializeId", "(", "JsonWriter", "writer", ",", "JsonSerializationContext", "ctx", ")", "{", "serializer", ".", "serialize", "(", "writer", ",", "id", ",", "ctx", ")", ";", "}" ]
<p>serializeId</p> @param writer a {@link com.github.nmorel.gwtjackson.client.stream.JsonWriter} object. @param ctx a {@link com.github.nmorel.gwtjackson.client.JsonSerializationContext} object.
[ "<p", ">", "serializeId<", "/", "p", ">" ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/ser/bean/ObjectIdSerializer.java#L52-L54
jparsec/jparsec
jparsec/src/main/java/org/jparsec/Terminals.java
Terminals.caseSensitive
@Deprecated public static Terminals caseSensitive(String[] ops, String[] keywords) { """ Returns a {@link Terminals} object for lexing and parsing the operators with names specified in {@code ops}, and for lexing and parsing the keywords case sensitively. Parsers for operators and keywords can be obtained through {@link #token}; parsers for identifiers through {@link #identifier}. <p>In detail, keywords and operators are lexed as {@link Tokens.Fragment} with {@link Tag#RESERVED} tag. Words that are not among {@code keywords} are lexed as {@code Fragment} with {@link Tag#IDENTIFIER} tag. <p>A word is defined as an alphanumeric string that starts with {@code [_a - zA - Z]}, with 0 or more {@code [0 - 9_a - zA - Z]} following. @param ops the operator names. @param keywords the keyword names. @return the Terminals instance. @deprecated Use {@code operators(ops) .words(Scanners.IDENTIFIER) .keywords(keywords) .build()} instead. """ return operators(ops).words(Scanners.IDENTIFIER).keywords(asList(keywords)).build(); }
java
@Deprecated public static Terminals caseSensitive(String[] ops, String[] keywords) { return operators(ops).words(Scanners.IDENTIFIER).keywords(asList(keywords)).build(); }
[ "@", "Deprecated", "public", "static", "Terminals", "caseSensitive", "(", "String", "[", "]", "ops", ",", "String", "[", "]", "keywords", ")", "{", "return", "operators", "(", "ops", ")", ".", "words", "(", "Scanners", ".", "IDENTIFIER", ")", ".", "keywords", "(", "asList", "(", "keywords", ")", ")", ".", "build", "(", ")", ";", "}" ]
Returns a {@link Terminals} object for lexing and parsing the operators with names specified in {@code ops}, and for lexing and parsing the keywords case sensitively. Parsers for operators and keywords can be obtained through {@link #token}; parsers for identifiers through {@link #identifier}. <p>In detail, keywords and operators are lexed as {@link Tokens.Fragment} with {@link Tag#RESERVED} tag. Words that are not among {@code keywords} are lexed as {@code Fragment} with {@link Tag#IDENTIFIER} tag. <p>A word is defined as an alphanumeric string that starts with {@code [_a - zA - Z]}, with 0 or more {@code [0 - 9_a - zA - Z]} following. @param ops the operator names. @param keywords the keyword names. @return the Terminals instance. @deprecated Use {@code operators(ops) .words(Scanners.IDENTIFIER) .keywords(keywords) .build()} instead.
[ "Returns", "a", "{", "@link", "Terminals", "}", "object", "for", "lexing", "and", "parsing", "the", "operators", "with", "names", "specified", "in", "{", "@code", "ops", "}", "and", "for", "lexing", "and", "parsing", "the", "keywords", "case", "sensitively", ".", "Parsers", "for", "operators", "and", "keywords", "can", "be", "obtained", "through", "{", "@link", "#token", "}", ";", "parsers", "for", "identifiers", "through", "{", "@link", "#identifier", "}", "." ]
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/Terminals.java#L267-L270
ykrasik/jaci
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java
ReflectionUtils.assertReturnValue
public static void assertReturnValue(ReflectionMethod method, Class<?> expectedReturnType) { """ Assert that the given method returns the expected return type. @param method Method to assert. @param expectedReturnType Expected return type of the method. @throws IllegalArgumentException If the method's return type doesn't match the expected type. """ final Class<?> returnType = method.getReturnType(); if (returnType != expectedReturnType) { final String message = "Class='"+method.getDeclaringClass()+"', method='"+method.getName()+"': Must return a value of type '"+expectedReturnType+"'!"; throw new IllegalArgumentException(message); } }
java
public static void assertReturnValue(ReflectionMethod method, Class<?> expectedReturnType) { final Class<?> returnType = method.getReturnType(); if (returnType != expectedReturnType) { final String message = "Class='"+method.getDeclaringClass()+"', method='"+method.getName()+"': Must return a value of type '"+expectedReturnType+"'!"; throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "assertReturnValue", "(", "ReflectionMethod", "method", ",", "Class", "<", "?", ">", "expectedReturnType", ")", "{", "final", "Class", "<", "?", ">", "returnType", "=", "method", ".", "getReturnType", "(", ")", ";", "if", "(", "returnType", "!=", "expectedReturnType", ")", "{", "final", "String", "message", "=", "\"Class='\"", "+", "method", ".", "getDeclaringClass", "(", ")", "+", "\"', method='\"", "+", "method", ".", "getName", "(", ")", "+", "\"': Must return a value of type '\"", "+", "expectedReturnType", "+", "\"'!\"", ";", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Assert that the given method returns the expected return type. @param method Method to assert. @param expectedReturnType Expected return type of the method. @throws IllegalArgumentException If the method's return type doesn't match the expected type.
[ "Assert", "that", "the", "given", "method", "returns", "the", "expected", "return", "type", "." ]
train
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L207-L213
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.optionsAsync
public <T> CompletableFuture<T> optionsAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) { """ Executes an asynchronous OPTIONS request on the configured URI (asynchronous alias to the `options(Class,Closure)` method), with additional configuration provided by the configuration closure. The result will be cast to the specified `type`. A response to a OPTIONS request contains no data; however, the `response.when()` methods may provide data based on response headers, which will be cast to the specified type. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101/date' } CompletableFuture future = http.optionsAsync(Date){ response.success { FromServer fromServer -> Date.parse('yyyy.MM.dd HH:mm', fromServer.headers.find { it.key == 'stamp' }.value) } } Date result = future.get() ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param type the type of the response content @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return a {@link CompletableFuture} which may be used to access the resulting content (if present) """ return CompletableFuture.supplyAsync(() -> options(type, closure), getExecutor()); }
java
public <T> CompletableFuture<T> optionsAsync(final Class<T> type, @DelegatesTo(HttpConfig.class) final Closure closure) { return CompletableFuture.supplyAsync(() -> options(type, closure), getExecutor()); }
[ "public", "<", "T", ">", "CompletableFuture", "<", "T", ">", "optionsAsync", "(", "final", "Class", "<", "T", ">", "type", ",", "@", "DelegatesTo", "(", "HttpConfig", ".", "class", ")", "final", "Closure", "closure", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", "->", "options", "(", "type", ",", "closure", ")", ",", "getExecutor", "(", ")", ")", ";", "}" ]
Executes an asynchronous OPTIONS request on the configured URI (asynchronous alias to the `options(Class,Closure)` method), with additional configuration provided by the configuration closure. The result will be cast to the specified `type`. A response to a OPTIONS request contains no data; however, the `response.when()` methods may provide data based on response headers, which will be cast to the specified type. [source,groovy] ---- def http = HttpBuilder.configure { request.uri = 'http://localhost:10101/date' } CompletableFuture future = http.optionsAsync(Date){ response.success { FromServer fromServer -> Date.parse('yyyy.MM.dd HH:mm', fromServer.headers.find { it.key == 'stamp' }.value) } } Date result = future.get() ---- The configuration `closure` allows additional configuration for this request based on the {@link HttpConfig} interface. @param type the type of the response content @param closure the additional configuration closure (delegated to {@link HttpConfig}) @return a {@link CompletableFuture} which may be used to access the resulting content (if present)
[ "Executes", "an", "asynchronous", "OPTIONS", "request", "on", "the", "configured", "URI", "(", "asynchronous", "alias", "to", "the", "options", "(", "Class", "Closure", ")", "method", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "closure", ".", "The", "result", "will", "be", "cast", "to", "the", "specified", "type", ".", "A", "response", "to", "a", "OPTIONS", "request", "contains", "no", "data", ";", "however", "the", "response", ".", "when", "()", "methods", "may", "provide", "data", "based", "on", "response", "headers", "which", "will", "be", "cast", "to", "the", "specified", "type", "." ]
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1956-L1958
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/price/PriceGraduation.java
PriceGraduation.createSimple
@Nonnull public static IMutablePriceGraduation createSimple (@Nonnull final IMutablePrice aPrice) { """ Create a simple price graduation that contains one item with the minimum quantity of 1. @param aPrice The price to use. May not be <code>null</code>. @return Never <code>null</code>. """ final PriceGraduation ret = new PriceGraduation (aPrice.getCurrency ()); ret.addItem (new PriceGraduationItem (1, aPrice.getNetAmount ().getValue ())); return ret; }
java
@Nonnull public static IMutablePriceGraduation createSimple (@Nonnull final IMutablePrice aPrice) { final PriceGraduation ret = new PriceGraduation (aPrice.getCurrency ()); ret.addItem (new PriceGraduationItem (1, aPrice.getNetAmount ().getValue ())); return ret; }
[ "@", "Nonnull", "public", "static", "IMutablePriceGraduation", "createSimple", "(", "@", "Nonnull", "final", "IMutablePrice", "aPrice", ")", "{", "final", "PriceGraduation", "ret", "=", "new", "PriceGraduation", "(", "aPrice", ".", "getCurrency", "(", ")", ")", ";", "ret", ".", "addItem", "(", "new", "PriceGraduationItem", "(", "1", ",", "aPrice", ".", "getNetAmount", "(", ")", ".", "getValue", "(", ")", ")", ")", ";", "return", "ret", ";", "}" ]
Create a simple price graduation that contains one item with the minimum quantity of 1. @param aPrice The price to use. May not be <code>null</code>. @return Never <code>null</code>.
[ "Create", "a", "simple", "price", "graduation", "that", "contains", "one", "item", "with", "the", "minimum", "quantity", "of", "1", "." ]
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/price/PriceGraduation.java#L218-L224
landawn/AbacusUtil
src/com/landawn/abacus/util/Maps.java
Maps.removeIf
public static <K, V, E extends Exception> boolean removeIf(final Map<K, V> map, final Try.Predicate<? super Map.Entry<K, V>, E> filter) throws E { """ Removes entries from the specified {@code map} by the the specified {@code filter}. @param map @param filter @return {@code true} if there are one or more than one entries removed from the specified map. @throws E """ List<K> keysToRemove = null; for (Map.Entry<K, V> entry : map.entrySet()) { if (filter.test(entry)) { if (keysToRemove == null) { keysToRemove = new ArrayList<>(7); } keysToRemove.add(entry.getKey()); } } if (N.notNullOrEmpty(keysToRemove)) { for (K key : keysToRemove) { map.remove(key); } return true; } return false; }
java
public static <K, V, E extends Exception> boolean removeIf(final Map<K, V> map, final Try.Predicate<? super Map.Entry<K, V>, E> filter) throws E { List<K> keysToRemove = null; for (Map.Entry<K, V> entry : map.entrySet()) { if (filter.test(entry)) { if (keysToRemove == null) { keysToRemove = new ArrayList<>(7); } keysToRemove.add(entry.getKey()); } } if (N.notNullOrEmpty(keysToRemove)) { for (K key : keysToRemove) { map.remove(key); } return true; } return false; }
[ "public", "static", "<", "K", ",", "V", ",", "E", "extends", "Exception", ">", "boolean", "removeIf", "(", "final", "Map", "<", "K", ",", "V", ">", "map", ",", "final", "Try", ".", "Predicate", "<", "?", "super", "Map", ".", "Entry", "<", "K", ",", "V", ">", ",", "E", ">", "filter", ")", "throws", "E", "{", "List", "<", "K", ">", "keysToRemove", "=", "null", ";", "for", "(", "Map", ".", "Entry", "<", "K", ",", "V", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "if", "(", "filter", ".", "test", "(", "entry", ")", ")", "{", "if", "(", "keysToRemove", "==", "null", ")", "{", "keysToRemove", "=", "new", "ArrayList", "<>", "(", "7", ")", ";", "}", "keysToRemove", ".", "add", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "}", "if", "(", "N", ".", "notNullOrEmpty", "(", "keysToRemove", ")", ")", "{", "for", "(", "K", "key", ":", "keysToRemove", ")", "{", "map", ".", "remove", "(", "key", ")", ";", "}", "return", "true", ";", "}", "return", "false", ";", "}" ]
Removes entries from the specified {@code map} by the the specified {@code filter}. @param map @param filter @return {@code true} if there are one or more than one entries removed from the specified map. @throws E
[ "Removes", "entries", "from", "the", "specified", "{", "@code", "map", "}", "by", "the", "the", "specified", "{", "@code", "filter", "}", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Maps.java#L599-L621
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/SharedFlowController.java
SharedFlowController.getPreviousPageInfoLegacy
public PreviousPageInfo getPreviousPageInfoLegacy( PageFlowController curJpf, HttpServletRequest request ) { """ Get a legacy PreviousPageInfo. @deprecated This method will be removed without replacement in a future release. """ assert curJpf != null; return curJpf.getCurrentPageInfo(); }
java
public PreviousPageInfo getPreviousPageInfoLegacy( PageFlowController curJpf, HttpServletRequest request ) { assert curJpf != null; return curJpf.getCurrentPageInfo(); }
[ "public", "PreviousPageInfo", "getPreviousPageInfoLegacy", "(", "PageFlowController", "curJpf", ",", "HttpServletRequest", "request", ")", "{", "assert", "curJpf", "!=", "null", ";", "return", "curJpf", ".", "getCurrentPageInfo", "(", ")", ";", "}" ]
Get a legacy PreviousPageInfo. @deprecated This method will be removed without replacement in a future release.
[ "Get", "a", "legacy", "PreviousPageInfo", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/SharedFlowController.java#L172-L176
kuali/ojb-1.0.4
src/jdori/org/apache/ojb/jdori/sql/OjbExtent.java
OjbExtent.provideStateManagers
protected Collection provideStateManagers(Collection pojos) { """ This methods enhances the objects loaded by a broker query with a JDO StateManager an brings them under JDO control. @param pojos the OJB pojos as obtained by the broker @return the collection of JDO PersistenceCapable instances """ PersistenceCapable pc; int [] fieldNums; Iterator iter = pojos.iterator(); Collection result = new ArrayList(); while (iter.hasNext()) { // obtain a StateManager pc = (PersistenceCapable) iter.next(); Identity oid = new Identity(pc, broker); StateManagerInternal smi = pmi.getStateManager(oid, pc.getClass()); // fetch attributes into StateManager JDOClass jdoClass = Helper.getJDOClass(pc.getClass()); fieldNums = jdoClass.getManagedFieldNumbers(); FieldManager fm = new OjbFieldManager(pc, broker); smi.replaceFields(fieldNums, fm); smi.retrieve(); // get JDO PersistencecCapable instance from SM and add it to result collection Object instance = smi.getObject(); result.add(instance); } return result; }
java
protected Collection provideStateManagers(Collection pojos) { PersistenceCapable pc; int [] fieldNums; Iterator iter = pojos.iterator(); Collection result = new ArrayList(); while (iter.hasNext()) { // obtain a StateManager pc = (PersistenceCapable) iter.next(); Identity oid = new Identity(pc, broker); StateManagerInternal smi = pmi.getStateManager(oid, pc.getClass()); // fetch attributes into StateManager JDOClass jdoClass = Helper.getJDOClass(pc.getClass()); fieldNums = jdoClass.getManagedFieldNumbers(); FieldManager fm = new OjbFieldManager(pc, broker); smi.replaceFields(fieldNums, fm); smi.retrieve(); // get JDO PersistencecCapable instance from SM and add it to result collection Object instance = smi.getObject(); result.add(instance); } return result; }
[ "protected", "Collection", "provideStateManagers", "(", "Collection", "pojos", ")", "{", "PersistenceCapable", "pc", ";", "int", "[", "]", "fieldNums", ";", "Iterator", "iter", "=", "pojos", ".", "iterator", "(", ")", ";", "Collection", "result", "=", "new", "ArrayList", "(", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "// obtain a StateManager\r", "pc", "=", "(", "PersistenceCapable", ")", "iter", ".", "next", "(", ")", ";", "Identity", "oid", "=", "new", "Identity", "(", "pc", ",", "broker", ")", ";", "StateManagerInternal", "smi", "=", "pmi", ".", "getStateManager", "(", "oid", ",", "pc", ".", "getClass", "(", ")", ")", ";", "// fetch attributes into StateManager\r", "JDOClass", "jdoClass", "=", "Helper", ".", "getJDOClass", "(", "pc", ".", "getClass", "(", ")", ")", ";", "fieldNums", "=", "jdoClass", ".", "getManagedFieldNumbers", "(", ")", ";", "FieldManager", "fm", "=", "new", "OjbFieldManager", "(", "pc", ",", "broker", ")", ";", "smi", ".", "replaceFields", "(", "fieldNums", ",", "fm", ")", ";", "smi", ".", "retrieve", "(", ")", ";", "// get JDO PersistencecCapable instance from SM and add it to result collection\r", "Object", "instance", "=", "smi", ".", "getObject", "(", ")", ";", "result", ".", "add", "(", "instance", ")", ";", "}", "return", "result", ";", "}" ]
This methods enhances the objects loaded by a broker query with a JDO StateManager an brings them under JDO control. @param pojos the OJB pojos as obtained by the broker @return the collection of JDO PersistenceCapable instances
[ "This", "methods", "enhances", "the", "objects", "loaded", "by", "a", "broker", "query", "with", "a", "JDO", "StateManager", "an", "brings", "them", "under", "JDO", "control", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/jdori/org/apache/ojb/jdori/sql/OjbExtent.java#L120-L147
junit-team/junit4
src/main/java/org/junit/runner/notification/RunNotifier.java
RunNotifier.wrapIfNotThreadSafe
RunListener wrapIfNotThreadSafe(RunListener listener) { """ Wraps the given listener with {@link SynchronizedRunListener} if it is not annotated with {@link RunListener.ThreadSafe}. """ return listener.getClass().isAnnotationPresent(RunListener.ThreadSafe.class) ? listener : new SynchronizedRunListener(listener, this); }
java
RunListener wrapIfNotThreadSafe(RunListener listener) { return listener.getClass().isAnnotationPresent(RunListener.ThreadSafe.class) ? listener : new SynchronizedRunListener(listener, this); }
[ "RunListener", "wrapIfNotThreadSafe", "(", "RunListener", "listener", ")", "{", "return", "listener", ".", "getClass", "(", ")", ".", "isAnnotationPresent", "(", "RunListener", ".", "ThreadSafe", ".", "class", ")", "?", "listener", ":", "new", "SynchronizedRunListener", "(", "listener", ",", "this", ")", ";", "}" ]
Wraps the given listener with {@link SynchronizedRunListener} if it is not annotated with {@link RunListener.ThreadSafe}.
[ "Wraps", "the", "given", "listener", "with", "{" ]
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/runner/notification/RunNotifier.java#L49-L52
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/transform/ChainedTransformationTools.java
ChainedTransformationTools.transformAddress
public static PathAddress transformAddress(final PathAddress original, final TransformationTarget target) { """ Transform a path address. @param original the path address to be transformed @param target the transformation target @return the transformed path address """ return TransformersImpl.transformAddress(original, target); }
java
public static PathAddress transformAddress(final PathAddress original, final TransformationTarget target) { return TransformersImpl.transformAddress(original, target); }
[ "public", "static", "PathAddress", "transformAddress", "(", "final", "PathAddress", "original", ",", "final", "TransformationTarget", "target", ")", "{", "return", "TransformersImpl", ".", "transformAddress", "(", "original", ",", "target", ")", ";", "}" ]
Transform a path address. @param original the path address to be transformed @param target the transformation target @return the transformed path address
[ "Transform", "a", "path", "address", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/ChainedTransformationTools.java#L90-L92
anotheria/moskito
moskito-webui/src/main/java/net/anotheria/moskito/webui/shared/action/BaseAJAXMoskitoUIAction.java
BaseAJAXMoskitoUIAction.writeTextToResponse
private static void writeTextToResponse(final HttpServletResponse res, final String text) throws IOException { """ Writes specified text to response and flushes the stream. @param res {@link HttpServletRequest} @param text {@link String} @throws java.io.IOException if an input or output exception occurred """ res.setCharacterEncoding(UTF_8); res.setContentType(TEXT_X_JSON); PrintWriter writer = res.getWriter(); writer.write(text); writer.flush(); }
java
private static void writeTextToResponse(final HttpServletResponse res, final String text) throws IOException { res.setCharacterEncoding(UTF_8); res.setContentType(TEXT_X_JSON); PrintWriter writer = res.getWriter(); writer.write(text); writer.flush(); }
[ "private", "static", "void", "writeTextToResponse", "(", "final", "HttpServletResponse", "res", ",", "final", "String", "text", ")", "throws", "IOException", "{", "res", ".", "setCharacterEncoding", "(", "UTF_8", ")", ";", "res", ".", "setContentType", "(", "TEXT_X_JSON", ")", ";", "PrintWriter", "writer", "=", "res", ".", "getWriter", "(", ")", ";", "writer", ".", "write", "(", "text", ")", ";", "writer", ".", "flush", "(", ")", ";", "}" ]
Writes specified text to response and flushes the stream. @param res {@link HttpServletRequest} @param text {@link String} @throws java.io.IOException if an input or output exception occurred
[ "Writes", "specified", "text", "to", "response", "and", "flushes", "the", "stream", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/shared/action/BaseAJAXMoskitoUIAction.java#L112-L118