repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java
ScreenField.setSFieldValue
public int setSFieldValue(String strParamValue, boolean bDisplayOption, int iMoveMode) { if (this.getConverter() != null) return this.getConverter().setString(strParamValue, bDisplayOption, iMoveMode); else return Constant.NORMAL_RETURN; }
java
public int setSFieldValue(String strParamValue, boolean bDisplayOption, int iMoveMode) { if (this.getConverter() != null) return this.getConverter().setString(strParamValue, bDisplayOption, iMoveMode); else return Constant.NORMAL_RETURN; }
[ "public", "int", "setSFieldValue", "(", "String", "strParamValue", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "if", "(", "this", ".", "getConverter", "(", ")", "!=", "null", ")", "return", "this", ".", "getConverter", "(", ")", "....
Set this control's converter to this HTML param. @param strParamValue The value to set the field to. @return The error code.
[ "Set", "this", "control", "s", "converter", "to", "this", "HTML", "param", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ScreenField.java#L595-L601
apache/spark
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java
UnsafeRow.writeToStream
public void writeToStream(OutputStream out, byte[] writeBuffer) throws IOException { if (baseObject instanceof byte[]) { int offsetInByteArray = (int) (baseOffset - Platform.BYTE_ARRAY_OFFSET); out.write((byte[]) baseObject, offsetInByteArray, sizeInBytes); }
java
public void writeToStream(OutputStream out, byte[] writeBuffer) throws IOException { if (baseObject instanceof byte[]) { int offsetInByteArray = (int) (baseOffset - Platform.BYTE_ARRAY_OFFSET); out.write((byte[]) baseObject, offsetInByteArray, sizeInBytes); }
[ "public", "void", "writeToStream", "(", "OutputStream", "out", ",", "byte", "[", "]", "writeBuffer", ")", "throws", "IOException", "{", "if", "(", "baseObject", "instanceof", "byte", "[", "]", ")", "{", "int", "offsetInByteArray", "=", "(", "int", ")", "("...
Write this UnsafeRow's underlying bytes to the given OutputStream. @param out the stream to write to. @param writeBuffer a byte array for buffering chunks of off-heap data while writing to the output stream. If this row is backed by an on-heap byte array, then this buffer will not be used and may be null.
[ "Write", "this", "UnsafeRow", "s", "underlying", "bytes", "to", "the", "given", "OutputStream", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/UnsafeRow.java#L506-L510
maddingo/sojo
src/main/java/net/sf/sojo/core/filter/ClassPropertyFilterHelper.java
ClassPropertyFilterHelper.isPropertyToFiltering
public static boolean isPropertyToFiltering (ClassPropertyFilterHandler pvClassPropertyFilterHandler, Class<?> pvClassForFindFilter, Object pvKey) { boolean lvAddProperty = false; if (pvClassPropertyFilterHandler != null) { ClassPropertyFilter lvClassPropertyFilter = pvClassPropertyFilterHandler.getClassPropertyFilterByClass(pvClassForFindFilter); String lvKey = (pvKey == null ? null : pvKey.toString()); if (lvClassPropertyFilter != null && lvClassPropertyFilter.isKnownProperty(lvKey) == true) { lvAddProperty = true; } } return lvAddProperty; }
java
public static boolean isPropertyToFiltering (ClassPropertyFilterHandler pvClassPropertyFilterHandler, Class<?> pvClassForFindFilter, Object pvKey) { boolean lvAddProperty = false; if (pvClassPropertyFilterHandler != null) { ClassPropertyFilter lvClassPropertyFilter = pvClassPropertyFilterHandler.getClassPropertyFilterByClass(pvClassForFindFilter); String lvKey = (pvKey == null ? null : pvKey.toString()); if (lvClassPropertyFilter != null && lvClassPropertyFilter.isKnownProperty(lvKey) == true) { lvAddProperty = true; } } return lvAddProperty; }
[ "public", "static", "boolean", "isPropertyToFiltering", "(", "ClassPropertyFilterHandler", "pvClassPropertyFilterHandler", ",", "Class", "<", "?", ">", "pvClassForFindFilter", ",", "Object", "pvKey", ")", "{", "boolean", "lvAddProperty", "=", "false", ";", "if", "(", ...
Check a property from a class by a handler. @param pvClassPropertyFilterHandler The handler implementation. @param pvClassForFindFilter The class for the filter. @param pvKey The to filtering property. @return <code>true</code>, if the property from the class is known by the handler, else <code>false</code>.
[ "Check", "a", "property", "from", "a", "class", "by", "a", "handler", "." ]
train
https://github.com/maddingo/sojo/blob/99e9e0a146b502deb7f507fe0623227402ed675b/src/main/java/net/sf/sojo/core/filter/ClassPropertyFilterHelper.java#L37-L47
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/group/DisjointSetForest.java
DisjointSetForest.makeUnion
public void makeUnion(int elementX, int elementY) { int xRoot = getRoot(elementX); int yRoot = getRoot(elementY); if (xRoot == yRoot) { return; } if (forest[xRoot] < forest[yRoot]) { forest[yRoot] = forest[yRoot] + forest[xRoot]; forest[xRoot] = yRoot; } else { forest[xRoot] = forest[xRoot] + forest[yRoot]; forest[yRoot] = xRoot; } }
java
public void makeUnion(int elementX, int elementY) { int xRoot = getRoot(elementX); int yRoot = getRoot(elementY); if (xRoot == yRoot) { return; } if (forest[xRoot] < forest[yRoot]) { forest[yRoot] = forest[yRoot] + forest[xRoot]; forest[xRoot] = yRoot; } else { forest[xRoot] = forest[xRoot] + forest[yRoot]; forest[yRoot] = xRoot; } }
[ "public", "void", "makeUnion", "(", "int", "elementX", ",", "int", "elementY", ")", "{", "int", "xRoot", "=", "getRoot", "(", "elementX", ")", ";", "int", "yRoot", "=", "getRoot", "(", "elementY", ")", ";", "if", "(", "xRoot", "==", "yRoot", ")", "{"...
Union these two elements - in other words, put them in the same set. @param elementX an element @param elementY an element
[ "Union", "these", "two", "elements", "-", "in", "other", "words", "put", "them", "in", "the", "same", "set", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/group/DisjointSetForest.java#L90-L105
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/PatternMatcher.java
PatternMatcher.attemptMatch
private void attemptMatch(BasicBlock basicBlock, BasicBlock.InstructionIterator instructionIterator) throws DataflowAnalysisException { work(new State(basicBlock, instructionIterator, pattern.getFirst())); }
java
private void attemptMatch(BasicBlock basicBlock, BasicBlock.InstructionIterator instructionIterator) throws DataflowAnalysisException { work(new State(basicBlock, instructionIterator, pattern.getFirst())); }
[ "private", "void", "attemptMatch", "(", "BasicBlock", "basicBlock", ",", "BasicBlock", ".", "InstructionIterator", "instructionIterator", ")", "throws", "DataflowAnalysisException", "{", "work", "(", "new", "State", "(", "basicBlock", ",", "instructionIterator", ",", ...
Attempt to begin a match. @param basicBlock the basic block @param instructionIterator the instruction iterator positioned just before the first instruction to be matched
[ "Attempt", "to", "begin", "a", "match", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/PatternMatcher.java#L159-L162
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/example/cookbook/datamovement/JobInformationRecorder.java
JobInformationRecorder.withWriteBatcher
public JobInformationRecorder withWriteBatcher(DataMovementManager dataMovementManager, WriteBatcher writeBatcher) { if(sourceBatcher.isStarted()) throw new IllegalStateException("Configuration cannot be changed after startJob has been called"); this.writeBatcher = writeBatcher; this.dataMovementManager = dataMovementManager; this.client = writeBatcher.getPrimaryClient(); this.dataMovementManager.startJob(this.writeBatcher); return this; }
java
public JobInformationRecorder withWriteBatcher(DataMovementManager dataMovementManager, WriteBatcher writeBatcher) { if(sourceBatcher.isStarted()) throw new IllegalStateException("Configuration cannot be changed after startJob has been called"); this.writeBatcher = writeBatcher; this.dataMovementManager = dataMovementManager; this.client = writeBatcher.getPrimaryClient(); this.dataMovementManager.startJob(this.writeBatcher); return this; }
[ "public", "JobInformationRecorder", "withWriteBatcher", "(", "DataMovementManager", "dataMovementManager", ",", "WriteBatcher", "writeBatcher", ")", "{", "if", "(", "sourceBatcher", ".", "isStarted", "(", ")", ")", "throw", "new", "IllegalStateException", "(", "\"Config...
Sets the WriteBatcher object which should be used for writing the job information. This overrides the internal WriteBatcher object created by default. @param writeBatcher The WriteBatcher object with which we should write the job information. @return this object for chaining
[ "Sets", "the", "WriteBatcher", "object", "which", "should", "be", "used", "for", "writing", "the", "job", "information", ".", "This", "overrides", "the", "internal", "WriteBatcher", "object", "created", "by", "default", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/example/cookbook/datamovement/JobInformationRecorder.java#L122-L129
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.readLines
public static <T extends Collection<String>> T readLines(Reader reader, final T collection) throws IORuntimeException { readLines(reader, new LineHandler() { @Override public void handle(String line) { collection.add(line); } }); return collection; }
java
public static <T extends Collection<String>> T readLines(Reader reader, final T collection) throws IORuntimeException { readLines(reader, new LineHandler() { @Override public void handle(String line) { collection.add(line); } }); return collection; }
[ "public", "static", "<", "T", "extends", "Collection", "<", "String", ">", ">", "T", "readLines", "(", "Reader", "reader", ",", "final", "T", "collection", ")", "throws", "IORuntimeException", "{", "readLines", "(", "reader", ",", "new", "LineHandler", "(", ...
从Reader中读取内容 @param <T> 集合类型 @param reader {@link Reader} @param collection 返回集合 @return 内容 @throws IORuntimeException IO异常
[ "从Reader中读取内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L671-L679
stratosphere/stratosphere
stratosphere-core/src/main/java/eu/stratosphere/api/common/io/FormatUtil.java
FormatUtil.openInput
public static <T, F extends FileInputFormat<T>> F openInput( Class<F> inputFormatClass, String path, Configuration configuration) throws IOException { configuration = configuration == null ? new Configuration() : configuration; Path normalizedPath = normalizePath(new Path(path)); final F inputFormat = ReflectionUtil.newInstance(inputFormatClass); inputFormat.setFilePath(normalizedPath); inputFormat.setOpenTimeout(0); inputFormat.configure(configuration); final FileSystem fs = FileSystem.get(normalizedPath.toUri()); FileStatus fileStatus = fs.getFileStatus(normalizedPath); BlockLocation[] blocks = fs.getFileBlockLocations(fileStatus, 0, fileStatus.getLen()); inputFormat.open(new FileInputSplit(0, new Path(path), 0, fileStatus.getLen(), blocks[0].getHosts())); return inputFormat; }
java
public static <T, F extends FileInputFormat<T>> F openInput( Class<F> inputFormatClass, String path, Configuration configuration) throws IOException { configuration = configuration == null ? new Configuration() : configuration; Path normalizedPath = normalizePath(new Path(path)); final F inputFormat = ReflectionUtil.newInstance(inputFormatClass); inputFormat.setFilePath(normalizedPath); inputFormat.setOpenTimeout(0); inputFormat.configure(configuration); final FileSystem fs = FileSystem.get(normalizedPath.toUri()); FileStatus fileStatus = fs.getFileStatus(normalizedPath); BlockLocation[] blocks = fs.getFileBlockLocations(fileStatus, 0, fileStatus.getLen()); inputFormat.open(new FileInputSplit(0, new Path(path), 0, fileStatus.getLen(), blocks[0].getHosts())); return inputFormat; }
[ "public", "static", "<", "T", ",", "F", "extends", "FileInputFormat", "<", "T", ">", ">", "F", "openInput", "(", "Class", "<", "F", ">", "inputFormatClass", ",", "String", "path", ",", "Configuration", "configuration", ")", "throws", "IOException", "{", "c...
Creates an {@link InputFormat} from a given class for the specified file. The optional {@link Configuration} initializes the format. @param <T> the class of the InputFormat @param inputFormatClass the class of the InputFormat @param path the path of the file @param configuration optional configuration of the InputFormat @return the created {@link InputFormat} @throws IOException if an I/O error occurred while accessing the file or initializing the InputFormat.
[ "Creates", "an", "{", "@link", "InputFormat", "}", "from", "a", "given", "class", "for", "the", "specified", "file", ".", "The", "optional", "{", "@link", "Configuration", "}", "initializes", "the", "format", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/io/FormatUtil.java#L55-L74
davidcarboni/cryptolite-java
src/main/java/com/github/davidcarboni/cryptolite/KeyExchange.java
KeyExchange.decryptKey
public SecretKey decryptKey(String encryptedKey, PrivateKey privateKey) { // Basic null check if (encryptedKey == null) { return null; } // Convert the encryptedKey key String back to a byte array: byte[] bytes = ByteArray.fromBase64(encryptedKey); // Decrypt the bytes: byte[] decrypted; try { Cipher cipher = getCipher(privateKey); decrypted = cipher.doFinal(bytes); } catch (IllegalBlockSizeException e) { throw new IllegalArgumentException("Error encrypting SecretKey: " + IllegalBlockSizeException.class.getSimpleName(), e); } catch (BadPaddingException e) { throw new IllegalArgumentException("Error decrypting SecretKey", e); } // Reconstruct the key: return new SecretKeySpec(decrypted, Crypto.CIPHER_ALGORITHM); }
java
public SecretKey decryptKey(String encryptedKey, PrivateKey privateKey) { // Basic null check if (encryptedKey == null) { return null; } // Convert the encryptedKey key String back to a byte array: byte[] bytes = ByteArray.fromBase64(encryptedKey); // Decrypt the bytes: byte[] decrypted; try { Cipher cipher = getCipher(privateKey); decrypted = cipher.doFinal(bytes); } catch (IllegalBlockSizeException e) { throw new IllegalArgumentException("Error encrypting SecretKey: " + IllegalBlockSizeException.class.getSimpleName(), e); } catch (BadPaddingException e) { throw new IllegalArgumentException("Error decrypting SecretKey", e); } // Reconstruct the key: return new SecretKeySpec(decrypted, Crypto.CIPHER_ALGORITHM); }
[ "public", "SecretKey", "decryptKey", "(", "String", "encryptedKey", ",", "PrivateKey", "privateKey", ")", "{", "// Basic null check\r", "if", "(", "encryptedKey", "==", "null", ")", "{", "return", "null", ";", "}", "// Convert the encryptedKey key String back to a byte ...
This method decrypts the given encrypted {@link SecretKey} using our {@link PrivateKey}. @param encryptedKey The encrypted key as a base64-encoded string, as returned by {@link #encryptKey(SecretKey, PublicKey)}. @param privateKey The {@link PrivateKey} to be used to decrypt the encrypted key. This can be obtained via {@link Keys#newKeyPair()}. @return The decrypted {@link SecretKey}.
[ "This", "method", "decrypts", "the", "given", "encrypted", "{", "@link", "SecretKey", "}", "using", "our", "{", "@link", "PrivateKey", "}", "." ]
train
https://github.com/davidcarboni/cryptolite-java/blob/e67954181a04ffc9beb1d9abca1421195fcf9764/src/main/java/com/github/davidcarboni/cryptolite/KeyExchange.java#L127-L150
padrig64/ValidationFramework
validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/anchor/AnchorLink.java
AnchorLink.getRelativeSlaveLocation
public Point getRelativeSlaveLocation(final Component masterComponent, final Component slaveComponent) { return getRelativeSlaveLocation(masterComponent.getWidth(), masterComponent.getHeight(), slaveComponent.getWidth(), slaveComponent.getHeight()); }
java
public Point getRelativeSlaveLocation(final Component masterComponent, final Component slaveComponent) { return getRelativeSlaveLocation(masterComponent.getWidth(), masterComponent.getHeight(), slaveComponent.getWidth(), slaveComponent.getHeight()); }
[ "public", "Point", "getRelativeSlaveLocation", "(", "final", "Component", "masterComponent", ",", "final", "Component", "slaveComponent", ")", "{", "return", "getRelativeSlaveLocation", "(", "masterComponent", ".", "getWidth", "(", ")", ",", "masterComponent", ".", "g...
Computes the location of the specified component that is slaved to the specified master component using this anchor link. @param masterComponent Master component to which the other component is slaved. @param slaveComponent Slave component that is slaved to the master component. @return Location where the slave component should be.
[ "Computes", "the", "location", "of", "the", "specified", "component", "that", "is", "slaved", "to", "the", "specified", "master", "component", "using", "this", "anchor", "link", "." ]
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-swing/src/main/java/com/google/code/validationframework/swing/decoration/anchor/AnchorLink.java#L113-L116
netty/netty
common/src/main/java/io/netty/util/AsciiString.java
AsciiString.containsIgnoreCase
public static boolean containsIgnoreCase(CharSequence a, CharSequence b) { return contains(a, b, AsciiCaseInsensitiveCharEqualityComparator.INSTANCE); }
java
public static boolean containsIgnoreCase(CharSequence a, CharSequence b) { return contains(a, b, AsciiCaseInsensitiveCharEqualityComparator.INSTANCE); }
[ "public", "static", "boolean", "containsIgnoreCase", "(", "CharSequence", "a", ",", "CharSequence", "b", ")", "{", "return", "contains", "(", "a", ",", "b", ",", "AsciiCaseInsensitiveCharEqualityComparator", ".", "INSTANCE", ")", ";", "}" ]
Determine if {@code a} contains {@code b} in a case insensitive manner.
[ "Determine", "if", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/AsciiString.java#L1432-L1434
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExampleSection.java
ExampleSection.getSource
private static String getSource(final String className) { String sourceName = '/' + className.replace('.', '/') + ".java"; InputStream stream = null; try { stream = ExampleSection.class.getResourceAsStream(sourceName); if (stream != null) { byte[] sourceBytes = StreamUtil.getBytes(stream); // we need to do some basic formatting of the source now. return new String(sourceBytes, "UTF-8"); } } catch (IOException e) { LOG.warn("Unable to read source code for class " + className, e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { LOG.error("Error closing stream", e); } } } return null; }
java
private static String getSource(final String className) { String sourceName = '/' + className.replace('.', '/') + ".java"; InputStream stream = null; try { stream = ExampleSection.class.getResourceAsStream(sourceName); if (stream != null) { byte[] sourceBytes = StreamUtil.getBytes(stream); // we need to do some basic formatting of the source now. return new String(sourceBytes, "UTF-8"); } } catch (IOException e) { LOG.warn("Unable to read source code for class " + className, e); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { LOG.error("Error closing stream", e); } } } return null; }
[ "private", "static", "String", "getSource", "(", "final", "String", "className", ")", "{", "String", "sourceName", "=", "'", "'", "+", "className", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\".java\"", ";", "InputStream", "stream", "=", ...
Tries to obtain the source file for the given class. @param className the name of the class to find the source for. @return the source file for the given class, or null on error.
[ "Tries", "to", "obtain", "the", "source", "file", "for", "the", "given", "class", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/picker/ExampleSection.java#L218-L245
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
Configuration.getResource
public Content getResource(String key, Object o) { return getResource(key, o, null, null); }
java
public Content getResource(String key, Object o) { return getResource(key, o, null, null); }
[ "public", "Content", "getResource", "(", "String", "key", ",", "Object", "o", ")", "{", "return", "getResource", "(", "key", ",", "o", ",", "null", ",", "null", ")", ";", "}" ]
Get the configuration string as a content. @param key the key to look for in the configuration file @param o string or content argument added to configuration text @return a content tree for the text
[ "Get", "the", "configuration", "string", "as", "a", "content", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java#L778-L780
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TextTrieMap.java
TextTrieMap.put
public TextTrieMap<V> put(CharSequence text, V val) { CharIterator chitr = new CharIterator(text, 0, _ignoreCase); _root.add(chitr, val); return this; }
java
public TextTrieMap<V> put(CharSequence text, V val) { CharIterator chitr = new CharIterator(text, 0, _ignoreCase); _root.add(chitr, val); return this; }
[ "public", "TextTrieMap", "<", "V", ">", "put", "(", "CharSequence", "text", ",", "V", "val", ")", "{", "CharIterator", "chitr", "=", "new", "CharIterator", "(", "text", ",", "0", ",", "_ignoreCase", ")", ";", "_root", ".", "add", "(", "chitr", ",", "...
Adds the text key and its associated object in this object. @param text The text. @param val The value object associated with the text.
[ "Adds", "the", "text", "key", "and", "its", "associated", "object", "in", "this", "object", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TextTrieMap.java#L44-L48
lukas-krecan/JsonUnit
json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/JsonUtils.java
JsonUtils.convertToJson
public static Node convertToJson(Object source, String label) { return convertToJson(source, label, false); }
java
public static Node convertToJson(Object source, String label) { return convertToJson(source, label, false); }
[ "public", "static", "Node", "convertToJson", "(", "Object", "source", ",", "String", "label", ")", "{", "return", "convertToJson", "(", "source", ",", "label", ",", "false", ")", ";", "}" ]
Converts object to JSON. @param source @param label label to be logged in case of error. @return
[ "Converts", "object", "to", "JSON", "." ]
train
https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-core/src/main/java/net/javacrumbs/jsonunit/core/internal/JsonUtils.java#L40-L42
VoltDB/voltdb
src/frontend/org/voltdb/exportclient/ExportRow.java
ExportRow.decodeRow
public static ExportRow decodeRow(ExportRow previous, int partition, long startTS, byte[] rowData) throws IOException { ByteBuffer bb = ByteBuffer.wrap(rowData); bb.order(ByteOrder.LITTLE_ENDIAN); return decodeRow(previous, partition, startTS, bb); }
java
public static ExportRow decodeRow(ExportRow previous, int partition, long startTS, byte[] rowData) throws IOException { ByteBuffer bb = ByteBuffer.wrap(rowData); bb.order(ByteOrder.LITTLE_ENDIAN); return decodeRow(previous, partition, startTS, bb); }
[ "public", "static", "ExportRow", "decodeRow", "(", "ExportRow", "previous", ",", "int", "partition", ",", "long", "startTS", ",", "byte", "[", "]", "rowData", ")", "throws", "IOException", "{", "ByteBuffer", "bb", "=", "ByteBuffer", ".", "wrap", "(", "rowDat...
Decode a byte array of row data into ExportRow @param rowData @return ExportRow @throws IOException
[ "Decode", "a", "byte", "array", "of", "row", "data", "into", "ExportRow" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/exportclient/ExportRow.java#L145-L149
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceClient.java
InstanceClient.insertInstance
@BetaApi public final Operation insertInstance(String zone, Instance instanceResource) { InsertInstanceHttpRequest request = InsertInstanceHttpRequest.newBuilder() .setZone(zone) .setInstanceResource(instanceResource) .build(); return insertInstance(request); }
java
@BetaApi public final Operation insertInstance(String zone, Instance instanceResource) { InsertInstanceHttpRequest request = InsertInstanceHttpRequest.newBuilder() .setZone(zone) .setInstanceResource(instanceResource) .build(); return insertInstance(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertInstance", "(", "String", "zone", ",", "Instance", "instanceResource", ")", "{", "InsertInstanceHttpRequest", "request", "=", "InsertInstanceHttpRequest", ".", "newBuilder", "(", ")", ".", "setZone", "(", "zone"...
Creates an instance resource in the specified project using the data included in the request. <p>Sample code: <pre><code> try (InstanceClient instanceClient = InstanceClient.create()) { ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); Instance instanceResource = Instance.newBuilder().build(); Operation response = instanceClient.insertInstance(zone.toString(), instanceResource); } </code></pre> @param zone The name of the zone for this request. @param instanceResource An Instance resource. (== resource_for beta.instances ==) (== resource_for v1.instances ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "an", "instance", "resource", "in", "the", "specified", "project", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceClient.java#L1370-L1379
dnsjava/dnsjava
org/xbill/DNS/DNSOutput.java
DNSOutput.writeByteArray
public void writeByteArray(byte [] b, int off, int len) { need(len); System.arraycopy(b, off, array, pos, len); pos += len; }
java
public void writeByteArray(byte [] b, int off, int len) { need(len); System.arraycopy(b, off, array, pos, len); pos += len; }
[ "public", "void", "writeByteArray", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "{", "need", "(", "len", ")", ";", "System", ".", "arraycopy", "(", "b", ",", "off", ",", "array", ",", "pos", ",", "len", ")", ";", "pos...
Writes a byte array to the stream. @param b The array to write. @param off The offset of the array to start copying data from. @param len The number of bytes to write.
[ "Writes", "a", "byte", "array", "to", "the", "stream", "." ]
train
https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/DNSOutput.java#L162-L167
gosu-lang/gosu-lang
gosu-core/src/main/java/gw/internal/gosu/parser/ContextSensitiveCodeRunner.java
ContextSensitiveCodeRunner.runMeSomeCode
public static Object runMeSomeCode( Object enclosingInstance, ClassLoader cl, Object[] extSyms, String strText, final String strClassContext, String strContextElementClass, int iSourcePosition ) { // Must execute in caller's classloader try { Class<?> cls; try { cls = Class.forName( ContextSensitiveCodeRunner.class.getName(), false, cl ); } catch( Exception e ) { cls = ContextSensitiveCodeRunner.class; } Method m = cls.getDeclaredMethod( "_runMeSomeCode", Object.class, Object[].class, String.class, String.class, String.class, int.class ); m.setAccessible( true ); return m.invoke( null, enclosingInstance, extSyms, strText, strClassContext, strContextElementClass, iSourcePosition ); } catch( Exception e ) { e.printStackTrace(); Throwable cause = GosuExceptionUtil.findExceptionCause( e ); if( cause instanceof ParseResultsException ) { List<IParseIssue> parseExceptions = ((ParseResultsException)cause).getParseExceptions(); if( parseExceptions != null && parseExceptions.size() >= 0 ) { throw GosuExceptionUtil.forceThrow( (Throwable)parseExceptions.get( 0 ) ); } } throw GosuExceptionUtil.forceThrow( cause ); } }
java
public static Object runMeSomeCode( Object enclosingInstance, ClassLoader cl, Object[] extSyms, String strText, final String strClassContext, String strContextElementClass, int iSourcePosition ) { // Must execute in caller's classloader try { Class<?> cls; try { cls = Class.forName( ContextSensitiveCodeRunner.class.getName(), false, cl ); } catch( Exception e ) { cls = ContextSensitiveCodeRunner.class; } Method m = cls.getDeclaredMethod( "_runMeSomeCode", Object.class, Object[].class, String.class, String.class, String.class, int.class ); m.setAccessible( true ); return m.invoke( null, enclosingInstance, extSyms, strText, strClassContext, strContextElementClass, iSourcePosition ); } catch( Exception e ) { e.printStackTrace(); Throwable cause = GosuExceptionUtil.findExceptionCause( e ); if( cause instanceof ParseResultsException ) { List<IParseIssue> parseExceptions = ((ParseResultsException)cause).getParseExceptions(); if( parseExceptions != null && parseExceptions.size() >= 0 ) { throw GosuExceptionUtil.forceThrow( (Throwable)parseExceptions.get( 0 ) ); } } throw GosuExceptionUtil.forceThrow( cause ); } }
[ "public", "static", "Object", "runMeSomeCode", "(", "Object", "enclosingInstance", ",", "ClassLoader", "cl", ",", "Object", "[", "]", "extSyms", ",", "String", "strText", ",", "final", "String", "strClassContext", ",", "String", "strContextElementClass", ",", "int...
Intended for use with a debugger to evaluate arbitrary expressions/programs in the context of a source position being debugged, usually at a breakpoint. @param enclosingInstance The instance of the object immediately enclosing the source position. @param extSyms An array of adjacent name/value pairs corresponding with the names and values of local symbols in scope. @param strText The text of the expression/program. @param strClassContext The name of the top-level class enclosing the the source position. @param strContextElementClass The name of the class immediately enclosing the source position (can be same as strClassContext). @param iSourcePosition The index of the source position within the containing file. @return The result of the expression or, in the case of a program, the return value of the program.
[ "Intended", "for", "use", "with", "a", "debugger", "to", "evaluate", "arbitrary", "expressions", "/", "programs", "in", "the", "context", "of", "a", "source", "position", "being", "debugged", "usually", "at", "a", "breakpoint", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/ContextSensitiveCodeRunner.java#L75-L104
bbottema/simple-java-mail
modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java
MimeMessageHelper.setRecipients
static void setRecipients(final Email email, final Message message) throws UnsupportedEncodingException, MessagingException { for (final Recipient recipient : email.getRecipients()) { final Address address = new InternetAddress(recipient.getAddress(), recipient.getName(), CHARACTER_ENCODING); message.addRecipient(recipient.getType(), address); } }
java
static void setRecipients(final Email email, final Message message) throws UnsupportedEncodingException, MessagingException { for (final Recipient recipient : email.getRecipients()) { final Address address = new InternetAddress(recipient.getAddress(), recipient.getName(), CHARACTER_ENCODING); message.addRecipient(recipient.getType(), address); } }
[ "static", "void", "setRecipients", "(", "final", "Email", "email", ",", "final", "Message", "message", ")", "throws", "UnsupportedEncodingException", ",", "MessagingException", "{", "for", "(", "final", "Recipient", "recipient", ":", "email", ".", "getRecipients", ...
Fills the {@link Message} instance with recipients from the {@link Email}. @param email The message in which the recipients are defined. @param message The javax message that needs to be filled with recipients. @throws UnsupportedEncodingException See {@link InternetAddress#InternetAddress(String, String)}. @throws MessagingException See {@link Message#addRecipient(Message.RecipientType, Address)}
[ "Fills", "the", "{", "@link", "Message", "}", "instance", "with", "recipients", "from", "the", "{", "@link", "Email", "}", "." ]
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java#L63-L69
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.addDataLakeStoreAccount
public void addDataLakeStoreAccount(String resourceGroupName, String accountName, String dataLakeStoreAccountName, AddDataLakeStoreParameters parameters) { addDataLakeStoreAccountWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName, parameters).toBlocking().single().body(); }
java
public void addDataLakeStoreAccount(String resourceGroupName, String accountName, String dataLakeStoreAccountName, AddDataLakeStoreParameters parameters) { addDataLakeStoreAccountWithServiceResponseAsync(resourceGroupName, accountName, dataLakeStoreAccountName, parameters).toBlocking().single().body(); }
[ "public", "void", "addDataLakeStoreAccount", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "dataLakeStoreAccountName", ",", "AddDataLakeStoreParameters", "parameters", ")", "{", "addDataLakeStoreAccountWithServiceResponseAsync", "(", "resource...
Updates the specified Data Lake Analytics account to include the additional Data Lake Store account. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param accountName The name of the Data Lake Analytics account to which to add the Data Lake Store account. @param dataLakeStoreAccountName The name of the Data Lake Store account to add. @param parameters The details of the Data Lake Store account. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Updates", "the", "specified", "Data", "Lake", "Analytics", "account", "to", "include", "the", "additional", "Data", "Lake", "Store", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L1132-L1134
scireum/s3ninja
src/main/java/ninja/S3Dispatcher.java
S3Dispatcher.abortMultipartUpload
private void abortMultipartUpload(WebContext ctx, String uploadId) { multipartUploads.remove(uploadId); ctx.respondWith().status(HttpResponseStatus.OK); delete(getUploadDir(uploadId)); }
java
private void abortMultipartUpload(WebContext ctx, String uploadId) { multipartUploads.remove(uploadId); ctx.respondWith().status(HttpResponseStatus.OK); delete(getUploadDir(uploadId)); }
[ "private", "void", "abortMultipartUpload", "(", "WebContext", "ctx", ",", "String", "uploadId", ")", "{", "multipartUploads", ".", "remove", "(", "uploadId", ")", ";", "ctx", ".", "respondWith", "(", ")", ".", "status", "(", "HttpResponseStatus", ".", "OK", ...
Handles DELETE /bucket/id?uploadId=X @param ctx the context describing the current request @param uploadId the multipart upload that should be cancelled
[ "Handles", "DELETE", "/", "bucket", "/", "id?uploadId", "=", "X" ]
train
https://github.com/scireum/s3ninja/blob/445eec55c91780267a7f987818b3fedecae009c5/src/main/java/ninja/S3Dispatcher.java#L801-L805
calrissian/mango
mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java
JsonMetadata.setArrayIndex
static void setArrayIndex(Map<String,String> meta, int level, int index) { meta.put(level + ARRAY_IDX_SUFFIX, Integer.toString(index)); }
java
static void setArrayIndex(Map<String,String> meta, int level, int index) { meta.put(level + ARRAY_IDX_SUFFIX, Integer.toString(index)); }
[ "static", "void", "setArrayIndex", "(", "Map", "<", "String", ",", "String", ">", "meta", ",", "int", "level", ",", "int", "index", ")", "{", "meta", ".", "put", "(", "level", "+", "ARRAY_IDX_SUFFIX", ",", "Integer", ".", "toString", "(", "index", ")",...
Sets an array index on a map of metadata for a specific level of a nested json tree. Since the json requires that arrays have preserved order, it's imported that it is constrained from the flattened to the re-expanded representation. @param meta @param level @param index
[ "Sets", "an", "array", "index", "on", "a", "map", "of", "metadata", "for", "a", "specific", "level", "of", "a", "nested", "json", "tree", ".", "Since", "the", "json", "requires", "that", "arrays", "have", "preserved", "order", "it", "s", "imported", "tha...
train
https://github.com/calrissian/mango/blob/a95aa5e77af9aa0e629787228d80806560023452/mango-json/src/main/java/org/calrissian/mango/json/mappings/JsonMetadata.java#L43-L45
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/parser/ctrlwords/RtfCtrlWordMgr.java
RtfCtrlWordMgr.handleKeyword
public int handleKeyword(RtfCtrlWordData ctrlWordData, int groupLevel) { //TODO: May be used for event handling. int result = RtfParser.errOK; // Call before handler event here beforeCtrlWord(ctrlWordData); result = dispatchKeyword(ctrlWordData, groupLevel); // call after handler event here afterCtrlWord(ctrlWordData); return result; }
java
public int handleKeyword(RtfCtrlWordData ctrlWordData, int groupLevel) { //TODO: May be used for event handling. int result = RtfParser.errOK; // Call before handler event here beforeCtrlWord(ctrlWordData); result = dispatchKeyword(ctrlWordData, groupLevel); // call after handler event here afterCtrlWord(ctrlWordData); return result; }
[ "public", "int", "handleKeyword", "(", "RtfCtrlWordData", "ctrlWordData", ",", "int", "groupLevel", ")", "{", "//TODO: May be used for event handling.", "int", "result", "=", "RtfParser", ".", "errOK", ";", "// Call before handler event here", "beforeCtrlWord", "(", "ctrl...
Internal to control word manager class. @param ctrlWordData The <code>RtfCtrlWordData</code> object with control word and param @param groupLevel The current document group parsing level @return errOK if ok, otherwise an error code.
[ "Internal", "to", "control", "word", "manager", "class", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/parser/ctrlwords/RtfCtrlWordMgr.java#L110-L123
adorsys/hbci4java-adorsys
src/main/java/org/kapott/cryptalgs/ISO9796p1.java
ISO9796p1.engineVerify
@Override protected boolean engineVerify(byte[] sig) throws SignatureException { BigInteger bExponent = this.pubKey.getPublicExponent(); byte[] exponent = bExponent.toByteArray(); BigInteger bModulus = this.pubKey.getModulus(); byte[] modulus = bModulus.toByteArray(); byte[] is = getISfromSig(sig, exponent, modulus); int[] ks = new int[1]; byte[] ir = getIRfromIS(is, exponent, modulus, ks); int k = ks[0]; int[] ts = new int[1]; byte[] mr = getMRfromIR(ir, k, ts); int t = ts[0]; int[] zs = new int[1]; int[] rs = new int[1]; byte[] mp = getMPfromMR(mr, t, zs, rs); int z = zs[0]; int r = rs[0]; int datalen = (z << 3) + 1 - r; int databytes = (datalen >> 3); if ((datalen & 0x07) != 0) { databytes++; } byte[] recHash = new byte[databytes]; System.arraycopy(mp, mp.length - databytes, recHash, 0, databytes); if ((datalen & 0x07) != 0) { recHash[0] &= (1 << (datalen & 0x07)) - 1; } BigInteger hash = new BigInteger(+1, recHash); BigInteger hash2 = new BigInteger(+1, this.dig.digest()); byte[] me2 = getMEfromMP(mp, t); byte[] mr2 = getMRfromME(me2, t, z, r); mr[0] &= (1 << (7 - ((mr.length << 3) - k))) - 1; mr2[0] &= (1 << (7 - ((mr2.length << 3) - k))) - 1; return hash.equals(hash2) && Arrays.equals(mr, mr2); }
java
@Override protected boolean engineVerify(byte[] sig) throws SignatureException { BigInteger bExponent = this.pubKey.getPublicExponent(); byte[] exponent = bExponent.toByteArray(); BigInteger bModulus = this.pubKey.getModulus(); byte[] modulus = bModulus.toByteArray(); byte[] is = getISfromSig(sig, exponent, modulus); int[] ks = new int[1]; byte[] ir = getIRfromIS(is, exponent, modulus, ks); int k = ks[0]; int[] ts = new int[1]; byte[] mr = getMRfromIR(ir, k, ts); int t = ts[0]; int[] zs = new int[1]; int[] rs = new int[1]; byte[] mp = getMPfromMR(mr, t, zs, rs); int z = zs[0]; int r = rs[0]; int datalen = (z << 3) + 1 - r; int databytes = (datalen >> 3); if ((datalen & 0x07) != 0) { databytes++; } byte[] recHash = new byte[databytes]; System.arraycopy(mp, mp.length - databytes, recHash, 0, databytes); if ((datalen & 0x07) != 0) { recHash[0] &= (1 << (datalen & 0x07)) - 1; } BigInteger hash = new BigInteger(+1, recHash); BigInteger hash2 = new BigInteger(+1, this.dig.digest()); byte[] me2 = getMEfromMP(mp, t); byte[] mr2 = getMRfromME(me2, t, z, r); mr[0] &= (1 << (7 - ((mr.length << 3) - k))) - 1; mr2[0] &= (1 << (7 - ((mr2.length << 3) - k))) - 1; return hash.equals(hash2) && Arrays.equals(mr, mr2); }
[ "@", "Override", "protected", "boolean", "engineVerify", "(", "byte", "[", "]", "sig", ")", "throws", "SignatureException", "{", "BigInteger", "bExponent", "=", "this", ".", "pubKey", ".", "getPublicExponent", "(", ")", ";", "byte", "[", "]", "exponent", "="...
/*private byte[] getRRfromIR(byte[] ir, int k, byte[] modulus, byte[] privExponent) { byte[] ir2 = new byte[ir.length]; System.arraycopy(ir, 0, ir2, 0, ir.length); ir2[0] &= ((1 << (8 - ((ir.length << 3) - k))) - 1); BigInteger bIR = new BigInteger(+1, ir2); BigInteger bModulus = new BigInteger(+1, modulus); BigInteger bRR = null; bRR = bIR; return bRR.toByteArray(); }
[ "/", "*", "private", "byte", "[]", "getRRfromIR", "(", "byte", "[]", "ir", "int", "k", "byte", "[]", "modulus", "byte", "[]", "privExponent", ")", "{", "byte", "[]", "ir2", "=", "new", "byte", "[", "ir", ".", "length", "]", ";", "System", ".", "arr...
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/cryptalgs/ISO9796p1.java#L429-L473
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/context/AuditorModuleConfig.java
AuditorModuleConfig.setAuditRepositoryTransport
public void setAuditRepositoryTransport(String transport) throws IllegalArgumentException { if (!transport.equalsIgnoreCase("SYSLOG") && !transport.equalsIgnoreCase("UDP") && !transport.equalsIgnoreCase("TLS") && !transport.equalsIgnoreCase("BSD")) throw new IllegalArgumentException("Audit Repository transport must be set to one of: SYSLOG, UDP, TLS, or BSD. Received: " + transport); setOption(AUDITOR_AUDIT_REPOSITORY_TRANSPORT_KEY, transport.toUpperCase()); }
java
public void setAuditRepositoryTransport(String transport) throws IllegalArgumentException { if (!transport.equalsIgnoreCase("SYSLOG") && !transport.equalsIgnoreCase("UDP") && !transport.equalsIgnoreCase("TLS") && !transport.equalsIgnoreCase("BSD")) throw new IllegalArgumentException("Audit Repository transport must be set to one of: SYSLOG, UDP, TLS, or BSD. Received: " + transport); setOption(AUDITOR_AUDIT_REPOSITORY_TRANSPORT_KEY, transport.toUpperCase()); }
[ "public", "void", "setAuditRepositoryTransport", "(", "String", "transport", ")", "throws", "IllegalArgumentException", "{", "if", "(", "!", "transport", ".", "equalsIgnoreCase", "(", "\"SYSLOG\"", ")", "&&", "!", "transport", ".", "equalsIgnoreCase", "(", "\"UDP\""...
Set the transport of the target audit repository (TLS, UDP, or BSD) @param transport The transport of the target audit repository
[ "Set", "the", "transport", "of", "the", "target", "audit", "repository", "(", "TLS", "UDP", "or", "BSD", ")" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/context/AuditorModuleConfig.java#L216-L221
aws/aws-sdk-java
aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateDeviceDefinitionRequest.java
CreateDeviceDefinitionRequest.withTags
public CreateDeviceDefinitionRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public CreateDeviceDefinitionRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateDeviceDefinitionRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
Tag(s) to add to the new resource @param tags Tag(s) to add to the new resource @return Returns a reference to this object so that method calls can be chained together.
[ "Tag", "(", "s", ")", "to", "add", "to", "the", "new", "resource" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateDeviceDefinitionRequest.java#L168-L171
carewebframework/carewebframework-core
org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java
InfoPanelService.findInfoPanel
public static IInfoPanel findInfoPanel(ElementBase element, boolean activeOnly) { ElementBase parent = element; ElementBase previousParent; IInfoPanel infoPanel = searchChildren(element, null, activeOnly); while ((infoPanel == null) && (parent != null)) { previousParent = parent; parent = parent.getParent(); infoPanel = searchChildren(parent, previousParent, activeOnly); } return infoPanel; }
java
public static IInfoPanel findInfoPanel(ElementBase element, boolean activeOnly) { ElementBase parent = element; ElementBase previousParent; IInfoPanel infoPanel = searchChildren(element, null, activeOnly); while ((infoPanel == null) && (parent != null)) { previousParent = parent; parent = parent.getParent(); infoPanel = searchChildren(parent, previousParent, activeOnly); } return infoPanel; }
[ "public", "static", "IInfoPanel", "findInfoPanel", "(", "ElementBase", "element", ",", "boolean", "activeOnly", ")", "{", "ElementBase", "parent", "=", "element", ";", "ElementBase", "previousParent", ";", "IInfoPanel", "infoPanel", "=", "searchChildren", "(", "elem...
Finds the "nearest" info panel. @param element The UI element from which to begin the search. @param activeOnly If true, only active info panels are considered. @return The nearest active info panel, or null if none found.
[ "Finds", "the", "nearest", "info", "panel", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.plugin-parent/org.carewebframework.plugin.infopanel/src/main/java/org/carewebframework/plugin/infopanel/service/InfoPanelService.java#L76-L88
m-m-m/util
io/src/main/java/net/sf/mmm/util/file/base/FileAccessPermissions.java
FileAccessPermissions.setFlag
private void setFlag(FileAccessClass fileModeClass, int bitMask, boolean flag) { setBits(shiftMask(fileModeClass, bitMask), flag); }
java
private void setFlag(FileAccessClass fileModeClass, int bitMask, boolean flag) { setBits(shiftMask(fileModeClass, bitMask), flag); }
[ "private", "void", "setFlag", "(", "FileAccessClass", "fileModeClass", ",", "int", "bitMask", ",", "boolean", "flag", ")", "{", "setBits", "(", "shiftMask", "(", "fileModeClass", ",", "bitMask", ")", ",", "flag", ")", ";", "}" ]
This method sets the flag(s) given by {@code bitMask} of this this {@link #getMaskBits() mask} for the given {@code fileModeClass} to the given value ({@code flag}). @param fileModeClass is the class of access ( {@link FileAccessClass#USER}, {@link FileAccessClass#GROUP}, or {@link FileAccessClass#OTHERS}). @param bitMask is the bit-mask of the flag(s) to set. @param flag - if {@code true} the flag will be set, if {@code false} it will be unset.
[ "This", "method", "sets", "the", "flag", "(", "s", ")", "given", "by", "{", "@code", "bitMask", "}", "of", "this", "this", "{", "@link", "#getMaskBits", "()", "mask", "}", "for", "the", "given", "{", "@code", "fileModeClass", "}", "to", "the", "given",...
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/io/src/main/java/net/sf/mmm/util/file/base/FileAccessPermissions.java#L337-L340
sebastiangraf/treetank
interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/AResource.java
AResource.getResource
public Response getResource(final String system, final UriInfo uri, final String resource, final HttpHeaders headers) { final JaxRx impl = Systems.getInstance(system); final Map<QueryParameter, String> param = getParameters(uri, impl); final ResourcePath path = new ResourcePath(resource, param, headers); return createResponse(impl, path); }
java
public Response getResource(final String system, final UriInfo uri, final String resource, final HttpHeaders headers) { final JaxRx impl = Systems.getInstance(system); final Map<QueryParameter, String> param = getParameters(uri, impl); final ResourcePath path = new ResourcePath(resource, param, headers); return createResponse(impl, path); }
[ "public", "Response", "getResource", "(", "final", "String", "system", ",", "final", "UriInfo", "uri", ",", "final", "String", "resource", ",", "final", "HttpHeaders", "headers", ")", "{", "final", "JaxRx", "impl", "=", "Systems", ".", "getInstance", "(", "s...
This method will be called when a HTTP client sends a POST request to an existing resource with 'application/query+xml' as Content-Type. @param system The implementation system. @param uri The context information due to the requested URI. @param resource The resource @param headers HTTP header attributes. @return The {@link Response} which can be empty when no response is expected. Otherwise it holds the response XML file.
[ "This", "method", "will", "be", "called", "when", "a", "HTTP", "client", "sends", "a", "POST", "request", "to", "an", "existing", "resource", "with", "application", "/", "query", "+", "xml", "as", "Content", "-", "Type", "." ]
train
https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/AResource.java#L332-L339
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java
DateUtil.isExpired
public static boolean isExpired(Date startDate, DateField dateField, int timeLength, Date checkedDate) { final Date endDate = offset(startDate, dateField, timeLength); return endDate.after(checkedDate); }
java
public static boolean isExpired(Date startDate, DateField dateField, int timeLength, Date checkedDate) { final Date endDate = offset(startDate, dateField, timeLength); return endDate.after(checkedDate); }
[ "public", "static", "boolean", "isExpired", "(", "Date", "startDate", ",", "DateField", "dateField", ",", "int", "timeLength", ",", "Date", "checkedDate", ")", "{", "final", "Date", "endDate", "=", "offset", "(", "startDate", ",", "dateField", ",", "timeLength...
判定给定开始时间经过某段时间后是否过期 @param startDate 开始时间 @param dateField 时间单位 @param timeLength 时长 @param checkedDate 被比较的时间。如果经过时长后的时间晚于被检查的时间,就表示过期 @return 是否过期 @since 3.1.1
[ "判定给定开始时间经过某段时间后是否过期" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L1561-L1564
Axway/Grapes
utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java
GrapesClient.getModule
public Module getModule(final String name, final String version) throws GrapesCommunicationException { final Client client = getClient(); final WebResource resource = client.resource(serverURL).path(RequestUtils.getModulePath(name, version)); final ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); client.destroy(); if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){ final String message = String.format(FAILED_TO_GET_MODULE, "get module details", name, version); if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } return response.getEntity(Module.class); }
java
public Module getModule(final String name, final String version) throws GrapesCommunicationException { final Client client = getClient(); final WebResource resource = client.resource(serverURL).path(RequestUtils.getModulePath(name, version)); final ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); client.destroy(); if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){ final String message = String.format(FAILED_TO_GET_MODULE, "get module details", name, version); if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } return response.getEntity(Module.class); }
[ "public", "Module", "getModule", "(", "final", "String", "name", ",", "final", "String", "version", ")", "throws", "GrapesCommunicationException", "{", "final", "Client", "client", "=", "getClient", "(", ")", ";", "final", "WebResource", "resource", "=", "client...
Send a get module request @param name @param version @return the targeted module @throws GrapesCommunicationException
[ "Send", "a", "get", "module", "request" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L225-L240
marklogic/marklogic-contentpump
mapreduce/src/main/java/com/marklogic/mapreduce/ForestReader.java
ForestReader.setKey
protected void setKey(String uri, String sub, int line, int col) { if (srcId == null) { srcId = split.getPath().toString(); } // apply prefix and suffix for URI uri = URIUtil.applyUriReplace(uri, conf); uri = URIUtil.applyPrefixSuffix(uri, conf); if (key == null) { key = new DocumentURIWithSourceInfo(uri, srcId, sub, line, col); } else { key.setSkipReason(""); key.setUri(uri); key.setSrcId(srcId); key.setSubId(sub); key.setColNumber(col); key.setLineNumber(line); } }
java
protected void setKey(String uri, String sub, int line, int col) { if (srcId == null) { srcId = split.getPath().toString(); } // apply prefix and suffix for URI uri = URIUtil.applyUriReplace(uri, conf); uri = URIUtil.applyPrefixSuffix(uri, conf); if (key == null) { key = new DocumentURIWithSourceInfo(uri, srcId, sub, line, col); } else { key.setSkipReason(""); key.setUri(uri); key.setSrcId(srcId); key.setSubId(sub); key.setColNumber(col); key.setLineNumber(line); } }
[ "protected", "void", "setKey", "(", "String", "uri", ",", "String", "sub", ",", "int", "line", ",", "int", "col", ")", "{", "if", "(", "srcId", "==", "null", ")", "{", "srcId", "=", "split", ".", "getPath", "(", ")", ".", "toString", "(", ")", ";...
Apply URI prefix and suffix configuration options and set the result as DocumentURI key. @param uri Source string of document URI. @param sub Sub-entry of the source of the document origin. @param line Line number in the source if applicable; -1 otherwise. @param col Column number in the source if applicable; -1 otherwise.
[ "Apply", "URI", "prefix", "and", "suffix", "configuration", "options", "and", "set", "the", "result", "as", "DocumentURI", "key", "." ]
train
https://github.com/marklogic/marklogic-contentpump/blob/4c41e4a953301f81a4c655efb2a847603dee8afc/mapreduce/src/main/java/com/marklogic/mapreduce/ForestReader.java#L195-L212
likethecolor/Alchemy-API
src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java
AbstractParser.getNonStandardBoolean
private Boolean getNonStandardBoolean(final String key, final JSONObject jsonObject) { Boolean value = false; try { String stringValue = jsonObject.getString(key); LOGGER.debug("got value: {} for key {}", stringValue, key); if(isTruthy(stringValue)) { LOGGER.debug("value is truthy"); value = true; } } catch(JSONException e) { LOGGER.error("Could not get boolean (not even truthy) from JSONObject for key: " + key, e); } return value; }
java
private Boolean getNonStandardBoolean(final String key, final JSONObject jsonObject) { Boolean value = false; try { String stringValue = jsonObject.getString(key); LOGGER.debug("got value: {} for key {}", stringValue, key); if(isTruthy(stringValue)) { LOGGER.debug("value is truthy"); value = true; } } catch(JSONException e) { LOGGER.error("Could not get boolean (not even truthy) from JSONObject for key: " + key, e); } return value; }
[ "private", "Boolean", "getNonStandardBoolean", "(", "final", "String", "key", ",", "final", "JSONObject", "jsonObject", ")", "{", "Boolean", "value", "=", "false", ";", "try", "{", "String", "stringValue", "=", "jsonObject", ".", "getString", "(", "key", ")", ...
This method differs from {@link #getBoolean(String, JSONObject)} in that the value is not be the standard JSON true/false but rather the string yes/no. @param key name of the field to fetch from the json object @param jsonObject object from which to fetch the value @return boolean value corresponding to the key or false
[ "This", "method", "differs", "from", "{", "@link", "#getBoolean", "(", "String", "JSONObject", ")", "}", "in", "that", "the", "value", "is", "not", "be", "the", "standard", "JSON", "true", "/", "false", "but", "rather", "the", "string", "yes", "/", "no",...
train
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java#L105-L119
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getImplementation
public static Class<?> getImplementation(Map<Class<?>, Class<?>> implementationsRegistry, Type interfaceType) { Class<?> implementation = implementationsRegistry.get(interfaceType); if(implementation == null) { throw new BugError("No registered implementation for type |%s|.", interfaceType); } return implementation; }
java
public static Class<?> getImplementation(Map<Class<?>, Class<?>> implementationsRegistry, Type interfaceType) { Class<?> implementation = implementationsRegistry.get(interfaceType); if(implementation == null) { throw new BugError("No registered implementation for type |%s|.", interfaceType); } return implementation; }
[ "public", "static", "Class", "<", "?", ">", "getImplementation", "(", "Map", "<", "Class", "<", "?", ">", ",", "Class", "<", "?", ">", ">", "implementationsRegistry", ",", "Type", "interfaceType", ")", "{", "Class", "<", "?", ">", "implementation", "=", ...
Lookup implementation into given registry, throwing exception if not found. @param implementationsRegistry implementations registry, @param interfaceType interface to lookup into registry. @return implementation for requested interface type. @throws BugError if implementation is not found into registry.
[ "Lookup", "implementation", "into", "given", "registry", "throwing", "exception", "if", "not", "found", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1487-L1494
morfologik/morfologik-stemming
morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java
FSABuilder.compare
private static int compare(byte[] s1, int start1, int lens1, byte[] s2, int start2, int lens2) { final int max = Math.min(lens1, lens2); for (int i = 0; i < max; i++) { final byte c1 = s1[start1++]; final byte c2 = s2[start2++]; if (c1 != c2) return (c1 & 0xff) - (c2 & 0xff); } return lens1 - lens2; }
java
private static int compare(byte[] s1, int start1, int lens1, byte[] s2, int start2, int lens2) { final int max = Math.min(lens1, lens2); for (int i = 0; i < max; i++) { final byte c1 = s1[start1++]; final byte c2 = s2[start2++]; if (c1 != c2) return (c1 & 0xff) - (c2 & 0xff); } return lens1 - lens2; }
[ "private", "static", "int", "compare", "(", "byte", "[", "]", "s1", ",", "int", "start1", ",", "int", "lens1", ",", "byte", "[", "]", "s2", ",", "int", "start2", ",", "int", "lens2", ")", "{", "final", "int", "max", "=", "Math", ".", "min", "(", ...
Lexicographic order of input sequences. By default, consistent with the "C" sort (absolute value of bytes, 0-255).
[ "Lexicographic", "order", "of", "input", "sequences", ".", "By", "default", "consistent", "with", "the", "C", "sort", "(", "absolute", "value", "of", "bytes", "0", "-", "255", ")", "." ]
train
https://github.com/morfologik/morfologik-stemming/blob/9d9099cc5ec4155a0eb8dfecdc23d01cbd734f6e/morfologik-fsa-builders/src/main/java/morfologik/fsa/builders/FSABuilder.java#L495-L506
networknt/light-4j
balance/src/main/java/com/networknt/balance/LocalFirstLoadBalance.java
LocalFirstLoadBalance.select
@Override public URL select(List<URL> urls, String requestKey) { // search for a URL in the same ip first List<URL> localUrls = searchLocalUrls(urls, ip); if(localUrls.size() > 0) { if(localUrls.size() == 1) { return localUrls.get(0); } else { // round robin within localUrls return doSelect(localUrls); } } else { // round robin within urls return doSelect(urls); } }
java
@Override public URL select(List<URL> urls, String requestKey) { // search for a URL in the same ip first List<URL> localUrls = searchLocalUrls(urls, ip); if(localUrls.size() > 0) { if(localUrls.size() == 1) { return localUrls.get(0); } else { // round robin within localUrls return doSelect(localUrls); } } else { // round robin within urls return doSelect(urls); } }
[ "@", "Override", "public", "URL", "select", "(", "List", "<", "URL", ">", "urls", ",", "String", "requestKey", ")", "{", "// search for a URL in the same ip first", "List", "<", "URL", ">", "localUrls", "=", "searchLocalUrls", "(", "urls", ",", "ip", ")", ";...
Local first requestKey is not used as it is ip on the localhost. It first needs to find a list of urls on the localhost for the service, and then round robin in the list to pick up one. Currently, this load balance is only used if you deploy the service as standalone java process on data center hosts. We need to find a way to identify two VMs or two docker containers sitting on the same physical machine in the future to improve it. It is also suitable if your services are built on top of light-hybrid-4j and want to use the remote interface for service to service communication. @param urls List @param requestKey String @return URL
[ "Local", "first", "requestKey", "is", "not", "used", "as", "it", "is", "ip", "on", "the", "localhost", ".", "It", "first", "needs", "to", "find", "a", "list", "of", "urls", "on", "the", "localhost", "for", "the", "service", "and", "then", "round", "rob...
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/balance/src/main/java/com/networknt/balance/LocalFirstLoadBalance.java#L71-L86
synchronoss/cpo-api
cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java
CassandraCpoAdapter.deleteObjects
@Override public <T> long deleteObjects(Collection<T> coll) throws CpoException { return processUpdateGroup(coll, CpoAdapter.DELETE_GROUP, null, null, null, null); }
java
@Override public <T> long deleteObjects(Collection<T> coll) throws CpoException { return processUpdateGroup(coll, CpoAdapter.DELETE_GROUP, null, null, null, null); }
[ "@", "Override", "public", "<", "T", ">", "long", "deleteObjects", "(", "Collection", "<", "T", ">", "coll", ")", "throws", "CpoException", "{", "return", "processUpdateGroup", "(", "coll", ",", "CpoAdapter", ".", "DELETE_GROUP", ",", "null", ",", "null", ...
Removes the Objects contained in the collection from the datasource. The assumption is that the object exists in the datasource. This method stores the objects contained in the collection in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions. <p/> This means that if one of the objects fail being deleted in the datasource then the CpoAdapter should stop processing the remainder of the collection, and if supported, rollback all the objects deleted thus far. <p/> <pre>Example: <code> <p/> class SomeObject so = null; class CpoAdapter cpo = null; <p/> try { cpo = new CpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p/> if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } try{ cpo.deleteObjects(al); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param coll This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. @return The number of objects deleted from the datasource @throws CpoException Thrown if there are errors accessing the datasource
[ "Removes", "the", "Objects", "contained", "in", "the", "collection", "from", "the", "datasource", ".", "The", "assumption", "is", "that", "the", "object", "exists", "in", "the", "datasource", ".", "This", "method", "stores", "the", "objects", "contained", "in"...
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L573-L576
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/util/InstantiationUtils.java
InstantiationUtils.newInstanceOrNull
public static <T> T newInstanceOrNull(Class<? extends T> clazz, Object...params) { Constructor<T> constructor = selectMatchingConstructor(clazz, params); if (constructor == null) { return null; } try { return constructor.newInstance(params); } catch (IllegalAccessException e) { return null; } catch (InstantiationException e) { return null; } catch (InvocationTargetException e) { return null; } }
java
public static <T> T newInstanceOrNull(Class<? extends T> clazz, Object...params) { Constructor<T> constructor = selectMatchingConstructor(clazz, params); if (constructor == null) { return null; } try { return constructor.newInstance(params); } catch (IllegalAccessException e) { return null; } catch (InstantiationException e) { return null; } catch (InvocationTargetException e) { return null; } }
[ "public", "static", "<", "T", ">", "T", "newInstanceOrNull", "(", "Class", "<", "?", "extends", "T", ">", "clazz", ",", "Object", "...", "params", ")", "{", "Constructor", "<", "T", ">", "constructor", "=", "selectMatchingConstructor", "(", "clazz", ",", ...
Create a new instance of a given class. It will search for a constructor matching passed parameters. If a matching constructor is not found then it returns null. Constructor is matching when it can be invoked with given parameters. The order of parameters is significant. When a class constructor contains a primitive argument then it's matching if and only if a parameter at the same position is not null. It throws {@link AmbigiousInstantiationException} when multiple matching constructors are found. @param clazz class to be instantiated @param params parameters to be passed to the constructor @param <T> class type to be instantiated @return a new instance of a given class @throws AmbigiousInstantiationException when multiple constructors matching the parameters
[ "Create", "a", "new", "instance", "of", "a", "given", "class", ".", "It", "will", "search", "for", "a", "constructor", "matching", "passed", "parameters", ".", "If", "a", "matching", "constructor", "is", "not", "found", "then", "it", "returns", "null", "."...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/util/InstantiationUtils.java#L49-L63
Tristan971/EasyFXML
easyfxml/src/main/java/moe/tristan/easyfxml/model/beanmanagement/AbstractInstanceManager.java
AbstractInstanceManager.registerSingle
public V registerSingle(final K parent, final V instance) { return this.singletons.put(parent, instance); }
java
public V registerSingle(final K parent, final V instance) { return this.singletons.put(parent, instance); }
[ "public", "V", "registerSingle", "(", "final", "K", "parent", ",", "final", "V", "instance", ")", "{", "return", "this", ".", "singletons", ".", "put", "(", "parent", ",", "instance", ")", ";", "}" ]
Registers a single instance of type {@link V} under the {@link K} category. @param parent The parent of this instance @param instance The instance to register @return The instance registered
[ "Registers", "a", "single", "instance", "of", "type", "{", "@link", "V", "}", "under", "the", "{", "@link", "K", "}", "category", "." ]
train
https://github.com/Tristan971/EasyFXML/blob/f82cad1d54e62903ca5e4a250279ad315b028aef/easyfxml/src/main/java/moe/tristan/easyfxml/model/beanmanagement/AbstractInstanceManager.java#L46-L48
keenlabs/KeenClient-Java
core/src/main/java/io/keen/client/java/KeenClient.java
KeenClient.addEvent
public void addEvent(String eventCollection, Map<String, Object> event) { addEvent(eventCollection, event, null); }
java
public void addEvent(String eventCollection, Map<String, Object> event) { addEvent(eventCollection, event, null); }
[ "public", "void", "addEvent", "(", "String", "eventCollection", ",", "Map", "<", "String", ",", "Object", ">", "event", ")", "{", "addEvent", "(", "eventCollection", ",", "event", ",", "null", ")", ";", "}" ]
Adds an event to the default project with default Keen properties and no callbacks. @see #addEvent(KeenProject, String, java.util.Map, java.util.Map, KeenCallback) @param eventCollection The name of the collection in which to publish the event. @param event A Map that consists of key/value pairs. Keen naming conventions apply (see docs). Nested Maps and lists are acceptable (and encouraged!).
[ "Adds", "an", "event", "to", "the", "default", "project", "with", "default", "Keen", "properties", "and", "no", "callbacks", "." ]
train
https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/KeenClient.java#L113-L115
apache/flink
flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/EdgeList.java
EdgeList.hasNullValueEdges
private static <T, ET> boolean hasNullValueEdges(DataSet<Edge<T, ET>> edges) { TypeInformation<?> genericTypeInfo = edges.getType(); @SuppressWarnings("unchecked") TupleTypeInfo<Tuple3<T, T, ET>> tupleTypeInfo = (TupleTypeInfo<Tuple3<T, T, ET>>) genericTypeInfo; return tupleTypeInfo.getTypeAt(2).equals(ValueTypeInfo.NULL_VALUE_TYPE_INFO); }
java
private static <T, ET> boolean hasNullValueEdges(DataSet<Edge<T, ET>> edges) { TypeInformation<?> genericTypeInfo = edges.getType(); @SuppressWarnings("unchecked") TupleTypeInfo<Tuple3<T, T, ET>> tupleTypeInfo = (TupleTypeInfo<Tuple3<T, T, ET>>) genericTypeInfo; return tupleTypeInfo.getTypeAt(2).equals(ValueTypeInfo.NULL_VALUE_TYPE_INFO); }
[ "private", "static", "<", "T", ",", "ET", ">", "boolean", "hasNullValueEdges", "(", "DataSet", "<", "Edge", "<", "T", ",", "ET", ">", ">", "edges", ")", "{", "TypeInformation", "<", "?", ">", "genericTypeInfo", "=", "edges", ".", "getType", "(", ")", ...
Check whether the edge type of the {@link DataSet} is {@link NullValue}. @param edges data set for introspection @param <T> graph ID type @param <ET> edge value type @return whether the edge type of the {@link DataSet} is {@link NullValue}
[ "Check", "whether", "the", "edge", "type", "of", "the", "{", "@link", "DataSet", "}", "is", "{", "@link", "NullValue", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly-examples/src/main/java/org/apache/flink/graph/drivers/EdgeList.java#L73-L79
taskadapter/redmine-java-api
src/main/java/com/taskadapter/redmineapi/internal/comm/betterssl/BetterSSLFactory.java
BetterSSLFactory.addX509Managers
private static void addX509Managers(final Collection<X509TrustManager> managers, KeyStore ks) throws KeyStoreException, Error { try { final TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks); for (TrustManager tm : tmf.getTrustManagers()) { if (tm instanceof X509TrustManager) { managers.add((X509TrustManager) tm); } } } catch (NoSuchAlgorithmException e) { throw new Error("Default trust manager algorithm is not supported!", e); } }
java
private static void addX509Managers(final Collection<X509TrustManager> managers, KeyStore ks) throws KeyStoreException, Error { try { final TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks); for (TrustManager tm : tmf.getTrustManagers()) { if (tm instanceof X509TrustManager) { managers.add((X509TrustManager) tm); } } } catch (NoSuchAlgorithmException e) { throw new Error("Default trust manager algorithm is not supported!", e); } }
[ "private", "static", "void", "addX509Managers", "(", "final", "Collection", "<", "X509TrustManager", ">", "managers", ",", "KeyStore", "ks", ")", "throws", "KeyStoreException", ",", "Error", "{", "try", "{", "final", "TrustManagerFactory", "tmf", "=", "TrustManage...
Adds X509 keystore-backed trust manager into the list of managers. @param managers list of the managers to add to. @param ks key store with target keys. @throws KeyStoreException if key store could not be accessed.
[ "Adds", "X509", "keystore", "-", "backed", "trust", "manager", "into", "the", "list", "of", "managers", "." ]
train
https://github.com/taskadapter/redmine-java-api/blob/0bb65f27ee806ec3bd4007e1641f3e996261a04e/src/main/java/com/taskadapter/redmineapi/internal/comm/betterssl/BetterSSLFactory.java#L61-L74
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.registerConverter
public final <S, T> void registerConverter(Class<S> input, Class<T> output, Converter<S, T> converter, Class<? extends Annotation> qualifier) { registerConverter(new ConverterKey<S,T>(input, output, qualifier == null ? DefaultBinding.class : qualifier), converter); }
java
public final <S, T> void registerConverter(Class<S> input, Class<T> output, Converter<S, T> converter, Class<? extends Annotation> qualifier) { registerConverter(new ConverterKey<S,T>(input, output, qualifier == null ? DefaultBinding.class : qualifier), converter); }
[ "public", "final", "<", "S", ",", "T", ">", "void", "registerConverter", "(", "Class", "<", "S", ">", "input", ",", "Class", "<", "T", ">", "output", ",", "Converter", "<", "S", ",", "T", ">", "converter", ",", "Class", "<", "?", "extends", "Annota...
Register a Converter with the given input and output classes. Instances of the input class can be converted into instances of the output class @param input The input class @param output The output class @param converter The Converter to be registered @param qualifier The qualifier for which the converter must be registered
[ "Register", "a", "Converter", "with", "the", "given", "input", "and", "output", "classes", ".", "Instances", "of", "the", "input", "class", "can", "be", "converted", "into", "instances", "of", "the", "output", "class" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L667-L669
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java
WebConfigParamUtils.getIntegerInitParameter
public static int getIntegerInitParameter(ExternalContext context, String[] names, int defaultValue) { if (names == null) { throw new NullPointerException(); } String param = null; for (String name : names) { if (name == null) { throw new NullPointerException(); } param = getStringInitParameter(context, name); if (param != null) { break; } } if (param == null) { return defaultValue; } else { return Integer.parseInt(param.toLowerCase()); } }
java
public static int getIntegerInitParameter(ExternalContext context, String[] names, int defaultValue) { if (names == null) { throw new NullPointerException(); } String param = null; for (String name : names) { if (name == null) { throw new NullPointerException(); } param = getStringInitParameter(context, name); if (param != null) { break; } } if (param == null) { return defaultValue; } else { return Integer.parseInt(param.toLowerCase()); } }
[ "public", "static", "int", "getIntegerInitParameter", "(", "ExternalContext", "context", ",", "String", "[", "]", "names", ",", "int", "defaultValue", ")", "{", "if", "(", "names", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";"...
Gets the int init parameter value from the specified context. If the parameter was not specified, the default value is used instead. @param context the application's external context @param names the init parameter's names @param defaultValue the default value to return in case the parameter was not set @return the init parameter value as a int @throws NullPointerException if context or name is <code>null</code>
[ "Gets", "the", "int", "init", "parameter", "value", "from", "the", "specified", "context", ".", "If", "the", "parameter", "was", "not", "specified", "the", "default", "value", "is", "used", "instead", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/WebConfigParamUtils.java#L511-L540
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/result/LogResultStructureResultHandler.java
LogResultStructureResultHandler.recursiveLogResult
private void recursiveLogResult(StringBuilder buf, Hierarchy<Result> hier, Result result, int depth) { if(result == null) { buf.append("null"); LOG.warning("null result!"); return; } if(depth > 50) { LOG.warning("Probably infinitely nested results, aborting!"); return; } for(int i = 0; i < depth; i++) { buf.append(' '); } buf.append(result.getClass().getSimpleName()).append(": ").append(result.getLongName()) // .append(" (").append(result.getShortName()).append(")\n"); if(hier.numChildren(result) > 0) { for(It<Result> iter = hier.iterChildren(result); iter.valid(); iter.advance()) { recursiveLogResult(buf, hier, iter.get(), depth + 1); } } }
java
private void recursiveLogResult(StringBuilder buf, Hierarchy<Result> hier, Result result, int depth) { if(result == null) { buf.append("null"); LOG.warning("null result!"); return; } if(depth > 50) { LOG.warning("Probably infinitely nested results, aborting!"); return; } for(int i = 0; i < depth; i++) { buf.append(' '); } buf.append(result.getClass().getSimpleName()).append(": ").append(result.getLongName()) // .append(" (").append(result.getShortName()).append(")\n"); if(hier.numChildren(result) > 0) { for(It<Result> iter = hier.iterChildren(result); iter.valid(); iter.advance()) { recursiveLogResult(buf, hier, iter.get(), depth + 1); } } }
[ "private", "void", "recursiveLogResult", "(", "StringBuilder", "buf", ",", "Hierarchy", "<", "Result", ">", "hier", ",", "Result", "result", ",", "int", "depth", ")", "{", "if", "(", "result", "==", "null", ")", "{", "buf", ".", "append", "(", "\"null\""...
Recursively walk through the result tree. @param buf Output buffer @param result Current result @param depth Depth
[ "Recursively", "walk", "through", "the", "result", "tree", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/result/LogResultStructureResultHandler.java#L67-L87
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/script/ScriptBuilder.java
ScriptBuilder.smallNum
public ScriptBuilder smallNum(int index, int num) { checkArgument(num >= 0, "Cannot encode negative numbers with smallNum"); checkArgument(num <= 16, "Cannot encode numbers larger than 16 with smallNum"); return addChunk(index, new ScriptChunk(Script.encodeToOpN(num), null)); }
java
public ScriptBuilder smallNum(int index, int num) { checkArgument(num >= 0, "Cannot encode negative numbers with smallNum"); checkArgument(num <= 16, "Cannot encode numbers larger than 16 with smallNum"); return addChunk(index, new ScriptChunk(Script.encodeToOpN(num), null)); }
[ "public", "ScriptBuilder", "smallNum", "(", "int", "index", ",", "int", "num", ")", "{", "checkArgument", "(", "num", ">=", "0", ",", "\"Cannot encode negative numbers with smallNum\"", ")", ";", "checkArgument", "(", "num", "<=", "16", ",", "\"Cannot encode numbe...
Adds the given number as a OP_N opcode to the given index in the program. Only handles values 0-16 inclusive. @see #number(long)
[ "Adds", "the", "given", "number", "as", "a", "OP_N", "opcode", "to", "the", "given", "index", "in", "the", "program", ".", "Only", "handles", "values", "0", "-", "16", "inclusive", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/ScriptBuilder.java#L167-L171
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.getImagesByIdsAsync
public Observable<List<Image>> getImagesByIdsAsync(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter) { return getImagesByIdsWithServiceResponseAsync(projectId, getImagesByIdsOptionalParameter).map(new Func1<ServiceResponse<List<Image>>, List<Image>>() { @Override public List<Image> call(ServiceResponse<List<Image>> response) { return response.body(); } }); }
java
public Observable<List<Image>> getImagesByIdsAsync(UUID projectId, GetImagesByIdsOptionalParameter getImagesByIdsOptionalParameter) { return getImagesByIdsWithServiceResponseAsync(projectId, getImagesByIdsOptionalParameter).map(new Func1<ServiceResponse<List<Image>>, List<Image>>() { @Override public List<Image> call(ServiceResponse<List<Image>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "Image", ">", ">", "getImagesByIdsAsync", "(", "UUID", "projectId", ",", "GetImagesByIdsOptionalParameter", "getImagesByIdsOptionalParameter", ")", "{", "return", "getImagesByIdsWithServiceResponseAsync", "(", "projectId", ",", "g...
Get images by id for a given project iteration. This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the current workspace is used. @param projectId The project id @param getImagesByIdsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;Image&gt; object
[ "Get", "images", "by", "id", "for", "a", "given", "project", "iteration", ".", "This", "API", "will", "return", "a", "set", "of", "Images", "for", "the", "specified", "tags", "and", "optionally", "iteration", ".", "If", "no", "iteration", "is", "specified"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L4312-L4319
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildSerializableFields
public void buildSerializableFields(XMLNode node, Content classContentTree) { MemberDoc[] members = currentClass.serializableFields(); int membersLength = members.length; if (membersLength > 0) { Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader(); for (int i = 0; i < membersLength; i++) { currentMember = members[i]; if (!currentClass.definesSerializableFields()) { Content fieldsContentTree = fieldWriter.getFieldsContentHeader( (i == membersLength - 1)); buildChildren(node, fieldsContentTree); serializableFieldsTree.addContent(fieldsContentTree); } else { buildSerialFieldTagsInfo(serializableFieldsTree); } } classContentTree.addContent(fieldWriter.getSerializableFields( configuration.getText("doclet.Serialized_Form_fields"), serializableFieldsTree)); } }
java
public void buildSerializableFields(XMLNode node, Content classContentTree) { MemberDoc[] members = currentClass.serializableFields(); int membersLength = members.length; if (membersLength > 0) { Content serializableFieldsTree = fieldWriter.getSerializableFieldsHeader(); for (int i = 0; i < membersLength; i++) { currentMember = members[i]; if (!currentClass.definesSerializableFields()) { Content fieldsContentTree = fieldWriter.getFieldsContentHeader( (i == membersLength - 1)); buildChildren(node, fieldsContentTree); serializableFieldsTree.addContent(fieldsContentTree); } else { buildSerialFieldTagsInfo(serializableFieldsTree); } } classContentTree.addContent(fieldWriter.getSerializableFields( configuration.getText("doclet.Serialized_Form_fields"), serializableFieldsTree)); } }
[ "public", "void", "buildSerializableFields", "(", "XMLNode", "node", ",", "Content", "classContentTree", ")", "{", "MemberDoc", "[", "]", "members", "=", "currentClass", ".", "serializableFields", "(", ")", ";", "int", "membersLength", "=", "members", ".", "leng...
Build the summaries for the fields that belong to the given class. @param node the XML element that specifies which components to document @param classContentTree content tree to which the documentation will be added
[ "Build", "the", "summaries", "for", "the", "fields", "that", "belong", "to", "the", "given", "class", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L412-L433
bartprokop/rxtx
src/main/java/gnu/io/RXTXPort.java
RXTXPort.staticSetSerialPortParams
public static void staticSetSerialPortParams(String f, int b, int d, int s, int p) throws UnsupportedCommOperationException { logger.fine( "RXTXPort:staticSetSerialPortParams( " + f + " " + b + " " + d + " " + s + " " + p); nativeStaticSetSerialPortParams(f, b, d, s, p); }
java
public static void staticSetSerialPortParams(String f, int b, int d, int s, int p) throws UnsupportedCommOperationException { logger.fine( "RXTXPort:staticSetSerialPortParams( " + f + " " + b + " " + d + " " + s + " " + p); nativeStaticSetSerialPortParams(f, b, d, s, p); }
[ "public", "static", "void", "staticSetSerialPortParams", "(", "String", "f", ",", "int", "b", ",", "int", "d", ",", "int", "s", ",", "int", "p", ")", "throws", "UnsupportedCommOperationException", "{", "logger", ".", "fine", "(", "\"RXTXPort:staticSetSerialPortP...
Extension to CommAPI This is an extension to CommAPI. It may not be supported on all operating systems. Set the SerialPort parameters 1.5 stop bits requires 5 databits @param f filename @param b baudrate @param d databits @param s stopbits @param p parity @throws UnsupportedCommOperationException on error @see gnu.io.UnsupportedCommOperationException
[ "Extension", "to", "CommAPI", "This", "is", "an", "extension", "to", "CommAPI", ".", "It", "may", "not", "be", "supported", "on", "all", "operating", "systems", "." ]
train
https://github.com/bartprokop/rxtx/blob/7b2c7857c262743e9dd15e9779c880b93c650890/src/main/java/gnu/io/RXTXPort.java#L1721-L1727
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java
ApiOvhHostingprivateDatabase.serviceName_whitelist_ip_GET
public OvhWhitelist serviceName_whitelist_ip_GET(String serviceName, String ip) throws IOException { String qPath = "/hosting/privateDatabase/{serviceName}/whitelist/{ip}"; StringBuilder sb = path(qPath, serviceName, ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhWhitelist.class); }
java
public OvhWhitelist serviceName_whitelist_ip_GET(String serviceName, String ip) throws IOException { String qPath = "/hosting/privateDatabase/{serviceName}/whitelist/{ip}"; StringBuilder sb = path(qPath, serviceName, ip); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhWhitelist.class); }
[ "public", "OvhWhitelist", "serviceName_whitelist_ip_GET", "(", "String", "serviceName", ",", "String", "ip", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/privateDatabase/{serviceName}/whitelist/{ip}\"", ";", "StringBuilder", "sb", "=", "path", "(...
Get this object properties REST: GET /hosting/privateDatabase/{serviceName}/whitelist/{ip} @param serviceName [required] The internal name of your private database @param ip [required] The whitelisted IP in your instance
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingprivateDatabase/src/main/java/net/minidev/ovh/api/ApiOvhHostingprivateDatabase.java#L804-L809
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java
JDBC4PreparedStatement.setObject
@Override public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { checkParameterBounds(parameterIndex); throw SQLError.noSupport(); }
java
@Override public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException { checkParameterBounds(parameterIndex); throw SQLError.noSupport(); }
[ "@", "Override", "public", "void", "setObject", "(", "int", "parameterIndex", ",", "Object", "x", ",", "int", "targetSqlType", ",", "int", "scaleOrLength", ")", "throws", "SQLException", "{", "checkParameterBounds", "(", "parameterIndex", ")", ";", "throw", "SQL...
Sets the value of the designated parameter with the given object.
[ "Sets", "the", "value", "of", "the", "designated", "parameter", "with", "the", "given", "object", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4PreparedStatement.java#L510-L515
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosGeoApi.java
PhotosGeoApi.getLocation
public Location getLocation(String photoId, boolean sign) throws JinxException { JinxUtils.validateParams(photoId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.geo.getLocation"); params.put("photo_id", photoId); return jinx.flickrGet(params, Location.class); }
java
public Location getLocation(String photoId, boolean sign) throws JinxException { JinxUtils.validateParams(photoId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.geo.getLocation"); params.put("photo_id", photoId); return jinx.flickrGet(params, Location.class); }
[ "public", "Location", "getLocation", "(", "String", "photoId", ",", "boolean", "sign", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "photoId", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap...
Get the geo data (latitude and longitude and the accuracy level) for a photo. <br> This method does not require authentication. @param photoId (Required) The id of the photo you want to retrieve location data for. @param sign if true, the request will be signed. @return location data for the specified photo. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.geo.getLocation.html">flickr.photos.geo.getLocation</a>
[ "Get", "the", "geo", "data", "(", "latitude", "and", "longitude", "and", "the", "accuracy", "level", ")", "for", "a", "photo", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosGeoApi.java#L126-L132
ReactiveX/RxJavaAsyncUtil
src/main/java/rx/util/async/Async.java
Async.toAsync
public static <T1> Func1<T1, Observable<Void>> toAsync(Action1<? super T1> action) { return toAsync(action, Schedulers.computation()); }
java
public static <T1> Func1<T1, Observable<Void>> toAsync(Action1<? super T1> action) { return toAsync(action, Schedulers.computation()); }
[ "public", "static", "<", "T1", ">", "Func1", "<", "T1", ",", "Observable", "<", "Void", ">", ">", "toAsync", "(", "Action1", "<", "?", "super", "T1", ">", "action", ")", "{", "return", "toAsync", "(", "action", ",", "Schedulers", ".", "computation", ...
Convert a synchronous action call into an asynchronous function call through an Observable. <p> <img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.an.png" alt=""> @param <T1> first parameter type of the action @param action the action to convert @return a function that returns an Observable that executes the {@code action} and emits {@code null} @see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a> @see <a href="http://msdn.microsoft.com/en-us/library/hh229657.aspx">MSDN: Observable.ToAsync</a>
[ "Convert", "a", "synchronous", "action", "call", "into", "an", "asynchronous", "function", "call", "through", "an", "Observable", ".", "<p", ">", "<img", "width", "=", "640", "src", "=", "https", ":", "//", "raw", ".", "github", ".", "com", "/", "wiki", ...
train
https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L191-L193
wildfly/wildfly-maven-plugin
core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java
DeploymentOperations.addRedeployOperationStep
private static void addRedeployOperationStep(final CompositeOperationBuilder builder, final DeploymentDescription deployment) { final String deploymentName = deployment.getName(); final Set<String> serverGroups = deployment.getServerGroups(); if (serverGroups.isEmpty()) { builder.addStep(createOperation(DEPLOYMENT_REDEPLOY_OPERATION, createAddress(DEPLOYMENT, deploymentName))); } else { for (String serverGroup : serverGroups) { builder.addStep(createOperation(DEPLOYMENT_REDEPLOY_OPERATION, createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, deploymentName))); } } }
java
private static void addRedeployOperationStep(final CompositeOperationBuilder builder, final DeploymentDescription deployment) { final String deploymentName = deployment.getName(); final Set<String> serverGroups = deployment.getServerGroups(); if (serverGroups.isEmpty()) { builder.addStep(createOperation(DEPLOYMENT_REDEPLOY_OPERATION, createAddress(DEPLOYMENT, deploymentName))); } else { for (String serverGroup : serverGroups) { builder.addStep(createOperation(DEPLOYMENT_REDEPLOY_OPERATION, createAddress(SERVER_GROUP, serverGroup, DEPLOYMENT, deploymentName))); } } }
[ "private", "static", "void", "addRedeployOperationStep", "(", "final", "CompositeOperationBuilder", "builder", ",", "final", "DeploymentDescription", "deployment", ")", "{", "final", "String", "deploymentName", "=", "deployment", ".", "getName", "(", ")", ";", "final"...
Adds a redeploy step to the composite operation. @param builder the builder to add the step to @param deployment the deployment being redeployed
[ "Adds", "a", "redeploy", "step", "to", "the", "composite", "operation", "." ]
train
https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/DeploymentOperations.java#L422-L432
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.getJobAsync
public Observable<JobResponseInner> getJobAsync(String resourceGroupName, String resourceName, String jobId) { return getJobWithServiceResponseAsync(resourceGroupName, resourceName, jobId).map(new Func1<ServiceResponse<JobResponseInner>, JobResponseInner>() { @Override public JobResponseInner call(ServiceResponse<JobResponseInner> response) { return response.body(); } }); }
java
public Observable<JobResponseInner> getJobAsync(String resourceGroupName, String resourceName, String jobId) { return getJobWithServiceResponseAsync(resourceGroupName, resourceName, jobId).map(new Func1<ServiceResponse<JobResponseInner>, JobResponseInner>() { @Override public JobResponseInner call(ServiceResponse<JobResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "JobResponseInner", ">", "getJobAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "jobId", ")", "{", "return", "getJobWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ",", "j...
Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. Get the details of a job from an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param jobId The job identifier. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the JobResponseInner object
[ "Get", "the", "details", "of", "a", "job", "from", "an", "IoT", "hub", ".", "For", "more", "information", "see", ":", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "azure", "/", "iot", "-", "hub", "/", "iot", "-", "hub", "-", "de...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L2237-L2244
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/FeatureUtil.java
FeatureUtil.toOutcomeVector
public static INDArray toOutcomeVector(long index, long numOutcomes) { if (index > Integer.MAX_VALUE || numOutcomes > Integer.MAX_VALUE) throw new UnsupportedOperationException(); val nums = new int[(int) numOutcomes]; nums[(int) index] = 1; return NDArrayUtil.toNDArray(nums); }
java
public static INDArray toOutcomeVector(long index, long numOutcomes) { if (index > Integer.MAX_VALUE || numOutcomes > Integer.MAX_VALUE) throw new UnsupportedOperationException(); val nums = new int[(int) numOutcomes]; nums[(int) index] = 1; return NDArrayUtil.toNDArray(nums); }
[ "public", "static", "INDArray", "toOutcomeVector", "(", "long", "index", ",", "long", "numOutcomes", ")", "{", "if", "(", "index", ">", "Integer", ".", "MAX_VALUE", "||", "numOutcomes", ">", "Integer", ".", "MAX_VALUE", ")", "throw", "new", "UnsupportedOperati...
Creates an out come vector from the specified inputs @param index the index of the label @param numOutcomes the number of possible outcomes @return a binary label matrix used for supervised learning
[ "Creates", "an", "out", "come", "vector", "from", "the", "specified", "inputs" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/FeatureUtil.java#L34-L41
m-m-m/util
lang/src/main/java/net/sf/mmm/util/lang/api/CaseSyntax.java
CaseSyntax.of
public static CaseSyntax of(Character separator, CaseConversion allCharCase) { return of(separator, allCharCase, allCharCase, allCharCase); }
java
public static CaseSyntax of(Character separator, CaseConversion allCharCase) { return of(separator, allCharCase, allCharCase, allCharCase); }
[ "public", "static", "CaseSyntax", "of", "(", "Character", "separator", ",", "CaseConversion", "allCharCase", ")", "{", "return", "of", "(", "separator", ",", "allCharCase", ",", "allCharCase", ",", "allCharCase", ")", ";", "}" ]
The constructor. @param separator - see {@link #getWordSeparator()}. @param allCharCase the {@link CaseConversion} used for {@link #getFirstCase() first}, {@link #getWordStartCase() word-start}, and all {@link #getOtherCase() other} alphabetic characters. @return the requested {@link CaseSyntax}.
[ "The", "constructor", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/lang/src/main/java/net/sf/mmm/util/lang/api/CaseSyntax.java#L382-L385
JodaOrg/joda-time
src/main/java/org/joda/time/base/BasePeriod.java
BasePeriod.toDurationFrom
public Duration toDurationFrom(ReadableInstant startInstant) { long startMillis = DateTimeUtils.getInstantMillis(startInstant); Chronology chrono = DateTimeUtils.getInstantChronology(startInstant); long endMillis = chrono.add(this, startMillis, 1); return new Duration(startMillis, endMillis); }
java
public Duration toDurationFrom(ReadableInstant startInstant) { long startMillis = DateTimeUtils.getInstantMillis(startInstant); Chronology chrono = DateTimeUtils.getInstantChronology(startInstant); long endMillis = chrono.add(this, startMillis, 1); return new Duration(startMillis, endMillis); }
[ "public", "Duration", "toDurationFrom", "(", "ReadableInstant", "startInstant", ")", "{", "long", "startMillis", "=", "DateTimeUtils", ".", "getInstantMillis", "(", "startInstant", ")", ";", "Chronology", "chrono", "=", "DateTimeUtils", ".", "getInstantChronology", "(...
Gets the total millisecond duration of this period relative to a start instant. <p> This method adds the period to the specified instant in order to calculate the duration. <p> An instant must be supplied as the duration of a period varies. For example, a period of 1 month could vary between the equivalent of 28 and 31 days in milliseconds due to different length months. Similarly, a day can vary at Daylight Savings cutover, typically between 23 and 25 hours. @param startInstant the instant to add the period to, thus obtaining the duration @return the total length of the period as a duration relative to the start instant @throws ArithmeticException if the millis exceeds the capacity of the duration
[ "Gets", "the", "total", "millisecond", "duration", "of", "this", "period", "relative", "to", "a", "start", "instant", ".", "<p", ">", "This", "method", "adds", "the", "period", "to", "the", "specified", "instant", "in", "order", "to", "calculate", "the", "...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/base/BasePeriod.java#L349-L354
soi-toolkit/soi-toolkit-mule
commons/components/module-logger/src/main/java/org/soitoolkit/commons/module/logger/SoitoolkitLoggerModule.java
SoitoolkitLoggerModule.logError
@Processor public Object logError( String message, @Optional String integrationScenario, @Optional String contractId, @Optional String correlationId, @Optional Map<String, String> extra) { return doLog(LogLevelType.ERROR, message, integrationScenario, contractId, correlationId, extra); }
java
@Processor public Object logError( String message, @Optional String integrationScenario, @Optional String contractId, @Optional String correlationId, @Optional Map<String, String> extra) { return doLog(LogLevelType.ERROR, message, integrationScenario, contractId, correlationId, extra); }
[ "@", "Processor", "public", "Object", "logError", "(", "String", "message", ",", "@", "Optional", "String", "integrationScenario", ",", "@", "Optional", "String", "contractId", ",", "@", "Optional", "String", "correlationId", ",", "@", "Optional", "Map", "<", ...
Log processor for level ERROR {@sample.xml ../../../doc/SoitoolkitLogger-connector.xml.sample soitoolkitlogger:log} @param message Log-message to be processed @param integrationScenario Optional name of the integration scenario or business process @param contractId Optional name of the contract in use @param correlationId Optional correlation identity of the message @param extra Optional extra info @return The incoming payload
[ "Log", "processor", "for", "level", "ERROR" ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/module-logger/src/main/java/org/soitoolkit/commons/module/logger/SoitoolkitLoggerModule.java#L190-L199
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/Utils.java
Utils.requireEmptyText
public static void requireEmptyText(Node node, String errMsg) throws IllegalArgumentException { require((node instanceof Text) || (node instanceof Comment), errMsg + ": " + node.toString()); if (node instanceof Text) { Text text = (Text)node; String textValue = text.getData(); require(textValue.trim().length() == 0, errMsg + ": " + textValue); } }
java
public static void requireEmptyText(Node node, String errMsg) throws IllegalArgumentException { require((node instanceof Text) || (node instanceof Comment), errMsg + ": " + node.toString()); if (node instanceof Text) { Text text = (Text)node; String textValue = text.getData(); require(textValue.trim().length() == 0, errMsg + ": " + textValue); } }
[ "public", "static", "void", "requireEmptyText", "(", "Node", "node", ",", "String", "errMsg", ")", "throws", "IllegalArgumentException", "{", "require", "(", "(", "node", "instanceof", "Text", ")", "||", "(", "node", "instanceof", "Comment", ")", ",", "errMsg"...
Assert that the given org.w3c.doc.Node is a comment element or a Text element and that it ontains whitespace only, otherwise throw an IllegalArgumentException using the given error message. This is helpful when nothing is expected at a certain place in a DOM tree, yet comments or whitespace text nodes can appear. @param node A DOM Node object. @param errMsg String used to in the IllegalArgumentException constructor if thrown. @throws IllegalArgumentException If the expression is false.
[ "Assert", "that", "the", "given", "org", ".", "w3c", ".", "doc", ".", "Node", "is", "a", "comment", "element", "or", "a", "Text", "element", "and", "that", "it", "ontains", "whitespace", "only", "otherwise", "throw", "an", "IllegalArgumentException", "using"...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/Utils.java#L1510-L1519
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/SerializationUtils.java
SerializationUtils.deserializeFromBytes
public static <T extends Serializable> T deserializeFromBytes(byte[] serialized, Class<T> clazz) throws IOException { try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(serialized))) { return clazz.cast(ois.readObject()); } catch (ClassNotFoundException e) { throw new IOException(e); } }
java
public static <T extends Serializable> T deserializeFromBytes(byte[] serialized, Class<T> clazz) throws IOException { try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(serialized))) { return clazz.cast(ois.readObject()); } catch (ClassNotFoundException e) { throw new IOException(e); } }
[ "public", "static", "<", "T", "extends", "Serializable", ">", "T", "deserializeFromBytes", "(", "byte", "[", "]", "serialized", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "IOException", "{", "try", "(", "ObjectInputStream", "ois", "=", "new", "Ob...
Deserialize a String obtained via {@link #serializeIntoBytes(Serializable)} into an object. @param serialized The serialized bytes @param clazz The class the deserialized object should be cast to. @return The deserialized object @throws IOException if it fails to deserialize the object
[ "Deserialize", "a", "String", "obtained", "via", "{", "@link", "#serializeIntoBytes", "(", "Serializable", ")", "}", "into", "an", "object", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/SerializationUtils.java#L122-L130
goldmansachs/reladomo
reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java
TransactionLocalMap.put
public void put(TransactionLocal key, Object value) { // We don't use a fast path as with get() because it is at // least as common to use set() to create new entries as // it is to replace existing ones, in which case, a fast // path would fail more often than not. Entry[] tab = table; int len = tab.length; int i = key.hashCode & (len - 1); for (Entry e = tab[i]; e != null; e = tab[i = nextIndex(i, len)]) { if (e.key == key) { e.value = value; return; } } tab[i] = new Entry(key, value); int sz = ++size; if (sz >= threshold) rehash(); }
java
public void put(TransactionLocal key, Object value) { // We don't use a fast path as with get() because it is at // least as common to use set() to create new entries as // it is to replace existing ones, in which case, a fast // path would fail more often than not. Entry[] tab = table; int len = tab.length; int i = key.hashCode & (len - 1); for (Entry e = tab[i]; e != null; e = tab[i = nextIndex(i, len)]) { if (e.key == key) { e.value = value; return; } } tab[i] = new Entry(key, value); int sz = ++size; if (sz >= threshold) rehash(); }
[ "public", "void", "put", "(", "TransactionLocal", "key", ",", "Object", "value", ")", "{", "// We don't use a fast path as with get() because it is at\r", "// least as common to use set() to create new entries as\r", "// it is to replace existing ones, in which case, a fast\r", "// path ...
Set the value associated with key. @param key the thread local object @param value the value to be set
[ "Set", "the", "value", "associated", "with", "key", "." ]
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java#L142-L169
maxmind/geoip-api-java
src/main/java/com/maxmind/geoip/LookupService.java
LookupService.getCountry
public synchronized Country getCountry(long ipAddress) { if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) { throw new IllegalStateException("Database has been closed."); } int ret = seekCountry(ipAddress) - COUNTRY_BEGIN; if (ret == 0) { return UNKNOWN_COUNTRY; } else { return new Country(countryCode[ret], countryName[ret]); } }
java
public synchronized Country getCountry(long ipAddress) { if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) { throw new IllegalStateException("Database has been closed."); } int ret = seekCountry(ipAddress) - COUNTRY_BEGIN; if (ret == 0) { return UNKNOWN_COUNTRY; } else { return new Country(countryCode[ret], countryName[ret]); } }
[ "public", "synchronized", "Country", "getCountry", "(", "long", "ipAddress", ")", "{", "if", "(", "file", "==", "null", "&&", "(", "dboptions", "&", "GEOIP_MEMORY_CACHE", ")", "==", "0", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Database has b...
Returns the country the IP address is in. @param ipAddress the IP address in long format. @return the country the IP address is from.
[ "Returns", "the", "country", "the", "IP", "address", "is", "in", "." ]
train
https://github.com/maxmind/geoip-api-java/blob/baae36617ba6c5004370642716bc6e526774ba87/src/main/java/com/maxmind/geoip/LookupService.java#L491-L501
apollographql/apollo-android
apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java
ResponseField.forEnum
public static ResponseField forEnum(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.ENUM, responseName, fieldName, arguments, optional, conditions); }
java
public static ResponseField forEnum(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.ENUM, responseName, fieldName, arguments, optional, conditions); }
[ "public", "static", "ResponseField", "forEnum", "(", "String", "responseName", ",", "String", "fieldName", ",", "Map", "<", "String", ",", "Object", ">", "arguments", ",", "boolean", "optional", ",", "List", "<", "Condition", ">", "conditions", ")", "{", "re...
Factory method for creating a Field instance representing {@link Type#ENUM}. @param responseName alias for the result of a field @param fieldName name of the field in the GraphQL operation @param arguments arguments to be passed along with the field @param optional whether the arguments passed along are optional or required @param conditions list of conditions for this field @return Field instance representing {@link Type#ENUM}
[ "Factory", "method", "for", "creating", "a", "Field", "instance", "representing", "{", "@link", "Type#ENUM", "}", "." ]
train
https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java#L115-L118
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/service/monitoring/FlowStatusGenerator.java
FlowStatusGenerator.getFlowStatus
public FlowStatus getFlowStatus(String flowName, String flowGroup, long flowExecutionId) { FlowStatus flowStatus = null; Iterator<JobStatus> jobStatusIterator = jobStatusRetriever.getJobStatusesForFlowExecution(flowName, flowGroup, flowExecutionId); if (jobStatusIterator.hasNext()) { flowStatus = new FlowStatus(flowName, flowGroup, flowExecutionId, jobStatusIterator); } return flowStatus; }
java
public FlowStatus getFlowStatus(String flowName, String flowGroup, long flowExecutionId) { FlowStatus flowStatus = null; Iterator<JobStatus> jobStatusIterator = jobStatusRetriever.getJobStatusesForFlowExecution(flowName, flowGroup, flowExecutionId); if (jobStatusIterator.hasNext()) { flowStatus = new FlowStatus(flowName, flowGroup, flowExecutionId, jobStatusIterator); } return flowStatus; }
[ "public", "FlowStatus", "getFlowStatus", "(", "String", "flowName", ",", "String", "flowGroup", ",", "long", "flowExecutionId", ")", "{", "FlowStatus", "flowStatus", "=", "null", ";", "Iterator", "<", "JobStatus", ">", "jobStatusIterator", "=", "jobStatusRetriever",...
Get the flow status for a specific execution. @param flowName @param flowGroup @param flowExecutionId @return the flow status, null is returned if the flow status does not exist
[ "Get", "the", "flow", "status", "for", "a", "specific", "execution", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/service/monitoring/FlowStatusGenerator.java#L68-L78
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.isInstaneOf
public static boolean isInstaneOf(String srcClassName, Class trg) { Class clazz = ClassUtil.loadClass(srcClassName, null); if (clazz == null) return false; return isInstaneOf(clazz, trg); }
java
public static boolean isInstaneOf(String srcClassName, Class trg) { Class clazz = ClassUtil.loadClass(srcClassName, null); if (clazz == null) return false; return isInstaneOf(clazz, trg); }
[ "public", "static", "boolean", "isInstaneOf", "(", "String", "srcClassName", ",", "Class", "trg", ")", "{", "Class", "clazz", "=", "ClassUtil", ".", "loadClass", "(", "srcClassName", ",", "null", ")", ";", "if", "(", "clazz", "==", "null", ")", "return", ...
check if Class is instanceof a a other Class @param srcClassName Class name to check @param trg is Class of? @return is Class Class of...
[ "check", "if", "Class", "is", "instanceof", "a", "a", "other", "Class" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L97-L101
atomix/atomix
core/src/main/java/io/atomix/core/map/impl/AbstractAtomicMapService.java
AbstractAtomicMapService.removeIf
private MapEntryUpdateResult<K, byte[]> removeIf(long index, K key, Predicate<MapEntryValue> predicate) { MapEntryValue value = entries().get(key); // If the value does not exist or doesn't match the predicate, return a PRECONDITION_FAILED error. if (valueIsNull(value) || !predicate.test(value)) { return new MapEntryUpdateResult<>(MapEntryUpdateResult.Status.PRECONDITION_FAILED, index, key, null); } // If the key has been locked by a transaction, return a WRITE_LOCK error. if (preparedKeys.contains(key)) { return new MapEntryUpdateResult<>(MapEntryUpdateResult.Status.WRITE_LOCK, index, key, null); } // If no transactions are active, remove the key. Otherwise, replace it with a tombstone. if (activeTransactions.isEmpty()) { entries().remove(key); } else { entries().put(key, new MapEntryValue(MapEntryValue.Type.TOMBSTONE, index, null, 0, 0)); } // Cancel the timer if one is scheduled. cancelTtl(value); Versioned<byte[]> result = toVersioned(value); publish(new AtomicMapEvent<>(AtomicMapEvent.Type.REMOVE, key, null, result)); return new MapEntryUpdateResult<>(MapEntryUpdateResult.Status.OK, index, key, result); }
java
private MapEntryUpdateResult<K, byte[]> removeIf(long index, K key, Predicate<MapEntryValue> predicate) { MapEntryValue value = entries().get(key); // If the value does not exist or doesn't match the predicate, return a PRECONDITION_FAILED error. if (valueIsNull(value) || !predicate.test(value)) { return new MapEntryUpdateResult<>(MapEntryUpdateResult.Status.PRECONDITION_FAILED, index, key, null); } // If the key has been locked by a transaction, return a WRITE_LOCK error. if (preparedKeys.contains(key)) { return new MapEntryUpdateResult<>(MapEntryUpdateResult.Status.WRITE_LOCK, index, key, null); } // If no transactions are active, remove the key. Otherwise, replace it with a tombstone. if (activeTransactions.isEmpty()) { entries().remove(key); } else { entries().put(key, new MapEntryValue(MapEntryValue.Type.TOMBSTONE, index, null, 0, 0)); } // Cancel the timer if one is scheduled. cancelTtl(value); Versioned<byte[]> result = toVersioned(value); publish(new AtomicMapEvent<>(AtomicMapEvent.Type.REMOVE, key, null, result)); return new MapEntryUpdateResult<>(MapEntryUpdateResult.Status.OK, index, key, result); }
[ "private", "MapEntryUpdateResult", "<", "K", ",", "byte", "[", "]", ">", "removeIf", "(", "long", "index", ",", "K", "key", ",", "Predicate", "<", "MapEntryValue", ">", "predicate", ")", "{", "MapEntryValue", "value", "=", "entries", "(", ")", ".", "get"...
Handles a remove commit. @param index the commit index @param key the key to remove @param predicate predicate to determine whether to remove the entry @return map entry update result
[ "Handles", "a", "remove", "commit", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/core/src/main/java/io/atomix/core/map/impl/AbstractAtomicMapService.java#L406-L432
nguyenq/tess4j
src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java
ImageIOHelper.mergeTiff
public static void mergeTiff(List<IIOImage> imageList, File outputTiff, String compressionType) throws IOException { if (imageList == null || imageList.isEmpty()) { // if no image return; } Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName(TIFF_FORMAT); if (!writers.hasNext()) { throw new RuntimeException(JAI_IMAGE_WRITER_MESSAGE); } ImageWriter writer = writers.next(); //Set up the writeParam TIFFImageWriteParam tiffWriteParam = new TIFFImageWriteParam(Locale.US); // tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_DISABLED); // comment out to preserve original sizes if (compressionType != null) { tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); tiffWriteParam.setCompressionType(compressionType); } //Get the stream metadata IIOMetadata streamMetadata = writer.getDefaultStreamMetadata(tiffWriteParam); try (ImageOutputStream ios = ImageIO.createImageOutputStream(outputTiff)) { writer.setOutput(ios); int dpiX = 300; int dpiY = 300; for (IIOImage iioImage : imageList) { // Get the default image metadata. ImageTypeSpecifier imageType = ImageTypeSpecifier.createFromRenderedImage(iioImage.getRenderedImage()); ImageWriteParam param = writer.getDefaultWriteParam(); IIOMetadata imageMetadata = writer.getDefaultImageMetadata(imageType, param); imageMetadata = setDPIViaAPI(imageMetadata, dpiX, dpiY); iioImage.setMetadata(imageMetadata); } IIOImage firstIioImage = imageList.remove(0); writer.write(streamMetadata, firstIioImage, tiffWriteParam); int i = 1; for (IIOImage iioImage : imageList) { writer.writeInsert(i++, iioImage, tiffWriteParam); } } finally { writer.dispose(); } }
java
public static void mergeTiff(List<IIOImage> imageList, File outputTiff, String compressionType) throws IOException { if (imageList == null || imageList.isEmpty()) { // if no image return; } Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName(TIFF_FORMAT); if (!writers.hasNext()) { throw new RuntimeException(JAI_IMAGE_WRITER_MESSAGE); } ImageWriter writer = writers.next(); //Set up the writeParam TIFFImageWriteParam tiffWriteParam = new TIFFImageWriteParam(Locale.US); // tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_DISABLED); // comment out to preserve original sizes if (compressionType != null) { tiffWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); tiffWriteParam.setCompressionType(compressionType); } //Get the stream metadata IIOMetadata streamMetadata = writer.getDefaultStreamMetadata(tiffWriteParam); try (ImageOutputStream ios = ImageIO.createImageOutputStream(outputTiff)) { writer.setOutput(ios); int dpiX = 300; int dpiY = 300; for (IIOImage iioImage : imageList) { // Get the default image metadata. ImageTypeSpecifier imageType = ImageTypeSpecifier.createFromRenderedImage(iioImage.getRenderedImage()); ImageWriteParam param = writer.getDefaultWriteParam(); IIOMetadata imageMetadata = writer.getDefaultImageMetadata(imageType, param); imageMetadata = setDPIViaAPI(imageMetadata, dpiX, dpiY); iioImage.setMetadata(imageMetadata); } IIOImage firstIioImage = imageList.remove(0); writer.write(streamMetadata, firstIioImage, tiffWriteParam); int i = 1; for (IIOImage iioImage : imageList) { writer.writeInsert(i++, iioImage, tiffWriteParam); } } finally { writer.dispose(); } }
[ "public", "static", "void", "mergeTiff", "(", "List", "<", "IIOImage", ">", "imageList", ",", "File", "outputTiff", ",", "String", "compressionType", ")", "throws", "IOException", "{", "if", "(", "imageList", "==", "null", "||", "imageList", ".", "isEmpty", ...
Merges multiple images into one multi-page TIFF image. @param imageList a list of <code>IIOImage</code> objects @param outputTiff the output TIFF file @param compressionType valid values: LZW, CCITT T.6, PackBits @throws IOException
[ "Merges", "multiple", "images", "into", "one", "multi", "-", "page", "TIFF", "image", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageIOHelper.java#L546-L594
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java
Util.javaScriptPropertyToJavaPropertyName
static String javaScriptPropertyToJavaPropertyName(final String prefix, final String jsPropertyName) { if (jsPropertyName.isEmpty()) { throw new JsiiException("jsPropertyName must not be empty"); } StringBuilder sb = new StringBuilder(); sb.append(prefix); sb.append(jsPropertyName.substring(0, 1).toUpperCase()); if (jsPropertyName.length() > 1) { sb.append(jsPropertyName.substring(1)); } return sb.toString(); }
java
static String javaScriptPropertyToJavaPropertyName(final String prefix, final String jsPropertyName) { if (jsPropertyName.isEmpty()) { throw new JsiiException("jsPropertyName must not be empty"); } StringBuilder sb = new StringBuilder(); sb.append(prefix); sb.append(jsPropertyName.substring(0, 1).toUpperCase()); if (jsPropertyName.length() > 1) { sb.append(jsPropertyName.substring(1)); } return sb.toString(); }
[ "static", "String", "javaScriptPropertyToJavaPropertyName", "(", "final", "String", "prefix", ",", "final", "String", "jsPropertyName", ")", "{", "if", "(", "jsPropertyName", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "JsiiException", "(", "\"jsPropertyNa...
Converts a javascript property name (xxx) to a Java property method (setXxx/getXxx). @param prefix The prefix (get/set) @param jsPropertyName The javascript property name @return The java method name
[ "Converts", "a", "javascript", "property", "name", "(", "xxx", ")", "to", "a", "Java", "property", "method", "(", "setXxx", "/", "getXxx", ")", "." ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java#L80-L92
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.noNullElements
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalNullElementsException.class }) public static <T extends Iterable<?>> T noNullElements(@Nonnull final T iterable, final String name) { Check.notNull(iterable, "iterable"); for (final Object element : iterable) { if (element == null) { throw new IllegalNullElementsException(name); } } return iterable; }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalNullElementsException.class }) public static <T extends Iterable<?>> T noNullElements(@Nonnull final T iterable, final String name) { Check.notNull(iterable, "iterable"); for (final Object element : iterable) { if (element == null) { throw new IllegalNullElementsException(name); } } return iterable; }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalNullElementsException", ".", "class", "}", ")", "public", "static", "<", "T", "extends", "Iterable", "<", "?", ">", ">", "T", "noNullElements", "(", "@...
Ensures that an iterable reference is neither {@code null} nor contains any elements that are {@code null}. @param iterable the iterable reference which should not contain {@code null} @param name name of object reference (in source code) @return the passed reference which contains no elements that are {@code null} @throws IllegalNullElementsException if the given argument {@code iterable} contains elements that are {@code null}
[ "Ensures", "that", "an", "iterable", "reference", "is", "neither", "{", "@code", "null", "}", "nor", "contains", "any", "elements", "that", "are", "{", "@code", "null", "}", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1842-L1852
sdl/odata
odata_client_api/src/main/java/com/sdl/odata/client/property/PropertyUtils.java
PropertyUtils.getStringProperty
public static String getStringProperty(Properties properties, String key) { String property = properties.getProperty(key); return property != null && property.trim().isEmpty() ? null : property; }
java
public static String getStringProperty(Properties properties, String key) { String property = properties.getProperty(key); return property != null && property.trim().isEmpty() ? null : property; }
[ "public", "static", "String", "getStringProperty", "(", "Properties", "properties", ",", "String", "key", ")", "{", "String", "property", "=", "properties", ".", "getProperty", "(", "key", ")", ";", "return", "property", "!=", "null", "&&", "property", ".", ...
Get a string property from the properties. @param properties the provided properties @return the string property
[ "Get", "a", "string", "property", "from", "the", "properties", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_client_api/src/main/java/com/sdl/odata/client/property/PropertyUtils.java#L67-L70
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.vps_serviceName_plesk_GET
public ArrayList<String> vps_serviceName_plesk_GET(String serviceName, OvhPleskLicenseDomainNumberEnum domainNumber) throws IOException { String qPath = "/order/vps/{serviceName}/plesk"; StringBuilder sb = path(qPath, serviceName); query(sb, "domainNumber", domainNumber); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> vps_serviceName_plesk_GET(String serviceName, OvhPleskLicenseDomainNumberEnum domainNumber) throws IOException { String qPath = "/order/vps/{serviceName}/plesk"; StringBuilder sb = path(qPath, serviceName); query(sb, "domainNumber", domainNumber); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "vps_serviceName_plesk_GET", "(", "String", "serviceName", ",", "OvhPleskLicenseDomainNumberEnum", "domainNumber", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/vps/{serviceName}/plesk\"", ";", "StringBuilder...
Get allowed durations for 'plesk' option REST: GET /order/vps/{serviceName}/plesk @param domainNumber [required] Domain number you want to order a licence for @param serviceName [required] The internal name of your VPS offer @deprecated
[ "Get", "allowed", "durations", "for", "plesk", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3308-L3314
phax/ph-css
ph-css/src/main/java/com/helger/css/reader/CSSReaderDeclarationList.java
CSSReaderDeclarationList.readFromReader
@Nullable public static CSSDeclarationList readFromReader (@Nonnull @WillClose final Reader aReader, @Nonnull final ECSSVersion eVersion) { return readFromReader (aReader, new CSSReaderSettings ().setCSSVersion (eVersion)); }
java
@Nullable public static CSSDeclarationList readFromReader (@Nonnull @WillClose final Reader aReader, @Nonnull final ECSSVersion eVersion) { return readFromReader (aReader, new CSSReaderSettings ().setCSSVersion (eVersion)); }
[ "@", "Nullable", "public", "static", "CSSDeclarationList", "readFromReader", "(", "@", "Nonnull", "@", "WillClose", "final", "Reader", "aReader", ",", "@", "Nonnull", "final", "ECSSVersion", "eVersion", ")", "{", "return", "readFromReader", "(", "aReader", ",", ...
Read the CSS from the passed {@link Reader}. @param aReader The reader to use. Will be closed automatically after reading - independent of success or error. May not be <code>null</code>. @param eVersion The CSS version to use. May not be <code>null</code>. @return <code>null</code> if reading failed, the CSS declarations otherwise.
[ "Read", "the", "CSS", "from", "the", "passed", "{", "@link", "Reader", "}", "." ]
train
https://github.com/phax/ph-css/blob/c9da5bb4decc681de6e27ce31712aad4c00adafa/ph-css/src/main/java/com/helger/css/reader/CSSReaderDeclarationList.java#L663-L668
spring-projects/spring-analytics
src/main/java/org/springframework/analytics/rest/controller/AggregateCounterController.java
AggregateCounterController.display
@ResponseBody @RequestMapping(value = "/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public AggregateCounterResource display( @PathVariable("name") String name, @RequestParam(value = "from", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) DateTime from, @RequestParam(value = "to", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) DateTime to, @RequestParam(value = "resolution", defaultValue = "hour") AggregateCounterResolution resolution) { to = providedOrDefaultToValue(to); from = providedOrDefaultFromValue(from, to, resolution); AggregateCounter aggregate = repository.getCounts(name, new Interval(from, to), resolution); return deepAssembler.toResource(aggregate); }
java
@ResponseBody @RequestMapping(value = "/{name}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public AggregateCounterResource display( @PathVariable("name") String name, @RequestParam(value = "from", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) DateTime from, @RequestParam(value = "to", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME) DateTime to, @RequestParam(value = "resolution", defaultValue = "hour") AggregateCounterResolution resolution) { to = providedOrDefaultToValue(to); from = providedOrDefaultFromValue(from, to, resolution); AggregateCounter aggregate = repository.getCounts(name, new Interval(from, to), resolution); return deepAssembler.toResource(aggregate); }
[ "@", "ResponseBody", "@", "RequestMapping", "(", "value", "=", "\"/{name}\"", ",", "method", "=", "RequestMethod", ".", "GET", ",", "produces", "=", "MediaType", ".", "APPLICATION_JSON_VALUE", ")", "public", "AggregateCounterResource", "display", "(", "@", "PathVa...
Retrieve counts for a given time interval, using some precision. @param name the name of the aggregate counter we want to retrieve data from @param from the start-time for the interval, default depends on the resolution (e.g. go back 1 day for hourly buckets) @param to the end-time for the interval, default "now" @param resolution the size of buckets to aggregate, <i>e.g.</i> hourly, daily, <i>etc.</i> (default "hour") @return counts
[ "Retrieve", "counts", "for", "a", "given", "time", "interval", "using", "some", "precision", "." ]
train
https://github.com/spring-projects/spring-analytics/blob/e3ef19d2b794d6dc10265c171bba46cd757b1abd/src/main/java/org/springframework/analytics/rest/controller/AggregateCounterController.java#L151-L162
hawkular/hawkular-inventory
hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/FilterApplicator.java
FilterApplicator.applyAll
public static <S, E> void applyAll(Query filterTree, GraphTraversal<S, E> q) { if (filterTree == null) { return; } QueryTranslationState state = new QueryTranslationState(); applyAll(filterTree, q, false, state); }
java
public static <S, E> void applyAll(Query filterTree, GraphTraversal<S, E> q) { if (filterTree == null) { return; } QueryTranslationState state = new QueryTranslationState(); applyAll(filterTree, q, false, state); }
[ "public", "static", "<", "S", ",", "E", ">", "void", "applyAll", "(", "Query", "filterTree", ",", "GraphTraversal", "<", "S", ",", "E", ">", "q", ")", "{", "if", "(", "filterTree", "==", "null", ")", "{", "return", ";", "}", "QueryTranslationState", ...
Applies all the filters from the applicator tree to the provided Gremlin query. @param filterTree the tree of filters to apply to the query @param q the query to update with filters from the tree @param <S> type of the source of the query @param <E> type of the output of the query
[ "Applies", "all", "the", "filters", "from", "the", "applicator", "tree", "to", "the", "provided", "Gremlin", "query", "." ]
train
https://github.com/hawkular/hawkular-inventory/blob/f56dc10323dca21777feb5b609a9e9cc70ffaf62/hawkular-inventory-impl-tinkerpop-parent/hawkular-inventory-impl-tinkerpop/src/main/java/org/hawkular/inventory/impl/tinkerpop/FilterApplicator.java#L129-L137
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java
AttributesImpl.getIndex
public int getIndex (String uri, String localName) { int max = length * 5; for (int i = 0; i < max; i += 5) { if (data[i].equals(uri) && data[i+1].equals(localName)) { return i / 5; } } return -1; }
java
public int getIndex (String uri, String localName) { int max = length * 5; for (int i = 0; i < max; i += 5) { if (data[i].equals(uri) && data[i+1].equals(localName)) { return i / 5; } } return -1; }
[ "public", "int", "getIndex", "(", "String", "uri", ",", "String", "localName", ")", "{", "int", "max", "=", "length", "*", "5", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "max", ";", "i", "+=", "5", ")", "{", "if", "(", "data", "["...
Look up an attribute's index by Namespace name. <p>In many cases, it will be more efficient to look up the name once and use the index query methods rather than using the name query methods repeatedly.</p> @param uri The attribute's Namespace URI, or the empty string if none is available. @param localName The attribute's local name. @return The attribute's index, or -1 if none matches. @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)
[ "Look", "up", "an", "attribute", "s", "index", "by", "Namespace", "name", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributesImpl.java#L199-L208
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java
SftpClient.get
public SftpFileAttributes get(String remote, String local, boolean resume) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { return get(remote, local, null, resume); }
java
public SftpFileAttributes get(String remote, String local, boolean resume) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { return get(remote, local, null, resume); }
[ "public", "SftpFileAttributes", "get", "(", "String", "remote", ",", "String", "local", ",", "boolean", "resume", ")", "throws", "FileNotFoundException", ",", "SftpStatusException", ",", "SshException", ",", "TransferCancelledException", "{", "return", "get", "(", "...
Download the remote file into the local file. @param remote @param local @param resume attempt to resume an interrupted download @return the downloaded file's attributes @throws FileNotFoundException @throws SftpStatusException @throws SshException @throws TransferCancelledException
[ "Download", "the", "remote", "file", "into", "the", "local", "file", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L1107-L1111
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaagroup_auditnslogpolicy_binding.java
aaagroup_auditnslogpolicy_binding.count_filtered
public static long count_filtered(nitro_service service, String groupname, String filter) throws Exception{ aaagroup_auditnslogpolicy_binding obj = new aaagroup_auditnslogpolicy_binding(); obj.set_groupname(groupname); options option = new options(); option.set_count(true); option.set_filter(filter); aaagroup_auditnslogpolicy_binding[] response = (aaagroup_auditnslogpolicy_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
java
public static long count_filtered(nitro_service service, String groupname, String filter) throws Exception{ aaagroup_auditnslogpolicy_binding obj = new aaagroup_auditnslogpolicy_binding(); obj.set_groupname(groupname); options option = new options(); option.set_count(true); option.set_filter(filter); aaagroup_auditnslogpolicy_binding[] response = (aaagroup_auditnslogpolicy_binding[]) obj.getfiltered(service, option); if (response != null) { return response[0].__count; } return 0; }
[ "public", "static", "long", "count_filtered", "(", "nitro_service", "service", ",", "String", "groupname", ",", "String", "filter", ")", "throws", "Exception", "{", "aaagroup_auditnslogpolicy_binding", "obj", "=", "new", "aaagroup_auditnslogpolicy_binding", "(", ")", ...
Use this API to count the filtered set of aaagroup_auditnslogpolicy_binding resources. filter string should be in JSON format.eg: "port:80,servicetype:HTTP".
[ "Use", "this", "API", "to", "count", "the", "filtered", "set", "of", "aaagroup_auditnslogpolicy_binding", "resources", ".", "filter", "string", "should", "be", "in", "JSON", "format", ".", "eg", ":", "port", ":", "80", "servicetype", ":", "HTTP", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/aaa/aaagroup_auditnslogpolicy_binding.java#L298-L309
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
AtomicReferenceFieldUpdater.getAndUpdate
public final V getAndUpdate(T obj, UnaryOperator<V> updateFunction) { V prev, next; do { prev = get(obj); next = updateFunction.apply(prev); } while (!compareAndSet(obj, prev, next)); return prev; }
java
public final V getAndUpdate(T obj, UnaryOperator<V> updateFunction) { V prev, next; do { prev = get(obj); next = updateFunction.apply(prev); } while (!compareAndSet(obj, prev, next)); return prev; }
[ "public", "final", "V", "getAndUpdate", "(", "T", "obj", ",", "UnaryOperator", "<", "V", ">", "updateFunction", ")", "{", "V", "prev", ",", "next", ";", "do", "{", "prev", "=", "get", "(", "obj", ")", ";", "next", "=", "updateFunction", ".", "apply",...
Atomically updates the field of the given object managed by this updater with the results of applying the given function, returning the previous value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. @param obj An object whose field to get and set @param updateFunction a side-effect-free function @return the previous value @since 1.8
[ "Atomically", "updates", "the", "field", "of", "the", "given", "object", "managed", "by", "this", "updater", "with", "the", "results", "of", "applying", "the", "given", "function", "returning", "the", "previous", "value", ".", "The", "function", "should", "be"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java#L205-L212
SahaginOrg/sahagin-java
src/main/java/org/sahagin/main/SahaginMain.java
SahaginMain.main
public static void main(String[] args) throws YamlConvertException, IllegalDataStructureException, IllegalTestScriptException { if (args.length == 0) { throw new IllegalArgumentException(MSG_NO_COMMAND_LINE_ARGUMENT); } Action action = null; try { action = Action.getEnum(args[0]); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(String.format(MSG_UNKNOWN_ACTION, args[0])); } String configFilePath; if (args.length <= 1) { configFilePath = "sahagin.yml"; } else { configFilePath = args[1]; } File configFile = new File(configFilePath); if (!configFile.exists()) { throw new IllegalArgumentException(String.format( MSG_CONFIG_NOT_FOUND, configFile.getAbsolutePath())); } Config config = Config.generateFromYamlConfig(configFile); Logging.setLoggerEnabled(config.isOutputLog()); AcceptableLocales locales = AcceptableLocales.getInstance(config.getUserLocale()); SysMessages.globalInitialize(locales); switch (action) { case Report: report(config); break; default: throw new RuntimeException("implementation error"); } }
java
public static void main(String[] args) throws YamlConvertException, IllegalDataStructureException, IllegalTestScriptException { if (args.length == 0) { throw new IllegalArgumentException(MSG_NO_COMMAND_LINE_ARGUMENT); } Action action = null; try { action = Action.getEnum(args[0]); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(String.format(MSG_UNKNOWN_ACTION, args[0])); } String configFilePath; if (args.length <= 1) { configFilePath = "sahagin.yml"; } else { configFilePath = args[1]; } File configFile = new File(configFilePath); if (!configFile.exists()) { throw new IllegalArgumentException(String.format( MSG_CONFIG_NOT_FOUND, configFile.getAbsolutePath())); } Config config = Config.generateFromYamlConfig(configFile); Logging.setLoggerEnabled(config.isOutputLog()); AcceptableLocales locales = AcceptableLocales.getInstance(config.getUserLocale()); SysMessages.globalInitialize(locales); switch (action) { case Report: report(config); break; default: throw new RuntimeException("implementation error"); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "YamlConvertException", ",", "IllegalDataStructureException", ",", "IllegalTestScriptException", "{", "if", "(", "args", ".", "length", "==", "0", ")", "{", "throw", "new", "Il...
first argument is action name (now "report" only), second argument is configuration file path
[ "first", "argument", "is", "action", "name", "(", "now", "report", "only", ")", "second", "argument", "is", "configuration", "file", "path" ]
train
https://github.com/SahaginOrg/sahagin-java/blob/7ace428adebe3466ceb5826bc9681f8e3d52be68/src/main/java/org/sahagin/main/SahaginMain.java#L44-L78
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java
NumberUtil.roundStr
public static String roundStr(double v, int scale, RoundingMode roundingMode) { return round(v, scale, roundingMode).toString(); }
java
public static String roundStr(double v, int scale, RoundingMode roundingMode) { return round(v, scale, roundingMode).toString(); }
[ "public", "static", "String", "roundStr", "(", "double", "v", ",", "int", "scale", ",", "RoundingMode", "roundingMode", ")", "{", "return", "round", "(", "v", ",", "scale", ",", "roundingMode", ")", ".", "toString", "(", ")", ";", "}" ]
保留固定位数小数<br> 例如保留四位小数:123.456789 =》 123.4567 @param v 值 @param scale 保留小数位数 @param roundingMode 保留小数的模式 {@link RoundingMode} @return 新值 @since 3.2.2
[ "保留固定位数小数<br", ">", "例如保留四位小数:123", ".", "456789", "=", "》", "123", ".", "4567" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/NumberUtil.java#L843-L845
mediathekview/MServer
src/main/java/mServer/crawler/sender/base/UrlUtils.java
UrlUtils.addDomainIfMissing
public static String addDomainIfMissing(final String aUrl, final String aDomain) { if (aUrl != null && !aUrl.isEmpty() && aUrl.startsWith("/")) { return aDomain + aUrl; } return aUrl; }
java
public static String addDomainIfMissing(final String aUrl, final String aDomain) { if (aUrl != null && !aUrl.isEmpty() && aUrl.startsWith("/")) { return aDomain + aUrl; } return aUrl; }
[ "public", "static", "String", "addDomainIfMissing", "(", "final", "String", "aUrl", ",", "final", "String", "aDomain", ")", "{", "if", "(", "aUrl", "!=", "null", "&&", "!", "aUrl", ".", "isEmpty", "(", ")", "&&", "aUrl", ".", "startsWith", "(", "\"/\"", ...
adds the domain if missing. @param aUrl the url to check @param aDomain the domain to add @return the url including the domain
[ "adds", "the", "domain", "if", "missing", "." ]
train
https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/crawler/sender/base/UrlUtils.java#L37-L43
vanilladb/vanillacore
src/main/java/org/vanilladb/core/remote/jdbc/RemoteConnectionImpl.java
RemoteConnectionImpl.setTransactionIsolation
@Override public void setTransactionIsolation(int level) throws RemoteException { if (getAutoCommit() != false) throw new RemoteException( "the auto-commit mode need to be set to false before changing the isolation level"); if (this.isolationLevel == level) return; tx.commit(); this.isolationLevel = level; try { tx = VanillaDb.txMgr().newTransaction(isolationLevel, readOnly); } catch (Exception e) { throw new RemoteException("error creating transaction ", e); } }
java
@Override public void setTransactionIsolation(int level) throws RemoteException { if (getAutoCommit() != false) throw new RemoteException( "the auto-commit mode need to be set to false before changing the isolation level"); if (this.isolationLevel == level) return; tx.commit(); this.isolationLevel = level; try { tx = VanillaDb.txMgr().newTransaction(isolationLevel, readOnly); } catch (Exception e) { throw new RemoteException("error creating transaction ", e); } }
[ "@", "Override", "public", "void", "setTransactionIsolation", "(", "int", "level", ")", "throws", "RemoteException", "{", "if", "(", "getAutoCommit", "(", ")", "!=", "false", ")", "throw", "new", "RemoteException", "(", "\"the auto-commit mode need to be set to false ...
Attempts to change the transaction isolation level for this connection. This method will commit current transaction and start a new transaction. Currently, the only supported isolation levels are {@link Connection#TRANSACTION_SERIALIZABLE} and {@link Connection#TRANSACTION_REPEATABLE_READ}. The auto-commit mode must be set to false before calling this method.
[ "Attempts", "to", "change", "the", "transaction", "isolation", "level", "for", "this", "connection", ".", "This", "method", "will", "commit", "current", "transaction", "and", "start", "a", "new", "transaction", ".", "Currently", "the", "only", "supported", "isol...
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/remote/jdbc/RemoteConnectionImpl.java#L112-L126
audit4j/audit4j-core
src/main/java/org/audit4j/core/util/ReflectUtil.java
ReflectUtil.getNewInstance
public I getNewInstance(Class<I> clazz) { Constructor<I> ctor; try { ctor = clazz.getConstructor(); return ctor.newInstance(); } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new InitializationException("Given class not found", e); } }
java
public I getNewInstance(Class<I> clazz) { Constructor<I> ctor; try { ctor = clazz.getConstructor(); return ctor.newInstance(); } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new InitializationException("Given class not found", e); } }
[ "public", "I", "getNewInstance", "(", "Class", "<", "I", ">", "clazz", ")", "{", "Constructor", "<", "I", ">", "ctor", ";", "try", "{", "ctor", "=", "clazz", ".", "getConstructor", "(", ")", ";", "return", "ctor", ".", "newInstance", "(", ")", ";", ...
Gets the new instance. @param clazz the clazz @return the new instance
[ "Gets", "the", "new", "instance", "." ]
train
https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/util/ReflectUtil.java#L44-L53
stratosphere/stratosphere
stratosphere-addons/hadoop-compatibility/src/main/java/eu/stratosphere/hadoopcompatibility/HadoopOutputFormatWrapper.java
HadoopOutputFormatWrapper.open
@Override public void open(int taskNumber, int numTasks) throws IOException { this.fileOutputCommitterWrapper.setupJob(this.jobConf); if (Integer.toString(taskNumber + 1).length() <= 6) { this.jobConf.set("mapred.task.id", "attempt__0000_r_" + String.format("%" + (6 - Integer.toString(taskNumber + 1).length()) + "s"," ").replace(" ", "0") + Integer.toString(taskNumber + 1) + "_0"); //compatible for hadoop 2.2.0, the temporary output directory is different from hadoop 1.2.1 this.jobConf.set("mapreduce.task.output.dir", this.fileOutputCommitterWrapper.getTempTaskOutputPath(this.jobConf,TaskAttemptID.forName(this.jobConf.get("mapred.task.id"))).toString()); } else { throw new IOException("task id too large"); } this.recordWriter = this.hadoopOutputFormat.getRecordWriter(null, this.jobConf, Integer.toString(taskNumber + 1), new DummyHadoopProgressable()); }
java
@Override public void open(int taskNumber, int numTasks) throws IOException { this.fileOutputCommitterWrapper.setupJob(this.jobConf); if (Integer.toString(taskNumber + 1).length() <= 6) { this.jobConf.set("mapred.task.id", "attempt__0000_r_" + String.format("%" + (6 - Integer.toString(taskNumber + 1).length()) + "s"," ").replace(" ", "0") + Integer.toString(taskNumber + 1) + "_0"); //compatible for hadoop 2.2.0, the temporary output directory is different from hadoop 1.2.1 this.jobConf.set("mapreduce.task.output.dir", this.fileOutputCommitterWrapper.getTempTaskOutputPath(this.jobConf,TaskAttemptID.forName(this.jobConf.get("mapred.task.id"))).toString()); } else { throw new IOException("task id too large"); } this.recordWriter = this.hadoopOutputFormat.getRecordWriter(null, this.jobConf, Integer.toString(taskNumber + 1), new DummyHadoopProgressable()); }
[ "@", "Override", "public", "void", "open", "(", "int", "taskNumber", ",", "int", "numTasks", ")", "throws", "IOException", "{", "this", ".", "fileOutputCommitterWrapper", ".", "setupJob", "(", "this", ".", "jobConf", ")", ";", "if", "(", "Integer", ".", "t...
create the temporary output file for hadoop RecordWriter. @param taskNumber The number of the parallel instance. @param numTasks The number of parallel tasks. @throws IOException
[ "create", "the", "temporary", "output", "file", "for", "hadoop", "RecordWriter", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-addons/hadoop-compatibility/src/main/java/eu/stratosphere/hadoopcompatibility/HadoopOutputFormatWrapper.java#L67-L78
aws/aws-sdk-java
aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateSubscriptionDefinitionRequest.java
CreateSubscriptionDefinitionRequest.withTags
public CreateSubscriptionDefinitionRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public CreateSubscriptionDefinitionRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateSubscriptionDefinitionRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
Tag(s) to add to the new resource @param tags Tag(s) to add to the new resource @return Returns a reference to this object so that method calls can be chained together.
[ "Tag", "(", "s", ")", "to", "add", "to", "the", "new", "resource" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateSubscriptionDefinitionRequest.java#L168-L171
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPTaxCategoryPersistenceImpl.java
CPTaxCategoryPersistenceImpl.findAll
@Override public List<CPTaxCategory> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CPTaxCategory> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CPTaxCategory", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp tax categories. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPTaxCategoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of cp tax categories @param end the upper bound of the range of cp tax categories (not inclusive) @return the range of cp tax categories
[ "Returns", "a", "range", "of", "all", "the", "cp", "tax", "categories", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPTaxCategoryPersistenceImpl.java#L1103-L1106
unbescape/unbescape
src/main/java/org/unbescape/css/CssEscape.java
CssEscape.escapeCssString
public static void escapeCssString(final Reader reader, final Writer writer) throws IOException { escapeCssString(reader, writer, CssStringEscapeType.BACKSLASH_ESCAPES_DEFAULT_TO_COMPACT_HEXA, CssStringEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
java
public static void escapeCssString(final Reader reader, final Writer writer) throws IOException { escapeCssString(reader, writer, CssStringEscapeType.BACKSLASH_ESCAPES_DEFAULT_TO_COMPACT_HEXA, CssStringEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET); }
[ "public", "static", "void", "escapeCssString", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeCssString", "(", "reader", ",", "writer", ",", "CssStringEscapeType", ".", "BACKSLASH_ESCAPES_DEFAULT_TO_COMPAC...
<p> Perform a CSS String level 2 (basic set and all non-ASCII chars) <strong>escape</strong> operation on a <tt>Reader</tt> input, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The CSS String basic escape set: <ul> <li>The <em>Backslash Escapes</em>: <tt>&#92;&quot;</tt> (<tt>U+0022</tt>) and <tt>&#92;&#39;</tt> (<tt>U+0027</tt>). </li> <li> Two ranges of non-displayable, control characters: <tt>U+0000</tt> to <tt>U+001F</tt> and <tt>U+007F</tt> to <tt>U+009F</tt>. </li> </ul> </li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by using Backslash escapes whenever possible. For escaped characters that do not have an associated Backslash, default to <tt>&#92;FF </tt> Hexadecimal Escapes. </p> <p> This method calls {@link #escapeCssString(Reader, Writer, CssStringEscapeType, CssStringEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link CssStringEscapeType#BACKSLASH_ESCAPES_DEFAULT_TO_COMPACT_HEXA}</li> <li><tt>level</tt>: {@link CssStringEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_BASIC_ESCAPE_SET}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param reader the <tt>Reader</tt> reading the text to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.2
[ "<p", ">", "Perform", "a", "CSS", "String", "level", "2", "(", "basic", "set", "and", "all", "non", "-", "ASCII", "chars", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "Reader<", "/", "tt", ">", "input", "...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/css/CssEscape.java#L563-L568
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.createGraphics
public static Graphics2D createGraphics(BufferedImage image, Color color) { return GraphicsUtil.createGraphics(image, color); }
java
public static Graphics2D createGraphics(BufferedImage image, Color color) { return GraphicsUtil.createGraphics(image, color); }
[ "public", "static", "Graphics2D", "createGraphics", "(", "BufferedImage", "image", ",", "Color", "color", ")", "{", "return", "GraphicsUtil", ".", "createGraphics", "(", "image", ",", "color", ")", ";", "}" ]
创建{@link Graphics2D} @param image {@link BufferedImage} @param color {@link Color}背景颜色以及当前画笔颜色 @return {@link Graphics2D} @since 3.2.3 @see GraphicsUtil#createGraphics(BufferedImage, Color)
[ "创建", "{", "@link", "Graphics2D", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1343-L1345
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/utility/logging/MetaCSPLogging.java
MetaCSPLogging.setLevel
public static void setLevel(Class<?> c, Level l) /* throws LoggerNotDefined */ { if (!loggers.containsKey(c)) tempLevels.put(c, l); else loggers.get(c).setLevel(l); //System.out.println("Set level " + l + " for logger " + loggers.get(c).getName()); }
java
public static void setLevel(Class<?> c, Level l) /* throws LoggerNotDefined */ { if (!loggers.containsKey(c)) tempLevels.put(c, l); else loggers.get(c).setLevel(l); //System.out.println("Set level " + l + " for logger " + loggers.get(c).getName()); }
[ "public", "static", "void", "setLevel", "(", "Class", "<", "?", ">", "c", ",", "Level", "l", ")", "/* throws LoggerNotDefined */", "{", "if", "(", "!", "loggers", ".", "containsKey", "(", "c", ")", ")", "tempLevels", ".", "put", "(", "c", ",", "l", "...
Set a desired log level for a specific class. @param c The class to set the log level for. @param l The desired log level.
[ "Set", "a", "desired", "log", "level", "for", "a", "specific", "class", "." ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/utility/logging/MetaCSPLogging.java#L126-L130
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/dos/dospolicy_stats.java
dospolicy_stats.get
public static dospolicy_stats get(nitro_service service, String name) throws Exception{ dospolicy_stats obj = new dospolicy_stats(); obj.set_name(name); dospolicy_stats response = (dospolicy_stats) obj.stat_resource(service); return response; }
java
public static dospolicy_stats get(nitro_service service, String name) throws Exception{ dospolicy_stats obj = new dospolicy_stats(); obj.set_name(name); dospolicy_stats response = (dospolicy_stats) obj.stat_resource(service); return response; }
[ "public", "static", "dospolicy_stats", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "dospolicy_stats", "obj", "=", "new", "dospolicy_stats", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "dos...
Use this API to fetch statistics of dospolicy_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "dospolicy_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/dos/dospolicy_stats.java#L279-L284
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
SubWriterHolderWriter.addClassContentTree
public void addClassContentTree(Content contentTree, Content classContentTree) { if (configuration.allowTag(HtmlTag.MAIN)) { mainTree.addContent(classContentTree); contentTree.addContent(mainTree); } else { contentTree.addContent(classContentTree); } }
java
public void addClassContentTree(Content contentTree, Content classContentTree) { if (configuration.allowTag(HtmlTag.MAIN)) { mainTree.addContent(classContentTree); contentTree.addContent(mainTree); } else { contentTree.addContent(classContentTree); } }
[ "public", "void", "addClassContentTree", "(", "Content", "contentTree", ",", "Content", "classContentTree", ")", "{", "if", "(", "configuration", ".", "allowTag", "(", "HtmlTag", ".", "MAIN", ")", ")", "{", "mainTree", ".", "addContent", "(", "classContentTree",...
Add the class content tree. @param contentTree content tree to which the class content will be added @param classContentTree class content tree which will be added to the content tree
[ "Add", "the", "class", "content", "tree", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java#L276-L283
liuyukuai/commons
commons-core/src/main/java/com/itxiaoer/commons/core/date/LocalDateTimeUtil.java
LocalDateTimeUtil.format
public static String format(TemporalAccessor localDate, String pattern) { return DateTimeFormatter.ofPattern(pattern).format(localDate); }
java
public static String format(TemporalAccessor localDate, String pattern) { return DateTimeFormatter.ofPattern(pattern).format(localDate); }
[ "public", "static", "String", "format", "(", "TemporalAccessor", "localDate", ",", "String", "pattern", ")", "{", "return", "DateTimeFormatter", ".", "ofPattern", "(", "pattern", ")", ".", "format", "(", "localDate", ")", ";", "}" ]
格式化时间 @param localDate 时间 @param pattern 时间格式 @return 时间字符串
[ "格式化时间" ]
train
https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/date/LocalDateTimeUtil.java#L104-L106
milaboratory/milib
src/main/java/com/milaboratory/core/clustering/Clustering.java
Clustering.getComparatorOfObjectsRegardingSequences
static <T, S extends Sequence> Comparator<T> getComparatorOfObjectsRegardingSequences(final Comparator<T> objectComparator, final SequenceExtractor<T, S> extractor) { return new Comparator<T>() { @Override public int compare(T o1, T o2) { int i = objectComparator.compare(o2, o1); // Reverse comparison return i == 0 ? extractor.getSequence(o2).compareTo(extractor.getSequence(o1)) : i; } }; }
java
static <T, S extends Sequence> Comparator<T> getComparatorOfObjectsRegardingSequences(final Comparator<T> objectComparator, final SequenceExtractor<T, S> extractor) { return new Comparator<T>() { @Override public int compare(T o1, T o2) { int i = objectComparator.compare(o2, o1); // Reverse comparison return i == 0 ? extractor.getSequence(o2).compareTo(extractor.getSequence(o1)) : i; } }; }
[ "static", "<", "T", ",", "S", "extends", "Sequence", ">", "Comparator", "<", "T", ">", "getComparatorOfObjectsRegardingSequences", "(", "final", "Comparator", "<", "T", ">", "objectComparator", ",", "final", "SequenceExtractor", "<", "T", ",", "S", ">", "extra...
First REVERSE compare objects (bigger objects comes first), if equal, REVERSE compare object sequence.
[ "First", "REVERSE", "compare", "objects", "(", "bigger", "objects", "comes", "first", ")", "if", "equal", "REVERSE", "compare", "object", "sequence", "." ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/clustering/Clustering.java#L246-L257
jenkinsci/jenkins
core/src/main/java/jenkins/model/identity/IdentityRootAction.java
IdentityRootAction.getFingerprint
public String getFingerprint() { RSAPublicKey key = InstanceIdentityProvider.RSA.getPublicKey(); if (key == null) { return null; } // TODO replace with org.jenkinsci.remoting.util.KeyUtils once JENKINS-36871 changes are merged try { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.reset(); byte[] bytes = digest.digest(key.getEncoded()); StringBuilder result = new StringBuilder(Math.max(0, bytes.length * 3 - 1)); for (int i = 0; i < bytes.length; i++) { if (i > 0) { result.append(':'); } int b = bytes[i] & 0xFF; result.append(Character.forDigit((b>>4)&0x0f, 16)).append(Character.forDigit(b&0xf, 16)); } return result.toString(); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("JLS mandates MD5 support"); } }
java
public String getFingerprint() { RSAPublicKey key = InstanceIdentityProvider.RSA.getPublicKey(); if (key == null) { return null; } // TODO replace with org.jenkinsci.remoting.util.KeyUtils once JENKINS-36871 changes are merged try { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.reset(); byte[] bytes = digest.digest(key.getEncoded()); StringBuilder result = new StringBuilder(Math.max(0, bytes.length * 3 - 1)); for (int i = 0; i < bytes.length; i++) { if (i > 0) { result.append(':'); } int b = bytes[i] & 0xFF; result.append(Character.forDigit((b>>4)&0x0f, 16)).append(Character.forDigit(b&0xf, 16)); } return result.toString(); } catch (NoSuchAlgorithmException e) { throw new IllegalStateException("JLS mandates MD5 support"); } }
[ "public", "String", "getFingerprint", "(", ")", "{", "RSAPublicKey", "key", "=", "InstanceIdentityProvider", ".", "RSA", ".", "getPublicKey", "(", ")", ";", "if", "(", "key", "==", "null", ")", "{", "return", "null", ";", "}", "// TODO replace with org.jenkins...
Returns the fingerprint of the public key. @return the fingerprint of the public key.
[ "Returns", "the", "fingerprint", "of", "the", "public", "key", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/identity/IdentityRootAction.java#L73-L95
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java
ApiOvhDedicatedserver.serviceName_serviceMonitoring_monitoringId_PUT
public void serviceName_serviceMonitoring_monitoringId_PUT(String serviceName, Long monitoringId, OvhServiceMonitoring body) throws IOException { String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}"; StringBuilder sb = path(qPath, serviceName, monitoringId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_serviceMonitoring_monitoringId_PUT(String serviceName, Long monitoringId, OvhServiceMonitoring body) throws IOException { String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}"; StringBuilder sb = path(qPath, serviceName, monitoringId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_serviceMonitoring_monitoringId_PUT", "(", "String", "serviceName", ",", "Long", "monitoringId", ",", "OvhServiceMonitoring", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicated/server/{serviceName}/serviceMonitoring/{m...
Alter this object properties REST: PUT /dedicated/server/{serviceName}/serviceMonitoring/{monitoringId} @param body [required] New object properties @param serviceName [required] The internal name of your dedicated server @param monitoringId [required] This monitoring id
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2283-L2287
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/config/ssl/yoko/SocketFactory.java
SocketFactory.createSocket
@Override public Socket createSocket(String host, int port) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "SocketFactory attempting to create socket for host: " + host + " port: " + port); // check for SSL addresses if (Util.isEncodedHost(host, HOST_PROTOCOL)) { String sslConfigName = Util.decodeHostInfo(host); host = Util.decodeHost(host); return createSSLSocket(host, (char) port, sslConfigName); } else { return createPlainSocket(host, port); } }
java
@Override public Socket createSocket(String host, int port) throws IOException { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(tc, "SocketFactory attempting to create socket for host: " + host + " port: " + port); // check for SSL addresses if (Util.isEncodedHost(host, HOST_PROTOCOL)) { String sslConfigName = Util.decodeHostInfo(host); host = Util.decodeHost(host); return createSSLSocket(host, (char) port, sslConfigName); } else { return createPlainSocket(host, port); } }
[ "@", "Override", "public", "Socket", "createSocket", "(", "String", "host", ",", "int", "port", ")", "throws", "IOException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "Tr", "....
Create a client socket of the appropriate type using the provided address and port information. @return A Socket (either plain or SSL) configured for connection to the target.
[ "Create", "a", "client", "socket", "of", "the", "appropriate", "type", "using", "the", "provided", "address", "and", "port", "information", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/config/ssl/yoko/SocketFactory.java#L114-L127
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java
BinaryString.concatWs
public static BinaryString concatWs(BinaryString separator, BinaryString... inputs) { return concatWs(separator, Arrays.asList(inputs)); }
java
public static BinaryString concatWs(BinaryString separator, BinaryString... inputs) { return concatWs(separator, Arrays.asList(inputs)); }
[ "public", "static", "BinaryString", "concatWs", "(", "BinaryString", "separator", ",", "BinaryString", "...", "inputs", ")", "{", "return", "concatWs", "(", "separator", ",", "Arrays", ".", "asList", "(", "inputs", ")", ")", ";", "}" ]
Concatenates input strings together into a single string using the separator. A null input is skipped. For example, concat(",", "a", null, "c") would yield "a,c".
[ "Concatenates", "input", "strings", "together", "into", "a", "single", "string", "using", "the", "separator", ".", "A", "null", "input", "is", "skipped", ".", "For", "example", "concat", "(", "a", "null", "c", ")", "would", "yield", "a", "c", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryString.java#L494-L496
nominanuda/zen-project
zen-core/src/main/java/com/nominanuda/zen/obj/JsonPath.java
JsonPath.copyPush
public void copyPush(Obj source, Obj target) { Iterator<Entry<String,Object>> itr = source.iterator(); while (itr.hasNext()) { Entry<String,Object> e = itr.next(); putPush(target, e.getKey(), e.getValue()); } }
java
public void copyPush(Obj source, Obj target) { Iterator<Entry<String,Object>> itr = source.iterator(); while (itr.hasNext()) { Entry<String,Object> e = itr.next(); putPush(target, e.getKey(), e.getValue()); } }
[ "public", "void", "copyPush", "(", "Obj", "source", ",", "Obj", "target", ")", "{", "Iterator", "<", "Entry", "<", "String", ",", "Object", ">", ">", "itr", "=", "source", ".", "iterator", "(", ")", ";", "while", "(", "itr", ".", "hasNext", "(", ")...
{a:1} {b:1} =&gt; {a:1, b:1} {a:1} {a:1} =&gt; {a:[1, 1]} {a:1} {a:null} =&gt; {a:[1, null]} {a:{b:1}} {a:null} =&gt; {a:[{b:1}, null]} {a:{b:1}} {a:{b:{c:null}}} =&gt; {a:{b:[1,{c:null}]}} {a:1} {a:[2]} =&gt; {a:[1,2]} {a:[1]} {a:[2]} =&gt; {a:[1,2]} {a:{b:1}} {a:[2]} =&gt; {a:[{b:1},2]} {a:{b:1}} {a:{b:[2]}} =&gt; {a:{b:[1,2]}} {a:1} {} =&gt; {a:1}}
[ "{", "a", ":", "1", "}", "{", "b", ":", "1", "}", "=", "&gt", ";", "{", "a", ":", "1", "b", ":", "1", "}", "{", "a", ":", "1", "}", "{", "a", ":", "1", "}", "=", "&gt", ";", "{", "a", ":", "[", "1", "1", "]", "}", "{", "a", ":",...
train
https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-core/src/main/java/com/nominanuda/zen/obj/JsonPath.java#L97-L103