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
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/ContentCryptoMaterial.java
ContentCryptoMaterial.create
static ContentCryptoMaterial create(SecretKey cek, byte[] iv, EncryptionMaterials kekMaterials, S3CryptoScheme scheme, CryptoConfiguration config, AWSKMS kms, AmazonWebServiceRequest req) { """ Returns a new instance of <code>ContentCryptoMaterial</code> for the input parameters using the specified s3 crypto scheme. Note network calls are involved if the CEK is to be protected by KMS. @param cek content encrypting key @param iv initialization vector @param kekMaterials kek encryption material used to secure the CEK; can be KMS enabled. @param scheme s3 crypto scheme to be used for the content crypto material by providing the content crypto scheme, key wrapping scheme and mechanism for secure randomness @param config crypto configuration @param kms reference to the KMS client @param req originating service request """ return doCreate(cek, iv, kekMaterials, scheme.getContentCryptoScheme(), scheme, config, kms, req); }
java
static ContentCryptoMaterial create(SecretKey cek, byte[] iv, EncryptionMaterials kekMaterials, S3CryptoScheme scheme, CryptoConfiguration config, AWSKMS kms, AmazonWebServiceRequest req) { return doCreate(cek, iv, kekMaterials, scheme.getContentCryptoScheme(), scheme, config, kms, req); }
[ "static", "ContentCryptoMaterial", "create", "(", "SecretKey", "cek", ",", "byte", "[", "]", "iv", ",", "EncryptionMaterials", "kekMaterials", ",", "S3CryptoScheme", "scheme", ",", "CryptoConfiguration", "config", ",", "AWSKMS", "kms", ",", "AmazonWebServiceRequest", "req", ")", "{", "return", "doCreate", "(", "cek", ",", "iv", ",", "kekMaterials", ",", "scheme", ".", "getContentCryptoScheme", "(", ")", ",", "scheme", ",", "config", ",", "kms", ",", "req", ")", ";", "}" ]
Returns a new instance of <code>ContentCryptoMaterial</code> for the input parameters using the specified s3 crypto scheme. Note network calls are involved if the CEK is to be protected by KMS. @param cek content encrypting key @param iv initialization vector @param kekMaterials kek encryption material used to secure the CEK; can be KMS enabled. @param scheme s3 crypto scheme to be used for the content crypto material by providing the content crypto scheme, key wrapping scheme and mechanism for secure randomness @param config crypto configuration @param kms reference to the KMS client @param req originating service request
[ "Returns", "a", "new", "instance", "of", "<code", ">", "ContentCryptoMaterial<", "/", "code", ">", "for", "the", "input", "parameters", "using", "the", "specified", "s3", "crypto", "scheme", ".", "Note", "network", "calls", "are", "involved", "if", "the", "CEK", "is", "to", "be", "protected", "by", "KMS", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/ContentCryptoMaterial.java#L768-L775
powermock/powermock
powermock-core/src/main/java/org/powermock/core/ClassReplicaCreator.java
ClassReplicaCreator.getReplicaMethodDelegationCode
private String getReplicaMethodDelegationCode(Class<?> clazz, CtMethod ctMethod, String classOrInstanceToDelegateTo) throws NotFoundException { """ /* Invokes a instance method of the original instance. This enables partial mocking of system classes. """ StringBuilder builder = new StringBuilder(); builder.append("{java.lang.reflect.Method originalMethod = "); builder.append(clazz.getName()); builder.append(".class.getDeclaredMethod(\""); builder.append(ctMethod.getName()); builder.append("\", "); final String parametersAsString = getParametersAsString(getParameterTypes(ctMethod)); if ("".equals(parametersAsString)) { builder.append("null"); } else { builder.append(parametersAsString); } builder.append(");\n"); builder.append("originalMethod.setAccessible(true);\n"); final CtClass returnType = ctMethod.getReturnType(); final boolean isVoid = returnType.equals(CtClass.voidType); if (!isVoid) { builder.append("return ("); builder.append(returnType.getName()); builder.append(") "); } builder.append("originalMethod.invoke("); if (Modifier.isStatic(ctMethod.getModifiers()) || classOrInstanceToDelegateTo == null) { builder.append(clazz.getName()); builder.append(".class"); } else { builder.append(classOrInstanceToDelegateTo); } builder.append(", $args);}"); return builder.toString(); }
java
private String getReplicaMethodDelegationCode(Class<?> clazz, CtMethod ctMethod, String classOrInstanceToDelegateTo) throws NotFoundException { StringBuilder builder = new StringBuilder(); builder.append("{java.lang.reflect.Method originalMethod = "); builder.append(clazz.getName()); builder.append(".class.getDeclaredMethod(\""); builder.append(ctMethod.getName()); builder.append("\", "); final String parametersAsString = getParametersAsString(getParameterTypes(ctMethod)); if ("".equals(parametersAsString)) { builder.append("null"); } else { builder.append(parametersAsString); } builder.append(");\n"); builder.append("originalMethod.setAccessible(true);\n"); final CtClass returnType = ctMethod.getReturnType(); final boolean isVoid = returnType.equals(CtClass.voidType); if (!isVoid) { builder.append("return ("); builder.append(returnType.getName()); builder.append(") "); } builder.append("originalMethod.invoke("); if (Modifier.isStatic(ctMethod.getModifiers()) || classOrInstanceToDelegateTo == null) { builder.append(clazz.getName()); builder.append(".class"); } else { builder.append(classOrInstanceToDelegateTo); } builder.append(", $args);}"); return builder.toString(); }
[ "private", "String", "getReplicaMethodDelegationCode", "(", "Class", "<", "?", ">", "clazz", ",", "CtMethod", "ctMethod", ",", "String", "classOrInstanceToDelegateTo", ")", "throws", "NotFoundException", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "builder", ".", "append", "(", "\"{java.lang.reflect.Method originalMethod = \"", ")", ";", "builder", ".", "append", "(", "clazz", ".", "getName", "(", ")", ")", ";", "builder", ".", "append", "(", "\".class.getDeclaredMethod(\\\"\"", ")", ";", "builder", ".", "append", "(", "ctMethod", ".", "getName", "(", ")", ")", ";", "builder", ".", "append", "(", "\"\\\", \"", ")", ";", "final", "String", "parametersAsString", "=", "getParametersAsString", "(", "getParameterTypes", "(", "ctMethod", ")", ")", ";", "if", "(", "\"\"", ".", "equals", "(", "parametersAsString", ")", ")", "{", "builder", ".", "append", "(", "\"null\"", ")", ";", "}", "else", "{", "builder", ".", "append", "(", "parametersAsString", ")", ";", "}", "builder", ".", "append", "(", "\");\\n\"", ")", ";", "builder", ".", "append", "(", "\"originalMethod.setAccessible(true);\\n\"", ")", ";", "final", "CtClass", "returnType", "=", "ctMethod", ".", "getReturnType", "(", ")", ";", "final", "boolean", "isVoid", "=", "returnType", ".", "equals", "(", "CtClass", ".", "voidType", ")", ";", "if", "(", "!", "isVoid", ")", "{", "builder", ".", "append", "(", "\"return (\"", ")", ";", "builder", ".", "append", "(", "returnType", ".", "getName", "(", ")", ")", ";", "builder", ".", "append", "(", "\") \"", ")", ";", "}", "builder", ".", "append", "(", "\"originalMethod.invoke(\"", ")", ";", "if", "(", "Modifier", ".", "isStatic", "(", "ctMethod", ".", "getModifiers", "(", ")", ")", "||", "classOrInstanceToDelegateTo", "==", "null", ")", "{", "builder", ".", "append", "(", "clazz", ".", "getName", "(", ")", ")", ";", "builder", ".", "append", "(", "\".class\"", ")", ";", "}", "else", "{", "builder", ".", "append", "(", "classOrInstanceToDelegateTo", ")", ";", "}", "builder", ".", "append", "(", "\", $args);}\"", ")", ";", "return", "builder", ".", "toString", "(", ")", ";", "}" ]
/* Invokes a instance method of the original instance. This enables partial mocking of system classes.
[ "/", "*", "Invokes", "a", "instance", "method", "of", "the", "original", "instance", ".", "This", "enables", "partial", "mocking", "of", "system", "classes", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-core/src/main/java/org/powermock/core/ClassReplicaCreator.java#L147-L179
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/CanonicalStore.java
CanonicalStore.retrieveOrCreate
public V retrieveOrCreate(K key, Factory<V> factory) { """ Create a value for the given key iff one has not already been stored. This method is safe to be called concurrently from multiple threads. It will ensure that only one thread succeeds to create the value for the given key. @return the created/retrieved {@link AppClassLoader} """ // Clean up stale entries on every put. // This should avoid a slow memory leak of reference objects. this.cleanUpStaleEntries(); return retrieveOrCreate(key, factory, new FutureRef<V>()); }
java
public V retrieveOrCreate(K key, Factory<V> factory) { // Clean up stale entries on every put. // This should avoid a slow memory leak of reference objects. this.cleanUpStaleEntries(); return retrieveOrCreate(key, factory, new FutureRef<V>()); }
[ "public", "V", "retrieveOrCreate", "(", "K", "key", ",", "Factory", "<", "V", ">", "factory", ")", "{", "// Clean up stale entries on every put.", "// This should avoid a slow memory leak of reference objects.", "this", ".", "cleanUpStaleEntries", "(", ")", ";", "return", "retrieveOrCreate", "(", "key", ",", "factory", ",", "new", "FutureRef", "<", "V", ">", "(", ")", ")", ";", "}" ]
Create a value for the given key iff one has not already been stored. This method is safe to be called concurrently from multiple threads. It will ensure that only one thread succeeds to create the value for the given key. @return the created/retrieved {@link AppClassLoader}
[ "Create", "a", "value", "for", "the", "given", "key", "iff", "one", "has", "not", "already", "been", "stored", ".", "This", "method", "is", "safe", "to", "be", "called", "concurrently", "from", "multiple", "threads", ".", "It", "will", "ensure", "that", "only", "one", "thread", "succeeds", "to", "create", "the", "value", "for", "the", "given", "key", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/util/CanonicalStore.java#L70-L75
windup/windup
utils/src/main/java/org/jboss/windup/util/furnace/FurnaceClasspathScanner.java
FurnaceClasspathScanner.handleDirectory
private void handleDirectory(final Predicate<String> filter, final File rootDir, final List<String> discoveredFiles) { """ Scans given directory for files passing given filter, adds the results into given list. """ try { new DirectoryWalker<String>() { private Path startDir; public void walk() throws IOException { this.startDir = rootDir.toPath(); this.walk(rootDir, discoveredFiles); } @Override protected void handleFile(File file, int depth, Collection<String> discoveredFiles) throws IOException { String newPath = startDir.relativize(file.toPath()).toString(); if (filter.accept(newPath)) discoveredFiles.add(newPath); } }.walk(); } catch (IOException ex) { LOG.log(Level.SEVERE, "Error reading Furnace addon directory", ex); } }
java
private void handleDirectory(final Predicate<String> filter, final File rootDir, final List<String> discoveredFiles) { try { new DirectoryWalker<String>() { private Path startDir; public void walk() throws IOException { this.startDir = rootDir.toPath(); this.walk(rootDir, discoveredFiles); } @Override protected void handleFile(File file, int depth, Collection<String> discoveredFiles) throws IOException { String newPath = startDir.relativize(file.toPath()).toString(); if (filter.accept(newPath)) discoveredFiles.add(newPath); } }.walk(); } catch (IOException ex) { LOG.log(Level.SEVERE, "Error reading Furnace addon directory", ex); } }
[ "private", "void", "handleDirectory", "(", "final", "Predicate", "<", "String", ">", "filter", ",", "final", "File", "rootDir", ",", "final", "List", "<", "String", ">", "discoveredFiles", ")", "{", "try", "{", "new", "DirectoryWalker", "<", "String", ">", "(", ")", "{", "private", "Path", "startDir", ";", "public", "void", "walk", "(", ")", "throws", "IOException", "{", "this", ".", "startDir", "=", "rootDir", ".", "toPath", "(", ")", ";", "this", ".", "walk", "(", "rootDir", ",", "discoveredFiles", ")", ";", "}", "@", "Override", "protected", "void", "handleFile", "(", "File", "file", ",", "int", "depth", ",", "Collection", "<", "String", ">", "discoveredFiles", ")", "throws", "IOException", "{", "String", "newPath", "=", "startDir", ".", "relativize", "(", "file", ".", "toPath", "(", ")", ")", ".", "toString", "(", ")", ";", "if", "(", "filter", ".", "accept", "(", "newPath", ")", ")", "discoveredFiles", ".", "add", "(", "newPath", ")", ";", "}", "}", ".", "walk", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "LOG", ".", "log", "(", "Level", ".", "SEVERE", ",", "\"Error reading Furnace addon directory\"", ",", "ex", ")", ";", "}", "}" ]
Scans given directory for files passing given filter, adds the results into given list.
[ "Scans", "given", "directory", "for", "files", "passing", "given", "filter", "adds", "the", "results", "into", "given", "list", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/utils/src/main/java/org/jboss/windup/util/furnace/FurnaceClasspathScanner.java#L172-L200
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setNumber
public void setNumber(int index, Number value) { """ Set a number value. @param index number index (1-20) @param value number value """ set(selectField(AssignmentFieldLists.CUSTOM_NUMBER, index), value); }
java
public void setNumber(int index, Number value) { set(selectField(AssignmentFieldLists.CUSTOM_NUMBER, index), value); }
[ "public", "void", "setNumber", "(", "int", "index", ",", "Number", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "CUSTOM_NUMBER", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set a number value. @param index number index (1-20) @param value number value
[ "Set", "a", "number", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1606-L1609
wwadge/bonecp
bonecp/src/main/java/com/jolbox/bonecp/PoolWatchThread.java
PoolWatchThread.fillConnections
private void fillConnections(int connectionsToCreate) throws InterruptedException { """ Adds new connections to the partition. @param connectionsToCreate number of connections to create @throws InterruptedException """ try { for (int i=0; i < connectionsToCreate; i++){ // boolean dbDown = this.pool.getDbIsDown().get(); if (this.pool.poolShuttingDown){ break; } this.partition.addFreeConnection(new ConnectionHandle(null, this.partition, this.pool, false)); } } catch (Exception e) { logger.error("Error in trying to obtain a connection. Retrying in "+this.acquireRetryDelayInMs+"ms", e); Thread.sleep(this.acquireRetryDelayInMs); } }
java
private void fillConnections(int connectionsToCreate) throws InterruptedException { try { for (int i=0; i < connectionsToCreate; i++){ // boolean dbDown = this.pool.getDbIsDown().get(); if (this.pool.poolShuttingDown){ break; } this.partition.addFreeConnection(new ConnectionHandle(null, this.partition, this.pool, false)); } } catch (Exception e) { logger.error("Error in trying to obtain a connection. Retrying in "+this.acquireRetryDelayInMs+"ms", e); Thread.sleep(this.acquireRetryDelayInMs); } }
[ "private", "void", "fillConnections", "(", "int", "connectionsToCreate", ")", "throws", "InterruptedException", "{", "try", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "connectionsToCreate", ";", "i", "++", ")", "{", "//\tboolean dbDown = this.pool.getDbIsDown().get();\r", "if", "(", "this", ".", "pool", ".", "poolShuttingDown", ")", "{", "break", ";", "}", "this", ".", "partition", ".", "addFreeConnection", "(", "new", "ConnectionHandle", "(", "null", ",", "this", ".", "partition", ",", "this", ".", "pool", ",", "false", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"Error in trying to obtain a connection. Retrying in \"", "+", "this", ".", "acquireRetryDelayInMs", "+", "\"ms\"", ",", "e", ")", ";", "Thread", ".", "sleep", "(", "this", ".", "acquireRetryDelayInMs", ")", ";", "}", "}" ]
Adds new connections to the partition. @param connectionsToCreate number of connections to create @throws InterruptedException
[ "Adds", "new", "connections", "to", "the", "partition", "." ]
train
https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/PoolWatchThread.java#L108-L122
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/lib/MultipleOutputs.java
MultipleOutputs.getCollector
@SuppressWarnings( { """ Gets the output collector for a named output. <p/> @param namedOutput the named output name @param reporter the reporter @return the output collector for the given named output @throws IOException thrown if output collector could not be created """"unchecked"}) public OutputCollector getCollector(String namedOutput, Reporter reporter) throws IOException { return getCollector(namedOutput, null, reporter); }
java
@SuppressWarnings({"unchecked"}) public OutputCollector getCollector(String namedOutput, Reporter reporter) throws IOException { return getCollector(namedOutput, null, reporter); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", "}", ")", "public", "OutputCollector", "getCollector", "(", "String", "namedOutput", ",", "Reporter", "reporter", ")", "throws", "IOException", "{", "return", "getCollector", "(", "namedOutput", ",", "null", ",", "reporter", ")", ";", "}" ]
Gets the output collector for a named output. <p/> @param namedOutput the named output name @param reporter the reporter @return the output collector for the given named output @throws IOException thrown if output collector could not be created
[ "Gets", "the", "output", "collector", "for", "a", "named", "output", ".", "<p", "/", ">" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/MultipleOutputs.java#L473-L477
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.swapReferences
private static <T> void swapReferences( T[] arr, int idx1, int idx2 ) { """ method to swap elements in an array @param arr an array of Objects @param idx1 the index of the first element @param idx2 the index of the second element """ T tmp = arr[idx1]; arr[idx1] = arr[idx2]; arr[idx2] = tmp; }
java
private static <T> void swapReferences( T[] arr, int idx1, int idx2 ) { T tmp = arr[idx1]; arr[idx1] = arr[idx2]; arr[idx2] = tmp; }
[ "private", "static", "<", "T", ">", "void", "swapReferences", "(", "T", "[", "]", "arr", ",", "int", "idx1", ",", "int", "idx2", ")", "{", "T", "tmp", "=", "arr", "[", "idx1", "]", ";", "arr", "[", "idx1", "]", "=", "arr", "[", "idx2", "]", ";", "arr", "[", "idx2", "]", "=", "tmp", ";", "}" ]
method to swap elements in an array @param arr an array of Objects @param idx1 the index of the first element @param idx2 the index of the second element
[ "method", "to", "swap", "elements", "in", "an", "array" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L194-L199
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java
Indexer.getMetricIterators
public static Collection<IteratorSetting> getMetricIterators(AccumuloTable table) { """ Gets a collection of iterator settings that should be added to the metric table for the given Accumulo table. Don't forget! Please! @param table Table for retrieving metrics iterators, see AccumuloClient#getTable @return Collection of iterator settings """ String cardQualifier = new String(CARDINALITY_CQ); String rowsFamily = new String(METRICS_TABLE_ROWS_CF.array()); // Build a string for all columns where the summing combiner should be applied, // i.e. all indexed columns StringBuilder cardBuilder = new StringBuilder(rowsFamily + ":" + cardQualifier + ","); for (String s : getLocalityGroups(table).keySet()) { cardBuilder.append(s).append(":").append(cardQualifier).append(','); } cardBuilder.deleteCharAt(cardBuilder.length() - 1); // Configuration rows for the Min/Max combiners String firstRowColumn = rowsFamily + ":" + new String(METRICS_TABLE_FIRST_ROW_CQ.array()); String lastRowColumn = rowsFamily + ":" + new String(METRICS_TABLE_LAST_ROW_CQ.array()); // Summing combiner for cardinality columns IteratorSetting s1 = new IteratorSetting(1, SummingCombiner.class, ImmutableMap.of("columns", cardBuilder.toString(), "type", "STRING")); // Min/Max combiner for the first/last rows of the table IteratorSetting s2 = new IteratorSetting(2, MinByteArrayCombiner.class, ImmutableMap.of("columns", firstRowColumn)); IteratorSetting s3 = new IteratorSetting(3, MaxByteArrayCombiner.class, ImmutableMap.of("columns", lastRowColumn)); return ImmutableList.of(s1, s2, s3); }
java
public static Collection<IteratorSetting> getMetricIterators(AccumuloTable table) { String cardQualifier = new String(CARDINALITY_CQ); String rowsFamily = new String(METRICS_TABLE_ROWS_CF.array()); // Build a string for all columns where the summing combiner should be applied, // i.e. all indexed columns StringBuilder cardBuilder = new StringBuilder(rowsFamily + ":" + cardQualifier + ","); for (String s : getLocalityGroups(table).keySet()) { cardBuilder.append(s).append(":").append(cardQualifier).append(','); } cardBuilder.deleteCharAt(cardBuilder.length() - 1); // Configuration rows for the Min/Max combiners String firstRowColumn = rowsFamily + ":" + new String(METRICS_TABLE_FIRST_ROW_CQ.array()); String lastRowColumn = rowsFamily + ":" + new String(METRICS_TABLE_LAST_ROW_CQ.array()); // Summing combiner for cardinality columns IteratorSetting s1 = new IteratorSetting(1, SummingCombiner.class, ImmutableMap.of("columns", cardBuilder.toString(), "type", "STRING")); // Min/Max combiner for the first/last rows of the table IteratorSetting s2 = new IteratorSetting(2, MinByteArrayCombiner.class, ImmutableMap.of("columns", firstRowColumn)); IteratorSetting s3 = new IteratorSetting(3, MaxByteArrayCombiner.class, ImmutableMap.of("columns", lastRowColumn)); return ImmutableList.of(s1, s2, s3); }
[ "public", "static", "Collection", "<", "IteratorSetting", ">", "getMetricIterators", "(", "AccumuloTable", "table", ")", "{", "String", "cardQualifier", "=", "new", "String", "(", "CARDINALITY_CQ", ")", ";", "String", "rowsFamily", "=", "new", "String", "(", "METRICS_TABLE_ROWS_CF", ".", "array", "(", ")", ")", ";", "// Build a string for all columns where the summing combiner should be applied,", "// i.e. all indexed columns", "StringBuilder", "cardBuilder", "=", "new", "StringBuilder", "(", "rowsFamily", "+", "\":\"", "+", "cardQualifier", "+", "\",\"", ")", ";", "for", "(", "String", "s", ":", "getLocalityGroups", "(", "table", ")", ".", "keySet", "(", ")", ")", "{", "cardBuilder", ".", "append", "(", "s", ")", ".", "append", "(", "\":\"", ")", ".", "append", "(", "cardQualifier", ")", ".", "append", "(", "'", "'", ")", ";", "}", "cardBuilder", ".", "deleteCharAt", "(", "cardBuilder", ".", "length", "(", ")", "-", "1", ")", ";", "// Configuration rows for the Min/Max combiners", "String", "firstRowColumn", "=", "rowsFamily", "+", "\":\"", "+", "new", "String", "(", "METRICS_TABLE_FIRST_ROW_CQ", ".", "array", "(", ")", ")", ";", "String", "lastRowColumn", "=", "rowsFamily", "+", "\":\"", "+", "new", "String", "(", "METRICS_TABLE_LAST_ROW_CQ", ".", "array", "(", ")", ")", ";", "// Summing combiner for cardinality columns", "IteratorSetting", "s1", "=", "new", "IteratorSetting", "(", "1", ",", "SummingCombiner", ".", "class", ",", "ImmutableMap", ".", "of", "(", "\"columns\"", ",", "cardBuilder", ".", "toString", "(", ")", ",", "\"type\"", ",", "\"STRING\"", ")", ")", ";", "// Min/Max combiner for the first/last rows of the table", "IteratorSetting", "s2", "=", "new", "IteratorSetting", "(", "2", ",", "MinByteArrayCombiner", ".", "class", ",", "ImmutableMap", ".", "of", "(", "\"columns\"", ",", "firstRowColumn", ")", ")", ";", "IteratorSetting", "s3", "=", "new", "IteratorSetting", "(", "3", ",", "MaxByteArrayCombiner", ".", "class", ",", "ImmutableMap", ".", "of", "(", "\"columns\"", ",", "lastRowColumn", ")", ")", ";", "return", "ImmutableList", ".", "of", "(", "s1", ",", "s2", ",", "s3", ")", ";", "}" ]
Gets a collection of iterator settings that should be added to the metric table for the given Accumulo table. Don't forget! Please! @param table Table for retrieving metrics iterators, see AccumuloClient#getTable @return Collection of iterator settings
[ "Gets", "a", "collection", "of", "iterator", "settings", "that", "should", "be", "added", "to", "the", "metric", "table", "for", "the", "given", "Accumulo", "table", ".", "Don", "t", "forget!", "Please!" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/Indexer.java#L363-L388
Azure/azure-sdk-for-java
batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java
JobsInner.beginTerminate
public void beginTerminate(String resourceGroupName, String workspaceName, String experimentName, String jobName) { """ Terminates a job. @param resourceGroupName Name of the resource group to which the resource belongs. @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @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 """ beginTerminateWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobName).toBlocking().single().body(); }
java
public void beginTerminate(String resourceGroupName, String workspaceName, String experimentName, String jobName) { beginTerminateWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobName).toBlocking().single().body(); }
[ "public", "void", "beginTerminate", "(", "String", "resourceGroupName", ",", "String", "workspaceName", ",", "String", "experimentName", ",", "String", "jobName", ")", "{", "beginTerminateWithServiceResponseAsync", "(", "resourceGroupName", ",", "workspaceName", ",", "experimentName", ",", "jobName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Terminates a job. @param resourceGroupName Name of the resource group to which the resource belongs. @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long. @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
[ "Terminates", "a", "job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java#L1256-L1258
jenkinsci/jenkins
core/src/main/java/jenkins/model/ParameterizedJobMixIn.java
ParameterizedJobMixIn.scheduleBuild2
public static @CheckForNull Queue.Item scheduleBuild2(final Job<?,?> job, int quietPeriod, Action... actions) { """ Convenience method to schedule a build. Useful for {@link Trigger} implementations, for example. If you need to wait for the build to start (or finish), use {@link Queue.Item#getFuture}. @param job a job which might be schedulable @param quietPeriod seconds to wait before starting; use {@code -1} to use the job’s default settings @param actions various actions to associate with the scheduling, such as {@link ParametersAction} or {@link CauseAction} @return a newly created, or reused, queue item if the job could be scheduled; null if it was refused for some reason (e.g., some {@link Queue.QueueDecisionHandler} rejected it), or if {@code job} is not a {@link ParameterizedJob} or it is not {@link Job#isBuildable}) @since 1.621 """ if (!(job instanceof ParameterizedJob)) { return null; } return new ParameterizedJobMixIn() { @Override protected Job asJob() { return job; } }.scheduleBuild2(quietPeriod == -1 ? ((ParameterizedJob) job).getQuietPeriod() : quietPeriod, Arrays.asList(actions)); }
java
public static @CheckForNull Queue.Item scheduleBuild2(final Job<?,?> job, int quietPeriod, Action... actions) { if (!(job instanceof ParameterizedJob)) { return null; } return new ParameterizedJobMixIn() { @Override protected Job asJob() { return job; } }.scheduleBuild2(quietPeriod == -1 ? ((ParameterizedJob) job).getQuietPeriod() : quietPeriod, Arrays.asList(actions)); }
[ "public", "static", "@", "CheckForNull", "Queue", ".", "Item", "scheduleBuild2", "(", "final", "Job", "<", "?", ",", "?", ">", "job", ",", "int", "quietPeriod", ",", "Action", "...", "actions", ")", "{", "if", "(", "!", "(", "job", "instanceof", "ParameterizedJob", ")", ")", "{", "return", "null", ";", "}", "return", "new", "ParameterizedJobMixIn", "(", ")", "{", "@", "Override", "protected", "Job", "asJob", "(", ")", "{", "return", "job", ";", "}", "}", ".", "scheduleBuild2", "(", "quietPeriod", "==", "-", "1", "?", "(", "(", "ParameterizedJob", ")", "job", ")", ".", "getQuietPeriod", "(", ")", ":", "quietPeriod", ",", "Arrays", ".", "asList", "(", "actions", ")", ")", ";", "}" ]
Convenience method to schedule a build. Useful for {@link Trigger} implementations, for example. If you need to wait for the build to start (or finish), use {@link Queue.Item#getFuture}. @param job a job which might be schedulable @param quietPeriod seconds to wait before starting; use {@code -1} to use the job’s default settings @param actions various actions to associate with the scheduling, such as {@link ParametersAction} or {@link CauseAction} @return a newly created, or reused, queue item if the job could be scheduled; null if it was refused for some reason (e.g., some {@link Queue.QueueDecisionHandler} rejected it), or if {@code job} is not a {@link ParameterizedJob} or it is not {@link Job#isBuildable}) @since 1.621
[ "Convenience", "method", "to", "schedule", "a", "build", ".", "Useful", "for", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/ParameterizedJobMixIn.java#L137-L146
google/closure-compiler
src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java
FixedPointGraphTraversal.computeFixedPoint
public void computeFixedPoint(DiGraph<N, E> graph, Set<N> entrySet) { """ Compute a fixed point for the given graph, entering from the given nodes. @param graph The graph to traverse. @param entrySet The nodes to begin traversing from. """ int cycleCount = 0; long nodeCount = graph.getNodeCount(); // Choose a bail-out heuristically in case the computation // doesn't converge. long maxIterations = Math.max(nodeCount * nodeCount * nodeCount, 100); // Use a LinkedHashSet, so that the traversal is deterministic. LinkedHashSet<DiGraphNode<N, E>> workSet = new LinkedHashSet<>(); for (N n : entrySet) { workSet.add(graph.getDirectedGraphNode(n)); } for (; !workSet.isEmpty() && cycleCount < maxIterations; cycleCount++) { // For every out edge in the workSet, traverse that edge. If that // edge updates the state of the graph, then add the destination // node to the resultSet, so that we can update all of its out edges // on the next iteration. DiGraphNode<N, E> source = workSet.iterator().next(); N sourceValue = source.getValue(); workSet.remove(source); List<DiGraphEdge<N, E>> outEdges = source.getOutEdges(); for (DiGraphEdge<N, E> edge : outEdges) { N destNode = edge.getDestination().getValue(); if (callback.traverseEdge(sourceValue, edge.getValue(), destNode)) { workSet.add(edge.getDestination()); } } } checkState(cycleCount != maxIterations, NON_HALTING_ERROR_MSG); }
java
public void computeFixedPoint(DiGraph<N, E> graph, Set<N> entrySet) { int cycleCount = 0; long nodeCount = graph.getNodeCount(); // Choose a bail-out heuristically in case the computation // doesn't converge. long maxIterations = Math.max(nodeCount * nodeCount * nodeCount, 100); // Use a LinkedHashSet, so that the traversal is deterministic. LinkedHashSet<DiGraphNode<N, E>> workSet = new LinkedHashSet<>(); for (N n : entrySet) { workSet.add(graph.getDirectedGraphNode(n)); } for (; !workSet.isEmpty() && cycleCount < maxIterations; cycleCount++) { // For every out edge in the workSet, traverse that edge. If that // edge updates the state of the graph, then add the destination // node to the resultSet, so that we can update all of its out edges // on the next iteration. DiGraphNode<N, E> source = workSet.iterator().next(); N sourceValue = source.getValue(); workSet.remove(source); List<DiGraphEdge<N, E>> outEdges = source.getOutEdges(); for (DiGraphEdge<N, E> edge : outEdges) { N destNode = edge.getDestination().getValue(); if (callback.traverseEdge(sourceValue, edge.getValue(), destNode)) { workSet.add(edge.getDestination()); } } } checkState(cycleCount != maxIterations, NON_HALTING_ERROR_MSG); }
[ "public", "void", "computeFixedPoint", "(", "DiGraph", "<", "N", ",", "E", ">", "graph", ",", "Set", "<", "N", ">", "entrySet", ")", "{", "int", "cycleCount", "=", "0", ";", "long", "nodeCount", "=", "graph", ".", "getNodeCount", "(", ")", ";", "// Choose a bail-out heuristically in case the computation", "// doesn't converge.", "long", "maxIterations", "=", "Math", ".", "max", "(", "nodeCount", "*", "nodeCount", "*", "nodeCount", ",", "100", ")", ";", "// Use a LinkedHashSet, so that the traversal is deterministic.", "LinkedHashSet", "<", "DiGraphNode", "<", "N", ",", "E", ">", ">", "workSet", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "for", "(", "N", "n", ":", "entrySet", ")", "{", "workSet", ".", "add", "(", "graph", ".", "getDirectedGraphNode", "(", "n", ")", ")", ";", "}", "for", "(", ";", "!", "workSet", ".", "isEmpty", "(", ")", "&&", "cycleCount", "<", "maxIterations", ";", "cycleCount", "++", ")", "{", "// For every out edge in the workSet, traverse that edge. If that", "// edge updates the state of the graph, then add the destination", "// node to the resultSet, so that we can update all of its out edges", "// on the next iteration.", "DiGraphNode", "<", "N", ",", "E", ">", "source", "=", "workSet", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "N", "sourceValue", "=", "source", ".", "getValue", "(", ")", ";", "workSet", ".", "remove", "(", "source", ")", ";", "List", "<", "DiGraphEdge", "<", "N", ",", "E", ">", ">", "outEdges", "=", "source", ".", "getOutEdges", "(", ")", ";", "for", "(", "DiGraphEdge", "<", "N", ",", "E", ">", "edge", ":", "outEdges", ")", "{", "N", "destNode", "=", "edge", ".", "getDestination", "(", ")", ".", "getValue", "(", ")", ";", "if", "(", "callback", ".", "traverseEdge", "(", "sourceValue", ",", "edge", ".", "getValue", "(", ")", ",", "destNode", ")", ")", "{", "workSet", ".", "add", "(", "edge", ".", "getDestination", "(", ")", ")", ";", "}", "}", "}", "checkState", "(", "cycleCount", "!=", "maxIterations", ",", "NON_HALTING_ERROR_MSG", ")", ";", "}" ]
Compute a fixed point for the given graph, entering from the given nodes. @param graph The graph to traverse. @param entrySet The nodes to begin traversing from.
[ "Compute", "a", "fixed", "point", "for", "the", "given", "graph", "entering", "from", "the", "given", "nodes", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/FixedPointGraphTraversal.java#L91-L124
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/views/overlay/ClickableIconOverlay.java
ClickableIconOverlay.onLongPress
public boolean onLongPress(final MotionEvent event, final MapView mapView) { """ By default does nothing ({@code return false}). If you handled the Event, return {@code true} , otherwise return {@code false}. If you returned {@code true} none of the following Overlays or the underlying {@link MapView} has the chance to handle this event. """ boolean touched = hitTest(event, mapView); if (touched) { return onMarkerLongPress(mapView, mId, mPosition, mData); } else { return super.onLongPress(event, mapView); } }
java
public boolean onLongPress(final MotionEvent event, final MapView mapView) { boolean touched = hitTest(event, mapView); if (touched) { return onMarkerLongPress(mapView, mId, mPosition, mData); } else { return super.onLongPress(event, mapView); } }
[ "public", "boolean", "onLongPress", "(", "final", "MotionEvent", "event", ",", "final", "MapView", "mapView", ")", "{", "boolean", "touched", "=", "hitTest", "(", "event", ",", "mapView", ")", ";", "if", "(", "touched", ")", "{", "return", "onMarkerLongPress", "(", "mapView", ",", "mId", ",", "mPosition", ",", "mData", ")", ";", "}", "else", "{", "return", "super", ".", "onLongPress", "(", "event", ",", "mapView", ")", ";", "}", "}" ]
By default does nothing ({@code return false}). If you handled the Event, return {@code true} , otherwise return {@code false}. If you returned {@code true} none of the following Overlays or the underlying {@link MapView} has the chance to handle this event.
[ "By", "default", "does", "nothing", "(", "{" ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/ClickableIconOverlay.java#L87-L94
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/pom/PomUtils.java
PomUtils.analyzePOM
public static void analyzePOM(Dependency dependency, File pomFile) throws AnalysisException { """ Reads in the pom file and adds elements as evidence to the given dependency. @param dependency the dependency being analyzed @param pomFile the pom file to read @throws AnalysisException is thrown if there is an exception parsing the pom """ final Model pom = PomUtils.readPom(pomFile); JarAnalyzer.setPomEvidence(dependency, pom, null, true); }
java
public static void analyzePOM(Dependency dependency, File pomFile) throws AnalysisException { final Model pom = PomUtils.readPom(pomFile); JarAnalyzer.setPomEvidence(dependency, pom, null, true); }
[ "public", "static", "void", "analyzePOM", "(", "Dependency", "dependency", ",", "File", "pomFile", ")", "throws", "AnalysisException", "{", "final", "Model", "pom", "=", "PomUtils", ".", "readPom", "(", "pomFile", ")", ";", "JarAnalyzer", ".", "setPomEvidence", "(", "dependency", ",", "pom", ",", "null", ",", "true", ")", ";", "}" ]
Reads in the pom file and adds elements as evidence to the given dependency. @param dependency the dependency being analyzed @param pomFile the pom file to read @throws AnalysisException is thrown if there is an exception parsing the pom
[ "Reads", "in", "the", "pom", "file", "and", "adds", "elements", "as", "evidence", "to", "the", "given", "dependency", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/pom/PomUtils.java#L139-L142
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java
Duration.minus
public Duration minus(Duration duration) { """ Returns a copy of this duration with the specified duration subtracted. <p> This instance is immutable and unaffected by this method call. @param duration the duration to subtract, positive or negative, not null @return a {@code Duration} based on this duration with the specified duration subtracted, not null @throws ArithmeticException if numeric overflow occurs """ long secsToSubtract = duration.getSeconds(); int nanosToSubtract = duration.getNano(); if (secsToSubtract == Long.MIN_VALUE) { return plus(Long.MAX_VALUE, -nanosToSubtract).plus(1, 0); } return plus(-secsToSubtract, -nanosToSubtract); }
java
public Duration minus(Duration duration) { long secsToSubtract = duration.getSeconds(); int nanosToSubtract = duration.getNano(); if (secsToSubtract == Long.MIN_VALUE) { return plus(Long.MAX_VALUE, -nanosToSubtract).plus(1, 0); } return plus(-secsToSubtract, -nanosToSubtract); }
[ "public", "Duration", "minus", "(", "Duration", "duration", ")", "{", "long", "secsToSubtract", "=", "duration", ".", "getSeconds", "(", ")", ";", "int", "nanosToSubtract", "=", "duration", ".", "getNano", "(", ")", ";", "if", "(", "secsToSubtract", "==", "Long", ".", "MIN_VALUE", ")", "{", "return", "plus", "(", "Long", ".", "MAX_VALUE", ",", "-", "nanosToSubtract", ")", ".", "plus", "(", "1", ",", "0", ")", ";", "}", "return", "plus", "(", "-", "secsToSubtract", ",", "-", "nanosToSubtract", ")", ";", "}" ]
Returns a copy of this duration with the specified duration subtracted. <p> This instance is immutable and unaffected by this method call. @param duration the duration to subtract, positive or negative, not null @return a {@code Duration} based on this duration with the specified duration subtracted, not null @throws ArithmeticException if numeric overflow occurs
[ "Returns", "a", "copy", "of", "this", "duration", "with", "the", "specified", "duration", "subtracted", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Duration.java#L826-L833
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/table/TableSliceGroup.java
TableSliceGroup.aggregate
@SuppressWarnings( { """ Applies the given aggregations to the given columns. The apply and combine steps of a split-apply-combine. @param functions map from column name to aggregation to apply on that function """ "unchecked", "rawtypes" }) public Table aggregate(ListMultimap<String, AggregateFunction<?,?>> functions) { Preconditions.checkArgument(!getSlices().isEmpty()); Table groupTable = summaryTableName(sourceTable); StringColumn groupColumn = StringColumn.create("Group"); groupTable.addColumns(groupColumn); for (Map.Entry<String, Collection<AggregateFunction<?,?>>> entry : functions.asMap().entrySet()) { String columnName = entry.getKey(); int functionCount = 0; for (AggregateFunction function : entry.getValue()) { String colName = aggregateColumnName(columnName, function.functionName()); ColumnType type = function.returnType(); Column resultColumn = type.create(colName); for (TableSlice subTable : getSlices()) { Object result = function.summarize(subTable.column(columnName)); if (functionCount == 0) { groupColumn.append(subTable.name()); } if (result instanceof Number) { Number number = (Number) result; resultColumn.append(number.doubleValue()); } else { resultColumn.append(result); } } groupTable.addColumns(resultColumn); functionCount++; } } return splitGroupingColumn(groupTable); }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public Table aggregate(ListMultimap<String, AggregateFunction<?,?>> functions) { Preconditions.checkArgument(!getSlices().isEmpty()); Table groupTable = summaryTableName(sourceTable); StringColumn groupColumn = StringColumn.create("Group"); groupTable.addColumns(groupColumn); for (Map.Entry<String, Collection<AggregateFunction<?,?>>> entry : functions.asMap().entrySet()) { String columnName = entry.getKey(); int functionCount = 0; for (AggregateFunction function : entry.getValue()) { String colName = aggregateColumnName(columnName, function.functionName()); ColumnType type = function.returnType(); Column resultColumn = type.create(colName); for (TableSlice subTable : getSlices()) { Object result = function.summarize(subTable.column(columnName)); if (functionCount == 0) { groupColumn.append(subTable.name()); } if (result instanceof Number) { Number number = (Number) result; resultColumn.append(number.doubleValue()); } else { resultColumn.append(result); } } groupTable.addColumns(resultColumn); functionCount++; } } return splitGroupingColumn(groupTable); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "Table", "aggregate", "(", "ListMultimap", "<", "String", ",", "AggregateFunction", "<", "?", ",", "?", ">", ">", "functions", ")", "{", "Preconditions", ".", "checkArgument", "(", "!", "getSlices", "(", ")", ".", "isEmpty", "(", ")", ")", ";", "Table", "groupTable", "=", "summaryTableName", "(", "sourceTable", ")", ";", "StringColumn", "groupColumn", "=", "StringColumn", ".", "create", "(", "\"Group\"", ")", ";", "groupTable", ".", "addColumns", "(", "groupColumn", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Collection", "<", "AggregateFunction", "<", "?", ",", "?", ">", ">", ">", "entry", ":", "functions", ".", "asMap", "(", ")", ".", "entrySet", "(", ")", ")", "{", "String", "columnName", "=", "entry", ".", "getKey", "(", ")", ";", "int", "functionCount", "=", "0", ";", "for", "(", "AggregateFunction", "function", ":", "entry", ".", "getValue", "(", ")", ")", "{", "String", "colName", "=", "aggregateColumnName", "(", "columnName", ",", "function", ".", "functionName", "(", ")", ")", ";", "ColumnType", "type", "=", "function", ".", "returnType", "(", ")", ";", "Column", "resultColumn", "=", "type", ".", "create", "(", "colName", ")", ";", "for", "(", "TableSlice", "subTable", ":", "getSlices", "(", ")", ")", "{", "Object", "result", "=", "function", ".", "summarize", "(", "subTable", ".", "column", "(", "columnName", ")", ")", ";", "if", "(", "functionCount", "==", "0", ")", "{", "groupColumn", ".", "append", "(", "subTable", ".", "name", "(", ")", ")", ";", "}", "if", "(", "result", "instanceof", "Number", ")", "{", "Number", "number", "=", "(", "Number", ")", "result", ";", "resultColumn", ".", "append", "(", "number", ".", "doubleValue", "(", ")", ")", ";", "}", "else", "{", "resultColumn", ".", "append", "(", "result", ")", ";", "}", "}", "groupTable", ".", "addColumns", "(", "resultColumn", ")", ";", "functionCount", "++", ";", "}", "}", "return", "splitGroupingColumn", "(", "groupTable", ")", ";", "}" ]
Applies the given aggregations to the given columns. The apply and combine steps of a split-apply-combine. @param functions map from column name to aggregation to apply on that function
[ "Applies", "the", "given", "aggregations", "to", "the", "given", "columns", ".", "The", "apply", "and", "combine", "steps", "of", "a", "split", "-", "apply", "-", "combine", "." ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/table/TableSliceGroup.java#L150-L180
VoltDB/voltdb
src/frontend/org/voltcore/messaging/SocketJoiner.java
SocketJoiner.initializeSocket
private SslHandshakeResult initializeSocket(SocketChannel sc, boolean clientMode, List<Long> clockSkews) throws IOException { """ Initialize a new {@link SocketChannel} either as a client or server @return {@link SslHandshakeResult} instance. Never {@code null} """ ByteBuffer timeBuffer = ByteBuffer.allocate(Long.BYTES); if (clientMode) { synchronized (sc.blockingLock()) { boolean isBlocking = sc.isBlocking(); // Just being lazy and using blocking mode here to get the server's current timestamp sc.configureBlocking(true); do { sc.read(timeBuffer); } while (timeBuffer.hasRemaining()); sc.configureBlocking(isBlocking); } if (clockSkews != null) { clockSkews.add(System.currentTimeMillis() - ((ByteBuffer) timeBuffer.flip()).getLong()); } } else { timeBuffer.putLong(System.currentTimeMillis()); timeBuffer.flip(); do { sc.write(timeBuffer); } while (timeBuffer.hasRemaining()); } return setupSSLIfNeeded(sc, clientMode); }
java
private SslHandshakeResult initializeSocket(SocketChannel sc, boolean clientMode, List<Long> clockSkews) throws IOException { ByteBuffer timeBuffer = ByteBuffer.allocate(Long.BYTES); if (clientMode) { synchronized (sc.blockingLock()) { boolean isBlocking = sc.isBlocking(); // Just being lazy and using blocking mode here to get the server's current timestamp sc.configureBlocking(true); do { sc.read(timeBuffer); } while (timeBuffer.hasRemaining()); sc.configureBlocking(isBlocking); } if (clockSkews != null) { clockSkews.add(System.currentTimeMillis() - ((ByteBuffer) timeBuffer.flip()).getLong()); } } else { timeBuffer.putLong(System.currentTimeMillis()); timeBuffer.flip(); do { sc.write(timeBuffer); } while (timeBuffer.hasRemaining()); } return setupSSLIfNeeded(sc, clientMode); }
[ "private", "SslHandshakeResult", "initializeSocket", "(", "SocketChannel", "sc", ",", "boolean", "clientMode", ",", "List", "<", "Long", ">", "clockSkews", ")", "throws", "IOException", "{", "ByteBuffer", "timeBuffer", "=", "ByteBuffer", ".", "allocate", "(", "Long", ".", "BYTES", ")", ";", "if", "(", "clientMode", ")", "{", "synchronized", "(", "sc", ".", "blockingLock", "(", ")", ")", "{", "boolean", "isBlocking", "=", "sc", ".", "isBlocking", "(", ")", ";", "// Just being lazy and using blocking mode here to get the server's current timestamp", "sc", ".", "configureBlocking", "(", "true", ")", ";", "do", "{", "sc", ".", "read", "(", "timeBuffer", ")", ";", "}", "while", "(", "timeBuffer", ".", "hasRemaining", "(", ")", ")", ";", "sc", ".", "configureBlocking", "(", "isBlocking", ")", ";", "}", "if", "(", "clockSkews", "!=", "null", ")", "{", "clockSkews", ".", "add", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "(", "(", "ByteBuffer", ")", "timeBuffer", ".", "flip", "(", ")", ")", ".", "getLong", "(", ")", ")", ";", "}", "}", "else", "{", "timeBuffer", ".", "putLong", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";", "timeBuffer", ".", "flip", "(", ")", ";", "do", "{", "sc", ".", "write", "(", "timeBuffer", ")", ";", "}", "while", "(", "timeBuffer", ".", "hasRemaining", "(", ")", ")", ";", "}", "return", "setupSSLIfNeeded", "(", "sc", ",", "clientMode", ")", ";", "}" ]
Initialize a new {@link SocketChannel} either as a client or server @return {@link SslHandshakeResult} instance. Never {@code null}
[ "Initialize", "a", "new", "{", "@link", "SocketChannel", "}", "either", "as", "a", "client", "or", "server" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/messaging/SocketJoiner.java#L440-L464
recommenders/rival
rival-examples/src/main/java/net/recommenders/rival/examples/movielens100k/IterativeCrossValidatedMahoutKNNRecommenderEvaluator.java
IterativeCrossValidatedMahoutKNNRecommenderEvaluator.prepareSplits
public static void prepareSplits(final String url, final int nFolds, final String inFile, final String folder, final String outPath) { """ Downloads a dataset and stores the splits generated from it. @param url url where dataset can be downloaded from @param nFolds number of folds @param inFile file to be used once the dataset has been downloaded @param folder folder where dataset will be stored @param outPath path where the splits will be stored """ DataDownloader dd = new DataDownloader(url, folder); dd.downloadAndUnzip(); boolean perUser = true; long seed = SEED; Parser<Long, Long> parser = new MovielensParser(); DataModelIF<Long, Long> data = null; try { data = parser.parseData(new File(inFile)); } catch (IOException e) { e.printStackTrace(); } new IterativeCrossValidationSplitter<Long, Long>(nFolds, perUser, seed, outPath).split(data); File dir = new File(outPath); if (!dir.exists()) { if (!dir.mkdir()) { System.err.println("Directory " + dir + " could not be created"); return; } } }
java
public static void prepareSplits(final String url, final int nFolds, final String inFile, final String folder, final String outPath) { DataDownloader dd = new DataDownloader(url, folder); dd.downloadAndUnzip(); boolean perUser = true; long seed = SEED; Parser<Long, Long> parser = new MovielensParser(); DataModelIF<Long, Long> data = null; try { data = parser.parseData(new File(inFile)); } catch (IOException e) { e.printStackTrace(); } new IterativeCrossValidationSplitter<Long, Long>(nFolds, perUser, seed, outPath).split(data); File dir = new File(outPath); if (!dir.exists()) { if (!dir.mkdir()) { System.err.println("Directory " + dir + " could not be created"); return; } } }
[ "public", "static", "void", "prepareSplits", "(", "final", "String", "url", ",", "final", "int", "nFolds", ",", "final", "String", "inFile", ",", "final", "String", "folder", ",", "final", "String", "outPath", ")", "{", "DataDownloader", "dd", "=", "new", "DataDownloader", "(", "url", ",", "folder", ")", ";", "dd", ".", "downloadAndUnzip", "(", ")", ";", "boolean", "perUser", "=", "true", ";", "long", "seed", "=", "SEED", ";", "Parser", "<", "Long", ",", "Long", ">", "parser", "=", "new", "MovielensParser", "(", ")", ";", "DataModelIF", "<", "Long", ",", "Long", ">", "data", "=", "null", ";", "try", "{", "data", "=", "parser", ".", "parseData", "(", "new", "File", "(", "inFile", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "new", "IterativeCrossValidationSplitter", "<", "Long", ",", "Long", ">", "(", "nFolds", ",", "perUser", ",", "seed", ",", "outPath", ")", ".", "split", "(", "data", ")", ";", "File", "dir", "=", "new", "File", "(", "outPath", ")", ";", "if", "(", "!", "dir", ".", "exists", "(", ")", ")", "{", "if", "(", "!", "dir", ".", "mkdir", "(", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"Directory \"", "+", "dir", "+", "\" could not be created\"", ")", ";", "return", ";", "}", "}", "}" ]
Downloads a dataset and stores the splits generated from it. @param url url where dataset can be downloaded from @param nFolds number of folds @param inFile file to be used once the dataset has been downloaded @param folder folder where dataset will be stored @param outPath path where the splits will be stored
[ "Downloads", "a", "dataset", "and", "stores", "the", "splits", "generated", "from", "it", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-examples/src/main/java/net/recommenders/rival/examples/movielens100k/IterativeCrossValidatedMahoutKNNRecommenderEvaluator.java#L117-L141
Activiti/Activiti
activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/ExecutionEntityManagerImpl.java
ExecutionEntityManagerImpl.createChildExecution
@Override public ExecutionEntity createChildExecution(ExecutionEntity parentExecutionEntity) { """ Creates a new execution. properties processDefinition, processInstance and activity will be initialized. """ ExecutionEntity childExecution = executionDataManager.create(); inheritCommonProperties(parentExecutionEntity, childExecution); childExecution.setParent(parentExecutionEntity); childExecution.setProcessDefinitionId(parentExecutionEntity.getProcessDefinitionId()); childExecution.setProcessDefinitionKey(parentExecutionEntity.getProcessDefinitionKey()); childExecution.setProcessInstanceId(parentExecutionEntity.getProcessInstanceId() != null ? parentExecutionEntity.getProcessInstanceId() : parentExecutionEntity.getId()); childExecution.setParentProcessInstanceId(parentExecutionEntity.getParentProcessInstanceId()); childExecution.setScope(false); // manage the bidirectional parent-child relation parentExecutionEntity.addChildExecution(childExecution); // Insert the child execution insert(childExecution, false); if (logger.isDebugEnabled()) { logger.debug("Child execution {} created with parent {}", childExecution, parentExecutionEntity.getId()); } if (getEventDispatcher().isEnabled()) { getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_CREATED, childExecution)); getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_INITIALIZED, childExecution)); } return childExecution; }
java
@Override public ExecutionEntity createChildExecution(ExecutionEntity parentExecutionEntity) { ExecutionEntity childExecution = executionDataManager.create(); inheritCommonProperties(parentExecutionEntity, childExecution); childExecution.setParent(parentExecutionEntity); childExecution.setProcessDefinitionId(parentExecutionEntity.getProcessDefinitionId()); childExecution.setProcessDefinitionKey(parentExecutionEntity.getProcessDefinitionKey()); childExecution.setProcessInstanceId(parentExecutionEntity.getProcessInstanceId() != null ? parentExecutionEntity.getProcessInstanceId() : parentExecutionEntity.getId()); childExecution.setParentProcessInstanceId(parentExecutionEntity.getParentProcessInstanceId()); childExecution.setScope(false); // manage the bidirectional parent-child relation parentExecutionEntity.addChildExecution(childExecution); // Insert the child execution insert(childExecution, false); if (logger.isDebugEnabled()) { logger.debug("Child execution {} created with parent {}", childExecution, parentExecutionEntity.getId()); } if (getEventDispatcher().isEnabled()) { getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_CREATED, childExecution)); getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_INITIALIZED, childExecution)); } return childExecution; }
[ "@", "Override", "public", "ExecutionEntity", "createChildExecution", "(", "ExecutionEntity", "parentExecutionEntity", ")", "{", "ExecutionEntity", "childExecution", "=", "executionDataManager", ".", "create", "(", ")", ";", "inheritCommonProperties", "(", "parentExecutionEntity", ",", "childExecution", ")", ";", "childExecution", ".", "setParent", "(", "parentExecutionEntity", ")", ";", "childExecution", ".", "setProcessDefinitionId", "(", "parentExecutionEntity", ".", "getProcessDefinitionId", "(", ")", ")", ";", "childExecution", ".", "setProcessDefinitionKey", "(", "parentExecutionEntity", ".", "getProcessDefinitionKey", "(", ")", ")", ";", "childExecution", ".", "setProcessInstanceId", "(", "parentExecutionEntity", ".", "getProcessInstanceId", "(", ")", "!=", "null", "?", "parentExecutionEntity", ".", "getProcessInstanceId", "(", ")", ":", "parentExecutionEntity", ".", "getId", "(", ")", ")", ";", "childExecution", ".", "setParentProcessInstanceId", "(", "parentExecutionEntity", ".", "getParentProcessInstanceId", "(", ")", ")", ";", "childExecution", ".", "setScope", "(", "false", ")", ";", "// manage the bidirectional parent-child relation", "parentExecutionEntity", ".", "addChildExecution", "(", "childExecution", ")", ";", "// Insert the child execution", "insert", "(", "childExecution", ",", "false", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"Child execution {} created with parent {}\"", ",", "childExecution", ",", "parentExecutionEntity", ".", "getId", "(", ")", ")", ";", "}", "if", "(", "getEventDispatcher", "(", ")", ".", "isEnabled", "(", ")", ")", "{", "getEventDispatcher", "(", ")", ".", "dispatchEvent", "(", "ActivitiEventBuilder", ".", "createEntityEvent", "(", "ActivitiEventType", ".", "ENTITY_CREATED", ",", "childExecution", ")", ")", ";", "getEventDispatcher", "(", ")", ".", "dispatchEvent", "(", "ActivitiEventBuilder", ".", "createEntityEvent", "(", "ActivitiEventType", ".", "ENTITY_INITIALIZED", ",", "childExecution", ")", ")", ";", "}", "return", "childExecution", ";", "}" ]
Creates a new execution. properties processDefinition, processInstance and activity will be initialized.
[ "Creates", "a", "new", "execution", ".", "properties", "processDefinition", "processInstance", "and", "activity", "will", "be", "initialized", "." ]
train
https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/persistence/entity/ExecutionEntityManagerImpl.java#L258-L286
crawljax/crawljax
core/src/main/java/com/crawljax/util/UrlUtils.java
UrlUtils.getVarFromQueryString
public static String getVarFromQueryString(String varName, String haystack) { """ Retrieve the var value for varName from a HTTP query string (format is "var1=val1&amp;var2=val2"). @param varName the name. @param haystack the haystack. @return variable value for varName """ if (haystack == null || haystack.length() == 0) { return null; } String modifiedHaystack = haystack; if (modifiedHaystack.charAt(0) == '?') { modifiedHaystack = modifiedHaystack.substring(1); } String[] vars = modifiedHaystack.split("&"); for (String var : vars) { String[] tuple = var.split("="); if (tuple.length == 2 && tuple[0].equals(varName)) { return tuple[1]; } } return null; }
java
public static String getVarFromQueryString(String varName, String haystack) { if (haystack == null || haystack.length() == 0) { return null; } String modifiedHaystack = haystack; if (modifiedHaystack.charAt(0) == '?') { modifiedHaystack = modifiedHaystack.substring(1); } String[] vars = modifiedHaystack.split("&"); for (String var : vars) { String[] tuple = var.split("="); if (tuple.length == 2 && tuple[0].equals(varName)) { return tuple[1]; } } return null; }
[ "public", "static", "String", "getVarFromQueryString", "(", "String", "varName", ",", "String", "haystack", ")", "{", "if", "(", "haystack", "==", "null", "||", "haystack", ".", "length", "(", ")", "==", "0", ")", "{", "return", "null", ";", "}", "String", "modifiedHaystack", "=", "haystack", ";", "if", "(", "modifiedHaystack", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "modifiedHaystack", "=", "modifiedHaystack", ".", "substring", "(", "1", ")", ";", "}", "String", "[", "]", "vars", "=", "modifiedHaystack", ".", "split", "(", "\"&\"", ")", ";", "for", "(", "String", "var", ":", "vars", ")", "{", "String", "[", "]", "tuple", "=", "var", ".", "split", "(", "\"=\"", ")", ";", "if", "(", "tuple", ".", "length", "==", "2", "&&", "tuple", "[", "0", "]", ".", "equals", "(", "varName", ")", ")", "{", "return", "tuple", "[", "1", "]", ";", "}", "}", "return", "null", ";", "}" ]
Retrieve the var value for varName from a HTTP query string (format is "var1=val1&amp;var2=val2"). @param varName the name. @param haystack the haystack. @return variable value for varName
[ "Retrieve", "the", "var", "value", "for", "varName", "from", "a", "HTTP", "query", "string", "(", "format", "is", "var1", "=", "val1&amp", ";", "var2", "=", "val2", ")", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/util/UrlUtils.java#L58-L77
auth0/auth0-java
src/main/java/com/auth0/client/auth/AuthorizeUrlBuilder.java
AuthorizeUrlBuilder.withParameter
public AuthorizeUrlBuilder withParameter(String name, String value) { """ Sets an additional parameter. @param name name of the parameter @param value value of the parameter to set @return the builder instance """ assertNotNull(name, "name"); assertNotNull(value, "value"); parameters.put(name, value); return this; }
java
public AuthorizeUrlBuilder withParameter(String name, String value) { assertNotNull(name, "name"); assertNotNull(value, "value"); parameters.put(name, value); return this; }
[ "public", "AuthorizeUrlBuilder", "withParameter", "(", "String", "name", ",", "String", "value", ")", "{", "assertNotNull", "(", "name", ",", "\"name\"", ")", ";", "assertNotNull", "(", "value", ",", "\"value\"", ")", ";", "parameters", ".", "put", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Sets an additional parameter. @param name name of the parameter @param value value of the parameter to set @return the builder instance
[ "Sets", "an", "additional", "parameter", "." ]
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/auth/AuthorizeUrlBuilder.java#L111-L116
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionRangeConfig.java
CollisionRangeConfig.exports
public static void exports(Xml root, CollisionRange range) { """ Export the collision range as a node. @param root The node root (must not be <code>null</code>). @param range The collision range to export (must not be <code>null</code>). @throws LionEngineException If error on writing. """ Check.notNull(root); Check.notNull(range); final Xml node = root.createChild(NODE_RANGE); node.writeString(ATT_AXIS, range.getOutput().name()); node.writeInteger(ATT_MIN_X, range.getMinX()); node.writeInteger(ATT_MIN_Y, range.getMinY()); node.writeInteger(ATT_MAX_X, range.getMaxX()); node.writeInteger(ATT_MAX_Y, range.getMaxY()); }
java
public static void exports(Xml root, CollisionRange range) { Check.notNull(root); Check.notNull(range); final Xml node = root.createChild(NODE_RANGE); node.writeString(ATT_AXIS, range.getOutput().name()); node.writeInteger(ATT_MIN_X, range.getMinX()); node.writeInteger(ATT_MIN_Y, range.getMinY()); node.writeInteger(ATT_MAX_X, range.getMaxX()); node.writeInteger(ATT_MAX_Y, range.getMaxY()); }
[ "public", "static", "void", "exports", "(", "Xml", "root", ",", "CollisionRange", "range", ")", "{", "Check", ".", "notNull", "(", "root", ")", ";", "Check", ".", "notNull", "(", "range", ")", ";", "final", "Xml", "node", "=", "root", ".", "createChild", "(", "NODE_RANGE", ")", ";", "node", ".", "writeString", "(", "ATT_AXIS", ",", "range", ".", "getOutput", "(", ")", ".", "name", "(", ")", ")", ";", "node", ".", "writeInteger", "(", "ATT_MIN_X", ",", "range", ".", "getMinX", "(", ")", ")", ";", "node", ".", "writeInteger", "(", "ATT_MIN_Y", ",", "range", ".", "getMinY", "(", ")", ")", ";", "node", ".", "writeInteger", "(", "ATT_MAX_X", ",", "range", ".", "getMaxX", "(", ")", ")", ";", "node", ".", "writeInteger", "(", "ATT_MAX_Y", ",", "range", ".", "getMaxY", "(", ")", ")", ";", "}" ]
Export the collision range as a node. @param root The node root (must not be <code>null</code>). @param range The collision range to export (must not be <code>null</code>). @throws LionEngineException If error on writing.
[ "Export", "the", "collision", "range", "as", "a", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionRangeConfig.java#L86-L97
StripesFramework/stripes-stuff
src/main/java/org/stripesstuff/plugin/security/J2EESecurityManager.java
J2EESecurityManager.isUserAuthenticated
protected Boolean isUserAuthenticated(ActionBean bean, Method handler) { """ Determine if the user is authenticated. The default implementation is to use {@code getUserPrincipal() != null} on the HttpServletRequest in the ActionBeanContext. @param bean the current action bean; used for security decisions @param handler the current event handler; used for security decisions @return {@link Boolean#TRUE TRUE} if the user is authenticated, {@link Boolean#FALSE FALSE} if not, and {@code null} if undecided """ return bean.getContext().getRequest().getUserPrincipal() != null; }
java
protected Boolean isUserAuthenticated(ActionBean bean, Method handler) { return bean.getContext().getRequest().getUserPrincipal() != null; }
[ "protected", "Boolean", "isUserAuthenticated", "(", "ActionBean", "bean", ",", "Method", "handler", ")", "{", "return", "bean", ".", "getContext", "(", ")", ".", "getRequest", "(", ")", ".", "getUserPrincipal", "(", ")", "!=", "null", ";", "}" ]
Determine if the user is authenticated. The default implementation is to use {@code getUserPrincipal() != null} on the HttpServletRequest in the ActionBeanContext. @param bean the current action bean; used for security decisions @param handler the current event handler; used for security decisions @return {@link Boolean#TRUE TRUE} if the user is authenticated, {@link Boolean#FALSE FALSE} if not, and {@code null} if undecided
[ "Determine", "if", "the", "user", "is", "authenticated", ".", "The", "default", "implementation", "is", "to", "use", "{", "@code", "getUserPrincipal", "()", "!", "=", "null", "}", "on", "the", "HttpServletRequest", "in", "the", "ActionBeanContext", "." ]
train
https://github.com/StripesFramework/stripes-stuff/blob/51ad92b4bd5862ba34d7c18c5829fb00ea3a3811/src/main/java/org/stripesstuff/plugin/security/J2EESecurityManager.java#L149-L152
icode/ameba
src/main/java/ameba/db/ebean/support/ModelResourceStructure.java
ModelResourceStructure.findByIds
public Response findByIds(@NotNull @PathParam("ids") URI_ID id, @NotNull @PathParam("ids") final PathSegment ids, @QueryParam("include_deleted") final boolean includeDeleted) throws Exception { """ Find a model or model list given its Ids. @param id The id use for path matching type @param ids the id of the model. @param includeDeleted a boolean. @return a {@link javax.ws.rs.core.Response} object. @throws java.lang.Exception if any. @see javax.ws.rs.GET @see AbstractModelResource#findByIds """ final Query<MODEL> query = server.find(modelType); final MODEL_ID firstId = tryConvertId(ids.getPath()); Set<String> idSet = ids.getMatrixParameters().keySet(); final Set<MODEL_ID> idCollection = Sets.newLinkedHashSet(); idCollection.add(firstId); if (!idSet.isEmpty()) { idCollection.addAll(Collections2.transform(idSet, this::tryConvertId)); } matchedFindByIds(firstId, idCollection, includeDeleted); Object model; if (includeDeleted) { query.setIncludeSoftDeletes(); } final TxRunnable configureQuery = t -> { configDefaultQuery(query); configFindByIdsQuery(query, includeDeleted); applyUriQuery(query, false); }; if (!idSet.isEmpty()) { model = executeTx(t -> { configureQuery.run(t); List<MODEL> m = query.where().idIn(idCollection.toArray()).findList(); return processFoundByIdsModelList(m, includeDeleted); }); } else { model = executeTx(t -> { configureQuery.run(t); MODEL m = query.setId(firstId).findOne(); return processFoundByIdModel(m, includeDeleted); }); } if (isEmptyEntity(model)) { throw new NotFoundException(); } return Response.ok(model).build(); }
java
public Response findByIds(@NotNull @PathParam("ids") URI_ID id, @NotNull @PathParam("ids") final PathSegment ids, @QueryParam("include_deleted") final boolean includeDeleted) throws Exception { final Query<MODEL> query = server.find(modelType); final MODEL_ID firstId = tryConvertId(ids.getPath()); Set<String> idSet = ids.getMatrixParameters().keySet(); final Set<MODEL_ID> idCollection = Sets.newLinkedHashSet(); idCollection.add(firstId); if (!idSet.isEmpty()) { idCollection.addAll(Collections2.transform(idSet, this::tryConvertId)); } matchedFindByIds(firstId, idCollection, includeDeleted); Object model; if (includeDeleted) { query.setIncludeSoftDeletes(); } final TxRunnable configureQuery = t -> { configDefaultQuery(query); configFindByIdsQuery(query, includeDeleted); applyUriQuery(query, false); }; if (!idSet.isEmpty()) { model = executeTx(t -> { configureQuery.run(t); List<MODEL> m = query.where().idIn(idCollection.toArray()).findList(); return processFoundByIdsModelList(m, includeDeleted); }); } else { model = executeTx(t -> { configureQuery.run(t); MODEL m = query.setId(firstId).findOne(); return processFoundByIdModel(m, includeDeleted); }); } if (isEmptyEntity(model)) { throw new NotFoundException(); } return Response.ok(model).build(); }
[ "public", "Response", "findByIds", "(", "@", "NotNull", "@", "PathParam", "(", "\"ids\"", ")", "URI_ID", "id", ",", "@", "NotNull", "@", "PathParam", "(", "\"ids\"", ")", "final", "PathSegment", "ids", ",", "@", "QueryParam", "(", "\"include_deleted\"", ")", "final", "boolean", "includeDeleted", ")", "throws", "Exception", "{", "final", "Query", "<", "MODEL", ">", "query", "=", "server", ".", "find", "(", "modelType", ")", ";", "final", "MODEL_ID", "firstId", "=", "tryConvertId", "(", "ids", ".", "getPath", "(", ")", ")", ";", "Set", "<", "String", ">", "idSet", "=", "ids", ".", "getMatrixParameters", "(", ")", ".", "keySet", "(", ")", ";", "final", "Set", "<", "MODEL_ID", ">", "idCollection", "=", "Sets", ".", "newLinkedHashSet", "(", ")", ";", "idCollection", ".", "add", "(", "firstId", ")", ";", "if", "(", "!", "idSet", ".", "isEmpty", "(", ")", ")", "{", "idCollection", ".", "addAll", "(", "Collections2", ".", "transform", "(", "idSet", ",", "this", "::", "tryConvertId", ")", ")", ";", "}", "matchedFindByIds", "(", "firstId", ",", "idCollection", ",", "includeDeleted", ")", ";", "Object", "model", ";", "if", "(", "includeDeleted", ")", "{", "query", ".", "setIncludeSoftDeletes", "(", ")", ";", "}", "final", "TxRunnable", "configureQuery", "=", "t", "->", "{", "configDefaultQuery", "(", "query", ")", ";", "configFindByIdsQuery", "(", "query", ",", "includeDeleted", ")", ";", "applyUriQuery", "(", "query", ",", "false", ")", ";", "}", ";", "if", "(", "!", "idSet", ".", "isEmpty", "(", ")", ")", "{", "model", "=", "executeTx", "(", "t", "->", "{", "configureQuery", ".", "run", "(", "t", ")", ";", "List", "<", "MODEL", ">", "m", "=", "query", ".", "where", "(", ")", ".", "idIn", "(", "idCollection", ".", "toArray", "(", ")", ")", ".", "findList", "(", ")", ";", "return", "processFoundByIdsModelList", "(", "m", ",", "includeDeleted", ")", ";", "}", ")", ";", "}", "else", "{", "model", "=", "executeTx", "(", "t", "->", "{", "configureQuery", ".", "run", "(", "t", ")", ";", "MODEL", "m", "=", "query", ".", "setId", "(", "firstId", ")", ".", "findOne", "(", ")", ";", "return", "processFoundByIdModel", "(", "m", ",", "includeDeleted", ")", ";", "}", ")", ";", "}", "if", "(", "isEmptyEntity", "(", "model", ")", ")", "{", "throw", "new", "NotFoundException", "(", ")", ";", "}", "return", "Response", ".", "ok", "(", "model", ")", ".", "build", "(", ")", ";", "}" ]
Find a model or model list given its Ids. @param id The id use for path matching type @param ids the id of the model. @param includeDeleted a boolean. @return a {@link javax.ws.rs.core.Response} object. @throws java.lang.Exception if any. @see javax.ws.rs.GET @see AbstractModelResource#findByIds
[ "Find", "a", "model", "or", "model", "list", "given", "its", "Ids", "." ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/support/ModelResourceStructure.java#L552-L591
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BreakIterator.java
BreakIterator.registerInstance
public static Object registerInstance(BreakIterator iter, Locale locale, int kind) { """ <strong>[icu]</strong> Registers a new break iterator of the indicated kind, to use in the given locale. Clones of the iterator will be returned if a request for a break iterator of the given kind matches or falls back to this locale. <p>Because ICU may choose to cache BreakIterator objects internally, this must be called at application startup, prior to any calls to BreakIterator.getInstance to avoid undefined behavior. @param iter the BreakIterator instance to adopt. @param locale the Locale for which this instance is to be registered @param kind the type of iterator for which this instance is to be registered @return a registry key that can be used to unregister this instance @hide unsupported on Android """ return registerInstance(iter, ULocale.forLocale(locale), kind); }
java
public static Object registerInstance(BreakIterator iter, Locale locale, int kind) { return registerInstance(iter, ULocale.forLocale(locale), kind); }
[ "public", "static", "Object", "registerInstance", "(", "BreakIterator", "iter", ",", "Locale", "locale", ",", "int", "kind", ")", "{", "return", "registerInstance", "(", "iter", ",", "ULocale", ".", "forLocale", "(", "locale", ")", ",", "kind", ")", ";", "}" ]
<strong>[icu]</strong> Registers a new break iterator of the indicated kind, to use in the given locale. Clones of the iterator will be returned if a request for a break iterator of the given kind matches or falls back to this locale. <p>Because ICU may choose to cache BreakIterator objects internally, this must be called at application startup, prior to any calls to BreakIterator.getInstance to avoid undefined behavior. @param iter the BreakIterator instance to adopt. @param locale the Locale for which this instance is to be registered @param kind the type of iterator for which this instance is to be registered @return a registry key that can be used to unregister this instance @hide unsupported on Android
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Registers", "a", "new", "break", "iterator", "of", "the", "indicated", "kind", "to", "use", "in", "the", "given", "locale", ".", "Clones", "of", "the", "iterator", "will", "be", "returned", "if", "a", "request", "for", "a", "break", "iterator", "of", "the", "given", "kind", "matches", "or", "falls", "back", "to", "this", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BreakIterator.java#L729-L731
alkacon/opencms-core
src/org/opencms/cache/CmsVfsDiskCache.java
CmsVfsDiskCache.getCacheName
public String getCacheName(boolean online, String rootPath, String parameters) { """ Returns the RFS name to use for caching the given VFS resource with parameters in the disk cache.<p> @param online if true, the online disk cache is used, the offline disk cache otherwise @param rootPath the VFS resource root path to get the RFS cache name for @param parameters the parameters of the request to the VFS resource @return the RFS name to use for caching the given VFS resource with parameters """ String rfsName = CmsFileUtil.getRepositoryName(m_rfsRepository, rootPath, online); if (CmsStringUtil.isNotEmpty(parameters)) { String extension = CmsFileUtil.getExtension(rfsName); // build the RFS name for the VFS name with parameters rfsName = CmsFileUtil.getRfsPath(rfsName, extension, parameters); } return rfsName; }
java
public String getCacheName(boolean online, String rootPath, String parameters) { String rfsName = CmsFileUtil.getRepositoryName(m_rfsRepository, rootPath, online); if (CmsStringUtil.isNotEmpty(parameters)) { String extension = CmsFileUtil.getExtension(rfsName); // build the RFS name for the VFS name with parameters rfsName = CmsFileUtil.getRfsPath(rfsName, extension, parameters); } return rfsName; }
[ "public", "String", "getCacheName", "(", "boolean", "online", ",", "String", "rootPath", ",", "String", "parameters", ")", "{", "String", "rfsName", "=", "CmsFileUtil", ".", "getRepositoryName", "(", "m_rfsRepository", ",", "rootPath", ",", "online", ")", ";", "if", "(", "CmsStringUtil", ".", "isNotEmpty", "(", "parameters", ")", ")", "{", "String", "extension", "=", "CmsFileUtil", ".", "getExtension", "(", "rfsName", ")", ";", "// build the RFS name for the VFS name with parameters", "rfsName", "=", "CmsFileUtil", ".", "getRfsPath", "(", "rfsName", ",", "extension", ",", "parameters", ")", ";", "}", "return", "rfsName", ";", "}" ]
Returns the RFS name to use for caching the given VFS resource with parameters in the disk cache.<p> @param online if true, the online disk cache is used, the offline disk cache otherwise @param rootPath the VFS resource root path to get the RFS cache name for @param parameters the parameters of the request to the VFS resource @return the RFS name to use for caching the given VFS resource with parameters
[ "Returns", "the", "RFS", "name", "to", "use", "for", "caching", "the", "given", "VFS", "resource", "with", "parameters", "in", "the", "disk", "cache", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/cache/CmsVfsDiskCache.java#L124-L134
google/closure-compiler
src/com/google/javascript/jscomp/RenameProperties.java
RenameProperties.generateNames
private void generateNames(Set<Property> props, Set<String> reservedNames) { """ Generates new names for properties. @param props Properties to generate new names for @param reservedNames A set of names to which properties should not be renamed """ nameGenerator.reset(reservedNames, "", reservedFirstCharacters, reservedNonFirstCharacters); for (Property p : props) { if (generatePseudoNames) { p.newName = "$" + p.oldName + "$"; } else { // If we haven't already given this property a reusable name. if (p.newName == null) { p.newName = nameGenerator.generateNextName(); } } reservedNames.add(p.newName); } }
java
private void generateNames(Set<Property> props, Set<String> reservedNames) { nameGenerator.reset(reservedNames, "", reservedFirstCharacters, reservedNonFirstCharacters); for (Property p : props) { if (generatePseudoNames) { p.newName = "$" + p.oldName + "$"; } else { // If we haven't already given this property a reusable name. if (p.newName == null) { p.newName = nameGenerator.generateNextName(); } } reservedNames.add(p.newName); } }
[ "private", "void", "generateNames", "(", "Set", "<", "Property", ">", "props", ",", "Set", "<", "String", ">", "reservedNames", ")", "{", "nameGenerator", ".", "reset", "(", "reservedNames", ",", "\"\"", ",", "reservedFirstCharacters", ",", "reservedNonFirstCharacters", ")", ";", "for", "(", "Property", "p", ":", "props", ")", "{", "if", "(", "generatePseudoNames", ")", "{", "p", ".", "newName", "=", "\"$\"", "+", "p", ".", "oldName", "+", "\"$\"", ";", "}", "else", "{", "// If we haven't already given this property a reusable name.", "if", "(", "p", ".", "newName", "==", "null", ")", "{", "p", ".", "newName", "=", "nameGenerator", ".", "generateNextName", "(", ")", ";", "}", "}", "reservedNames", ".", "add", "(", "p", ".", "newName", ")", ";", "}", "}" ]
Generates new names for properties. @param props Properties to generate new names for @param reservedNames A set of names to which properties should not be renamed
[ "Generates", "new", "names", "for", "properties", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/RenameProperties.java#L293-L306
cubedtear/aritzh
aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java
Configuration.getProperty
public String getProperty(String category, String key, String defaultValue) { """ Gets a property @param category The category in which the property is @param key The key of the property @param defaultValue If the property couldn't be found, this will be returned @return The value associated with {@code key} in {@code category}, or {@code defaultValue} if not found """ category = (this.compressedSpaces ? category.replaceAll("\\s+", " ") : category).trim(); if (Strings.isNullOrEmpty(category)) category = "Main"; key = (this.compressedSpaces ? key.replaceAll("\\s+", " ") : key).trim().replace(" ", "_"); try { return this.categories.get(category).get(key).replace("_", " "); } catch (NullPointerException e) { return defaultValue; } }
java
public String getProperty(String category, String key, String defaultValue) { category = (this.compressedSpaces ? category.replaceAll("\\s+", " ") : category).trim(); if (Strings.isNullOrEmpty(category)) category = "Main"; key = (this.compressedSpaces ? key.replaceAll("\\s+", " ") : key).trim().replace(" ", "_"); try { return this.categories.get(category).get(key).replace("_", " "); } catch (NullPointerException e) { return defaultValue; } }
[ "public", "String", "getProperty", "(", "String", "category", ",", "String", "key", ",", "String", "defaultValue", ")", "{", "category", "=", "(", "this", ".", "compressedSpaces", "?", "category", ".", "replaceAll", "(", "\"\\\\s+\"", ",", "\" \"", ")", ":", "category", ")", ".", "trim", "(", ")", ";", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "category", ")", ")", "category", "=", "\"Main\"", ";", "key", "=", "(", "this", ".", "compressedSpaces", "?", "key", ".", "replaceAll", "(", "\"\\\\s+\"", ",", "\" \"", ")", ":", "key", ")", ".", "trim", "(", ")", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", ";", "try", "{", "return", "this", ".", "categories", ".", "get", "(", "category", ")", ".", "get", "(", "key", ")", ".", "replace", "(", "\"_\"", ",", "\" \"", ")", ";", "}", "catch", "(", "NullPointerException", "e", ")", "{", "return", "defaultValue", ";", "}", "}" ]
Gets a property @param category The category in which the property is @param key The key of the property @param defaultValue If the property couldn't be found, this will be returned @return The value associated with {@code key} in {@code category}, or {@code defaultValue} if not found
[ "Gets", "a", "property" ]
train
https://github.com/cubedtear/aritzh/blob/bc7493447a1a6088c4a7306ca4d0f0c20278364f/aritzh-core/src/main/java/io/github/aritzhack/aritzh/config/Configuration.java#L298-L307
hibernate/hibernate-ogm
core/src/main/java/org/hibernate/ogm/loader/entity/impl/BatchingEntityLoaderBuilder.java
BatchingEntityLoaderBuilder.buildLoader
public UniqueEntityLoader buildLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers influencers, BatchableEntityLoaderBuilder innerEntityLoaderBuilder) { """ Builds a batch-fetch capable loader based on the given persister, lock-mode, etc. @param persister The entity persister @param batchSize The maximum number of ids to batch-fetch at once @param lockMode The lock mode @param factory The SessionFactory @param influencers Any influencers that should affect the built query @param innerEntityLoaderBuilder Builder of the entity loader receiving the subset of batches @return The loader. """ if ( batchSize <= 1 ) { // no batching return buildNonBatchingLoader( persister, lockMode, factory, influencers, innerEntityLoaderBuilder ); } return buildBatchingLoader( persister, batchSize, lockMode, factory, influencers, innerEntityLoaderBuilder ); }
java
public UniqueEntityLoader buildLoader( OuterJoinLoadable persister, int batchSize, LockMode lockMode, SessionFactoryImplementor factory, LoadQueryInfluencers influencers, BatchableEntityLoaderBuilder innerEntityLoaderBuilder) { if ( batchSize <= 1 ) { // no batching return buildNonBatchingLoader( persister, lockMode, factory, influencers, innerEntityLoaderBuilder ); } return buildBatchingLoader( persister, batchSize, lockMode, factory, influencers, innerEntityLoaderBuilder ); }
[ "public", "UniqueEntityLoader", "buildLoader", "(", "OuterJoinLoadable", "persister", ",", "int", "batchSize", ",", "LockMode", "lockMode", ",", "SessionFactoryImplementor", "factory", ",", "LoadQueryInfluencers", "influencers", ",", "BatchableEntityLoaderBuilder", "innerEntityLoaderBuilder", ")", "{", "if", "(", "batchSize", "<=", "1", ")", "{", "// no batching", "return", "buildNonBatchingLoader", "(", "persister", ",", "lockMode", ",", "factory", ",", "influencers", ",", "innerEntityLoaderBuilder", ")", ";", "}", "return", "buildBatchingLoader", "(", "persister", ",", "batchSize", ",", "lockMode", ",", "factory", ",", "influencers", ",", "innerEntityLoaderBuilder", ")", ";", "}" ]
Builds a batch-fetch capable loader based on the given persister, lock-mode, etc. @param persister The entity persister @param batchSize The maximum number of ids to batch-fetch at once @param lockMode The lock mode @param factory The SessionFactory @param influencers Any influencers that should affect the built query @param innerEntityLoaderBuilder Builder of the entity loader receiving the subset of batches @return The loader.
[ "Builds", "a", "batch", "-", "fetch", "capable", "loader", "based", "on", "the", "given", "persister", "lock", "-", "mode", "etc", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/loader/entity/impl/BatchingEntityLoaderBuilder.java#L89-L101
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/SparseHashMatrix.java
SparseHashMatrix.checkIndices
private void checkIndices(int row, int col) { """ Checks that the indices are within the bounds of this matrix or throws an {@link IndexOutOfBoundsException} if not. """ if (row < 0 || col < 0 || row >= rows || col >= columns) { throw new IndexOutOfBoundsException(); } }
java
private void checkIndices(int row, int col) { if (row < 0 || col < 0 || row >= rows || col >= columns) { throw new IndexOutOfBoundsException(); } }
[ "private", "void", "checkIndices", "(", "int", "row", ",", "int", "col", ")", "{", "if", "(", "row", "<", "0", "||", "col", "<", "0", "||", "row", ">=", "rows", "||", "col", ">=", "columns", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", ")", ";", "}", "}" ]
Checks that the indices are within the bounds of this matrix or throws an {@link IndexOutOfBoundsException} if not.
[ "Checks", "that", "the", "indices", "are", "within", "the", "bounds", "of", "this", "matrix", "or", "throws", "an", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/SparseHashMatrix.java#L78-L82
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/actions/FindBugsAction.java
FindBugsAction.work
protected void work(IWorkbenchPart part, final IResource resource, final List<WorkItem> resources) { """ Run a FindBugs analysis on the given resource, displaying a progress monitor. @param part @param resources The resource to run the analysis on. """ FindBugsJob runFindBugs = new StartedFromViewJob("Finding bugs in " + resource.getName() + "...", resource, resources, part); runFindBugs.scheduleInteractive(); }
java
protected void work(IWorkbenchPart part, final IResource resource, final List<WorkItem> resources) { FindBugsJob runFindBugs = new StartedFromViewJob("Finding bugs in " + resource.getName() + "...", resource, resources, part); runFindBugs.scheduleInteractive(); }
[ "protected", "void", "work", "(", "IWorkbenchPart", "part", ",", "final", "IResource", "resource", ",", "final", "List", "<", "WorkItem", ">", "resources", ")", "{", "FindBugsJob", "runFindBugs", "=", "new", "StartedFromViewJob", "(", "\"Finding bugs in \"", "+", "resource", ".", "getName", "(", ")", "+", "\"...\"", ",", "resource", ",", "resources", ",", "part", ")", ";", "runFindBugs", ".", "scheduleInteractive", "(", ")", ";", "}" ]
Run a FindBugs analysis on the given resource, displaying a progress monitor. @param part @param resources The resource to run the analysis on.
[ "Run", "a", "FindBugs", "analysis", "on", "the", "given", "resource", "displaying", "a", "progress", "monitor", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/actions/FindBugsAction.java#L167-L170
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java
CustomerAccountUrl.getCustomersPurchaseOrderAccountsUrl
public static MozuUrl getCustomersPurchaseOrderAccountsUrl(String accountType, Integer pageSize, String responseFields, String sortBy, Integer startIndex) { """ Get Resource Url for GetCustomersPurchaseOrderAccounts @param accountType @param pageSize When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param sortBy The element to sort the results by and the channel in which the results appear. Either ascending (a-z) or descending (z-a) channel. Optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for more information. @param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with pageSize set to 25, to get the 51st through the 75th items, set this parameter to 50. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/purchaseOrderAccounts?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&accountType={accountType}&responseFields={responseFields}"); formatter.formatUrl("accountType", accountType); formatter.formatUrl("pageSize", pageSize); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("sortBy", sortBy); formatter.formatUrl("startIndex", startIndex); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getCustomersPurchaseOrderAccountsUrl(String accountType, Integer pageSize, String responseFields, String sortBy, Integer startIndex) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/purchaseOrderAccounts?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&accountType={accountType}&responseFields={responseFields}"); formatter.formatUrl("accountType", accountType); formatter.formatUrl("pageSize", pageSize); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("sortBy", sortBy); formatter.formatUrl("startIndex", startIndex); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getCustomersPurchaseOrderAccountsUrl", "(", "String", "accountType", ",", "Integer", "pageSize", ",", "String", "responseFields", ",", "String", "sortBy", ",", "Integer", "startIndex", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/customer/accounts/purchaseOrderAccounts?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&accountType={accountType}&responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"accountType\"", ",", "accountType", ")", ";", "formatter", ".", "formatUrl", "(", "\"pageSize\"", ",", "pageSize", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "formatter", ".", "formatUrl", "(", "\"sortBy\"", ",", "sortBy", ")", ";", "formatter", ".", "formatUrl", "(", "\"startIndex\"", ",", "startIndex", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for GetCustomersPurchaseOrderAccounts @param accountType @param pageSize When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param sortBy The element to sort the results by and the channel in which the results appear. Either ascending (a-z) or descending (z-a) channel. Optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for more information. @param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with pageSize set to 25, to get the 51st through the 75th items, set this parameter to 50. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetCustomersPurchaseOrderAccounts" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerAccountUrl.java#L235-L244
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/StatefulBeanO.java
StatefulBeanO.updateFailoverEntry
public void updateFailoverEntry(byte[] beanData, long lastAccessTime) throws RemoteException //LIDB2018 { """ Update failover entry for this SFSB with the replicated data for this SFSB and indicate SFSB status is passivated. @param beanData is the replicated data for this SFSB. @param lastAccessTime is the last access time for this SFSB. """ try { // Note, updating failover entry for a SFSB only occurs when // the bean is passivated. Therefore, the updateEntry // method implicitly sets the passivated flag in reaper. ivSfFailoverClient.passivated(beanId, beanData, lastAccessTime); //d204278.2 } catch (Exception e) { FFDCFilter.processException(e, CLASS_NAME + ".updateFailoverEntry", "1137", this); throw new RemoteException("Could not update SFSB Entry", e); } }
java
public void updateFailoverEntry(byte[] beanData, long lastAccessTime) throws RemoteException //LIDB2018 { try { // Note, updating failover entry for a SFSB only occurs when // the bean is passivated. Therefore, the updateEntry // method implicitly sets the passivated flag in reaper. ivSfFailoverClient.passivated(beanId, beanData, lastAccessTime); //d204278.2 } catch (Exception e) { FFDCFilter.processException(e, CLASS_NAME + ".updateFailoverEntry", "1137", this); throw new RemoteException("Could not update SFSB Entry", e); } }
[ "public", "void", "updateFailoverEntry", "(", "byte", "[", "]", "beanData", ",", "long", "lastAccessTime", ")", "throws", "RemoteException", "//LIDB2018", "{", "try", "{", "// Note, updating failover entry for a SFSB only occurs when", "// the bean is passivated. Therefore, the updateEntry", "// method implicitly sets the passivated flag in reaper.", "ivSfFailoverClient", ".", "passivated", "(", "beanId", ",", "beanData", ",", "lastAccessTime", ")", ";", "//d204278.2", "}", "catch", "(", "Exception", "e", ")", "{", "FFDCFilter", ".", "processException", "(", "e", ",", "CLASS_NAME", "+", "\".updateFailoverEntry\"", ",", "\"1137\"", ",", "this", ")", ";", "throw", "new", "RemoteException", "(", "\"Could not update SFSB Entry\"", ",", "e", ")", ";", "}", "}" ]
Update failover entry for this SFSB with the replicated data for this SFSB and indicate SFSB status is passivated. @param beanData is the replicated data for this SFSB. @param lastAccessTime is the last access time for this SFSB.
[ "Update", "failover", "entry", "for", "this", "SFSB", "with", "the", "replicated", "data", "for", "this", "SFSB", "and", "indicate", "SFSB", "status", "is", "passivated", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/StatefulBeanO.java#L1718-L1729
opentelecoms-org/jsmpp
jsmpp/src/main/java/org/jsmpp/session/AbstractSession.java
AbstractSession.executeSendCommand
protected Command executeSendCommand(SendCommandTask task, long timeout) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, IOException { """ Execute send command command task. @param task is the task. @param timeout is the timeout in millisecond. @return the command response. @throws PDUException if there is invalid PDU parameter found. @throws ResponseTimeoutException if the response has reach it timeout. @throws InvalidResponseException if invalid response found. @throws NegativeResponseException if the negative response found. @throws IOException if there is an IO error found. """ int seqNum = sequence.nextValue(); PendingResponse<Command> pendingResp = new PendingResponse<Command>(timeout); pendingResponse.put(seqNum, pendingResp); try { task.executeTask(connection().getOutputStream(), seqNum); } catch (IOException e) { logger.error("Failed sending " + task.getCommandName() + " command", e); if("enquire_link".equals(task.getCommandName())) { logger.info("Tomas: Ignore failure of sending enquire_link, wait to see if connection is restored"); } else { pendingResponse.remove(seqNum); close(); throw e; } } try { pendingResp.waitDone(); logger.debug("{} response with sequence {} received for session {}", task.getCommandName(), seqNum, sessionId); } catch (ResponseTimeoutException e) { pendingResponse.remove(seqNum); throw new ResponseTimeoutException("No response after waiting for " + timeout + " millis when executing " + task.getCommandName() + " with sessionId " + sessionId + " and sequenceNumber " + seqNum, e); } catch (InvalidResponseException e) { pendingResponse.remove(seqNum); throw e; } Command resp = pendingResp.getResponse(); validateResponse(resp); return resp; }
java
protected Command executeSendCommand(SendCommandTask task, long timeout) throws PDUException, ResponseTimeoutException, InvalidResponseException, NegativeResponseException, IOException { int seqNum = sequence.nextValue(); PendingResponse<Command> pendingResp = new PendingResponse<Command>(timeout); pendingResponse.put(seqNum, pendingResp); try { task.executeTask(connection().getOutputStream(), seqNum); } catch (IOException e) { logger.error("Failed sending " + task.getCommandName() + " command", e); if("enquire_link".equals(task.getCommandName())) { logger.info("Tomas: Ignore failure of sending enquire_link, wait to see if connection is restored"); } else { pendingResponse.remove(seqNum); close(); throw e; } } try { pendingResp.waitDone(); logger.debug("{} response with sequence {} received for session {}", task.getCommandName(), seqNum, sessionId); } catch (ResponseTimeoutException e) { pendingResponse.remove(seqNum); throw new ResponseTimeoutException("No response after waiting for " + timeout + " millis when executing " + task.getCommandName() + " with sessionId " + sessionId + " and sequenceNumber " + seqNum, e); } catch (InvalidResponseException e) { pendingResponse.remove(seqNum); throw e; } Command resp = pendingResp.getResponse(); validateResponse(resp); return resp; }
[ "protected", "Command", "executeSendCommand", "(", "SendCommandTask", "task", ",", "long", "timeout", ")", "throws", "PDUException", ",", "ResponseTimeoutException", ",", "InvalidResponseException", ",", "NegativeResponseException", ",", "IOException", "{", "int", "seqNum", "=", "sequence", ".", "nextValue", "(", ")", ";", "PendingResponse", "<", "Command", ">", "pendingResp", "=", "new", "PendingResponse", "<", "Command", ">", "(", "timeout", ")", ";", "pendingResponse", ".", "put", "(", "seqNum", ",", "pendingResp", ")", ";", "try", "{", "task", ".", "executeTask", "(", "connection", "(", ")", ".", "getOutputStream", "(", ")", ",", "seqNum", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "error", "(", "\"Failed sending \"", "+", "task", ".", "getCommandName", "(", ")", "+", "\" command\"", ",", "e", ")", ";", "if", "(", "\"enquire_link\"", ".", "equals", "(", "task", ".", "getCommandName", "(", ")", ")", ")", "{", "logger", ".", "info", "(", "\"Tomas: Ignore failure of sending enquire_link, wait to see if connection is restored\"", ")", ";", "}", "else", "{", "pendingResponse", ".", "remove", "(", "seqNum", ")", ";", "close", "(", ")", ";", "throw", "e", ";", "}", "}", "try", "{", "pendingResp", ".", "waitDone", "(", ")", ";", "logger", ".", "debug", "(", "\"{} response with sequence {} received for session {}\"", ",", "task", ".", "getCommandName", "(", ")", ",", "seqNum", ",", "sessionId", ")", ";", "}", "catch", "(", "ResponseTimeoutException", "e", ")", "{", "pendingResponse", ".", "remove", "(", "seqNum", ")", ";", "throw", "new", "ResponseTimeoutException", "(", "\"No response after waiting for \"", "+", "timeout", "+", "\" millis when executing \"", "+", "task", ".", "getCommandName", "(", ")", "+", "\" with sessionId \"", "+", "sessionId", "+", "\" and sequenceNumber \"", "+", "seqNum", ",", "e", ")", ";", "}", "catch", "(", "InvalidResponseException", "e", ")", "{", "pendingResponse", ".", "remove", "(", "seqNum", ")", ";", "throw", "e", ";", "}", "Command", "resp", "=", "pendingResp", ".", "getResponse", "(", ")", ";", "validateResponse", "(", "resp", ")", ";", "return", "resp", ";", "}" ]
Execute send command command task. @param task is the task. @param timeout is the timeout in millisecond. @return the command response. @throws PDUException if there is invalid PDU parameter found. @throws ResponseTimeoutException if the response has reach it timeout. @throws InvalidResponseException if invalid response found. @throws NegativeResponseException if the negative response found. @throws IOException if there is an IO error found.
[ "Execute", "send", "command", "command", "task", "." ]
train
https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/session/AbstractSession.java#L269-L307
alkacon/opencms-core
src/org/opencms/db/CmsUserSettings.java
CmsUserSettings.getAdditionalPreference
public String getAdditionalPreference(String name, boolean useDefault) { """ Gets the value for a user defined preference.<p> @param name the name of the preference @param useDefault true if the default value should be returned in case the preference is not set @return the preference value """ String value = m_additionalPreferences.get(name); if ((value == null) && useDefault) { I_CmsPreference pref = OpenCms.getWorkplaceManager().getDefaultUserSettings().getPreferences().get(name); if (pref != null) { value = pref.getDefaultValue(); } } return value; }
java
public String getAdditionalPreference(String name, boolean useDefault) { String value = m_additionalPreferences.get(name); if ((value == null) && useDefault) { I_CmsPreference pref = OpenCms.getWorkplaceManager().getDefaultUserSettings().getPreferences().get(name); if (pref != null) { value = pref.getDefaultValue(); } } return value; }
[ "public", "String", "getAdditionalPreference", "(", "String", "name", ",", "boolean", "useDefault", ")", "{", "String", "value", "=", "m_additionalPreferences", ".", "get", "(", "name", ")", ";", "if", "(", "(", "value", "==", "null", ")", "&&", "useDefault", ")", "{", "I_CmsPreference", "pref", "=", "OpenCms", ".", "getWorkplaceManager", "(", ")", ".", "getDefaultUserSettings", "(", ")", ".", "getPreferences", "(", ")", ".", "get", "(", "name", ")", ";", "if", "(", "pref", "!=", "null", ")", "{", "value", "=", "pref", ".", "getDefaultValue", "(", ")", ";", "}", "}", "return", "value", ";", "}" ]
Gets the value for a user defined preference.<p> @param name the name of the preference @param useDefault true if the default value should be returned in case the preference is not set @return the preference value
[ "Gets", "the", "value", "for", "a", "user", "defined", "preference", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsUserSettings.java#L489-L499
alkacon/opencms-core
src/org/opencms/security/CmsOrgUnitManager.java
CmsOrgUnitManager.writeOrganizationalUnit
public void writeOrganizationalUnit(CmsObject cms, CmsOrganizationalUnit organizationalUnit) throws CmsException { """ Writes an already existing organizational unit.<p> The organizational unit has to be a valid OpenCms organizational unit.<br> The organizational unit will be completely overridden by the given data.<p> @param cms the opencms context @param organizationalUnit the organizational unit that should be written @throws CmsException if operation was not successful """ m_securityManager.writeOrganizationalUnit(cms.getRequestContext(), organizationalUnit); }
java
public void writeOrganizationalUnit(CmsObject cms, CmsOrganizationalUnit organizationalUnit) throws CmsException { m_securityManager.writeOrganizationalUnit(cms.getRequestContext(), organizationalUnit); }
[ "public", "void", "writeOrganizationalUnit", "(", "CmsObject", "cms", ",", "CmsOrganizationalUnit", "organizationalUnit", ")", "throws", "CmsException", "{", "m_securityManager", ".", "writeOrganizationalUnit", "(", "cms", ".", "getRequestContext", "(", ")", ",", "organizationalUnit", ")", ";", "}" ]
Writes an already existing organizational unit.<p> The organizational unit has to be a valid OpenCms organizational unit.<br> The organizational unit will be completely overridden by the given data.<p> @param cms the opencms context @param organizationalUnit the organizational unit that should be written @throws CmsException if operation was not successful
[ "Writes", "an", "already", "existing", "organizational", "unit", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsOrgUnitManager.java#L375-L378
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.registry/src/com/ibm/ws/security/wim/registry/util/BridgeUtils.java
BridgeUtils.createPropertyControlDataObject
protected void createPropertyControlDataObject(Root inputRootDataObject, String inputProperty) { """ Create a DataObject for the property request. @param inputRootDataObject The root DataObject. @param inputProperty The property to request @pre inputRootDataObject != null @pre inputProperty != null @pre inputProperty != "" """ // use the root DataGraph to create a PropertyControl DataGraph List<Control> propertyControls = inputRootDataObject.getControls(); PropertyControl propCtrl = null; if (propertyControls != null) { propCtrl = new PropertyControl(); propertyControls.add(propCtrl); } // add the requested property to the return list of properties if (propCtrl != null) { propCtrl.getProperties().add(inputProperty); } }
java
protected void createPropertyControlDataObject(Root inputRootDataObject, String inputProperty) { // use the root DataGraph to create a PropertyControl DataGraph List<Control> propertyControls = inputRootDataObject.getControls(); PropertyControl propCtrl = null; if (propertyControls != null) { propCtrl = new PropertyControl(); propertyControls.add(propCtrl); } // add the requested property to the return list of properties if (propCtrl != null) { propCtrl.getProperties().add(inputProperty); } }
[ "protected", "void", "createPropertyControlDataObject", "(", "Root", "inputRootDataObject", ",", "String", "inputProperty", ")", "{", "// use the root DataGraph to create a PropertyControl DataGraph", "List", "<", "Control", ">", "propertyControls", "=", "inputRootDataObject", ".", "getControls", "(", ")", ";", "PropertyControl", "propCtrl", "=", "null", ";", "if", "(", "propertyControls", "!=", "null", ")", "{", "propCtrl", "=", "new", "PropertyControl", "(", ")", ";", "propertyControls", ".", "add", "(", "propCtrl", ")", ";", "}", "// add the requested property to the return list of properties", "if", "(", "propCtrl", "!=", "null", ")", "{", "propCtrl", ".", "getProperties", "(", ")", ".", "add", "(", "inputProperty", ")", ";", "}", "}" ]
Create a DataObject for the property request. @param inputRootDataObject The root DataObject. @param inputProperty The property to request @pre inputRootDataObject != null @pre inputProperty != null @pre inputProperty != ""
[ "Create", "a", "DataObject", "for", "the", "property", "request", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.registry/src/com/ibm/ws/security/wim/registry/util/BridgeUtils.java#L370-L382
JetBrains/xodus
entity-store/src/main/java/jetbrains/exodus/entitystore/tables/TwoColumnTable.java
TwoColumnTable.get
@Nullable public ByteIterable get(@NotNull final Transaction txn, @NotNull final ByteIterable first) { """ Search for the first entry in the first database. Use this method for databases configured with no duplicates. @param txn enclosing transaction @param first first key. @return null if no entry found, otherwise the value. """ return this.first.get(txn, first); }
java
@Nullable public ByteIterable get(@NotNull final Transaction txn, @NotNull final ByteIterable first) { return this.first.get(txn, first); }
[ "@", "Nullable", "public", "ByteIterable", "get", "(", "@", "NotNull", "final", "Transaction", "txn", ",", "@", "NotNull", "final", "ByteIterable", "first", ")", "{", "return", "this", ".", "first", ".", "get", "(", "txn", ",", "first", ")", ";", "}" ]
Search for the first entry in the first database. Use this method for databases configured with no duplicates. @param txn enclosing transaction @param first first key. @return null if no entry found, otherwise the value.
[ "Search", "for", "the", "first", "entry", "in", "the", "first", "database", ".", "Use", "this", "method", "for", "databases", "configured", "with", "no", "duplicates", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/entity-store/src/main/java/jetbrains/exodus/entitystore/tables/TwoColumnTable.java#L54-L57
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/context/ContextHolder.java
ContextHolder.getInstance
public static synchronized ContextHolder getInstance() { """ Singleton pattern @return the instance for the context holder. """ if (INSTANCE == null) { Properties props = new Properties(); try { props.load(new ClassPathResource("/cudafunctions.properties", ContextHolder.class.getClassLoader()).getInputStream()); } catch (IOException e) { throw new RuntimeException(e); } INSTANCE = new ContextHolder(); INSTANCE.configure(); //set the properties to be accessible globally for (String pair : props.stringPropertyNames()) System.getProperties().put(pair, props.getProperty(pair)); } return INSTANCE; }
java
public static synchronized ContextHolder getInstance() { if (INSTANCE == null) { Properties props = new Properties(); try { props.load(new ClassPathResource("/cudafunctions.properties", ContextHolder.class.getClassLoader()).getInputStream()); } catch (IOException e) { throw new RuntimeException(e); } INSTANCE = new ContextHolder(); INSTANCE.configure(); //set the properties to be accessible globally for (String pair : props.stringPropertyNames()) System.getProperties().put(pair, props.getProperty(pair)); } return INSTANCE; }
[ "public", "static", "synchronized", "ContextHolder", "getInstance", "(", ")", "{", "if", "(", "INSTANCE", "==", "null", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "try", "{", "props", ".", "load", "(", "new", "ClassPathResource", "(", "\"/cudafunctions.properties\"", ",", "ContextHolder", ".", "class", ".", "getClassLoader", "(", ")", ")", ".", "getInputStream", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "INSTANCE", "=", "new", "ContextHolder", "(", ")", ";", "INSTANCE", ".", "configure", "(", ")", ";", "//set the properties to be accessible globally", "for", "(", "String", "pair", ":", "props", ".", "stringPropertyNames", "(", ")", ")", "System", ".", "getProperties", "(", ")", ".", "put", "(", "pair", ",", "props", ".", "getProperty", "(", "pair", ")", ")", ";", "}", "return", "INSTANCE", ";", "}" ]
Singleton pattern @return the instance for the context holder.
[ "Singleton", "pattern" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/context/ContextHolder.java#L63-L86
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/context/TemplateParserContext.java
TemplateParserContext.addLocalVariable
public LocalVariableInfo addLocalVariable(String typeQualifiedName, String name) { """ Add a local variable in the current context. @param typeQualifiedName The type of the variable @param name The name of the variable @return {@link LocalVariableInfo} for the added variable """ return contextLayers.getFirst().addLocalVariable(typeQualifiedName, name); }
java
public LocalVariableInfo addLocalVariable(String typeQualifiedName, String name) { return contextLayers.getFirst().addLocalVariable(typeQualifiedName, name); }
[ "public", "LocalVariableInfo", "addLocalVariable", "(", "String", "typeQualifiedName", ",", "String", "name", ")", "{", "return", "contextLayers", ".", "getFirst", "(", ")", ".", "addLocalVariable", "(", "typeQualifiedName", ",", "name", ")", ";", "}" ]
Add a local variable in the current context. @param typeQualifiedName The type of the variable @param name The name of the variable @return {@link LocalVariableInfo} for the added variable
[ "Add", "a", "local", "variable", "in", "the", "current", "context", "." ]
train
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/context/TemplateParserContext.java#L117-L119
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesInner.java
ElasticPoolActivitiesInner.listByElasticPoolAsync
public Observable<List<ElasticPoolActivityInner>> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { """ Returns elastic pool activities. @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 elasticPoolName The name of the elastic pool for which to get the current activity. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ElasticPoolActivityInner&gt; object """ return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1<ServiceResponse<List<ElasticPoolActivityInner>>, List<ElasticPoolActivityInner>>() { @Override public List<ElasticPoolActivityInner> call(ServiceResponse<List<ElasticPoolActivityInner>> response) { return response.body(); } }); }
java
public Observable<List<ElasticPoolActivityInner>> listByElasticPoolAsync(String resourceGroupName, String serverName, String elasticPoolName) { return listByElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1<ServiceResponse<List<ElasticPoolActivityInner>>, List<ElasticPoolActivityInner>>() { @Override public List<ElasticPoolActivityInner> call(ServiceResponse<List<ElasticPoolActivityInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ElasticPoolActivityInner", ">", ">", "listByElasticPoolAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "elasticPoolName", ")", "{", "return", "listByElasticPoolWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "elasticPoolName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "List", "<", "ElasticPoolActivityInner", ">", ">", ",", "List", "<", "ElasticPoolActivityInner", ">", ">", "(", ")", "{", "@", "Override", "public", "List", "<", "ElasticPoolActivityInner", ">", "call", "(", "ServiceResponse", "<", "List", "<", "ElasticPoolActivityInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Returns elastic pool activities. @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 elasticPoolName The name of the elastic pool for which to get the current activity. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ElasticPoolActivityInner&gt; object
[ "Returns", "elastic", "pool", "activities", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolActivitiesInner.java#L99-L106
igniterealtime/Smack
smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java
RTPBridge.relaySession
@SuppressWarnings("deprecation") public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException, InterruptedException { """ Check if the server support RTPBridge Service. @param connection @return the RTPBridge @throws NotConnectedException @throws InterruptedException """ if (!connection.isConnected()) { return null; } RTPBridge rtpPacket = new RTPBridge(sessionID, RTPBridge.BridgeAction.change); rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain()); rtpPacket.setType(Type.set); rtpPacket.setPass(pass); rtpPacket.setPortA(localCandidate.getPort()); rtpPacket.setPortB(proxyCandidate.getPort()); rtpPacket.setHostA(localCandidate.getIp()); rtpPacket.setHostB(proxyCandidate.getIp()); // LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort()); StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket); RTPBridge response = collector.nextResult(); // Cancel the collector. collector.cancel(); return response; }
java
@SuppressWarnings("deprecation") public static RTPBridge relaySession(XMPPConnection connection, String sessionID, String pass, TransportCandidate proxyCandidate, TransportCandidate localCandidate) throws NotConnectedException, InterruptedException { if (!connection.isConnected()) { return null; } RTPBridge rtpPacket = new RTPBridge(sessionID, RTPBridge.BridgeAction.change); rtpPacket.setTo(RTPBridge.NAME + "." + connection.getXMPPServiceDomain()); rtpPacket.setType(Type.set); rtpPacket.setPass(pass); rtpPacket.setPortA(localCandidate.getPort()); rtpPacket.setPortB(proxyCandidate.getPort()); rtpPacket.setHostA(localCandidate.getIp()); rtpPacket.setHostB(proxyCandidate.getIp()); // LOGGER.debug("Relayed to: " + candidate.getIp() + ":" + candidate.getPort()); StanzaCollector collector = connection.createStanzaCollectorAndSend(rtpPacket); RTPBridge response = collector.nextResult(); // Cancel the collector. collector.cancel(); return response; }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "RTPBridge", "relaySession", "(", "XMPPConnection", "connection", ",", "String", "sessionID", ",", "String", "pass", ",", "TransportCandidate", "proxyCandidate", ",", "TransportCandidate", "localCandidate", ")", "throws", "NotConnectedException", ",", "InterruptedException", "{", "if", "(", "!", "connection", ".", "isConnected", "(", ")", ")", "{", "return", "null", ";", "}", "RTPBridge", "rtpPacket", "=", "new", "RTPBridge", "(", "sessionID", ",", "RTPBridge", ".", "BridgeAction", ".", "change", ")", ";", "rtpPacket", ".", "setTo", "(", "RTPBridge", ".", "NAME", "+", "\".\"", "+", "connection", ".", "getXMPPServiceDomain", "(", ")", ")", ";", "rtpPacket", ".", "setType", "(", "Type", ".", "set", ")", ";", "rtpPacket", ".", "setPass", "(", "pass", ")", ";", "rtpPacket", ".", "setPortA", "(", "localCandidate", ".", "getPort", "(", ")", ")", ";", "rtpPacket", ".", "setPortB", "(", "proxyCandidate", ".", "getPort", "(", ")", ")", ";", "rtpPacket", ".", "setHostA", "(", "localCandidate", ".", "getIp", "(", ")", ")", ";", "rtpPacket", ".", "setHostB", "(", "proxyCandidate", ".", "getIp", "(", ")", ")", ";", "// LOGGER.debug(\"Relayed to: \" + candidate.getIp() + \":\" + candidate.getPort());", "StanzaCollector", "collector", "=", "connection", ".", "createStanzaCollectorAndSend", "(", "rtpPacket", ")", ";", "RTPBridge", "response", "=", "collector", ".", "nextResult", "(", ")", ";", "// Cancel the collector.", "collector", ".", "cancel", "(", ")", ";", "return", "response", ";", "}" ]
Check if the server support RTPBridge Service. @param connection @return the RTPBridge @throws NotConnectedException @throws InterruptedException
[ "Check", "if", "the", "server", "support", "RTPBridge", "Service", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java#L467-L494
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java
TrajectoryEnvelope.setTrajectory
public void setTrajectory(Trajectory traj) { """ Set the {@link Trajectory} of this {@link TrajectoryEnvelope}. @param traj The {@link Trajectory} of this {@link TrajectoryEnvelope}. """ if (this.footprint == null) { throw new NoFootprintException("No footprint set for " + this + ", please specify one before setting the trajecotry."); } else{ createOuterEnvelope(traj); } if(this.innerFootprint != null){ createInnerEnvelope(traj); } }
java
public void setTrajectory(Trajectory traj) { if (this.footprint == null) { throw new NoFootprintException("No footprint set for " + this + ", please specify one before setting the trajecotry."); } else{ createOuterEnvelope(traj); } if(this.innerFootprint != null){ createInnerEnvelope(traj); } }
[ "public", "void", "setTrajectory", "(", "Trajectory", "traj", ")", "{", "if", "(", "this", ".", "footprint", "==", "null", ")", "{", "throw", "new", "NoFootprintException", "(", "\"No footprint set for \"", "+", "this", "+", "\", please specify one before setting the trajecotry.\"", ")", ";", "}", "else", "{", "createOuterEnvelope", "(", "traj", ")", ";", "}", "if", "(", "this", ".", "innerFootprint", "!=", "null", ")", "{", "createInnerEnvelope", "(", "traj", ")", ";", "}", "}" ]
Set the {@link Trajectory} of this {@link TrajectoryEnvelope}. @param traj The {@link Trajectory} of this {@link TrajectoryEnvelope}.
[ "Set", "the", "{" ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java#L761-L772
jenkinsci/jenkins
core/src/main/java/jenkins/util/JSONSignatureValidator.java
JSONSignatureValidator.digestMatches
private boolean digestMatches(byte[] digest, String providedDigest) { """ Utility method supporting both possible digest formats: Base64 and Hex """ return providedDigest.equalsIgnoreCase(Hex.encodeHexString(digest)) || providedDigest.equalsIgnoreCase(new String(Base64.getEncoder().encode(digest))); }
java
private boolean digestMatches(byte[] digest, String providedDigest) { return providedDigest.equalsIgnoreCase(Hex.encodeHexString(digest)) || providedDigest.equalsIgnoreCase(new String(Base64.getEncoder().encode(digest))); }
[ "private", "boolean", "digestMatches", "(", "byte", "[", "]", "digest", ",", "String", "providedDigest", ")", "{", "return", "providedDigest", ".", "equalsIgnoreCase", "(", "Hex", ".", "encodeHexString", "(", "digest", ")", ")", "||", "providedDigest", ".", "equalsIgnoreCase", "(", "new", "String", "(", "Base64", ".", "getEncoder", "(", ")", ".", "encode", "(", "digest", ")", ")", ")", ";", "}" ]
Utility method supporting both possible digest formats: Base64 and Hex
[ "Utility", "method", "supporting", "both", "possible", "digest", "formats", ":", "Base64", "and", "Hex" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/util/JSONSignatureValidator.java#L238-L240
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/UserApi.java
UserApi.deleteCustomAttribute
public void deleteCustomAttribute(final Object userIdOrUsername, final CustomAttribute customAttribute) throws GitLabApiException { """ Delete a custom attribute for the given user @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param customAttribute to remove @throws GitLabApiException on failure while deleting customAttributes """ if (Objects.isNull(customAttribute)) { throw new IllegalArgumentException("customAttributes can't be null"); } deleteCustomAttribute(userIdOrUsername, customAttribute.getKey()); }
java
public void deleteCustomAttribute(final Object userIdOrUsername, final CustomAttribute customAttribute) throws GitLabApiException { if (Objects.isNull(customAttribute)) { throw new IllegalArgumentException("customAttributes can't be null"); } deleteCustomAttribute(userIdOrUsername, customAttribute.getKey()); }
[ "public", "void", "deleteCustomAttribute", "(", "final", "Object", "userIdOrUsername", ",", "final", "CustomAttribute", "customAttribute", ")", "throws", "GitLabApiException", "{", "if", "(", "Objects", ".", "isNull", "(", "customAttribute", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"customAttributes can't be null\"", ")", ";", "}", "deleteCustomAttribute", "(", "userIdOrUsername", ",", "customAttribute", ".", "getKey", "(", ")", ")", ";", "}" ]
Delete a custom attribute for the given user @param userIdOrUsername the user in the form of an Integer(ID), String(username), or User instance @param customAttribute to remove @throws GitLabApiException on failure while deleting customAttributes
[ "Delete", "a", "custom", "attribute", "for", "the", "given", "user" ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/UserApi.java#L965-L971
pippo-java/pippo
pippo-server-parent/pippo-jetty/src/main/java/ro/pippo/jetty/JettyServer.java
JettyServer.asJettyFriendlyPath
private String asJettyFriendlyPath(String path, String name) { """ Jetty treats non-URL paths are file paths interpreted in the current working directory. Provide ability to accept paths to resources on the Classpath. @param path @param name Descriptive name of what is for. Used in logs, error messages @return Path in a format Jetty will understand, even if it is a Classpath-relative path. """ try { new URL(path); log.debug("Defer interpretation of {} URL '{}' to Jetty", name, path); return path; } catch (MalformedURLException e) { //Expected. We've got a path and not a URL Path p = Paths.get(path); if (Files.exists(Paths.get(path))) { //Jetty knows how to find files on the file system log.debug("Located {} '{}' on file system", name, path); return path; } else { //Maybe it's a resource on the Classpath. Jetty needs that converted to a URL. //(e.g. "jar:file:/path/to/my.jar!<path>") URL url = JettyServer.class.getResource(path); if (url != null) { log.debug("Located {} '{}' on Classpath", name, path); return url.toExternalForm(); } else { throw new IllegalArgumentException(String.format("%s '%s' not found", name, path)); } } } }
java
private String asJettyFriendlyPath(String path, String name) { try { new URL(path); log.debug("Defer interpretation of {} URL '{}' to Jetty", name, path); return path; } catch (MalformedURLException e) { //Expected. We've got a path and not a URL Path p = Paths.get(path); if (Files.exists(Paths.get(path))) { //Jetty knows how to find files on the file system log.debug("Located {} '{}' on file system", name, path); return path; } else { //Maybe it's a resource on the Classpath. Jetty needs that converted to a URL. //(e.g. "jar:file:/path/to/my.jar!<path>") URL url = JettyServer.class.getResource(path); if (url != null) { log.debug("Located {} '{}' on Classpath", name, path); return url.toExternalForm(); } else { throw new IllegalArgumentException(String.format("%s '%s' not found", name, path)); } } } }
[ "private", "String", "asJettyFriendlyPath", "(", "String", "path", ",", "String", "name", ")", "{", "try", "{", "new", "URL", "(", "path", ")", ";", "log", ".", "debug", "(", "\"Defer interpretation of {} URL '{}' to Jetty\"", ",", "name", ",", "path", ")", ";", "return", "path", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "//Expected. We've got a path and not a URL", "Path", "p", "=", "Paths", ".", "get", "(", "path", ")", ";", "if", "(", "Files", ".", "exists", "(", "Paths", ".", "get", "(", "path", ")", ")", ")", "{", "//Jetty knows how to find files on the file system", "log", ".", "debug", "(", "\"Located {} '{}' on file system\"", ",", "name", ",", "path", ")", ";", "return", "path", ";", "}", "else", "{", "//Maybe it's a resource on the Classpath. Jetty needs that converted to a URL.", "//(e.g. \"jar:file:/path/to/my.jar!<path>\")", "URL", "url", "=", "JettyServer", ".", "class", ".", "getResource", "(", "path", ")", ";", "if", "(", "url", "!=", "null", ")", "{", "log", ".", "debug", "(", "\"Located {} '{}' on Classpath\"", ",", "name", ",", "path", ")", ";", "return", "url", ".", "toExternalForm", "(", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(", "\"%s '%s' not found\"", ",", "name", ",", "path", ")", ")", ";", "}", "}", "}", "}" ]
Jetty treats non-URL paths are file paths interpreted in the current working directory. Provide ability to accept paths to resources on the Classpath. @param path @param name Descriptive name of what is for. Used in logs, error messages @return Path in a format Jetty will understand, even if it is a Classpath-relative path.
[ "Jetty", "treats", "non", "-", "URL", "paths", "are", "file", "paths", "interpreted", "in", "the", "current", "working", "directory", ".", "Provide", "ability", "to", "accept", "paths", "to", "resources", "on", "the", "Classpath", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-server-parent/pippo-jetty/src/main/java/ro/pippo/jetty/JettyServer.java#L134-L158
aws/aws-sdk-java
aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/model/SendMessageBatchRequestEntry.java
SendMessageBatchRequestEntry.withMessageAttributes
public SendMessageBatchRequestEntry withMessageAttributes(java.util.Map<String, MessageAttributeValue> messageAttributes) { """ <p> Each message attribute consists of a <code>Name</code>, <code>Type</code>, and <code>Value</code>. For more information, see <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html" >Amazon SQS Message Attributes</a> in the <i>Amazon Simple Queue Service Developer Guide</i>. </p> @param messageAttributes Each message attribute consists of a <code>Name</code>, <code>Type</code>, and <code>Value</code>. For more information, see <a href= "http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html" >Amazon SQS Message Attributes</a> in the <i>Amazon Simple Queue Service Developer Guide</i>. @return Returns a reference to this object so that method calls can be chained together. """ setMessageAttributes(messageAttributes); return this; }
java
public SendMessageBatchRequestEntry withMessageAttributes(java.util.Map<String, MessageAttributeValue> messageAttributes) { setMessageAttributes(messageAttributes); return this; }
[ "public", "SendMessageBatchRequestEntry", "withMessageAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "MessageAttributeValue", ">", "messageAttributes", ")", "{", "setMessageAttributes", "(", "messageAttributes", ")", ";", "return", "this", ";", "}" ]
<p> Each message attribute consists of a <code>Name</code>, <code>Type</code>, and <code>Value</code>. For more information, see <a href="http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html" >Amazon SQS Message Attributes</a> in the <i>Amazon Simple Queue Service Developer Guide</i>. </p> @param messageAttributes Each message attribute consists of a <code>Name</code>, <code>Type</code>, and <code>Value</code>. For more information, see <a href= "http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-message-attributes.html" >Amazon SQS Message Attributes</a> in the <i>Amazon Simple Queue Service Developer Guide</i>. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Each", "message", "attribute", "consists", "of", "a", "<code", ">", "Name<", "/", "code", ">", "<code", ">", "Type<", "/", "code", ">", "and", "<code", ">", "Value<", "/", "code", ">", ".", "For", "more", "information", "see", "<a", "href", "=", "http", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "AWSSimpleQueueService", "/", "latest", "/", "SQSDeveloperGuide", "/", "sqs", "-", "message", "-", "attributes", ".", "html", ">", "Amazon", "SQS", "Message", "Attributes<", "/", "a", ">", "in", "the", "<i", ">", "Amazon", "Simple", "Queue", "Service", "Developer", "Guide<", "/", "i", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/model/SendMessageBatchRequestEntry.java#L498-L501
maguro/aunit
junit/src/main/java/com/toolazydogs/aunit/Assert.java
Assert.assertTree
public static void assertTree(String rootText, String preorder, ParseResults parseResults) { """ Asserts a parse tree. @param rootText the text of the root of the tree. @param preorder the preorder traversal of the tree. @param parseResults a helper class """ assertTree(rootText, preorder, parseResults.getTree()); }
java
public static void assertTree(String rootText, String preorder, ParseResults parseResults) { assertTree(rootText, preorder, parseResults.getTree()); }
[ "public", "static", "void", "assertTree", "(", "String", "rootText", ",", "String", "preorder", ",", "ParseResults", "parseResults", ")", "{", "assertTree", "(", "rootText", ",", "preorder", ",", "parseResults", ".", "getTree", "(", ")", ")", ";", "}" ]
Asserts a parse tree. @param rootText the text of the root of the tree. @param preorder the preorder traversal of the tree. @param parseResults a helper class
[ "Asserts", "a", "parse", "tree", "." ]
train
https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/Assert.java#L284-L287
landawn/AbacusUtil
src/com/landawn/abacus/util/BiIterator.java
BiIterator.generate
public static <A, B> BiIterator<A, B> generate(final Consumer<Pair<A, B>> output) { """ Returns an infinite {@code BiIterator}. @param output transfer the next values. @return """ return generate(BooleanSupplier.TRUE, output); }
java
public static <A, B> BiIterator<A, B> generate(final Consumer<Pair<A, B>> output) { return generate(BooleanSupplier.TRUE, output); }
[ "public", "static", "<", "A", ",", "B", ">", "BiIterator", "<", "A", ",", "B", ">", "generate", "(", "final", "Consumer", "<", "Pair", "<", "A", ",", "B", ">", ">", "output", ")", "{", "return", "generate", "(", "BooleanSupplier", ".", "TRUE", ",", "output", ")", ";", "}" ]
Returns an infinite {@code BiIterator}. @param output transfer the next values. @return
[ "Returns", "an", "infinite", "{", "@code", "BiIterator", "}", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/BiIterator.java#L133-L135
samskivert/samskivert
src/main/java/com/samskivert/swing/RadialLabelSausage.java
RadialLabelSausage.layout
public void layout (Graphics2D gfx, Font font) { """ Computes the dimensions of this label based on the specified font and in the specified graphics context. """ _label.setFont(font); layout(gfx, BORDER_THICKNESS); openBounds.width = _size.width; openBounds.height = _size.height; // and closed up, we're just a circle closedBounds.height = closedBounds.width = _size.height; }
java
public void layout (Graphics2D gfx, Font font) { _label.setFont(font); layout(gfx, BORDER_THICKNESS); openBounds.width = _size.width; openBounds.height = _size.height; // and closed up, we're just a circle closedBounds.height = closedBounds.width = _size.height; }
[ "public", "void", "layout", "(", "Graphics2D", "gfx", ",", "Font", "font", ")", "{", "_label", ".", "setFont", "(", "font", ")", ";", "layout", "(", "gfx", ",", "BORDER_THICKNESS", ")", ";", "openBounds", ".", "width", "=", "_size", ".", "width", ";", "openBounds", ".", "height", "=", "_size", ".", "height", ";", "// and closed up, we're just a circle", "closedBounds", ".", "height", "=", "closedBounds", ".", "width", "=", "_size", ".", "height", ";", "}" ]
Computes the dimensions of this label based on the specified font and in the specified graphics context.
[ "Computes", "the", "dimensions", "of", "this", "label", "based", "on", "the", "specified", "font", "and", "in", "the", "specified", "graphics", "context", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/RadialLabelSausage.java#L89-L99
loldevs/riotapi
rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java
ThrottledApiHandler.getLeagueEntries
public Future<List<LeagueItem>> getLeagueEntries(String teamId) { """ Get a listing of all league entries in the team's leagues @param teamId The id of the team @return A list of league entries @see <a href=https://developer.riotgames.com/api/methods#!/593/1861>Official API documentation</a> """ return new ApiFuture<>(() -> handler.getLeagueEntries(teamId)); }
java
public Future<List<LeagueItem>> getLeagueEntries(String teamId) { return new ApiFuture<>(() -> handler.getLeagueEntries(teamId)); }
[ "public", "Future", "<", "List", "<", "LeagueItem", ">", ">", "getLeagueEntries", "(", "String", "teamId", ")", "{", "return", "new", "ApiFuture", "<>", "(", "(", ")", "->", "handler", ".", "getLeagueEntries", "(", "teamId", ")", ")", ";", "}" ]
Get a listing of all league entries in the team's leagues @param teamId The id of the team @return A list of league entries @see <a href=https://developer.riotgames.com/api/methods#!/593/1861>Official API documentation</a>
[ "Get", "a", "listing", "of", "all", "league", "entries", "in", "the", "team", "s", "leagues" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L285-L287
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java
JBBPBitOutputStream.writeLong
public void writeLong(final long value, final JBBPByteOrder byteOrder) throws IOException { """ Write a long value into the output stream. @param value a value to be written into the output stream. @param byteOrder the byte order of the value bytes to be used for writing. @throws IOException it will be thrown for transport errors @see JBBPByteOrder#BIG_ENDIAN @see JBBPByteOrder#LITTLE_ENDIAN """ if (byteOrder == JBBPByteOrder.BIG_ENDIAN) { this.writeInt((int) (value >>> 32), byteOrder); this.writeInt((int) value, byteOrder); } else { this.writeInt((int) value, byteOrder); this.writeInt((int) (value >>> 32), byteOrder); } }
java
public void writeLong(final long value, final JBBPByteOrder byteOrder) throws IOException { if (byteOrder == JBBPByteOrder.BIG_ENDIAN) { this.writeInt((int) (value >>> 32), byteOrder); this.writeInt((int) value, byteOrder); } else { this.writeInt((int) value, byteOrder); this.writeInt((int) (value >>> 32), byteOrder); } }
[ "public", "void", "writeLong", "(", "final", "long", "value", ",", "final", "JBBPByteOrder", "byteOrder", ")", "throws", "IOException", "{", "if", "(", "byteOrder", "==", "JBBPByteOrder", ".", "BIG_ENDIAN", ")", "{", "this", ".", "writeInt", "(", "(", "int", ")", "(", "value", ">>>", "32", ")", ",", "byteOrder", ")", ";", "this", ".", "writeInt", "(", "(", "int", ")", "value", ",", "byteOrder", ")", ";", "}", "else", "{", "this", ".", "writeInt", "(", "(", "int", ")", "value", ",", "byteOrder", ")", ";", "this", ".", "writeInt", "(", "(", "int", ")", "(", "value", ">>>", "32", ")", ",", "byteOrder", ")", ";", "}", "}" ]
Write a long value into the output stream. @param value a value to be written into the output stream. @param byteOrder the byte order of the value bytes to be used for writing. @throws IOException it will be thrown for transport errors @see JBBPByteOrder#BIG_ENDIAN @see JBBPByteOrder#LITTLE_ENDIAN
[ "Write", "a", "long", "value", "into", "the", "output", "stream", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPBitOutputStream.java#L151-L159
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions.java
EscapedFunctions.sqlcurdate
public static String sqlcurdate(List<?> parsedArgs) throws SQLException { """ curdate to current_date translation. @param parsedArgs arguments @return sql call @throws SQLException if something wrong happens """ if (!parsedArgs.isEmpty()) { throw new PSQLException(GT.tr("{0} function doesn''t take any argument.", "curdate"), PSQLState.SYNTAX_ERROR); } return "current_date"; }
java
public static String sqlcurdate(List<?> parsedArgs) throws SQLException { if (!parsedArgs.isEmpty()) { throw new PSQLException(GT.tr("{0} function doesn''t take any argument.", "curdate"), PSQLState.SYNTAX_ERROR); } return "current_date"; }
[ "public", "static", "String", "sqlcurdate", "(", "List", "<", "?", ">", "parsedArgs", ")", "throws", "SQLException", "{", "if", "(", "!", "parsedArgs", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "PSQLException", "(", "GT", ".", "tr", "(", "\"{0} function doesn''t take any argument.\"", ",", "\"curdate\"", ")", ",", "PSQLState", ".", "SYNTAX_ERROR", ")", ";", "}", "return", "\"current_date\"", ";", "}" ]
curdate to current_date translation. @param parsedArgs arguments @return sql call @throws SQLException if something wrong happens
[ "curdate", "to", "current_date", "translation", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions.java#L407-L413
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRuleParser.java
CollationRuleParser.parseSpecialPosition
private int parseSpecialPosition(int i, StringBuilder str) throws ParseException { """ Sets str to a contraction of U+FFFE and (U+2800 + Position). @return rule index after the special reset position @throws ParseException """ int j = readWords(i + 1, rawBuilder); if(j > i && rules.charAt(j) == 0x5d && rawBuilder.length() != 0) { // words end with ] ++j; String raw = rawBuilder.toString(); str.setLength(0); for(int pos = 0; pos < positions.length; ++pos) { if(raw.equals(positions[pos])) { str.append(POS_LEAD).append((char)(POS_BASE + pos)); return j; } } if(raw.equals("top")) { str.append(POS_LEAD).append((char)(POS_BASE + Position.LAST_REGULAR.ordinal())); return j; } if(raw.equals("variable top")) { str.append(POS_LEAD).append((char)(POS_BASE + Position.LAST_VARIABLE.ordinal())); return j; } } setParseError("not a valid special reset position"); return i; }
java
private int parseSpecialPosition(int i, StringBuilder str) throws ParseException { int j = readWords(i + 1, rawBuilder); if(j > i && rules.charAt(j) == 0x5d && rawBuilder.length() != 0) { // words end with ] ++j; String raw = rawBuilder.toString(); str.setLength(0); for(int pos = 0; pos < positions.length; ++pos) { if(raw.equals(positions[pos])) { str.append(POS_LEAD).append((char)(POS_BASE + pos)); return j; } } if(raw.equals("top")) { str.append(POS_LEAD).append((char)(POS_BASE + Position.LAST_REGULAR.ordinal())); return j; } if(raw.equals("variable top")) { str.append(POS_LEAD).append((char)(POS_BASE + Position.LAST_VARIABLE.ordinal())); return j; } } setParseError("not a valid special reset position"); return i; }
[ "private", "int", "parseSpecialPosition", "(", "int", "i", ",", "StringBuilder", "str", ")", "throws", "ParseException", "{", "int", "j", "=", "readWords", "(", "i", "+", "1", ",", "rawBuilder", ")", ";", "if", "(", "j", ">", "i", "&&", "rules", ".", "charAt", "(", "j", ")", "==", "0x5d", "&&", "rawBuilder", ".", "length", "(", ")", "!=", "0", ")", "{", "// words end with ]", "++", "j", ";", "String", "raw", "=", "rawBuilder", ".", "toString", "(", ")", ";", "str", ".", "setLength", "(", "0", ")", ";", "for", "(", "int", "pos", "=", "0", ";", "pos", "<", "positions", ".", "length", ";", "++", "pos", ")", "{", "if", "(", "raw", ".", "equals", "(", "positions", "[", "pos", "]", ")", ")", "{", "str", ".", "append", "(", "POS_LEAD", ")", ".", "append", "(", "(", "char", ")", "(", "POS_BASE", "+", "pos", ")", ")", ";", "return", "j", ";", "}", "}", "if", "(", "raw", ".", "equals", "(", "\"top\"", ")", ")", "{", "str", ".", "append", "(", "POS_LEAD", ")", ".", "append", "(", "(", "char", ")", "(", "POS_BASE", "+", "Position", ".", "LAST_REGULAR", ".", "ordinal", "(", ")", ")", ")", ";", "return", "j", ";", "}", "if", "(", "raw", ".", "equals", "(", "\"variable top\"", ")", ")", "{", "str", ".", "append", "(", "POS_LEAD", ")", ".", "append", "(", "(", "char", ")", "(", "POS_BASE", "+", "Position", ".", "LAST_VARIABLE", ".", "ordinal", "(", ")", ")", ")", ";", "return", "j", ";", "}", "}", "setParseError", "(", "\"not a valid special reset position\"", ")", ";", "return", "i", ";", "}" ]
Sets str to a contraction of U+FFFE and (U+2800 + Position). @return rule index after the special reset position @throws ParseException
[ "Sets", "str", "to", "a", "contraction", "of", "U", "+", "FFFE", "and", "(", "U", "+", "2800", "+", "Position", ")", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRuleParser.java#L501-L524
UrielCh/ovh-java-sdk
ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java
ApiOvhHorizonView.serviceName_customerNetwork_customerNetworkId_DELETE
public ArrayList<OvhTask> serviceName_customerNetwork_customerNetworkId_DELETE(String serviceName, Long customerNetworkId) throws IOException { """ Delete this Customer Network REST: DELETE /horizonView/{serviceName}/customerNetwork/{customerNetworkId} @param serviceName [required] Domain of the service @param customerNetworkId [required] Customer Network id """ String qPath = "/horizonView/{serviceName}/customerNetwork/{customerNetworkId}"; StringBuilder sb = path(qPath, serviceName, customerNetworkId); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<OvhTask> serviceName_customerNetwork_customerNetworkId_DELETE(String serviceName, Long customerNetworkId) throws IOException { String qPath = "/horizonView/{serviceName}/customerNetwork/{customerNetworkId}"; StringBuilder sb = path(qPath, serviceName, customerNetworkId); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "OvhTask", ">", "serviceName_customerNetwork_customerNetworkId_DELETE", "(", "String", "serviceName", ",", "Long", "customerNetworkId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/horizonView/{serviceName}/customerNetwork/{customerNetworkId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "customerNetworkId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t2", ")", ";", "}" ]
Delete this Customer Network REST: DELETE /horizonView/{serviceName}/customerNetwork/{customerNetworkId} @param serviceName [required] Domain of the service @param customerNetworkId [required] Customer Network id
[ "Delete", "this", "Customer", "Network" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java#L445-L450
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/memory/MemoryRemoteTable.java
MemoryRemoteTable.doRemoteAction
public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException { """ Do a remote action. Not implemented. @param strCommand Command to perform remotely. @param properties Properties for this command (optional). @return boolean success. """ return null; // Not supported }
java
public Object doRemoteAction(String strCommand, Map<String, Object> properties) throws DBException, RemoteException { return null; // Not supported }
[ "public", "Object", "doRemoteAction", "(", "String", "strCommand", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "DBException", ",", "RemoteException", "{", "return", "null", ";", "// Not supported", "}" ]
Do a remote action. Not implemented. @param strCommand Command to perform remotely. @param properties Properties for this command (optional). @return boolean success.
[ "Do", "a", "remote", "action", ".", "Not", "implemented", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/memory/MemoryRemoteTable.java#L304-L307
prestodb/presto
presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java
AccumuloClient.renameIndexTables
private void renameIndexTables(AccumuloTable oldTable, AccumuloTable newTable) { """ Renames the index tables (if applicable) for the old table to the new table. @param oldTable Old AccumuloTable @param newTable New AccumuloTable """ if (!oldTable.isIndexed()) { return; } if (!tableManager.exists(oldTable.getIndexTableName())) { throw new PrestoException(ACCUMULO_TABLE_DNE, format("Table %s does not exist", oldTable.getIndexTableName())); } if (tableManager.exists(newTable.getIndexTableName())) { throw new PrestoException(ACCUMULO_TABLE_EXISTS, format("Table %s already exists", newTable.getIndexTableName())); } if (!tableManager.exists(oldTable.getMetricsTableName())) { throw new PrestoException(ACCUMULO_TABLE_DNE, format("Table %s does not exist", oldTable.getMetricsTableName())); } if (tableManager.exists(newTable.getMetricsTableName())) { throw new PrestoException(ACCUMULO_TABLE_EXISTS, format("Table %s already exists", newTable.getMetricsTableName())); } tableManager.renameAccumuloTable(oldTable.getIndexTableName(), newTable.getIndexTableName()); tableManager.renameAccumuloTable(oldTable.getMetricsTableName(), newTable.getMetricsTableName()); }
java
private void renameIndexTables(AccumuloTable oldTable, AccumuloTable newTable) { if (!oldTable.isIndexed()) { return; } if (!tableManager.exists(oldTable.getIndexTableName())) { throw new PrestoException(ACCUMULO_TABLE_DNE, format("Table %s does not exist", oldTable.getIndexTableName())); } if (tableManager.exists(newTable.getIndexTableName())) { throw new PrestoException(ACCUMULO_TABLE_EXISTS, format("Table %s already exists", newTable.getIndexTableName())); } if (!tableManager.exists(oldTable.getMetricsTableName())) { throw new PrestoException(ACCUMULO_TABLE_DNE, format("Table %s does not exist", oldTable.getMetricsTableName())); } if (tableManager.exists(newTable.getMetricsTableName())) { throw new PrestoException(ACCUMULO_TABLE_EXISTS, format("Table %s already exists", newTable.getMetricsTableName())); } tableManager.renameAccumuloTable(oldTable.getIndexTableName(), newTable.getIndexTableName()); tableManager.renameAccumuloTable(oldTable.getMetricsTableName(), newTable.getMetricsTableName()); }
[ "private", "void", "renameIndexTables", "(", "AccumuloTable", "oldTable", ",", "AccumuloTable", "newTable", ")", "{", "if", "(", "!", "oldTable", ".", "isIndexed", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "tableManager", ".", "exists", "(", "oldTable", ".", "getIndexTableName", "(", ")", ")", ")", "{", "throw", "new", "PrestoException", "(", "ACCUMULO_TABLE_DNE", ",", "format", "(", "\"Table %s does not exist\"", ",", "oldTable", ".", "getIndexTableName", "(", ")", ")", ")", ";", "}", "if", "(", "tableManager", ".", "exists", "(", "newTable", ".", "getIndexTableName", "(", ")", ")", ")", "{", "throw", "new", "PrestoException", "(", "ACCUMULO_TABLE_EXISTS", ",", "format", "(", "\"Table %s already exists\"", ",", "newTable", ".", "getIndexTableName", "(", ")", ")", ")", ";", "}", "if", "(", "!", "tableManager", ".", "exists", "(", "oldTable", ".", "getMetricsTableName", "(", ")", ")", ")", "{", "throw", "new", "PrestoException", "(", "ACCUMULO_TABLE_DNE", ",", "format", "(", "\"Table %s does not exist\"", ",", "oldTable", ".", "getMetricsTableName", "(", ")", ")", ")", ";", "}", "if", "(", "tableManager", ".", "exists", "(", "newTable", ".", "getMetricsTableName", "(", ")", ")", ")", "{", "throw", "new", "PrestoException", "(", "ACCUMULO_TABLE_EXISTS", ",", "format", "(", "\"Table %s already exists\"", ",", "newTable", ".", "getMetricsTableName", "(", ")", ")", ")", ";", "}", "tableManager", ".", "renameAccumuloTable", "(", "oldTable", ".", "getIndexTableName", "(", ")", ",", "newTable", ".", "getIndexTableName", "(", ")", ")", ";", "tableManager", ".", "renameAccumuloTable", "(", "oldTable", ".", "getMetricsTableName", "(", ")", ",", "newTable", ".", "getMetricsTableName", "(", ")", ")", ";", "}" ]
Renames the index tables (if applicable) for the old table to the new table. @param oldTable Old AccumuloTable @param newTable New AccumuloTable
[ "Renames", "the", "index", "tables", "(", "if", "applicable", ")", "for", "the", "old", "table", "to", "the", "new", "table", "." ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-accumulo/src/main/java/com/facebook/presto/accumulo/AccumuloClient.java#L515-L539
apereo/cas
support/cas-server-support-scim/src/main/java/org/apereo/cas/scim/v2/ScimV2PrincipalProvisioner.java
ScimV2PrincipalProvisioner.createUserResource
@SneakyThrows protected boolean createUserResource(final Principal p, final Credential credential) { """ Create user resource boolean. @param p the p @param credential the credential @return the boolean """ val user = new UserResource(); this.mapper.map(user, p, credential); return scimService.create("Users", user) != null; }
java
@SneakyThrows protected boolean createUserResource(final Principal p, final Credential credential) { val user = new UserResource(); this.mapper.map(user, p, credential); return scimService.create("Users", user) != null; }
[ "@", "SneakyThrows", "protected", "boolean", "createUserResource", "(", "final", "Principal", "p", ",", "final", "Credential", "credential", ")", "{", "val", "user", "=", "new", "UserResource", "(", ")", ";", "this", ".", "mapper", ".", "map", "(", "user", ",", "p", ",", "credential", ")", ";", "return", "scimService", ".", "create", "(", "\"Users\"", ",", "user", ")", "!=", "null", ";", "}" ]
Create user resource boolean. @param p the p @param credential the credential @return the boolean
[ "Create", "user", "resource", "boolean", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-scim/src/main/java/org/apereo/cas/scim/v2/ScimV2PrincipalProvisioner.java#L90-L95
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarZKShell.java
AvatarZKShell.updateZooKeeper
public void updateZooKeeper(boolean force, boolean toOverwrite, String serviceName, String primary) throws IOException { """ /* This method tries to update the information in ZooKeeper For every address of the NameNode it is being run for (fs.default.name, dfs.namenode.dn-address, dfs.namenode.http.address) if they are present. It also creates information for aliases in ZooKeeper for lists of strings in fs.default.name.aliases, dfs.namenode.dn-address.aliases and dfs.namenode.http.address.aliases Each address it transformed to the address of the zNode to be created by substituting all . and : characters to /. The slash is also added in the front to make it a valid zNode address. So dfs.domain.com:9000 will be /dfs/domain/com/9000 If any part of the path does not exist it is created automatically """ if (!force) { initAvatarRPC(); Avatar avatar = avatarnode.getAvatar(); if (avatar != Avatar.ACTIVE) { throw new IOException( "Cannot update ZooKeeper information to point to " + "the AvatarNode in Standby mode"); } } AvatarNodeZkUtil.updateZooKeeper(originalConf, conf, toOverwrite, serviceName, primary); }
java
public void updateZooKeeper(boolean force, boolean toOverwrite, String serviceName, String primary) throws IOException { if (!force) { initAvatarRPC(); Avatar avatar = avatarnode.getAvatar(); if (avatar != Avatar.ACTIVE) { throw new IOException( "Cannot update ZooKeeper information to point to " + "the AvatarNode in Standby mode"); } } AvatarNodeZkUtil.updateZooKeeper(originalConf, conf, toOverwrite, serviceName, primary); }
[ "public", "void", "updateZooKeeper", "(", "boolean", "force", ",", "boolean", "toOverwrite", ",", "String", "serviceName", ",", "String", "primary", ")", "throws", "IOException", "{", "if", "(", "!", "force", ")", "{", "initAvatarRPC", "(", ")", ";", "Avatar", "avatar", "=", "avatarnode", ".", "getAvatar", "(", ")", ";", "if", "(", "avatar", "!=", "Avatar", ".", "ACTIVE", ")", "{", "throw", "new", "IOException", "(", "\"Cannot update ZooKeeper information to point to \"", "+", "\"the AvatarNode in Standby mode\"", ")", ";", "}", "}", "AvatarNodeZkUtil", ".", "updateZooKeeper", "(", "originalConf", ",", "conf", ",", "toOverwrite", ",", "serviceName", ",", "primary", ")", ";", "}" ]
/* This method tries to update the information in ZooKeeper For every address of the NameNode it is being run for (fs.default.name, dfs.namenode.dn-address, dfs.namenode.http.address) if they are present. It also creates information for aliases in ZooKeeper for lists of strings in fs.default.name.aliases, dfs.namenode.dn-address.aliases and dfs.namenode.http.address.aliases Each address it transformed to the address of the zNode to be created by substituting all . and : characters to /. The slash is also added in the front to make it a valid zNode address. So dfs.domain.com:9000 will be /dfs/domain/com/9000 If any part of the path does not exist it is created automatically
[ "/", "*", "This", "method", "tries", "to", "update", "the", "information", "in", "ZooKeeper", "For", "every", "address", "of", "the", "NameNode", "it", "is", "being", "run", "for", "(", "fs", ".", "default", ".", "name", "dfs", ".", "namenode", ".", "dn", "-", "address", "dfs", ".", "namenode", ".", "http", ".", "address", ")", "if", "they", "are", "present", ".", "It", "also", "creates", "information", "for", "aliases", "in", "ZooKeeper", "for", "lists", "of", "strings", "in", "fs", ".", "default", ".", "name", ".", "aliases", "dfs", ".", "namenode", ".", "dn", "-", "address", ".", "aliases", "and", "dfs", ".", "namenode", ".", "http", ".", "address", ".", "aliases" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/AvatarZKShell.java#L373-L385
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java
TwitterEndpointServices.createAuthorizationHeaderString
public String createAuthorizationHeaderString(Map<String, String> parameters) { """ Per {@link https://dev.twitter.com/oauth/overview/authorizing-requests}, the authorization header for requests must be built the following way: <ol type="1"> <li>Append the string "OAuth " (including the space at the end) to DST.</li> <li>For each key/value pair of the 7 parameters* listed below: <ol type="a"> <li>Percent encode the key and append it to DST.</li> <li>Append the equals character '=' to DST.</li> <li>Append a double quote '"' to DST.</li> <li>Percent encode the value and append it to DST.</li> <li>Append a double quote '"' to DST.</li> <li>If there are key/value pairs remaining, append a comma ',' and a space ' ' to DST.</li> </ol> </li> </ol> *The seven parameters are: oauth_consumer_key, oauth_nonce, oauth_signature, oauth_signature_method, oauth_timestamp, oauth_token, and oauth_version. Note: The oauth_token parameter may be omitted in some flows. Generally this value will be an access token. @param parameters Raw parameter names and values, not percent encoded. This method will perform the percent encoding. @return """ StringBuilder authzHeaderString = new StringBuilder(); // Step 1: Append "OAuth " authzHeaderString.append("OAuth "); if (parameters == null) { return authzHeaderString.toString(); } // Sort parameter names alphabetically List<String> sortedKeys = new ArrayList<String>(); sortedKeys.addAll(parameters.keySet()); Collections.sort(sortedKeys); // Determines whether a param was already added to the string, and therefore whether to prepend ", " to delineate the params boolean isParamAlreadyPresent = false; for (String key : sortedKeys) { // Step 2: Go through each of the seven expected parameters if (!TwitterConstants.AUTHZ_HEADER_PARAMS.contains(key)) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Skipping unexpected parameter: " + key); } continue; } if (isParamAlreadyPresent) { // Step 2f: Another non-ignored parameter was previously appended, so append ", " to the output string authzHeaderString.append(", "); } // Steps 2a-2e String value = parameters.get(key); String encodedKey = Utils.percentEncode(key); String encodedValue = Utils.percentEncode(value); authzHeaderString.append(encodedKey).append("=\"").append(encodedValue).append("\""); isParamAlreadyPresent = true; } return authzHeaderString.toString(); }
java
public String createAuthorizationHeaderString(Map<String, String> parameters) { StringBuilder authzHeaderString = new StringBuilder(); // Step 1: Append "OAuth " authzHeaderString.append("OAuth "); if (parameters == null) { return authzHeaderString.toString(); } // Sort parameter names alphabetically List<String> sortedKeys = new ArrayList<String>(); sortedKeys.addAll(parameters.keySet()); Collections.sort(sortedKeys); // Determines whether a param was already added to the string, and therefore whether to prepend ", " to delineate the params boolean isParamAlreadyPresent = false; for (String key : sortedKeys) { // Step 2: Go through each of the seven expected parameters if (!TwitterConstants.AUTHZ_HEADER_PARAMS.contains(key)) { if (tc.isDebugEnabled()) { Tr.debug(tc, "Skipping unexpected parameter: " + key); } continue; } if (isParamAlreadyPresent) { // Step 2f: Another non-ignored parameter was previously appended, so append ", " to the output string authzHeaderString.append(", "); } // Steps 2a-2e String value = parameters.get(key); String encodedKey = Utils.percentEncode(key); String encodedValue = Utils.percentEncode(value); authzHeaderString.append(encodedKey).append("=\"").append(encodedValue).append("\""); isParamAlreadyPresent = true; } return authzHeaderString.toString(); }
[ "public", "String", "createAuthorizationHeaderString", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "StringBuilder", "authzHeaderString", "=", "new", "StringBuilder", "(", ")", ";", "// Step 1: Append \"OAuth \"", "authzHeaderString", ".", "append", "(", "\"OAuth \"", ")", ";", "if", "(", "parameters", "==", "null", ")", "{", "return", "authzHeaderString", ".", "toString", "(", ")", ";", "}", "// Sort parameter names alphabetically", "List", "<", "String", ">", "sortedKeys", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "sortedKeys", ".", "addAll", "(", "parameters", ".", "keySet", "(", ")", ")", ";", "Collections", ".", "sort", "(", "sortedKeys", ")", ";", "// Determines whether a param was already added to the string, and therefore whether to prepend \", \" to delineate the params", "boolean", "isParamAlreadyPresent", "=", "false", ";", "for", "(", "String", "key", ":", "sortedKeys", ")", "{", "// Step 2: Go through each of the seven expected parameters", "if", "(", "!", "TwitterConstants", ".", "AUTHZ_HEADER_PARAMS", ".", "contains", "(", "key", ")", ")", "{", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Skipping unexpected parameter: \"", "+", "key", ")", ";", "}", "continue", ";", "}", "if", "(", "isParamAlreadyPresent", ")", "{", "// Step 2f: Another non-ignored parameter was previously appended, so append \", \" to the output string", "authzHeaderString", ".", "append", "(", "\", \"", ")", ";", "}", "// Steps 2a-2e", "String", "value", "=", "parameters", ".", "get", "(", "key", ")", ";", "String", "encodedKey", "=", "Utils", ".", "percentEncode", "(", "key", ")", ";", "String", "encodedValue", "=", "Utils", ".", "percentEncode", "(", "value", ")", ";", "authzHeaderString", ".", "append", "(", "encodedKey", ")", ".", "append", "(", "\"=\\\"\"", ")", ".", "append", "(", "encodedValue", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "isParamAlreadyPresent", "=", "true", ";", "}", "return", "authzHeaderString", ".", "toString", "(", ")", ";", "}" ]
Per {@link https://dev.twitter.com/oauth/overview/authorizing-requests}, the authorization header for requests must be built the following way: <ol type="1"> <li>Append the string "OAuth " (including the space at the end) to DST.</li> <li>For each key/value pair of the 7 parameters* listed below: <ol type="a"> <li>Percent encode the key and append it to DST.</li> <li>Append the equals character '=' to DST.</li> <li>Append a double quote '"' to DST.</li> <li>Percent encode the value and append it to DST.</li> <li>Append a double quote '"' to DST.</li> <li>If there are key/value pairs remaining, append a comma ',' and a space ' ' to DST.</li> </ol> </li> </ol> *The seven parameters are: oauth_consumer_key, oauth_nonce, oauth_signature, oauth_signature_method, oauth_timestamp, oauth_token, and oauth_version. Note: The oauth_token parameter may be omitted in some flows. Generally this value will be an access token. @param parameters Raw parameter names and values, not percent encoded. This method will perform the percent encoding. @return
[ "Per", "{", "@link", "https", ":", "//", "dev", ".", "twitter", ".", "com", "/", "oauth", "/", "overview", "/", "authorizing", "-", "requests", "}", "the", "authorization", "header", "for", "requests", "must", "be", "built", "the", "following", "way", ":", "<ol", "type", "=", "1", ">", "<li", ">", "Append", "the", "string", "OAuth", "(", "including", "the", "space", "at", "the", "end", ")", "to", "DST", ".", "<", "/", "li", ">", "<li", ">", "For", "each", "key", "/", "value", "pair", "of", "the", "7", "parameters", "*", "listed", "below", ":", "<ol", "type", "=", "a", ">", "<li", ">", "Percent", "encode", "the", "key", "and", "append", "it", "to", "DST", ".", "<", "/", "li", ">", "<li", ">", "Append", "the", "equals", "character", "=", "to", "DST", ".", "<", "/", "li", ">", "<li", ">", "Append", "a", "double", "quote", "to", "DST", ".", "<", "/", "li", ">", "<li", ">", "Percent", "encode", "the", "value", "and", "append", "it", "to", "DST", ".", "<", "/", "li", ">", "<li", ">", "Append", "a", "double", "quote", "to", "DST", ".", "<", "/", "li", ">", "<li", ">", "If", "there", "are", "key", "/", "value", "pairs", "remaining", "append", "a", "comma", "and", "a", "space", "to", "DST", ".", "<", "/", "li", ">", "<", "/", "ol", ">", "<", "/", "li", ">", "<", "/", "ol", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L320-L361
gallandarakhneorg/afc
core/text/src/main/java/org/arakhne/afc/text/TextUtil.java
TextUtil.splitBrackets
@Pure @Inline(value = "textUtil.split(' { """ Split the given string according to brackets. The brackets are used to delimit the groups of characters. <p>Examples: <ul> <li><code>splitBrackets("{a}{b}{cd}")</code> returns the array <code>["a","b","cd"]</code></li> <li><code>splitBrackets("abcd")</code> returns the array <code>["abcd"]</code></li> <li><code>splitBrackets("a{bcd")</code> returns the array <code>["a","bcd"]</code></li> </ul> @param str is the strig with brackets. @return the groups of strings """', '}', $1)", imported = {TextUtil.class}) public static String[] splitBrackets(String str) { return split('{', '}', str); }
java
@Pure @Inline(value = "textUtil.split('{', '}', $1)", imported = {TextUtil.class}) public static String[] splitBrackets(String str) { return split('{', '}', str); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"textUtil.split('{', '}', $1)\"", ",", "imported", "=", "{", "TextUtil", ".", "class", "}", ")", "public", "static", "String", "[", "]", "splitBrackets", "(", "String", "str", ")", "{", "return", "split", "(", "'", "'", ",", "'", "'", ",", "str", ")", ";", "}" ]
Split the given string according to brackets. The brackets are used to delimit the groups of characters. <p>Examples: <ul> <li><code>splitBrackets("{a}{b}{cd}")</code> returns the array <code>["a","b","cd"]</code></li> <li><code>splitBrackets("abcd")</code> returns the array <code>["abcd"]</code></li> <li><code>splitBrackets("a{bcd")</code> returns the array <code>["a","bcd"]</code></li> </ul> @param str is the strig with brackets. @return the groups of strings
[ "Split", "the", "given", "string", "according", "to", "brackets", ".", "The", "brackets", "are", "used", "to", "delimit", "the", "groups", "of", "characters", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L613-L617
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.appendHavingClause
protected void appendHavingClause(StringBuffer having, Criteria crit, StringBuffer stmt) { """ appends a HAVING-clause to the Statement @param having @param crit @param stmt """ if (having.length() == 0) { having = null; } if (having != null || crit != null) { stmt.append(" HAVING "); appendClause(having, crit, stmt); } }
java
protected void appendHavingClause(StringBuffer having, Criteria crit, StringBuffer stmt) { if (having.length() == 0) { having = null; } if (having != null || crit != null) { stmt.append(" HAVING "); appendClause(having, crit, stmt); } }
[ "protected", "void", "appendHavingClause", "(", "StringBuffer", "having", ",", "Criteria", "crit", ",", "StringBuffer", "stmt", ")", "{", "if", "(", "having", ".", "length", "(", ")", "==", "0", ")", "{", "having", "=", "null", ";", "}", "if", "(", "having", "!=", "null", "||", "crit", "!=", "null", ")", "{", "stmt", ".", "append", "(", "\" HAVING \"", ")", ";", "appendClause", "(", "having", ",", "crit", ",", "stmt", ")", ";", "}", "}" ]
appends a HAVING-clause to the Statement @param having @param crit @param stmt
[ "appends", "a", "HAVING", "-", "clause", "to", "the", "Statement" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L561-L573
haraldk/TwelveMonkeys
imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java
PICTUtil.readRGBColor
public static Color readRGBColor(final DataInput pStream) throws IOException { """ /* http://developer.apple.com/DOCUMENTATION/mac/QuickDraw/QuickDraw-269.html#HEADING269-11 RGBColor = RECORD red: Integer; {red component} green: Integer; {green component} blue: Integer; {blue component} END; """ short r = pStream.readShort(); short g = pStream.readShort(); short b = pStream.readShort(); return new RGBColor(r, g, b); }
java
public static Color readRGBColor(final DataInput pStream) throws IOException { short r = pStream.readShort(); short g = pStream.readShort(); short b = pStream.readShort(); return new RGBColor(r, g, b); }
[ "public", "static", "Color", "readRGBColor", "(", "final", "DataInput", "pStream", ")", "throws", "IOException", "{", "short", "r", "=", "pStream", ".", "readShort", "(", ")", ";", "short", "g", "=", "pStream", ".", "readShort", "(", ")", ";", "short", "b", "=", "pStream", ".", "readShort", "(", ")", ";", "return", "new", "RGBColor", "(", "r", ",", "g", ",", "b", ")", ";", "}" ]
/* http://developer.apple.com/DOCUMENTATION/mac/QuickDraw/QuickDraw-269.html#HEADING269-11 RGBColor = RECORD red: Integer; {red component} green: Integer; {green component} blue: Integer; {blue component} END;
[ "/", "*", "http", ":", "//", "developer", ".", "apple", ".", "com", "/", "DOCUMENTATION", "/", "mac", "/", "QuickDraw", "/", "QuickDraw", "-", "269", ".", "html#HEADING269", "-", "11", "RGBColor", "=", "RECORD", "red", ":", "Integer", ";", "{", "red", "component", "}", "green", ":", "Integer", ";", "{", "green", "component", "}", "blue", ":", "Integer", ";", "{", "blue", "component", "}", "END", ";" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-pict/src/main/java/com/twelvemonkeys/imageio/plugins/pict/PICTUtil.java#L223-L229
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShippingMethodPersistenceImpl.java
CommerceShippingMethodPersistenceImpl.findByG_E
@Override public CommerceShippingMethod findByG_E(long groupId, String engineKey) throws NoSuchShippingMethodException { """ Returns the commerce shipping method where groupId = &#63; and engineKey = &#63; or throws a {@link NoSuchShippingMethodException} if it could not be found. @param groupId the group ID @param engineKey the engine key @return the matching commerce shipping method @throws NoSuchShippingMethodException if a matching commerce shipping method could not be found """ CommerceShippingMethod commerceShippingMethod = fetchByG_E(groupId, engineKey); if (commerceShippingMethod == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", engineKey="); msg.append(engineKey); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchShippingMethodException(msg.toString()); } return commerceShippingMethod; }
java
@Override public CommerceShippingMethod findByG_E(long groupId, String engineKey) throws NoSuchShippingMethodException { CommerceShippingMethod commerceShippingMethod = fetchByG_E(groupId, engineKey); if (commerceShippingMethod == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", engineKey="); msg.append(engineKey); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchShippingMethodException(msg.toString()); } return commerceShippingMethod; }
[ "@", "Override", "public", "CommerceShippingMethod", "findByG_E", "(", "long", "groupId", ",", "String", "engineKey", ")", "throws", "NoSuchShippingMethodException", "{", "CommerceShippingMethod", "commerceShippingMethod", "=", "fetchByG_E", "(", "groupId", ",", "engineKey", ")", ";", "if", "(", "commerceShippingMethod", "==", "null", ")", "{", "StringBundler", "msg", "=", "new", "StringBundler", "(", "6", ")", ";", "msg", ".", "append", "(", "_NO_SUCH_ENTITY_WITH_KEY", ")", ";", "msg", ".", "append", "(", "\"groupId=\"", ")", ";", "msg", ".", "append", "(", "groupId", ")", ";", "msg", ".", "append", "(", "\", engineKey=\"", ")", ";", "msg", ".", "append", "(", "engineKey", ")", ";", "msg", ".", "append", "(", "\"}\"", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "throw", "new", "NoSuchShippingMethodException", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "return", "commerceShippingMethod", ";", "}" ]
Returns the commerce shipping method where groupId = &#63; and engineKey = &#63; or throws a {@link NoSuchShippingMethodException} if it could not be found. @param groupId the group ID @param engineKey the engine key @return the matching commerce shipping method @throws NoSuchShippingMethodException if a matching commerce shipping method could not be found
[ "Returns", "the", "commerce", "shipping", "method", "where", "groupId", "=", "&#63", ";", "and", "engineKey", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchShippingMethodException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShippingMethodPersistenceImpl.java#L625-L652
demidenko05/beigesoft-accounting
src/main/java/org/beigesoft/accounting/processor/PrcManufactureSave.java
PrcManufactureSave.makeOtherEntries
@Override public final void makeOtherEntries(final Map<String, Object> pAddParam, final Manufacture pEntity, final IRequestData pRequestData, final boolean pIsNew) throws Exception { """ <p>Make other entries include reversing if it's need when save.</p> @param pAddParam additional param @param pEntity entity @param pRequestData Request Data @param pIsNew if entity was new @throws Exception - an exception """ //always new ManufactureForDraw manufactureForDraw = new ManufactureForDraw(pEntity); if (pEntity.getReversedId() != null) { //reverse draw product in process from warehouse getSrvWarehouseEntry().reverseDraw(pAddParam, manufactureForDraw); //reverse draw product in process from manufacturing process useMaterialReverse(pAddParam, pEntity); //reverse acc.entries already done } else { //draw product in process from warehouse getSrvWarehouseEntry().withdrawal(pAddParam, manufactureForDraw, pEntity.getWarehouseSiteFo()); //draw product in process from manufacturing process useMaterial(pAddParam, pEntity); //it will update this doc: getSrvAccEntry().makeEntries(pAddParam, pEntity); } //load(put) or reverse product or created material on warehouse getSrvWarehouseEntry().load(pAddParam, pEntity, pEntity.getWarehouseSite()); }
java
@Override public final void makeOtherEntries(final Map<String, Object> pAddParam, final Manufacture pEntity, final IRequestData pRequestData, final boolean pIsNew) throws Exception { //always new ManufactureForDraw manufactureForDraw = new ManufactureForDraw(pEntity); if (pEntity.getReversedId() != null) { //reverse draw product in process from warehouse getSrvWarehouseEntry().reverseDraw(pAddParam, manufactureForDraw); //reverse draw product in process from manufacturing process useMaterialReverse(pAddParam, pEntity); //reverse acc.entries already done } else { //draw product in process from warehouse getSrvWarehouseEntry().withdrawal(pAddParam, manufactureForDraw, pEntity.getWarehouseSiteFo()); //draw product in process from manufacturing process useMaterial(pAddParam, pEntity); //it will update this doc: getSrvAccEntry().makeEntries(pAddParam, pEntity); } //load(put) or reverse product or created material on warehouse getSrvWarehouseEntry().load(pAddParam, pEntity, pEntity.getWarehouseSite()); }
[ "@", "Override", "public", "final", "void", "makeOtherEntries", "(", "final", "Map", "<", "String", ",", "Object", ">", "pAddParam", ",", "final", "Manufacture", "pEntity", ",", "final", "IRequestData", "pRequestData", ",", "final", "boolean", "pIsNew", ")", "throws", "Exception", "{", "//always new", "ManufactureForDraw", "manufactureForDraw", "=", "new", "ManufactureForDraw", "(", "pEntity", ")", ";", "if", "(", "pEntity", ".", "getReversedId", "(", ")", "!=", "null", ")", "{", "//reverse draw product in process from warehouse", "getSrvWarehouseEntry", "(", ")", ".", "reverseDraw", "(", "pAddParam", ",", "manufactureForDraw", ")", ";", "//reverse draw product in process from manufacturing process", "useMaterialReverse", "(", "pAddParam", ",", "pEntity", ")", ";", "//reverse acc.entries already done", "}", "else", "{", "//draw product in process from warehouse", "getSrvWarehouseEntry", "(", ")", ".", "withdrawal", "(", "pAddParam", ",", "manufactureForDraw", ",", "pEntity", ".", "getWarehouseSiteFo", "(", ")", ")", ";", "//draw product in process from manufacturing process", "useMaterial", "(", "pAddParam", ",", "pEntity", ")", ";", "//it will update this doc:", "getSrvAccEntry", "(", ")", ".", "makeEntries", "(", "pAddParam", ",", "pEntity", ")", ";", "}", "//load(put) or reverse product or created material on warehouse", "getSrvWarehouseEntry", "(", ")", ".", "load", "(", "pAddParam", ",", "pEntity", ",", "pEntity", ".", "getWarehouseSite", "(", ")", ")", ";", "}" ]
<p>Make other entries include reversing if it's need when save.</p> @param pAddParam additional param @param pEntity entity @param pRequestData Request Data @param pIsNew if entity was new @throws Exception - an exception
[ "<p", ">", "Make", "other", "entries", "include", "reversing", "if", "it", "s", "need", "when", "save", ".", "<", "/", "p", ">" ]
train
https://github.com/demidenko05/beigesoft-accounting/blob/e6f423949008218ddd05953b078f1ea8805095c1/src/main/java/org/beigesoft/accounting/processor/PrcManufactureSave.java#L116-L139
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java
IndexImage.applyAlpha
private static void applyAlpha(BufferedImage pImage, BufferedImage pAlpha) { """ Applies the alpha-component of the alpha image to the given image. The given image is modified in place. @param pImage the image to apply alpha to @param pAlpha the image containing the alpha """ // Apply alpha as transparency, using threshold of 25% for (int y = 0; y < pAlpha.getHeight(); y++) { for (int x = 0; x < pAlpha.getWidth(); x++) { // Get alpha component of pixel, if less than 25% opaque // (0x40 = 64 => 25% of 256), the pixel will be transparent if (((pAlpha.getRGB(x, y) >> 24) & 0xFF) < 0x40) { pImage.setRGB(x, y, 0x00FFFFFF); // 100% transparent } } } }
java
private static void applyAlpha(BufferedImage pImage, BufferedImage pAlpha) { // Apply alpha as transparency, using threshold of 25% for (int y = 0; y < pAlpha.getHeight(); y++) { for (int x = 0; x < pAlpha.getWidth(); x++) { // Get alpha component of pixel, if less than 25% opaque // (0x40 = 64 => 25% of 256), the pixel will be transparent if (((pAlpha.getRGB(x, y) >> 24) & 0xFF) < 0x40) { pImage.setRGB(x, y, 0x00FFFFFF); // 100% transparent } } } }
[ "private", "static", "void", "applyAlpha", "(", "BufferedImage", "pImage", ",", "BufferedImage", "pAlpha", ")", "{", "// Apply alpha as transparency, using threshold of 25%\r", "for", "(", "int", "y", "=", "0", ";", "y", "<", "pAlpha", ".", "getHeight", "(", ")", ";", "y", "++", ")", "{", "for", "(", "int", "x", "=", "0", ";", "x", "<", "pAlpha", ".", "getWidth", "(", ")", ";", "x", "++", ")", "{", "// Get alpha component of pixel, if less than 25% opaque\r", "// (0x40 = 64 => 25% of 256), the pixel will be transparent\r", "if", "(", "(", "(", "pAlpha", ".", "getRGB", "(", "x", ",", "y", ")", ">>", "24", ")", "&", "0xFF", ")", "<", "0x40", ")", "{", "pImage", ".", "setRGB", "(", "x", ",", "y", ",", "0x00FFFFFF", ")", ";", "// 100% transparent\r", "}", "}", "}", "}" ]
Applies the alpha-component of the alpha image to the given image. The given image is modified in place. @param pImage the image to apply alpha to @param pAlpha the image containing the alpha
[ "Applies", "the", "alpha", "-", "component", "of", "the", "alpha", "image", "to", "the", "given", "image", ".", "The", "given", "image", "is", "modified", "in", "place", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java#L1189-L1201
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java
StateUtils.main
public static void main (String[] args) throws UnsupportedEncodingException { """ Utility method for generating base 64 encoded strings. @param args @throws UnsupportedEncodingException """ byte[] bytes = encode(args[0].getBytes(ZIP_CHARSET)); System.out.println(new String(bytes, ZIP_CHARSET)); }
java
public static void main (String[] args) throws UnsupportedEncodingException { byte[] bytes = encode(args[0].getBytes(ZIP_CHARSET)); System.out.println(new String(bytes, ZIP_CHARSET)); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "UnsupportedEncodingException", "{", "byte", "[", "]", "bytes", "=", "encode", "(", "args", "[", "0", "]", ".", "getBytes", "(", "ZIP_CHARSET", ")", ")", ";", "System", ".", "out", ".", "println", "(", "new", "String", "(", "bytes", ",", "ZIP_CHARSET", ")", ")", ";", "}" ]
Utility method for generating base 64 encoded strings. @param args @throws UnsupportedEncodingException
[ "Utility", "method", "for", "generating", "base", "64", "encoded", "strings", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/StateUtils.java#L654-L658
rhuss/jolokia
agent/core/src/main/java/org/jolokia/converter/json/ArrayExtractor.java
ArrayExtractor.setObjectValue
public Object setObjectValue(StringToObjectConverter pConverter, Object pInner, String pIndex, Object pValue) throws IllegalAccessException, InvocationTargetException { """ Set a value in an array @param pConverter the global converter in order to be able do dispatch for serializing inner data types @param pInner object on which to set the value (which must be a {@link List}) @param pIndex index (as string) where to set the value within the array @param pValue the new value to set @return the old value at this index @throws IllegalAccessException @throws InvocationTargetException """ Class clazz = pInner.getClass(); if (!clazz.isArray()) { throw new IllegalArgumentException("Not an array to set a value, but " + clazz + ". (index = " + pIndex + ", value = " + pValue + ")"); } int idx; try { idx = Integer.parseInt(pIndex); } catch (NumberFormatException exp) { throw new IllegalArgumentException("Non-numeric index for accessing array " + pInner + ". (index = " + pIndex + ", value to set = " + pValue + ")",exp); } Class type = clazz.getComponentType(); Object value = pConverter.prepareValue(type.getName(), pValue); Object oldValue = Array.get(pInner, idx); Array.set(pInner, idx, value); return oldValue; }
java
public Object setObjectValue(StringToObjectConverter pConverter, Object pInner, String pIndex, Object pValue) throws IllegalAccessException, InvocationTargetException { Class clazz = pInner.getClass(); if (!clazz.isArray()) { throw new IllegalArgumentException("Not an array to set a value, but " + clazz + ". (index = " + pIndex + ", value = " + pValue + ")"); } int idx; try { idx = Integer.parseInt(pIndex); } catch (NumberFormatException exp) { throw new IllegalArgumentException("Non-numeric index for accessing array " + pInner + ". (index = " + pIndex + ", value to set = " + pValue + ")",exp); } Class type = clazz.getComponentType(); Object value = pConverter.prepareValue(type.getName(), pValue); Object oldValue = Array.get(pInner, idx); Array.set(pInner, idx, value); return oldValue; }
[ "public", "Object", "setObjectValue", "(", "StringToObjectConverter", "pConverter", ",", "Object", "pInner", ",", "String", "pIndex", ",", "Object", "pValue", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", "{", "Class", "clazz", "=", "pInner", ".", "getClass", "(", ")", ";", "if", "(", "!", "clazz", ".", "isArray", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Not an array to set a value, but \"", "+", "clazz", "+", "\". (index = \"", "+", "pIndex", "+", "\", value = \"", "+", "pValue", "+", "\")\"", ")", ";", "}", "int", "idx", ";", "try", "{", "idx", "=", "Integer", ".", "parseInt", "(", "pIndex", ")", ";", "}", "catch", "(", "NumberFormatException", "exp", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Non-numeric index for accessing array \"", "+", "pInner", "+", "\". (index = \"", "+", "pIndex", "+", "\", value to set = \"", "+", "pValue", "+", "\")\"", ",", "exp", ")", ";", "}", "Class", "type", "=", "clazz", ".", "getComponentType", "(", ")", ";", "Object", "value", "=", "pConverter", ".", "prepareValue", "(", "type", ".", "getName", "(", ")", ",", "pValue", ")", ";", "Object", "oldValue", "=", "Array", ".", "get", "(", "pInner", ",", "idx", ")", ";", "Array", ".", "set", "(", "pInner", ",", "idx", ",", "value", ")", ";", "return", "oldValue", ";", "}" ]
Set a value in an array @param pConverter the global converter in order to be able do dispatch for serializing inner data types @param pInner object on which to set the value (which must be a {@link List}) @param pIndex index (as string) where to set the value within the array @param pValue the new value to set @return the old value at this index @throws IllegalAccessException @throws InvocationTargetException
[ "Set", "a", "value", "in", "an", "array" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/json/ArrayExtractor.java#L82-L101
kiegroup/jbpm
jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java
QueryCriteriaUtil.fillCriteriaQuery
protected <R,T> void fillCriteriaQuery( CriteriaQuery<R> query, QueryWhere queryWhere, CriteriaBuilder builder, Class<T> queryType ) { """ This is the main ("highest"? "most abstract"?) method that is used to create a {@link CriteriaQuery} from a {@link QueryWhere} instance. @param query The (empty) {@link CriteriaQuery} that will be filled using the {@link QueryCriteria} and other information in the {@link QueryWhere} instance @param queryWhere The {@link QueryWhere} instance, with abstract information that should be added to the {@link CriteriaQuery} @param builder The {@link CriteriaBuilder}, helpful when creating {@link Predicate}s to add to the {@link CriteriaQuery} @param queryType The {@link Class} indicating the main {@link Root} of the {@link CriteriaQuery} """ Predicate queryPredicate = createPredicateFromCriteriaList(query, builder, queryType, queryWhere.getCriteria(), queryWhere ); if( queryPredicate != null ) { query.where(queryPredicate); } if( queryWhere.getAscOrDesc() != null ) { String orderByListId = queryWhere.getOrderByListId(); assert orderByListId != null : "Ascending boolean is set but no order by list Id has been specified!"; Expression orderByPath = getOrderByExpression(query, queryType, orderByListId); Order order; if( queryWhere.getAscOrDesc() ) { order = builder.asc(orderByPath); } else { order = builder.desc(orderByPath); } query.orderBy(order); } }
java
protected <R,T> void fillCriteriaQuery( CriteriaQuery<R> query, QueryWhere queryWhere, CriteriaBuilder builder, Class<T> queryType ) { Predicate queryPredicate = createPredicateFromCriteriaList(query, builder, queryType, queryWhere.getCriteria(), queryWhere ); if( queryPredicate != null ) { query.where(queryPredicate); } if( queryWhere.getAscOrDesc() != null ) { String orderByListId = queryWhere.getOrderByListId(); assert orderByListId != null : "Ascending boolean is set but no order by list Id has been specified!"; Expression orderByPath = getOrderByExpression(query, queryType, orderByListId); Order order; if( queryWhere.getAscOrDesc() ) { order = builder.asc(orderByPath); } else { order = builder.desc(orderByPath); } query.orderBy(order); } }
[ "protected", "<", "R", ",", "T", ">", "void", "fillCriteriaQuery", "(", "CriteriaQuery", "<", "R", ">", "query", ",", "QueryWhere", "queryWhere", ",", "CriteriaBuilder", "builder", ",", "Class", "<", "T", ">", "queryType", ")", "{", "Predicate", "queryPredicate", "=", "createPredicateFromCriteriaList", "(", "query", ",", "builder", ",", "queryType", ",", "queryWhere", ".", "getCriteria", "(", ")", ",", "queryWhere", ")", ";", "if", "(", "queryPredicate", "!=", "null", ")", "{", "query", ".", "where", "(", "queryPredicate", ")", ";", "}", "if", "(", "queryWhere", ".", "getAscOrDesc", "(", ")", "!=", "null", ")", "{", "String", "orderByListId", "=", "queryWhere", ".", "getOrderByListId", "(", ")", ";", "assert", "orderByListId", "!=", "null", ":", "\"Ascending boolean is set but no order by list Id has been specified!\"", ";", "Expression", "orderByPath", "=", "getOrderByExpression", "(", "query", ",", "queryType", ",", "orderByListId", ")", ";", "Order", "order", ";", "if", "(", "queryWhere", ".", "getAscOrDesc", "(", ")", ")", "{", "order", "=", "builder", ".", "asc", "(", "orderByPath", ")", ";", "}", "else", "{", "order", "=", "builder", ".", "desc", "(", "orderByPath", ")", ";", "}", "query", ".", "orderBy", "(", "order", ")", ";", "}", "}" ]
This is the main ("highest"? "most abstract"?) method that is used to create a {@link CriteriaQuery} from a {@link QueryWhere} instance. @param query The (empty) {@link CriteriaQuery} that will be filled using the {@link QueryCriteria} and other information in the {@link QueryWhere} instance @param queryWhere The {@link QueryWhere} instance, with abstract information that should be added to the {@link CriteriaQuery} @param builder The {@link CriteriaBuilder}, helpful when creating {@link Predicate}s to add to the {@link CriteriaQuery} @param queryType The {@link Class} indicating the main {@link Root} of the {@link CriteriaQuery}
[ "This", "is", "the", "main", "(", "highest", "?", "most", "abstract", "?", ")", "method", "that", "is", "used", "to", "create", "a", "{", "@link", "CriteriaQuery", "}", "from", "a", "{", "@link", "QueryWhere", "}", "instance", "." ]
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-query-jpa/src/main/java/org/jbpm/query/jpa/impl/QueryCriteriaUtil.java#L161-L181
line/armeria
core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java
ServerSentEvents.fromStream
public static HttpResponse fromStream(HttpHeaders headers, Stream<? extends ServerSentEvent> contentStream, HttpHeaders trailingHeaders, Executor executor) { """ Creates a new Server-Sent Events stream from the specified {@link Stream}. @param headers the HTTP headers supposed to send @param contentStream the {@link Stream} which publishes the objects supposed to send as contents @param trailingHeaders the trailing HTTP headers supposed to send @param executor the executor which iterates the stream """ requireNonNull(headers, "headers"); requireNonNull(contentStream, "contentStream"); requireNonNull(trailingHeaders, "trailingHeaders"); requireNonNull(executor, "executor"); return streamingFrom(contentStream, sanitizeHeaders(headers), trailingHeaders, ServerSentEvents::toHttpData, executor); }
java
public static HttpResponse fromStream(HttpHeaders headers, Stream<? extends ServerSentEvent> contentStream, HttpHeaders trailingHeaders, Executor executor) { requireNonNull(headers, "headers"); requireNonNull(contentStream, "contentStream"); requireNonNull(trailingHeaders, "trailingHeaders"); requireNonNull(executor, "executor"); return streamingFrom(contentStream, sanitizeHeaders(headers), trailingHeaders, ServerSentEvents::toHttpData, executor); }
[ "public", "static", "HttpResponse", "fromStream", "(", "HttpHeaders", "headers", ",", "Stream", "<", "?", "extends", "ServerSentEvent", ">", "contentStream", ",", "HttpHeaders", "trailingHeaders", ",", "Executor", "executor", ")", "{", "requireNonNull", "(", "headers", ",", "\"headers\"", ")", ";", "requireNonNull", "(", "contentStream", ",", "\"contentStream\"", ")", ";", "requireNonNull", "(", "trailingHeaders", ",", "\"trailingHeaders\"", ")", ";", "requireNonNull", "(", "executor", ",", "\"executor\"", ")", ";", "return", "streamingFrom", "(", "contentStream", ",", "sanitizeHeaders", "(", "headers", ")", ",", "trailingHeaders", ",", "ServerSentEvents", "::", "toHttpData", ",", "executor", ")", ";", "}" ]
Creates a new Server-Sent Events stream from the specified {@link Stream}. @param headers the HTTP headers supposed to send @param contentStream the {@link Stream} which publishes the objects supposed to send as contents @param trailingHeaders the trailing HTTP headers supposed to send @param executor the executor which iterates the stream
[ "Creates", "a", "new", "Server", "-", "Sent", "Events", "stream", "from", "the", "specified", "{", "@link", "Stream", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java#L195-L204
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/TransactionManager.java
TransactionManager.mergeRolledBackTransaction
void mergeRolledBackTransaction(Object[] list, int start, int limit) { """ merge a given list of transaction rollback action with given timestamp """ for (int i = start; i < limit; i++) { RowAction rowact = (RowAction) list[i]; if (rowact == null || rowact.type == RowActionBase.ACTION_NONE || rowact.type == RowActionBase.ACTION_DELETE_FINAL) { continue; } Row row = rowact.memoryRow; if (row == null) { PersistentStore store = rowact.session.sessionData.getRowStore(rowact.table); row = (Row) store.get(rowact.getPos(), false); } if (row == null) { continue; } synchronized (row) { rowact.mergeRollback(row); } } // } catch (Throwable t) { // System.out.println("throw in merge"); // t.printStackTrace(); // } }
java
void mergeRolledBackTransaction(Object[] list, int start, int limit) { for (int i = start; i < limit; i++) { RowAction rowact = (RowAction) list[i]; if (rowact == null || rowact.type == RowActionBase.ACTION_NONE || rowact.type == RowActionBase.ACTION_DELETE_FINAL) { continue; } Row row = rowact.memoryRow; if (row == null) { PersistentStore store = rowact.session.sessionData.getRowStore(rowact.table); row = (Row) store.get(rowact.getPos(), false); } if (row == null) { continue; } synchronized (row) { rowact.mergeRollback(row); } } // } catch (Throwable t) { // System.out.println("throw in merge"); // t.printStackTrace(); // } }
[ "void", "mergeRolledBackTransaction", "(", "Object", "[", "]", "list", ",", "int", "start", ",", "int", "limit", ")", "{", "for", "(", "int", "i", "=", "start", ";", "i", "<", "limit", ";", "i", "++", ")", "{", "RowAction", "rowact", "=", "(", "RowAction", ")", "list", "[", "i", "]", ";", "if", "(", "rowact", "==", "null", "||", "rowact", ".", "type", "==", "RowActionBase", ".", "ACTION_NONE", "||", "rowact", ".", "type", "==", "RowActionBase", ".", "ACTION_DELETE_FINAL", ")", "{", "continue", ";", "}", "Row", "row", "=", "rowact", ".", "memoryRow", ";", "if", "(", "row", "==", "null", ")", "{", "PersistentStore", "store", "=", "rowact", ".", "session", ".", "sessionData", ".", "getRowStore", "(", "rowact", ".", "table", ")", ";", "row", "=", "(", "Row", ")", "store", ".", "get", "(", "rowact", ".", "getPos", "(", ")", ",", "false", ")", ";", "}", "if", "(", "row", "==", "null", ")", "{", "continue", ";", "}", "synchronized", "(", "row", ")", "{", "rowact", ".", "mergeRollback", "(", "row", ")", ";", "}", "}", "// } catch (Throwable t) {", "// System.out.println(\"throw in merge\");", "// t.printStackTrace();", "// }", "}" ]
merge a given list of transaction rollback action with given timestamp
[ "merge", "a", "given", "list", "of", "transaction", "rollback", "action", "with", "given", "timestamp" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/TransactionManager.java#L625-L657
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamidentifier_binding.java
streamidentifier_binding.get
public static streamidentifier_binding get(nitro_service service, String name) throws Exception { """ Use this API to fetch streamidentifier_binding resource of given name . """ streamidentifier_binding obj = new streamidentifier_binding(); obj.set_name(name); streamidentifier_binding response = (streamidentifier_binding) obj.get_resource(service); return response; }
java
public static streamidentifier_binding get(nitro_service service, String name) throws Exception{ streamidentifier_binding obj = new streamidentifier_binding(); obj.set_name(name); streamidentifier_binding response = (streamidentifier_binding) obj.get_resource(service); return response; }
[ "public", "static", "streamidentifier_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "streamidentifier_binding", "obj", "=", "new", "streamidentifier_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "streamidentifier_binding", "response", "=", "(", "streamidentifier_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch streamidentifier_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "streamidentifier_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/stream/streamidentifier_binding.java#L103-L108
aragozin/jvm-tools
mxdump/src/main/java/org/gridkit/jvmtool/jackson/JsonGenerator.java
JsonGenerator.configure
public JsonGenerator configure(Feature f, boolean state) { """ Method for enabling or disabling specified feature: check {@link Feature} for list of available features. @return Generator itself (this), to allow chaining @since 1.2 """ if (state) { enable(f); } else { disable(f); } return this; }
java
public JsonGenerator configure(Feature f, boolean state) { if (state) { enable(f); } else { disable(f); } return this; }
[ "public", "JsonGenerator", "configure", "(", "Feature", "f", ",", "boolean", "state", ")", "{", "if", "(", "state", ")", "{", "enable", "(", "f", ")", ";", "}", "else", "{", "disable", "(", "f", ")", ";", "}", "return", "this", ";", "}" ]
Method for enabling or disabling specified feature: check {@link Feature} for list of available features. @return Generator itself (this), to allow chaining @since 1.2
[ "Method", "for", "enabling", "or", "disabling", "specified", "feature", ":", "check", "{", "@link", "Feature", "}", "for", "list", "of", "available", "features", "." ]
train
https://github.com/aragozin/jvm-tools/blob/d3a4d0c6a47fb9317f274988569655f30dcd2f76/mxdump/src/main/java/org/gridkit/jvmtool/jackson/JsonGenerator.java#L240-L248
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/query/QueryUtil.java
QueryUtil.packageResult
public static <T> IQueryResult<T> packageResult(List<T> results) { """ Convenience method for packaging query results. @param <T> Class of query result. @param results Results to package. @return Packaged results. """ return packageResult(results, null); }
java
public static <T> IQueryResult<T> packageResult(List<T> results) { return packageResult(results, null); }
[ "public", "static", "<", "T", ">", "IQueryResult", "<", "T", ">", "packageResult", "(", "List", "<", "T", ">", "results", ")", "{", "return", "packageResult", "(", "results", ",", "null", ")", ";", "}" ]
Convenience method for packaging query results. @param <T> Class of query result. @param results Results to package. @return Packaged results.
[ "Convenience", "method", "for", "packaging", "query", "results", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/query/QueryUtil.java#L103-L105
playn/playn
scene/src/playn/scene/LayerUtil.java
LayerUtil.screenToLayer
public static Point screenToLayer(Layer layer, float x, float y) { """ Converts the supplied point from screen coordinates to coordinates relative to the specified layer. """ Point into = new Point(x, y); return screenToLayer(layer, into, into); }
java
public static Point screenToLayer(Layer layer, float x, float y) { Point into = new Point(x, y); return screenToLayer(layer, into, into); }
[ "public", "static", "Point", "screenToLayer", "(", "Layer", "layer", ",", "float", "x", ",", "float", "y", ")", "{", "Point", "into", "=", "new", "Point", "(", "x", ",", "y", ")", ";", "return", "screenToLayer", "(", "layer", ",", "into", ",", "into", ")", ";", "}" ]
Converts the supplied point from screen coordinates to coordinates relative to the specified layer.
[ "Converts", "the", "supplied", "point", "from", "screen", "coordinates", "to", "coordinates", "relative", "to", "the", "specified", "layer", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L94-L97
networknt/light-4j
http-url/src/main/java/com/networknt/url/HttpURL.java
HttpURL.toURI
public URI toURI() { """ Converts this HttpURL to a {@link URI}, making sure appropriate characters are escaped properly. @return a URI @since 1.7.0 @throws RuntimeException when URL is malformed """ String url = toString(); try { return new URI(url); } catch (URISyntaxException e) { throw new RuntimeException("Cannot convert to URI: " + url, e); } }
java
public URI toURI() { String url = toString(); try { return new URI(url); } catch (URISyntaxException e) { throw new RuntimeException("Cannot convert to URI: " + url, e); } }
[ "public", "URI", "toURI", "(", ")", "{", "String", "url", "=", "toString", "(", ")", ";", "try", "{", "return", "new", "URI", "(", "url", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"Cannot convert to URI: \"", "+", "url", ",", "e", ")", ";", "}", "}" ]
Converts this HttpURL to a {@link URI}, making sure appropriate characters are escaped properly. @return a URI @since 1.7.0 @throws RuntimeException when URL is malformed
[ "Converts", "this", "HttpURL", "to", "a", "{" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/http-url/src/main/java/com/networknt/url/HttpURL.java#L299-L306
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java
AnnotationTypeRequiredMemberBuilder.buildTagInfo
public void buildTagInfo(XMLNode node, Content annotationDocTree) { """ Build the tag information. @param node the XML element that specifies which components to document @param annotationDocTree the content tree to which the documentation will be added """ writer.addTags((MemberDoc) members.get(currentMemberIndex), annotationDocTree); }
java
public void buildTagInfo(XMLNode node, Content annotationDocTree) { writer.addTags((MemberDoc) members.get(currentMemberIndex), annotationDocTree); }
[ "public", "void", "buildTagInfo", "(", "XMLNode", "node", ",", "Content", "annotationDocTree", ")", "{", "writer", ".", "addTags", "(", "(", "MemberDoc", ")", "members", ".", "get", "(", "currentMemberIndex", ")", ",", "annotationDocTree", ")", ";", "}" ]
Build the tag information. @param node the XML element that specifies which components to document @param annotationDocTree the content tree to which the documentation will be added
[ "Build", "the", "tag", "information", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/AnnotationTypeRequiredMemberBuilder.java#L227-L230
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_SharedRendererUtils.java
_SharedRendererUtils.log
private static void log(FacesContext context, String msg, Exception e) { """ This method is different in the two versions of _SharedRendererUtils. """ context.getExternalContext().log(msg, e); }
java
private static void log(FacesContext context, String msg, Exception e) { context.getExternalContext().log(msg, e); }
[ "private", "static", "void", "log", "(", "FacesContext", "context", ",", "String", "msg", ",", "Exception", "e", ")", "{", "context", ".", "getExternalContext", "(", ")", ".", "log", "(", "msg", ",", "e", ")", ";", "}" ]
This method is different in the two versions of _SharedRendererUtils.
[ "This", "method", "is", "different", "in", "the", "two", "versions", "of", "_SharedRendererUtils", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_SharedRendererUtils.java#L489-L492
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/BeanDeploymentModule.java
BeanDeploymentModule.fireEvent
public void fireEvent(Type eventType, Object event, Annotation... qualifiers) { """ Fire an event and notify observers that belong to this module. @param eventType @param event @param qualifiers """ final EventMetadata metadata = new EventMetadataImpl(eventType, null, qualifiers); notifier.fireEvent(eventType, event, metadata, qualifiers); }
java
public void fireEvent(Type eventType, Object event, Annotation... qualifiers) { final EventMetadata metadata = new EventMetadataImpl(eventType, null, qualifiers); notifier.fireEvent(eventType, event, metadata, qualifiers); }
[ "public", "void", "fireEvent", "(", "Type", "eventType", ",", "Object", "event", ",", "Annotation", "...", "qualifiers", ")", "{", "final", "EventMetadata", "metadata", "=", "new", "EventMetadataImpl", "(", "eventType", ",", "null", ",", "qualifiers", ")", ";", "notifier", ".", "fireEvent", "(", "eventType", ",", "event", ",", "metadata", ",", "qualifiers", ")", ";", "}" ]
Fire an event and notify observers that belong to this module. @param eventType @param event @param qualifiers
[ "Fire", "an", "event", "and", "notify", "observers", "that", "belong", "to", "this", "module", "." ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeploymentModule.java#L91-L94
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java
DataContextUtils.replaceTokensInScript
public static File replaceTokensInScript( final String script, final Map<String, Map<String, String>> dataContext, final Framework framework, final ScriptfileUtils.LineEndingStyle style, final File destination ) throws IOException { """ Copies the source file to a file, replacing the @key.X@ tokens with the values from the data context @param script source file path @param dataContext input data context @param framework the framework @param style line ending style @param destination destination file, or null to create a temp file @return the token replaced temp file, or null if an error occurs. @throws java.io.IOException on io error """ if (null == script) { throw new NullPointerException("script cannot be null"); } //use ReplaceTokens to replace tokens within the content final Reader read = new StringReader(script); final Map<String, String> toks = flattenDataContext(dataContext); final ReplaceTokenReader replaceTokens = new ReplaceTokenReader(read, toks::get, true, '@', '@'); final File temp; if (null != destination) { ScriptfileUtils.writeScriptFile(null, null, replaceTokens, style, destination); temp = destination; } else { if (null == framework) { throw new NullPointerException("framework cannot be null"); } temp = ScriptfileUtils.writeScriptTempfile(framework, replaceTokens, style); } ScriptfileUtils.setExecutePermissions(temp); return temp; }
java
public static File replaceTokensInScript( final String script, final Map<String, Map<String, String>> dataContext, final Framework framework, final ScriptfileUtils.LineEndingStyle style, final File destination ) throws IOException { if (null == script) { throw new NullPointerException("script cannot be null"); } //use ReplaceTokens to replace tokens within the content final Reader read = new StringReader(script); final Map<String, String> toks = flattenDataContext(dataContext); final ReplaceTokenReader replaceTokens = new ReplaceTokenReader(read, toks::get, true, '@', '@'); final File temp; if (null != destination) { ScriptfileUtils.writeScriptFile(null, null, replaceTokens, style, destination); temp = destination; } else { if (null == framework) { throw new NullPointerException("framework cannot be null"); } temp = ScriptfileUtils.writeScriptTempfile(framework, replaceTokens, style); } ScriptfileUtils.setExecutePermissions(temp); return temp; }
[ "public", "static", "File", "replaceTokensInScript", "(", "final", "String", "script", ",", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "dataContext", ",", "final", "Framework", "framework", ",", "final", "ScriptfileUtils", ".", "LineEndingStyle", "style", ",", "final", "File", "destination", ")", "throws", "IOException", "{", "if", "(", "null", "==", "script", ")", "{", "throw", "new", "NullPointerException", "(", "\"script cannot be null\"", ")", ";", "}", "//use ReplaceTokens to replace tokens within the content", "final", "Reader", "read", "=", "new", "StringReader", "(", "script", ")", ";", "final", "Map", "<", "String", ",", "String", ">", "toks", "=", "flattenDataContext", "(", "dataContext", ")", ";", "final", "ReplaceTokenReader", "replaceTokens", "=", "new", "ReplaceTokenReader", "(", "read", ",", "toks", "::", "get", ",", "true", ",", "'", "'", ",", "'", "'", ")", ";", "final", "File", "temp", ";", "if", "(", "null", "!=", "destination", ")", "{", "ScriptfileUtils", ".", "writeScriptFile", "(", "null", ",", "null", ",", "replaceTokens", ",", "style", ",", "destination", ")", ";", "temp", "=", "destination", ";", "}", "else", "{", "if", "(", "null", "==", "framework", ")", "{", "throw", "new", "NullPointerException", "(", "\"framework cannot be null\"", ")", ";", "}", "temp", "=", "ScriptfileUtils", ".", "writeScriptTempfile", "(", "framework", ",", "replaceTokens", ",", "style", ")", ";", "}", "ScriptfileUtils", ".", "setExecutePermissions", "(", "temp", ")", ";", "return", "temp", ";", "}" ]
Copies the source file to a file, replacing the @key.X@ tokens with the values from the data context @param script source file path @param dataContext input data context @param framework the framework @param style line ending style @param destination destination file, or null to create a temp file @return the token replaced temp file, or null if an error occurs. @throws java.io.IOException on io error
[ "Copies", "the", "source", "file", "to", "a", "file", "replacing", "the", "@key", ".", "X@", "tokens", "with", "the", "values", "from", "the", "data", "context" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java#L101-L129
spring-projects/spring-android
spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java
HttpHeaders.getFirstDate
public long getFirstDate(String headerName) { """ Parse the first header value for the given header name as a date, return -1 if there is no value, or raise {@link IllegalArgumentException} if the value cannot be parsed as a date. """ String headerValue = getFirst(headerName); if (headerValue == null) { return -1; } for (String dateFormat : DATE_FORMATS) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat, Locale.US); simpleDateFormat.setTimeZone(GMT); try { return simpleDateFormat.parse(headerValue).getTime(); } catch (ParseException e) { // ignore } } throw new IllegalArgumentException("Cannot parse date value \"" + headerValue + "\" for \"" + headerName + "\" header"); }
java
public long getFirstDate(String headerName) { String headerValue = getFirst(headerName); if (headerValue == null) { return -1; } for (String dateFormat : DATE_FORMATS) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat, Locale.US); simpleDateFormat.setTimeZone(GMT); try { return simpleDateFormat.parse(headerValue).getTime(); } catch (ParseException e) { // ignore } } throw new IllegalArgumentException("Cannot parse date value \"" + headerValue + "\" for \"" + headerName + "\" header"); }
[ "public", "long", "getFirstDate", "(", "String", "headerName", ")", "{", "String", "headerValue", "=", "getFirst", "(", "headerName", ")", ";", "if", "(", "headerValue", "==", "null", ")", "{", "return", "-", "1", ";", "}", "for", "(", "String", "dateFormat", ":", "DATE_FORMATS", ")", "{", "SimpleDateFormat", "simpleDateFormat", "=", "new", "SimpleDateFormat", "(", "dateFormat", ",", "Locale", ".", "US", ")", ";", "simpleDateFormat", ".", "setTimeZone", "(", "GMT", ")", ";", "try", "{", "return", "simpleDateFormat", ".", "parse", "(", "headerValue", ")", ".", "getTime", "(", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "// ignore", "}", "}", "throw", "new", "IllegalArgumentException", "(", "\"Cannot parse date value \\\"\"", "+", "headerValue", "+", "\"\\\" for \\\"\"", "+", "headerName", "+", "\"\\\" header\"", ")", ";", "}" ]
Parse the first header value for the given header name as a date, return -1 if there is no value, or raise {@link IllegalArgumentException} if the value cannot be parsed as a date.
[ "Parse", "the", "first", "header", "value", "for", "the", "given", "header", "name", "as", "a", "date", "return", "-", "1", "if", "there", "is", "no", "value", "or", "raise", "{" ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/HttpHeaders.java#L886-L903
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/model/globalfac/ProjDepTreeFactor.java
ProjDepTreeFactor.getMsgs
private Tensor getMsgs(VarTensor[] inMsgs, int tf) { """ Gets messages from the Messages[]. @param inMsgs The input messages. @param tf Whether to get TRUE or FALSE messages. @return The messages as a Tensor. """ Algebra s = inMsgs[0].getAlgebra(); EdgeScores es = new EdgeScores(n, s.zero()); for (VarTensor inMsg : inMsgs) { LinkVar link = (LinkVar) inMsg.getVars().get(0); double val = inMsg.getValue(tf); es.setScore(link.getParent(), link.getChild(), val); } return es.toTensor(s); }
java
private Tensor getMsgs(VarTensor[] inMsgs, int tf) { Algebra s = inMsgs[0].getAlgebra(); EdgeScores es = new EdgeScores(n, s.zero()); for (VarTensor inMsg : inMsgs) { LinkVar link = (LinkVar) inMsg.getVars().get(0); double val = inMsg.getValue(tf); es.setScore(link.getParent(), link.getChild(), val); } return es.toTensor(s); }
[ "private", "Tensor", "getMsgs", "(", "VarTensor", "[", "]", "inMsgs", ",", "int", "tf", ")", "{", "Algebra", "s", "=", "inMsgs", "[", "0", "]", ".", "getAlgebra", "(", ")", ";", "EdgeScores", "es", "=", "new", "EdgeScores", "(", "n", ",", "s", ".", "zero", "(", ")", ")", ";", "for", "(", "VarTensor", "inMsg", ":", "inMsgs", ")", "{", "LinkVar", "link", "=", "(", "LinkVar", ")", "inMsg", ".", "getVars", "(", ")", ".", "get", "(", "0", ")", ";", "double", "val", "=", "inMsg", ".", "getValue", "(", "tf", ")", ";", "es", ".", "setScore", "(", "link", ".", "getParent", "(", ")", ",", "link", ".", "getChild", "(", ")", ",", "val", ")", ";", "}", "return", "es", ".", "toTensor", "(", "s", ")", ";", "}" ]
Gets messages from the Messages[]. @param inMsgs The input messages. @param tf Whether to get TRUE or FALSE messages. @return The messages as a Tensor.
[ "Gets", "messages", "from", "the", "Messages", "[]", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/globalfac/ProjDepTreeFactor.java#L283-L292
nextreports/nextreports-engine
src/ro/nextreports/engine/chart/ChartRunner.java
ChartRunner.setConnection
public void setConnection(Connection connection, boolean csv) { """ Set database connection @param connection database connection @param csv true for a csv file connection """ this.connection = connection; this.csv = csv; try { dialect = DialectUtil.getDialect(connection); } catch (Exception e) { e.printStackTrace(); } if (chart != null) { if (chart.getReport().getQuery() != null) { chart.getReport().getQuery().setDialect(dialect); } } }
java
public void setConnection(Connection connection, boolean csv) { this.connection = connection; this.csv = csv; try { dialect = DialectUtil.getDialect(connection); } catch (Exception e) { e.printStackTrace(); } if (chart != null) { if (chart.getReport().getQuery() != null) { chart.getReport().getQuery().setDialect(dialect); } } }
[ "public", "void", "setConnection", "(", "Connection", "connection", ",", "boolean", "csv", ")", "{", "this", ".", "connection", "=", "connection", ";", "this", ".", "csv", "=", "csv", ";", "try", "{", "dialect", "=", "DialectUtil", ".", "getDialect", "(", "connection", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "if", "(", "chart", "!=", "null", ")", "{", "if", "(", "chart", ".", "getReport", "(", ")", ".", "getQuery", "(", ")", "!=", "null", ")", "{", "chart", ".", "getReport", "(", ")", ".", "getQuery", "(", ")", ".", "setDialect", "(", "dialect", ")", ";", "}", "}", "}" ]
Set database connection @param connection database connection @param csv true for a csv file connection
[ "Set", "database", "connection" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/chart/ChartRunner.java#L100-L113
aws/aws-sdk-java
aws-java-sdk-inspector/src/main/java/com/amazonaws/services/inspector/model/AssessmentRun.java
AssessmentRun.withFindingCounts
public AssessmentRun withFindingCounts(java.util.Map<String, Integer> findingCounts) { """ <p> Provides a total count of generated findings per severity. </p> @param findingCounts Provides a total count of generated findings per severity. @return Returns a reference to this object so that method calls can be chained together. """ setFindingCounts(findingCounts); return this; }
java
public AssessmentRun withFindingCounts(java.util.Map<String, Integer> findingCounts) { setFindingCounts(findingCounts); return this; }
[ "public", "AssessmentRun", "withFindingCounts", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "Integer", ">", "findingCounts", ")", "{", "setFindingCounts", "(", "findingCounts", ")", ";", "return", "this", ";", "}" ]
<p> Provides a total count of generated findings per severity. </p> @param findingCounts Provides a total count of generated findings per severity. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Provides", "a", "total", "count", "of", "generated", "findings", "per", "severity", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-inspector/src/main/java/com/amazonaws/services/inspector/model/AssessmentRun.java#L906-L909
pip-services3-java/pip-services3-components-java
src/org/pipservices3/components/config/YamlConfigReader.java
YamlConfigReader.readObject
public static Object readObject(String correlationId, String path, ConfigParams parameters) throws ApplicationException { """ Reads configuration file, parameterizes its content and converts it into JSON object. @param correlationId (optional) transaction id to trace execution through call chain. @param path a path to configuration file. @param parameters values to parameters the configuration. @return a JSON object with configuration. @throws ApplicationException when error occured. """ return new YamlConfigReader(path).readObject(correlationId, parameters); }
java
public static Object readObject(String correlationId, String path, ConfigParams parameters) throws ApplicationException { return new YamlConfigReader(path).readObject(correlationId, parameters); }
[ "public", "static", "Object", "readObject", "(", "String", "correlationId", ",", "String", "path", ",", "ConfigParams", "parameters", ")", "throws", "ApplicationException", "{", "return", "new", "YamlConfigReader", "(", "path", ")", ".", "readObject", "(", "correlationId", ",", "parameters", ")", ";", "}" ]
Reads configuration file, parameterizes its content and converts it into JSON object. @param correlationId (optional) transaction id to trace execution through call chain. @param path a path to configuration file. @param parameters values to parameters the configuration. @return a JSON object with configuration. @throws ApplicationException when error occured.
[ "Reads", "configuration", "file", "parameterizes", "its", "content", "and", "converts", "it", "into", "JSON", "object", "." ]
train
https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/config/YamlConfigReader.java#L113-L116
stephanenicolas/robospice
robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/RequestProgressManager.java
RequestProgressManager.dontNotifyRequestListenersForRequest
public void dontNotifyRequestListenersForRequest(final CachedSpiceRequest<?> request, final Collection<RequestListener<?>> listRequestListener) { """ Disable request listeners notifications for a specific request.<br/> All listeners associated to this request won't be called when request will finish.<br/> @param request Request on which you want to disable listeners @param listRequestListener the collection of listeners associated to request not to be notified """ final Set<RequestListener<?>> setRequestListener = mapRequestToRequestListener.get(request); requestListenerNotifier.clearNotificationsForRequest(request, setRequestListener); if (setRequestListener != null && listRequestListener != null) { Ln.d("Removing listeners of request : " + request.toString() + " : " + setRequestListener.size()); setRequestListener.removeAll(listRequestListener); } }
java
public void dontNotifyRequestListenersForRequest(final CachedSpiceRequest<?> request, final Collection<RequestListener<?>> listRequestListener) { final Set<RequestListener<?>> setRequestListener = mapRequestToRequestListener.get(request); requestListenerNotifier.clearNotificationsForRequest(request, setRequestListener); if (setRequestListener != null && listRequestListener != null) { Ln.d("Removing listeners of request : " + request.toString() + " : " + setRequestListener.size()); setRequestListener.removeAll(listRequestListener); } }
[ "public", "void", "dontNotifyRequestListenersForRequest", "(", "final", "CachedSpiceRequest", "<", "?", ">", "request", ",", "final", "Collection", "<", "RequestListener", "<", "?", ">", ">", "listRequestListener", ")", "{", "final", "Set", "<", "RequestListener", "<", "?", ">", ">", "setRequestListener", "=", "mapRequestToRequestListener", ".", "get", "(", "request", ")", ";", "requestListenerNotifier", ".", "clearNotificationsForRequest", "(", "request", ",", "setRequestListener", ")", ";", "if", "(", "setRequestListener", "!=", "null", "&&", "listRequestListener", "!=", "null", ")", "{", "Ln", ".", "d", "(", "\"Removing listeners of request : \"", "+", "request", ".", "toString", "(", ")", "+", "\" : \"", "+", "setRequestListener", ".", "size", "(", ")", ")", ";", "setRequestListener", ".", "removeAll", "(", "listRequestListener", ")", ";", "}", "}" ]
Disable request listeners notifications for a specific request.<br/> All listeners associated to this request won't be called when request will finish.<br/> @param request Request on which you want to disable listeners @param listRequestListener the collection of listeners associated to request not to be notified
[ "Disable", "request", "listeners", "notifications", "for", "a", "specific", "request", ".", "<br", "/", ">", "All", "listeners", "associated", "to", "this", "request", "won", "t", "be", "called", "when", "request", "will", "finish", ".", "<br", "/", ">" ]
train
https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/RequestProgressManager.java#L141-L150
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java
DatabaseVulnerabilityAssessmentRuleBaselinesInner.delete
public void delete(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { """ Removes the database's vulnerability assessment rule baseline. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. @param ruleId The vulnerability assessment rule ID. @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' @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 """ deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).toBlocking().single().body(); }
java
public void delete(String resourceGroupName, String serverName, String databaseName, String ruleId, VulnerabilityAssessmentPolicyBaselineName baselineName) { deleteWithServiceResponseAsync(resourceGroupName, serverName, databaseName, ruleId, baselineName).toBlocking().single().body(); }
[ "public", "void", "delete", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "ruleId", ",", "VulnerabilityAssessmentPolicyBaselineName", "baselineName", ")", "{", "deleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ",", "ruleId", ",", "baselineName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Removes the database's vulnerability assessment rule baseline. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database for which the vulnerability assessment rule baseline is defined. @param ruleId The vulnerability assessment rule ID. @param baselineName The name of the vulnerability assessment rule baseline (default implies a baseline on a database level rule and master for server level rule). Possible values include: 'master', 'default' @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
[ "Removes", "the", "database", "s", "vulnerability", "assessment", "rule", "baseline", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/DatabaseVulnerabilityAssessmentRuleBaselinesInner.java#L313-L315
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionAggregate.java
ExpressionAggregate.getAggregatedValue
public Object getAggregatedValue(Session session, Object currValue) { """ Get the result of a SetFunction or an ordinary value @param currValue instance of set function or value @param session context @return object """ if (currValue == null) { // A VoltDB extension APPROX_COUNT_DISTINCT return opType == OpTypes.COUNT || opType == OpTypes.APPROX_COUNT_DISTINCT ? ValuePool.INTEGER_0: null; /* disable 2 lines... return opType == OpTypes.COUNT ? ValuePool.INTEGER_0 : null; ...disabled 2 lines */ // End of VoltDB extension } return ((SetFunction) currValue).getValue(); }
java
public Object getAggregatedValue(Session session, Object currValue) { if (currValue == null) { // A VoltDB extension APPROX_COUNT_DISTINCT return opType == OpTypes.COUNT || opType == OpTypes.APPROX_COUNT_DISTINCT ? ValuePool.INTEGER_0: null; /* disable 2 lines... return opType == OpTypes.COUNT ? ValuePool.INTEGER_0 : null; ...disabled 2 lines */ // End of VoltDB extension } return ((SetFunction) currValue).getValue(); }
[ "public", "Object", "getAggregatedValue", "(", "Session", "session", ",", "Object", "currValue", ")", "{", "if", "(", "currValue", "==", "null", ")", "{", "// A VoltDB extension APPROX_COUNT_DISTINCT", "return", "opType", "==", "OpTypes", ".", "COUNT", "||", "opType", "==", "OpTypes", ".", "APPROX_COUNT_DISTINCT", "?", "ValuePool", ".", "INTEGER_0", ":", "null", ";", "/* disable 2 lines...\n return opType == OpTypes.COUNT ? ValuePool.INTEGER_0\n : null;\n ...disabled 2 lines */", "// End of VoltDB extension", "}", "return", "(", "(", "SetFunction", ")", "currValue", ")", ".", "getValue", "(", ")", ";", "}" ]
Get the result of a SetFunction or an ordinary value @param currValue instance of set function or value @param session context @return object
[ "Get", "the", "result", "of", "a", "SetFunction", "or", "an", "ordinary", "value" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionAggregate.java#L293-L307
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/obl/StateSet.java
StateSet.deleteObligation
public void deleteObligation(final Obligation obligation, int basicBlockId) throws ObligationAcquiredOrReleasedInLoopException { """ Remove an Obligation from every State in the StateSet. @param obligation the obligation to remove @param basicBlockId the id of the basic block (path component) removing the obligation @throws ObligationAcquiredOrReleasedInLoopException """ Map<ObligationSet, State> updatedStateMap = new HashMap<>(); for (Iterator<State> i = stateIterator(); i.hasNext();) { State state = i.next(); checkCircularity(state, obligation, basicBlockId); ObligationSet obligationSet = state.getObligationSet(); obligationSet.remove(obligation); if (!obligationSet.isEmpty()) { updatedStateMap.put(obligationSet, state); } } replaceMap(updatedStateMap); }
java
public void deleteObligation(final Obligation obligation, int basicBlockId) throws ObligationAcquiredOrReleasedInLoopException { Map<ObligationSet, State> updatedStateMap = new HashMap<>(); for (Iterator<State> i = stateIterator(); i.hasNext();) { State state = i.next(); checkCircularity(state, obligation, basicBlockId); ObligationSet obligationSet = state.getObligationSet(); obligationSet.remove(obligation); if (!obligationSet.isEmpty()) { updatedStateMap.put(obligationSet, state); } } replaceMap(updatedStateMap); }
[ "public", "void", "deleteObligation", "(", "final", "Obligation", "obligation", ",", "int", "basicBlockId", ")", "throws", "ObligationAcquiredOrReleasedInLoopException", "{", "Map", "<", "ObligationSet", ",", "State", ">", "updatedStateMap", "=", "new", "HashMap", "<>", "(", ")", ";", "for", "(", "Iterator", "<", "State", ">", "i", "=", "stateIterator", "(", ")", ";", "i", ".", "hasNext", "(", ")", ";", ")", "{", "State", "state", "=", "i", ".", "next", "(", ")", ";", "checkCircularity", "(", "state", ",", "obligation", ",", "basicBlockId", ")", ";", "ObligationSet", "obligationSet", "=", "state", ".", "getObligationSet", "(", ")", ";", "obligationSet", ".", "remove", "(", "obligation", ")", ";", "if", "(", "!", "obligationSet", ".", "isEmpty", "(", ")", ")", "{", "updatedStateMap", ".", "put", "(", "obligationSet", ",", "state", ")", ";", "}", "}", "replaceMap", "(", "updatedStateMap", ")", ";", "}" ]
Remove an Obligation from every State in the StateSet. @param obligation the obligation to remove @param basicBlockId the id of the basic block (path component) removing the obligation @throws ObligationAcquiredOrReleasedInLoopException
[ "Remove", "an", "Obligation", "from", "every", "State", "in", "the", "StateSet", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/obl/StateSet.java#L216-L229
zaproxy/zaproxy
src/org/zaproxy/zap/extension/api/ApiImplementor.java
ApiImplementor.handleApiOther
public HttpMessage handleApiOther(HttpMessage msg, String name, JSONObject params) throws ApiException { """ Override if implementing one or more 'other' operations - these are operations that _dont_ return structured data @param msg the HTTP message containing the API request @param name the name of the requested other endpoint @param params the API request parameters @return the HTTP message with the API response @throws ApiException if an error occurred while handling the API other endpoint """ throw new ApiException(ApiException.Type.BAD_OTHER, name); }
java
public HttpMessage handleApiOther(HttpMessage msg, String name, JSONObject params) throws ApiException { throw new ApiException(ApiException.Type.BAD_OTHER, name); }
[ "public", "HttpMessage", "handleApiOther", "(", "HttpMessage", "msg", ",", "String", "name", ",", "JSONObject", "params", ")", "throws", "ApiException", "{", "throw", "new", "ApiException", "(", "ApiException", ".", "Type", ".", "BAD_OTHER", ",", "name", ")", ";", "}" ]
Override if implementing one or more 'other' operations - these are operations that _dont_ return structured data @param msg the HTTP message containing the API request @param name the name of the requested other endpoint @param params the API request parameters @return the HTTP message with the API response @throws ApiException if an error occurred while handling the API other endpoint
[ "Override", "if", "implementing", "one", "or", "more", "other", "operations", "-", "these", "are", "operations", "that", "_dont_", "return", "structured", "data" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/api/ApiImplementor.java#L347-L349
stevespringett/Alpine
alpine/src/main/java/alpine/crypto/DataEncryption.java
DataEncryption.decryptAsString
public static String decryptAsString(final SecretKey secretKey, final String encryptedText) throws Exception { """ Decrypts the specified string using AES-256. The encryptedText is expected to be the Base64 encoded representation of the encrypted bytes generated from {@link #encryptAsString(String)}. @param secretKey the secret key to decrypt with @param encryptedText the text to decrypt @return the decrypted string @throws Exception a number of exceptions may be thrown @since 1.3.0 """ return new String(decryptAsBytes(secretKey, Base64.getDecoder().decode(encryptedText))); }
java
public static String decryptAsString(final SecretKey secretKey, final String encryptedText) throws Exception { return new String(decryptAsBytes(secretKey, Base64.getDecoder().decode(encryptedText))); }
[ "public", "static", "String", "decryptAsString", "(", "final", "SecretKey", "secretKey", ",", "final", "String", "encryptedText", ")", "throws", "Exception", "{", "return", "new", "String", "(", "decryptAsBytes", "(", "secretKey", ",", "Base64", ".", "getDecoder", "(", ")", ".", "decode", "(", "encryptedText", ")", ")", ")", ";", "}" ]
Decrypts the specified string using AES-256. The encryptedText is expected to be the Base64 encoded representation of the encrypted bytes generated from {@link #encryptAsString(String)}. @param secretKey the secret key to decrypt with @param encryptedText the text to decrypt @return the decrypted string @throws Exception a number of exceptions may be thrown @since 1.3.0
[ "Decrypts", "the", "specified", "string", "using", "AES", "-", "256", ".", "The", "encryptedText", "is", "expected", "to", "be", "the", "Base64", "encoded", "representation", "of", "the", "encrypted", "bytes", "generated", "from", "{" ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/crypto/DataEncryption.java#L161-L163
bbottema/simple-java-mail
modules/simple-java-mail/src/main/java/org/simplejavamail/mailer/internal/mailsender/MailSenderImpl.java
MailSenderImpl.configureSessionWithTimeout
private void configureSessionWithTimeout(final Session session, final int sessionTimeout) { """ Configures the {@link Session} with the same timeout for socket connection timeout, read and write timeout. """ if (transportStrategy != null) { // socket timeouts handling final Properties sessionProperties = session.getProperties(); sessionProperties.put(transportStrategy.propertyNameConnectionTimeout(), String.valueOf(sessionTimeout)); sessionProperties.put(transportStrategy.propertyNameTimeout(), String.valueOf(sessionTimeout)); sessionProperties.put(transportStrategy.propertyNameWriteTimeout(), String.valueOf(sessionTimeout)); } else { LOGGER.debug("No transport strategy provided, skipping defaults for .connectiontimout, .timout and .writetimeout"); } }
java
private void configureSessionWithTimeout(final Session session, final int sessionTimeout) { if (transportStrategy != null) { // socket timeouts handling final Properties sessionProperties = session.getProperties(); sessionProperties.put(transportStrategy.propertyNameConnectionTimeout(), String.valueOf(sessionTimeout)); sessionProperties.put(transportStrategy.propertyNameTimeout(), String.valueOf(sessionTimeout)); sessionProperties.put(transportStrategy.propertyNameWriteTimeout(), String.valueOf(sessionTimeout)); } else { LOGGER.debug("No transport strategy provided, skipping defaults for .connectiontimout, .timout and .writetimeout"); } }
[ "private", "void", "configureSessionWithTimeout", "(", "final", "Session", "session", ",", "final", "int", "sessionTimeout", ")", "{", "if", "(", "transportStrategy", "!=", "null", ")", "{", "// socket timeouts handling", "final", "Properties", "sessionProperties", "=", "session", ".", "getProperties", "(", ")", ";", "sessionProperties", ".", "put", "(", "transportStrategy", ".", "propertyNameConnectionTimeout", "(", ")", ",", "String", ".", "valueOf", "(", "sessionTimeout", ")", ")", ";", "sessionProperties", ".", "put", "(", "transportStrategy", ".", "propertyNameTimeout", "(", ")", ",", "String", ".", "valueOf", "(", "sessionTimeout", ")", ")", ";", "sessionProperties", ".", "put", "(", "transportStrategy", ".", "propertyNameWriteTimeout", "(", ")", ",", "String", ".", "valueOf", "(", "sessionTimeout", ")", ")", ";", "}", "else", "{", "LOGGER", ".", "debug", "(", "\"No transport strategy provided, skipping defaults for .connectiontimout, .timout and .writetimeout\"", ")", ";", "}", "}" ]
Configures the {@link Session} with the same timeout for socket connection timeout, read and write timeout.
[ "Configures", "the", "{" ]
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/mailer/internal/mailsender/MailSenderImpl.java#L198-L208
antopen/alipay-sdk-java
src/main/java/com/alipay/api/internal/util/AlipaySignature.java
AlipaySignature.rsaDecrypt
public static String rsaDecrypt(String content, String privateKey, String charset) throws AlipayApiException { """ 私钥解密 @param content 待解密内容 @param privateKey 私钥 @param charset 字符集,如UTF-8, GBK, GB2312 @return 明文内容 @throws AlipayApiException """ try { PrivateKey priKey = getPrivateKeyFromPKCS8(AlipayConstants.SIGN_TYPE_RSA, new ByteArrayInputStream(privateKey.getBytes())); Cipher cipher = Cipher.getInstance(AlipayConstants.SIGN_TYPE_RSA); cipher.init(Cipher.DECRYPT_MODE, priKey); byte[] encryptedData = StringUtils.isEmpty(charset) ? Base64.decodeBase64(content.getBytes()) : Base64.decodeBase64(content.getBytes(charset)); int inputLen = encryptedData.length; ByteArrayOutputStream out = new ByteArrayOutputStream(); int offSet = 0; byte[] cache; int i = 0; // 对数据分段解密 while (inputLen - offSet > 0) { if (inputLen - offSet > MAX_DECRYPT_BLOCK) { cache = cipher.doFinal(encryptedData, offSet, MAX_DECRYPT_BLOCK); } else { cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet); } out.write(cache, 0, cache.length); i++; offSet = i * MAX_DECRYPT_BLOCK; } byte[] decryptedData = out.toByteArray(); out.close(); return StringUtils.isEmpty(charset) ? new String(decryptedData) : new String(decryptedData, charset); } catch (Exception e) { throw new AlipayApiException("EncodeContent = " + content + ",charset = " + charset, e); } }
java
public static String rsaDecrypt(String content, String privateKey, String charset) throws AlipayApiException { try { PrivateKey priKey = getPrivateKeyFromPKCS8(AlipayConstants.SIGN_TYPE_RSA, new ByteArrayInputStream(privateKey.getBytes())); Cipher cipher = Cipher.getInstance(AlipayConstants.SIGN_TYPE_RSA); cipher.init(Cipher.DECRYPT_MODE, priKey); byte[] encryptedData = StringUtils.isEmpty(charset) ? Base64.decodeBase64(content.getBytes()) : Base64.decodeBase64(content.getBytes(charset)); int inputLen = encryptedData.length; ByteArrayOutputStream out = new ByteArrayOutputStream(); int offSet = 0; byte[] cache; int i = 0; // 对数据分段解密 while (inputLen - offSet > 0) { if (inputLen - offSet > MAX_DECRYPT_BLOCK) { cache = cipher.doFinal(encryptedData, offSet, MAX_DECRYPT_BLOCK); } else { cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet); } out.write(cache, 0, cache.length); i++; offSet = i * MAX_DECRYPT_BLOCK; } byte[] decryptedData = out.toByteArray(); out.close(); return StringUtils.isEmpty(charset) ? new String(decryptedData) : new String(decryptedData, charset); } catch (Exception e) { throw new AlipayApiException("EncodeContent = " + content + ",charset = " + charset, e); } }
[ "public", "static", "String", "rsaDecrypt", "(", "String", "content", ",", "String", "privateKey", ",", "String", "charset", ")", "throws", "AlipayApiException", "{", "try", "{", "PrivateKey", "priKey", "=", "getPrivateKeyFromPKCS8", "(", "AlipayConstants", ".", "SIGN_TYPE_RSA", ",", "new", "ByteArrayInputStream", "(", "privateKey", ".", "getBytes", "(", ")", ")", ")", ";", "Cipher", "cipher", "=", "Cipher", ".", "getInstance", "(", "AlipayConstants", ".", "SIGN_TYPE_RSA", ")", ";", "cipher", ".", "init", "(", "Cipher", ".", "DECRYPT_MODE", ",", "priKey", ")", ";", "byte", "[", "]", "encryptedData", "=", "StringUtils", ".", "isEmpty", "(", "charset", ")", "?", "Base64", ".", "decodeBase64", "(", "content", ".", "getBytes", "(", ")", ")", ":", "Base64", ".", "decodeBase64", "(", "content", ".", "getBytes", "(", "charset", ")", ")", ";", "int", "inputLen", "=", "encryptedData", ".", "length", ";", "ByteArrayOutputStream", "out", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "int", "offSet", "=", "0", ";", "byte", "[", "]", "cache", ";", "int", "i", "=", "0", ";", "// 对数据分段解密 ", "while", "(", "inputLen", "-", "offSet", ">", "0", ")", "{", "if", "(", "inputLen", "-", "offSet", ">", "MAX_DECRYPT_BLOCK", ")", "{", "cache", "=", "cipher", ".", "doFinal", "(", "encryptedData", ",", "offSet", ",", "MAX_DECRYPT_BLOCK", ")", ";", "}", "else", "{", "cache", "=", "cipher", ".", "doFinal", "(", "encryptedData", ",", "offSet", ",", "inputLen", "-", "offSet", ")", ";", "}", "out", ".", "write", "(", "cache", ",", "0", ",", "cache", ".", "length", ")", ";", "i", "++", ";", "offSet", "=", "i", "*", "MAX_DECRYPT_BLOCK", ";", "}", "byte", "[", "]", "decryptedData", "=", "out", ".", "toByteArray", "(", ")", ";", "out", ".", "close", "(", ")", ";", "return", "StringUtils", ".", "isEmpty", "(", "charset", ")", "?", "new", "String", "(", "decryptedData", ")", ":", "new", "String", "(", "decryptedData", ",", "charset", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "AlipayApiException", "(", "\"EncodeContent = \"", "+", "content", "+", "\",charset = \"", "+", "charset", ",", "e", ")", ";", "}", "}" ]
私钥解密 @param content 待解密内容 @param privateKey 私钥 @param charset 字符集,如UTF-8, GBK, GB2312 @return 明文内容 @throws AlipayApiException
[ "私钥解密" ]
train
https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/AlipaySignature.java#L598-L632
basho/riak-java-client
src/main/java/com/basho/riak/client/core/query/UserMetadata/RiakUserMetadata.java
RiakUserMetadata.put
public void put(String key, String value) { """ Set a user metadata entry. <p> This method and its {@link RiakUserMetadata#get(java.lang.String) } counterpart use the default {@code Charset} to convert the {@code String}s. </p> @param key the key for the user metadata entry as a {@code String} encoded using the default {@code Charset} @param value the value for the entry as a {@code String} encoded using the default {@code Charset} """ put(key, value, DefaultCharset.get()); }
java
public void put(String key, String value) { put(key, value, DefaultCharset.get()); }
[ "public", "void", "put", "(", "String", "key", ",", "String", "value", ")", "{", "put", "(", "key", ",", "value", ",", "DefaultCharset", ".", "get", "(", ")", ")", ";", "}" ]
Set a user metadata entry. <p> This method and its {@link RiakUserMetadata#get(java.lang.String) } counterpart use the default {@code Charset} to convert the {@code String}s. </p> @param key the key for the user metadata entry as a {@code String} encoded using the default {@code Charset} @param value the value for the entry as a {@code String} encoded using the default {@code Charset}
[ "Set", "a", "user", "metadata", "entry", ".", "<p", ">", "This", "method", "and", "its", "{", "@link", "RiakUserMetadata#get", "(", "java", ".", "lang", ".", "String", ")", "}", "counterpart", "use", "the", "default", "{", "@code", "Charset", "}", "to", "convert", "the", "{", "@code", "String", "}", "s", ".", "<", "/", "p", ">" ]
train
https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/core/query/UserMetadata/RiakUserMetadata.java#L165-L168
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
DBCleanService.getRepositoryDBCleaner
public static DBCleanerTool getRepositoryDBCleaner(Connection jdbcConn, RepositoryEntry rEntry) throws DBCleanException { """ Returns database cleaner for repository. @param jdbcConn database connection which need to use @param rEntry repository configuration @return DBCleanerTool @throws DBCleanException """ SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); WorkspaceEntry wsEntry = rEntry.getWorkspaceEntries().get(0); boolean multiDb = getMultiDbParameter(wsEntry); if (multiDb) { throw new DBCleanException( "It is not possible to create cleaner with common connection for multi database repository configuration"); } String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); DBCleaningScripts scripts = DBCleaningScriptsFactory.prepareScripts(dialect, rEntry); return new DBCleanerTool(jdbcConn, autoCommit, scripts.getCleaningScripts(), scripts.getCommittingScripts(), scripts.getRollbackingScripts()); }
java
public static DBCleanerTool getRepositoryDBCleaner(Connection jdbcConn, RepositoryEntry rEntry) throws DBCleanException { SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION); WorkspaceEntry wsEntry = rEntry.getWorkspaceEntries().get(0); boolean multiDb = getMultiDbParameter(wsEntry); if (multiDb) { throw new DBCleanException( "It is not possible to create cleaner with common connection for multi database repository configuration"); } String dialect = resolveDialect(jdbcConn, wsEntry); boolean autoCommit = dialect.startsWith(DialectConstants.DB_DIALECT_SYBASE); DBCleaningScripts scripts = DBCleaningScriptsFactory.prepareScripts(dialect, rEntry); return new DBCleanerTool(jdbcConn, autoCommit, scripts.getCleaningScripts(), scripts.getCommittingScripts(), scripts.getRollbackingScripts()); }
[ "public", "static", "DBCleanerTool", "getRepositoryDBCleaner", "(", "Connection", "jdbcConn", ",", "RepositoryEntry", "rEntry", ")", "throws", "DBCleanException", "{", "SecurityHelper", ".", "validateSecurityPermission", "(", "JCRRuntimePermissions", ".", "MANAGE_REPOSITORY_PERMISSION", ")", ";", "WorkspaceEntry", "wsEntry", "=", "rEntry", ".", "getWorkspaceEntries", "(", ")", ".", "get", "(", "0", ")", ";", "boolean", "multiDb", "=", "getMultiDbParameter", "(", "wsEntry", ")", ";", "if", "(", "multiDb", ")", "{", "throw", "new", "DBCleanException", "(", "\"It is not possible to create cleaner with common connection for multi database repository configuration\"", ")", ";", "}", "String", "dialect", "=", "resolveDialect", "(", "jdbcConn", ",", "wsEntry", ")", ";", "boolean", "autoCommit", "=", "dialect", ".", "startsWith", "(", "DialectConstants", ".", "DB_DIALECT_SYBASE", ")", ";", "DBCleaningScripts", "scripts", "=", "DBCleaningScriptsFactory", ".", "prepareScripts", "(", "dialect", ",", "rEntry", ")", ";", "return", "new", "DBCleanerTool", "(", "jdbcConn", ",", "autoCommit", ",", "scripts", ".", "getCleaningScripts", "(", ")", ",", "scripts", ".", "getCommittingScripts", "(", ")", ",", "scripts", ".", "getRollbackingScripts", "(", ")", ")", ";", "}" ]
Returns database cleaner for repository. @param jdbcConn database connection which need to use @param rEntry repository configuration @return DBCleanerTool @throws DBCleanException
[ "Returns", "database", "cleaner", "for", "repository", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java#L158-L179
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/WSX509KeyManager.java
WSX509KeyManager.chooseEngineServerAlias
@Override public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine) { """ Handshakes that use the SSLEngine and not an SSLSocket require this method from the extended X509KeyManager. @see javax.net.ssl.X509ExtendedKeyManager#chooseEngineServerAlias(java.lang.String, java.security.Principal[], javax.net.ssl.SSLEngine) """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "chooseEngineServerAlias", new Object[] { keyType, issuers, engine }); String rc = null; if (null != customKM && customKM instanceof X509ExtendedKeyManager) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "chooseEngineServerAlias, using customKM -> " + customKM.getClass().getName()); rc = ((X509ExtendedKeyManager) customKM).chooseEngineServerAlias(keyType, issuers, engine); } else { rc = chooseServerAlias(keyType, issuers); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "chooseEngineServerAlias: " + rc); return rc; }
java
@Override public String chooseEngineServerAlias(String keyType, Principal[] issuers, SSLEngine engine) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "chooseEngineServerAlias", new Object[] { keyType, issuers, engine }); String rc = null; if (null != customKM && customKM instanceof X509ExtendedKeyManager) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "chooseEngineServerAlias, using customKM -> " + customKM.getClass().getName()); rc = ((X509ExtendedKeyManager) customKM).chooseEngineServerAlias(keyType, issuers, engine); } else { rc = chooseServerAlias(keyType, issuers); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "chooseEngineServerAlias: " + rc); return rc; }
[ "@", "Override", "public", "String", "chooseEngineServerAlias", "(", "String", "keyType", ",", "Principal", "[", "]", "issuers", ",", "SSLEngine", "engine", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"chooseEngineServerAlias\"", ",", "new", "Object", "[", "]", "{", "keyType", ",", "issuers", ",", "engine", "}", ")", ";", "String", "rc", "=", "null", ";", "if", "(", "null", "!=", "customKM", "&&", "customKM", "instanceof", "X509ExtendedKeyManager", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", ".", "debug", "(", "tc", ",", "\"chooseEngineServerAlias, using customKM -> \"", "+", "customKM", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "rc", "=", "(", "(", "X509ExtendedKeyManager", ")", "customKM", ")", ".", "chooseEngineServerAlias", "(", "keyType", ",", "issuers", ",", "engine", ")", ";", "}", "else", "{", "rc", "=", "chooseServerAlias", "(", "keyType", ",", "issuers", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"chooseEngineServerAlias: \"", "+", "rc", ")", ";", "return", "rc", ";", "}" ]
Handshakes that use the SSLEngine and not an SSLSocket require this method from the extended X509KeyManager. @see javax.net.ssl.X509ExtendedKeyManager#chooseEngineServerAlias(java.lang.String, java.security.Principal[], javax.net.ssl.SSLEngine)
[ "Handshakes", "that", "use", "the", "SSLEngine", "and", "not", "an", "SSLSocket", "require", "this", "method", "from", "the", "extended", "X509KeyManager", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/core/WSX509KeyManager.java#L313-L329
michael-rapp/AndroidMaterialDialog
example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java
PreferenceFragment.createPositiveButtonListener
private OnClickListener createPositiveButtonListener() { """ Creates and returns a listener, which allows to show a toast, when the positive button of a dialog has been clicked. @return The listener, which has been created, as an instance of the class {@link OnClickListener} """ return new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getActivity(), R.string.positive_button_toast, Toast.LENGTH_SHORT) .show(); } }; }
java
private OnClickListener createPositiveButtonListener() { return new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getActivity(), R.string.positive_button_toast, Toast.LENGTH_SHORT) .show(); } }; }
[ "private", "OnClickListener", "createPositiveButtonListener", "(", ")", "{", "return", "new", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "DialogInterface", "dialog", ",", "int", "which", ")", "{", "Toast", ".", "makeText", "(", "getActivity", "(", ")", ",", "R", ".", "string", ".", "positive_button_toast", ",", "Toast", ".", "LENGTH_SHORT", ")", ".", "show", "(", ")", ";", "}", "}", ";", "}" ]
Creates and returns a listener, which allows to show a toast, when the positive button of a dialog has been clicked. @return The listener, which has been created, as an instance of the class {@link OnClickListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "show", "a", "toast", "when", "the", "positive", "button", "of", "a", "dialog", "has", "been", "clicked", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java#L791-L801
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyFile
public static boolean copyFile(final File source, final File destination, final boolean lastModified) throws IOException { """ Copies the given source file to the given destination file with the option to set the lastModified time from the given destination file. @param source The source file. @param destination The destination file. @param lastModified Flag the tells if the attribute lastModified has to be set with the attribute from the destination file. @return 's true if the file is copied, otherwise false. @throws IOException Is thrown if an error occurs by reading or writing. """ return copyFile(source, destination, null, null, lastModified); }
java
public static boolean copyFile(final File source, final File destination, final boolean lastModified) throws IOException { return copyFile(source, destination, null, null, lastModified); }
[ "public", "static", "boolean", "copyFile", "(", "final", "File", "source", ",", "final", "File", "destination", ",", "final", "boolean", "lastModified", ")", "throws", "IOException", "{", "return", "copyFile", "(", "source", ",", "destination", ",", "null", ",", "null", ",", "lastModified", ")", ";", "}" ]
Copies the given source file to the given destination file with the option to set the lastModified time from the given destination file. @param source The source file. @param destination The destination file. @param lastModified Flag the tells if the attribute lastModified has to be set with the attribute from the destination file. @return 's true if the file is copied, otherwise false. @throws IOException Is thrown if an error occurs by reading or writing.
[ "Copies", "the", "given", "source", "file", "to", "the", "given", "destination", "file", "with", "the", "option", "to", "set", "the", "lastModified", "time", "from", "the", "given", "destination", "file", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L507-L511
banq/jdonframework
src/main/java/com/jdon/util/UtilDateTime.java
UtilDateTime.toSqlDate
public static java.sql.Date toSqlDate(int month, int day, int year) { """ Makes a java.sql.Date from separate ints for month, day, year @param month The month int @param day The day int @param year The year int @return A java.sql.Date made from separate ints for month, day, year """ java.util.Date newDate = toDate(month, day, year, 0, 0, 0); if (newDate != null) return new java.sql.Date(newDate.getTime()); else return null; }
java
public static java.sql.Date toSqlDate(int month, int day, int year) { java.util.Date newDate = toDate(month, day, year, 0, 0, 0); if (newDate != null) return new java.sql.Date(newDate.getTime()); else return null; }
[ "public", "static", "java", ".", "sql", ".", "Date", "toSqlDate", "(", "int", "month", ",", "int", "day", ",", "int", "year", ")", "{", "java", ".", "util", ".", "Date", "newDate", "=", "toDate", "(", "month", ",", "day", ",", "year", ",", "0", ",", "0", ",", "0", ")", ";", "if", "(", "newDate", "!=", "null", ")", "return", "new", "java", ".", "sql", ".", "Date", "(", "newDate", ".", "getTime", "(", ")", ")", ";", "else", "return", "null", ";", "}" ]
Makes a java.sql.Date from separate ints for month, day, year @param month The month int @param day The day int @param year The year int @return A java.sql.Date made from separate ints for month, day, year
[ "Makes", "a", "java", ".", "sql", ".", "Date", "from", "separate", "ints", "for", "month", "day", "year" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L137-L144
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java
TenantService.deleteTenant
public void deleteTenant(String tenantName, Map<String, String> options) { """ Delete an existing tenant with the given options. The tenant's keyspace is dropped, which deletes all user and system tables, and the tenant's users are deleted. The given options are currently used for testing only. This method is a no-op if the given tenant does not exist. @param tenantName Name of tenant to delete. """ checkServiceState(); TenantDefinition tenantDef = getTenantDef(tenantName); if (tenantDef == null) { return; } Tenant tenant = new Tenant(tenantDef); try { DBService.instance(tenant).dropNamespace(); } catch (RuntimeException e) { if (options == null || !"true".equalsIgnoreCase(options.get("ignoreTenantDBNotAvailable"))) { throw e; } m_logger.warn("Drop namespace skipped for tenant '{}'", tenantName); } // Delete tenant definition in default database. Tenant defaultTenant = getDefaultTenant(); DBTransaction dbTran = new DBTransaction(defaultTenant); dbTran.deleteRow(TENANTS_STORE_NAME, tenantName); DBService.instance(defaultTenant).commit(dbTran); DBManagerService.instance().deleteTenantDB(tenant); }
java
public void deleteTenant(String tenantName, Map<String, String> options) { checkServiceState(); TenantDefinition tenantDef = getTenantDef(tenantName); if (tenantDef == null) { return; } Tenant tenant = new Tenant(tenantDef); try { DBService.instance(tenant).dropNamespace(); } catch (RuntimeException e) { if (options == null || !"true".equalsIgnoreCase(options.get("ignoreTenantDBNotAvailable"))) { throw e; } m_logger.warn("Drop namespace skipped for tenant '{}'", tenantName); } // Delete tenant definition in default database. Tenant defaultTenant = getDefaultTenant(); DBTransaction dbTran = new DBTransaction(defaultTenant); dbTran.deleteRow(TENANTS_STORE_NAME, tenantName); DBService.instance(defaultTenant).commit(dbTran); DBManagerService.instance().deleteTenantDB(tenant); }
[ "public", "void", "deleteTenant", "(", "String", "tenantName", ",", "Map", "<", "String", ",", "String", ">", "options", ")", "{", "checkServiceState", "(", ")", ";", "TenantDefinition", "tenantDef", "=", "getTenantDef", "(", "tenantName", ")", ";", "if", "(", "tenantDef", "==", "null", ")", "{", "return", ";", "}", "Tenant", "tenant", "=", "new", "Tenant", "(", "tenantDef", ")", ";", "try", "{", "DBService", ".", "instance", "(", "tenant", ")", ".", "dropNamespace", "(", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "if", "(", "options", "==", "null", "||", "!", "\"true\"", ".", "equalsIgnoreCase", "(", "options", ".", "get", "(", "\"ignoreTenantDBNotAvailable\"", ")", ")", ")", "{", "throw", "e", ";", "}", "m_logger", ".", "warn", "(", "\"Drop namespace skipped for tenant '{}'\"", ",", "tenantName", ")", ";", "}", "// Delete tenant definition in default database.", "Tenant", "defaultTenant", "=", "getDefaultTenant", "(", ")", ";", "DBTransaction", "dbTran", "=", "new", "DBTransaction", "(", "defaultTenant", ")", ";", "dbTran", ".", "deleteRow", "(", "TENANTS_STORE_NAME", ",", "tenantName", ")", ";", "DBService", ".", "instance", "(", "defaultTenant", ")", ".", "commit", "(", "dbTran", ")", ";", "DBManagerService", ".", "instance", "(", ")", ".", "deleteTenantDB", "(", "tenant", ")", ";", "}" ]
Delete an existing tenant with the given options. The tenant's keyspace is dropped, which deletes all user and system tables, and the tenant's users are deleted. The given options are currently used for testing only. This method is a no-op if the given tenant does not exist. @param tenantName Name of tenant to delete.
[ "Delete", "an", "existing", "tenant", "with", "the", "given", "options", ".", "The", "tenant", "s", "keyspace", "is", "dropped", "which", "deletes", "all", "user", "and", "system", "tables", "and", "the", "tenant", "s", "users", "are", "deleted", ".", "The", "given", "options", "are", "currently", "used", "for", "testing", "only", ".", "This", "method", "is", "a", "no", "-", "op", "if", "the", "given", "tenant", "does", "not", "exist", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/tenant/TenantService.java#L315-L338